RenderTextControlSingleLine shouldn't mutate placeholder element inline style
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 6 Mar 2016 10:17:52 +0000 (10:17 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 6 Mar 2016 10:17:52 +0000 (10:17 +0000)
commit5a7cdb937d81942f2c62cc3af94e6265e335b9a1
tree8f4181bfca22037bf0b787c2c5e18fb39228fe6b
parent8ea8aa2676768804d4a8a8e303724a7df39fa4bb
RenderTextControlSingleLine shouldn't mutate placeholder element inline style
https://bugs.webkit.org/show_bug.cgi?id=155086

Reviewed by Andreas Kling.

Text field placeholder element is currently managed by changing its inline style
from the host renderer based on the host style and state. Rendering poking
into DOM is wrong.

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setRangeText):
(WebCore::HTMLInputElement::shouldTruncateText):

    Add a helper.

(WebCore::HTMLInputElement::createInnerTextStyle):
* html/HTMLInputElement.h:
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::HTMLTextAreaElement):
(WebCore::HTMLTextAreaElement::placeholderElement):
(WebCore::HTMLTextAreaElement::matchesReadWritePseudoClass):
(WebCore::HTMLTextAreaElement::updatePlaceholderText):

    Use the new shadow element.

* html/HTMLTextAreaElement.h:
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::updatePlaceholderVisibility):

    No more poking to inline style.

(WebCore::HTMLTextFormControlElement::setSelectionStart):
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::updatePlaceholderText):

    Use the new shadow element.

* html/shadow/TextControlInnerElements.cpp:
(WebCore::TextControlPlaceholderElement::TextControlPlaceholderElement):

    Add a subclass for the placeholder element instead of just using div.

(WebCore::TextControlPlaceholderElement::customStyleForRenderer):

    Compute style base on the host state and style.

(WebCore::SearchFieldResultsButtonElement::SearchFieldResultsButtonElement):
* html/shadow/TextControlInnerElements.h:
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::styleDidChange):

    No more setInlineStyleProperty.
    This now needs to trigger layout like it does with other inner elements.

(WebCore::RenderTextControlSingleLine::computeControlLogicalHeight):
(WebCore::RenderTextControlSingleLine::autoscroll):
(WebCore::RenderTextControlSingleLine::textShouldBeTruncated): Deleted.
* rendering/RenderTextControlSingleLine.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@197637 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLInputElement.h
Source/WebCore/html/HTMLTextAreaElement.cpp
Source/WebCore/html/HTMLTextAreaElement.h
Source/WebCore/html/HTMLTextFormControlElement.cpp
Source/WebCore/html/TextFieldInputType.cpp
Source/WebCore/html/shadow/TextControlInnerElements.cpp
Source/WebCore/html/shadow/TextControlInnerElements.h
Source/WebCore/rendering/RenderTextControlSingleLine.cpp
Source/WebCore/rendering/RenderTextControlSingleLine.h