Inner text element should not use -webkit-user-modify
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Feb 2014 04:09:28 +0000 (04:09 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Feb 2014 04:09:28 +0000 (04:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=129035

Reviewed by Andreas Kling.

Source/WebCore:

To eliminate the internal use of -webkit-user-modify, use contenteditable attribute in the inner text elements
instead of manually inspecting disabled-ness and readonly-ness in RenderTextControl.

Unfortunately, we still have to manually set UserModify value in RenderTextControl::adjustInnerTextStyle since
RenderTextControl::styleDidChange creates RenderStyle for its inner text from scratch via createInnerTextStyle.

* html/HTMLFieldSetElement.cpp:
(WebCore::HTMLFieldSetElement::disabledStateChanged): Don't use childrenOfType iterator which asserts that DOM
isn't mutated during the traversal since we now set contenteditable attribute inside disabledStateChanged via
updateFromControlElementsAncestorDisabledStateUnder.

* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::parseAttribute): Extracted readOnlyAttributeChanged out of this function so
that HTMLTextFormControl could override it to call updateInnerTextElementEditability.
(WebCore::HTMLFormControlElement::readOnlyAttributeChanged): Ditto.
* html/HTMLFormControlElement.h:

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::didAddUserAgentShadowRoot): Call updateInnerTextElementEditability after creating
shadow DOM for the current input type.
(WebCore::HTMLInputElement::updateType): Ditto.
(WebCore::HTMLInputElement::parseAttribute): Ditto.

* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::didAddUserAgentShadowRoot): Call updateInnerTextElementEditability.

* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::disabledStateChanged): Added to update contenteditable attribute since
the editability of the inner text element depends on disabled-ness of the element.
(WebCore::HTMLTextFormControlElement::readOnlyAttributeChanged): Ditto for the readonly-ness of the element.
(WebCore::HTMLTextFormControlElement::updateInnerTextElementEditability): Added.
* html/HTMLTextFormControlElement.h:

* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::adjustInnerTextStyle): Use the inner text element's presentationAttributeStyle() to
compute the appropriate EUserModify value instead of hard-coding it here.
* rendering/RenderTextControl.h:

LayoutTests:

Rebaselined tests as the user agent shadow DOM of input and textarea elements now have contenteditable attribute.

* editing/input/paste-text-ending-with-interchange-newline-expected.txt:
* editing/inserting/5607069-2-expected.txt:
* editing/inserting/5607069-3-expected.txt:
* editing/pasteboard/copy-image-with-alt-text-expected.txt:
* editing/pasteboard/copy-null-characters-expected.txt:
* editing/pasteboard/nested-blocks-with-text-area-expected.txt:
* editing/pasteboard/nested-blocks-with-text-field-expected.txt:
* editing/selection/dump-as-markup-expected.txt:
* editing/selection/dump-as-markup-form-text-expected.txt:
* fast/forms/suggested-value-after-setvalue-expected.txt:
* fast/forms/suggested-value-expected.txt:
* fast/parser/object-with-textarea-fallback-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@164526 268f45cc-cd09-0410-ab3c-d52691b4dbfc

23 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/input/paste-text-ending-with-interchange-newline-expected.txt
LayoutTests/editing/inserting/5607069-2-expected.txt
LayoutTests/editing/inserting/5607069-3-expected.txt
LayoutTests/editing/pasteboard/copy-image-with-alt-text-expected.txt
LayoutTests/editing/pasteboard/copy-null-characters-expected.txt
LayoutTests/editing/pasteboard/nested-blocks-with-text-area-expected.txt
LayoutTests/editing/pasteboard/nested-blocks-with-text-field-expected.txt
LayoutTests/editing/selection/dump-as-markup-expected.txt
LayoutTests/editing/selection/dump-as-markup-form-text-expected.txt
LayoutTests/fast/forms/suggested-value-after-setvalue-expected.txt
LayoutTests/fast/forms/suggested-value-expected.txt
LayoutTests/fast/parser/object-with-textarea-fallback-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLFieldSetElement.cpp
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLFormControlElement.h
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLTextAreaElement.cpp
Source/WebCore/html/HTMLTextFormControlElement.cpp
Source/WebCore/html/HTMLTextFormControlElement.h
Source/WebCore/rendering/RenderTextControl.cpp
Source/WebCore/rendering/RenderTextControl.h

index 6890b347aa2ca2c6da65ace46d8c526fb73b75ca..7603bd60233ef6d20a5130c3e01cf37a401570b8 100644 (file)
@@ -1,3 +1,25 @@
+2014-02-21  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Inner text element should not use -webkit-user-modify
+        https://bugs.webkit.org/show_bug.cgi?id=129035
+
+        Reviewed by Andreas Kling.
+
+        Rebaselined tests as the user agent shadow DOM of input and textarea elements now have contenteditable attribute.
+
+        * editing/input/paste-text-ending-with-interchange-newline-expected.txt:
+        * editing/inserting/5607069-2-expected.txt:
+        * editing/inserting/5607069-3-expected.txt:
+        * editing/pasteboard/copy-image-with-alt-text-expected.txt:
+        * editing/pasteboard/copy-null-characters-expected.txt:
+        * editing/pasteboard/nested-blocks-with-text-area-expected.txt:
+        * editing/pasteboard/nested-blocks-with-text-field-expected.txt:
+        * editing/selection/dump-as-markup-expected.txt:
+        * editing/selection/dump-as-markup-form-text-expected.txt:
+        * fast/forms/suggested-value-after-setvalue-expected.txt:
+        * fast/forms/suggested-value-expected.txt:
+        * fast/parser/object-with-textarea-fallback-expected.txt:
+
 2014-02-21  Myles C. Maxfield  <mmaxfield@apple.com>
 
         After copy and paste, cursor may appear to be above the bottom of content
index e7898f78f7632e1e7a1cc30d919e9aae13c9b478..d81d92209e442a6df7ffe6b1e0d6d6dc2a82da28 100644 (file)
@@ -1,4 +1,5 @@
 This tests pasting a text with an interchange new line at the end. WebKit shouldn't insert a new line.
 |   <shadow:root>
 |     <div>
+|       contenteditable="plaintext-only"
 |       "abc def"
index dac9355ca7964362e979cadac13062292a05e89f..76157ef6f7b947103f1c7869ae11984008250462 100644 (file)
@@ -4,9 +4,11 @@ This tests for a bug where InsertLineBreak would insert a '\n' instead of a <br>
 |   this.value=""
 |   <shadow:root>
 |     <div>
+|       contenteditable="plaintext-only"
 | <br>
 | <input>
 |   type="text"
 |   this.value=""
 |   <shadow:root>
 |     <div>
+|       contenteditable="plaintext-only"
index 5ccb76c8c32d71cfda393fb5b58d176c7064205a..8dbeed9da30abd803c0724b3cdb0367ac8f67928 100644 (file)
@@ -6,6 +6,7 @@ This tests for a bug in InsertParagraph where it would split and clone a <form>
 |     this.value=""
 |     <shadow:root>
 |       <div>
+|         contenteditable="plaintext-only"
 |   "x"
 |   <br>
 |   "<#selection-caret>x"
@@ -14,3 +15,4 @@ This tests for a bug in InsertParagraph where it would split and clone a <form>
 |     this.value=""
 |     <shadow:root>
 |       <div>
+|         contenteditable="plaintext-only"
index f940dafc4c75368845d67e7e26fbe187f6ec7856..887c4b4b7e94da1e189cda246a0385ab4f7efedd 100644 (file)
@@ -3,6 +3,7 @@ This tests that image alt text makes it to the clipboard. This test requires DRT
 Dump of markup 1:
 |   <shadow:root>
 |     <div>
+|       contenteditable="plaintext-only"
 |       "Here is an emoticon [], some more text [], an empty alt tag [], no alt tag [] and two consecutive images [].
 
 "
@@ -17,6 +18,7 @@ Dump of markup 2:
 Dump of markup 3:
 |   <shadow:root>
 |     <div>
+|       contenteditable="plaintext-only"
 |       "Here is an emoticon [:)], some more text [sample text], an empty alt tag [], no alt tag [] and two consecutive images [firstsecond].
 
 "
index 04b3208567bf22cbebb40f8f79aecc5ff596fd63..18cc22ee547e399ca7e272901c25e5f86d17b241 100644 (file)
@@ -40,6 +40,7 @@ Copy paste me
 green"
 |   <shadow:root>
 |     <div>
+|       contenteditable="plaintext-only"
 |       "Copy paste mebold
 
 Copy paste me
index 45668d4bc837db8ace50e5e9c0ea6191184723b8..190cd40e3662f54a3ce905619248a680b75aeb8b 100644 (file)
@@ -25,6 +25,7 @@ These demonstrate 11475: the '\n's at the end of the fragment should be unrender
 |       " "
 |       <shadow:root>
 |         <div>
+|           contenteditable="plaintext-only"
 |           " "
 |     " 
 x<#selection-caret>
index 4bfd75063acfd090699f5653a2eadebaf5be096f..43ef1f4aecac9932508fb2998a5e0c87f7dda2fd 100644 (file)
@@ -25,6 +25,7 @@ These demonstrate 11475: the '\n's at the end of the fragment should be unrender
 |       this.value=""
 |       <shadow:root>
 |         <div>
+|           contenteditable="plaintext-only"
 |     " 
 x<#selection-caret>
 "
index d125d9304e1a62de681bf8d5102eae853e751356..b3b3e1c091972afe091d2bb40df5ef46367749e1 100644 (file)
@@ -20,6 +20,7 @@ Tests basic dump-as-markup functionality.
 |       this.value=""
 |       <shadow:root>
 |         <div>
+|           contenteditable="plaintext-only"
 |     "
 "
 |     <div>
index 3360a18a9efa65199818891472c9e171ae52039e..fc503dfd30150abbab0c17b994cb24c9eb6b8e69 100644 (file)
@@ -13,6 +13,7 @@ Tests dump-as-markup for input and textarea forms.
 |       this.value="replaced"
 |       <shadow:root>
 |         <div>
+|           contenteditable="plaintext-only"
 |           "replaced"
 |     "
 "
@@ -21,6 +22,7 @@ Tests dump-as-markup for input and textarea forms.
 |       "original"
 |       <shadow:root>
 |         <div>
+|           contenteditable="plaintext-only"
 |           "replaced"
 |     "
 "
index 1cf61867f4a77b4e83aa50ca376a89722c7bd564..dbbbf14c3c7906d8660dfaede3f277bacdff1e38 100644 (file)
@@ -8,6 +8,7 @@ After setting suggestedValue:
 |   this.value="initial value"
 |   <shadow:root>
 |     <div>
+|       contenteditable="plaintext-only"
 |       "suggested value"
 | "input.value: initial value"
 | "internals.suggestedValue(input): suggested value"
@@ -22,6 +23,7 @@ After setting value:
 |   this.value="new value"
 |   <shadow:root>
 |     <div>
+|       contenteditable="plaintext-only"
 |       "new value"
 | "input.value: new value"
 | "internals.suggestedValue(input): "
index a5d3a27bfd8268075e368ccdd6bb2f0467af9cdc..9ac223286bd89d3e60578004e0fa6775960052a2 100644 (file)
@@ -7,6 +7,7 @@ The dump below should have the "suggested value" instead of "initial value".
 |   this.value="initial value"
 |   <shadow:root>
 |     <div>
+|       contenteditable="plaintext-only"
 |       "suggested value"
 | "input.value: initial value"
 | "internals.suggestedValue(input): suggested value"
index 5f445877e7e802ed90e71374c8f0a59813662c21..c0ea18ea0da6e9bdfe4de6f7c8364f94435b17d9 100644 (file)
@@ -15,6 +15,7 @@
 |         this.value=""
 |         <shadow:root>
 |           <div>
+|             contenteditable="plaintext-only"
 |       "
 "
 |     "
index f4421c52a9533eb743e3867a21156e27f97e9ee4..c51428f85b4b7cfef1e09d27f8677e17feda7d36 100644 (file)
@@ -1,3 +1,48 @@
+2014-02-21  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Inner text element should not use -webkit-user-modify
+        https://bugs.webkit.org/show_bug.cgi?id=129035
+
+        Reviewed by Andreas Kling.
+
+        To eliminate the internal use of -webkit-user-modify, use contenteditable attribute in the inner text elements
+        instead of manually inspecting disabled-ness and readonly-ness in RenderTextControl.
+
+        Unfortunately, we still have to manually set UserModify value in RenderTextControl::adjustInnerTextStyle since
+        RenderTextControl::styleDidChange creates RenderStyle for its inner text from scratch via createInnerTextStyle.    
+
+        * html/HTMLFieldSetElement.cpp:
+        (WebCore::HTMLFieldSetElement::disabledStateChanged): Don't use childrenOfType iterator which asserts that DOM
+        isn't mutated during the traversal since we now set contenteditable attribute inside disabledStateChanged via
+        updateFromControlElementsAncestorDisabledStateUnder.
+
+        * html/HTMLFormControlElement.cpp:
+        (WebCore::HTMLFormControlElement::parseAttribute): Extracted readOnlyAttributeChanged out of this function so
+        that HTMLTextFormControl could override it to call updateInnerTextElementEditability.
+        (WebCore::HTMLFormControlElement::readOnlyAttributeChanged): Ditto.
+        * html/HTMLFormControlElement.h:
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::didAddUserAgentShadowRoot): Call updateInnerTextElementEditability after creating
+        shadow DOM for the current input type.
+        (WebCore::HTMLInputElement::updateType): Ditto.
+        (WebCore::HTMLInputElement::parseAttribute): Ditto.
+
+        * html/HTMLTextAreaElement.cpp:
+        (WebCore::HTMLTextAreaElement::didAddUserAgentShadowRoot): Call updateInnerTextElementEditability.
+
+        * html/HTMLTextFormControlElement.cpp:
+        (WebCore::HTMLTextFormControlElement::disabledStateChanged): Added to update contenteditable attribute since
+        the editability of the inner text element depends on disabled-ness of the element.
+        (WebCore::HTMLTextFormControlElement::readOnlyAttributeChanged): Ditto for the readonly-ness of the element.
+        (WebCore::HTMLTextFormControlElement::updateInnerTextElementEditability): Added.
+        * html/HTMLTextFormControlElement.h:
+
+        * rendering/RenderTextControl.cpp:
+        (WebCore::RenderTextControl::adjustInnerTextStyle): Use the inner text element's presentationAttributeStyle() to
+        compute the appropriate EUserModify value instead of hard-coding it here.
+        * rendering/RenderTextControl.h:
+
 2014-02-21  ChangSeok Oh  <changseok.oh@collabora.com>
 
         [GTK] Support WEBGL_draw_buffers extension.
index 91112933cc10c4bec94489c6e083cf2906710dd6..bc0f8d383deeff8421f7692e7871eb08dc0db7a9 100644 (file)
@@ -92,13 +92,13 @@ void HTMLFieldSetElement::disabledStateChanged()
 
     bool thisFieldsetIsDisabled = hasAttribute(disabledAttr);
     bool hasSeenFirstLegendElement = false;
-    for (auto& control : childrenOfType<HTMLElement>(*this)) {
+    for (HTMLElement* control = Traversal<HTMLElement>::firstChild(this); control; control = Traversal<HTMLElement>::nextSibling(control)) {
         if (!hasSeenFirstLegendElement && isHTMLLegendElement(control)) {
             hasSeenFirstLegendElement = true;
-            updateFromControlElementsAncestorDisabledStateUnder(control, false /* isDisabled */);
+            updateFromControlElementsAncestorDisabledStateUnder(*control, false /* isDisabled */);
             continue;
         }
-        updateFromControlElementsAncestorDisabledStateUnder(control, thisFieldsetIsDisabled);
+        updateFromControlElementsAncestorDisabledStateUnder(*control, thisFieldsetIsDisabled);
     }
 }
 
index db4be6525c8605f4de1a1bd534ee76871f7ec85c..50b0bfbfb2fa465b676e89ab48b849a5489c6f74 100644 (file)
@@ -135,12 +135,8 @@ void HTMLFormControlElement::parseAttribute(const QualifiedName& name, const Ato
     } else if (name == readonlyAttr) {
         bool wasReadOnly = m_isReadOnly;
         m_isReadOnly = !value.isNull();
-        if (wasReadOnly != m_isReadOnly) {
-            setNeedsWillValidateCheck();
-            setNeedsStyleRecalc();
-            if (renderer() && renderer()->style().hasAppearance())
-                renderer()->theme().stateChanged(renderer(), ReadOnlyState);
-        }
+        if (wasReadOnly != m_isReadOnly)
+            readOnlyAttributeChanged();
     } else if (name == requiredAttr) {
         bool wasRequired = m_isRequired;
         m_isRequired = !value.isNull();
@@ -167,6 +163,14 @@ void HTMLFormControlElement::disabledStateChanged()
         renderer()->theme().stateChanged(renderer(), EnabledState);
 }
 
+void HTMLFormControlElement::readOnlyAttributeChanged()
+{
+    setNeedsWillValidateCheck();
+    setNeedsStyleRecalc();
+    if (renderer() && renderer()->style().hasAppearance())
+        renderer()->theme().stateChanged(renderer(), ReadOnlyState);
+}
+
 void HTMLFormControlElement::requiredAttributeChanged()
 {
     setNeedsValidityCheck();
index 6958f28b89760efcb2814ba4185df0146d2032f9..0457981655b02567d3dd6d8b0f4f6079c3c7cb59 100644 (file)
@@ -123,9 +123,10 @@ protected:
     bool disabledByAncestorFieldset() const { return m_disabledByAncestorFieldset; }
 
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
-    virtual void requiredAttributeChanged();
     virtual void disabledAttributeChanged();
     virtual void disabledStateChanged();
+    virtual void readOnlyAttributeChanged();
+    virtual void requiredAttributeChanged();
     virtual void didAttachRenderers() override;
     virtual InsertionNotificationRequest insertedInto(ContainerNode&) override;
     virtual void removedFrom(ContainerNode&) override;
index f8746f9bfe731cb81a22156a81c002fc59afee6c..8ffa3a7a98ae6ddc93f94ed75810df97b37711bf 100644 (file)
@@ -149,6 +149,7 @@ HTMLImageLoader* HTMLInputElement::imageLoader()
 void HTMLInputElement::didAddUserAgentShadowRoot(ShadowRoot*)
 {
     m_inputType->createShadowSubtree();
+    updateInnerTextElementEditability();
 }
 
 HTMLInputElement::~HTMLInputElement()
@@ -473,6 +474,7 @@ void HTMLInputElement::updateType()
 
     m_inputType = std::move(newType);
     m_inputType->createShadowSubtree();
+    updateInnerTextElementEditability();
 
 #if ENABLE(TOUCH_EVENTS)
     bool hasTouchEventHandler = m_inputType->hasTouchEventHandler();
@@ -735,6 +737,7 @@ void HTMLInputElement::parseAttribute(const QualifiedName& name, const AtomicStr
     else if (name == webkitspeechAttr) {
         m_inputType->destroyShadowSubtree();
         m_inputType->createShadowSubtree();
+        updateInnerTextElementEditability();
 
         // This renderer and its children have quite different layouts and styles depending on
         // whether the speech button is visible or not. So we reset the whole thing and recreate
index ed69d7e3b8201375e76972f1d4b380e8ef212d89..6a2d60ac266fd8efc49b84df2568d54f809ef4fb 100644 (file)
@@ -110,6 +110,7 @@ PassRefPtr<HTMLTextAreaElement> HTMLTextAreaElement::create(const QualifiedName&
 void HTMLTextAreaElement::didAddUserAgentShadowRoot(ShadowRoot* root)
 {
     root->appendChild(TextControlInnerTextElement::create(document()), ASSERT_NO_EXCEPTION);
+    updateInnerTextElementEditability();
 }
 
 const AtomicString& HTMLTextAreaElement::formControlType() const
index 6c325e6e63426fea4f1b5a465c4d8ad82c859fcd..4c8c0f0724acebb52eeb4bfaa19debede04fc54b 100644 (file)
@@ -493,6 +493,24 @@ void HTMLTextFormControlElement::parseAttribute(const QualifiedName& name, const
         HTMLFormControlElementWithState::parseAttribute(name, value);
 }
 
+void HTMLTextFormControlElement::disabledStateChanged()
+{
+    HTMLFormControlElementWithState::disabledStateChanged();
+    updateInnerTextElementEditability();
+}
+
+void HTMLTextFormControlElement::readOnlyAttributeChanged()
+{
+    HTMLFormControlElementWithState::disabledAttributeChanged();
+    updateInnerTextElementEditability();
+}
+
+void HTMLTextFormControlElement::updateInnerTextElementEditability()
+{
+    if (TextControlInnerTextElement* innerText = innerTextElement())
+        innerText->setAttribute(contenteditableAttr, isDisabledOrReadOnly() ? "false" : "plaintext-only");
+}
+
 bool HTMLTextFormControlElement::lastChangeWasUserEdit() const
 {
     if (!isTextFormControl())
index 05dcb4e59909ab2a5039c7ea3987415f5747d4c7..67f15300a9f101d9425f1896f8b9a595e5b5b571 100644 (file)
@@ -99,6 +99,10 @@ protected:
 
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
 
+    virtual void disabledStateChanged() override;
+    virtual void readOnlyAttributeChanged() override;
+    void updateInnerTextElementEditability();
+
     void cacheSelection(int start, int end, TextFieldSelectionDirection direction)
     {
         m_cachedSelectionStart = start;
index 69e0ff7d411f448dd0e512e562cbe8da0adcdf8e..5604121fbd8767a948291508dd9f3d94ad4b11fd 100644 (file)
@@ -22,6 +22,7 @@
 #include "config.h"
 #include "RenderTextControl.h"
 
+#include "CSSPrimitiveValueMappings.h"
 #include "HTMLTextFormControlElement.h"
 #include "HitTestResult.h"
 #include "RenderText.h"
@@ -29,6 +30,7 @@
 #include "RenderTheme.h"
 #include "ScrollbarTheme.h"
 #include "StyleInheritedData.h"
+#include "StyleProperties.h"
 #include "TextControlInnerElements.h"
 #include "VisiblePosition.h"
 #include <wtf/unicode/CharacterNames.h>
@@ -72,15 +74,6 @@ void RenderTextControl::styleDidChange(StyleDifference diff, const RenderStyle*
     textFormControlElement().updatePlaceholderVisibility(false);
 }
 
-static inline bool updateUserModifyProperty(const HTMLTextFormControlElement& element, RenderStyle* style)
-{
-    bool isDisabled = element.isDisabledFormControl();
-    bool isReadOnlyControl = element.isReadOnly();
-
-    style->setUserModify((isReadOnlyControl || isDisabled) ? READ_ONLY : READ_WRITE_PLAINTEXT_ONLY);
-    return isDisabled;
-}
-
 void RenderTextControl::adjustInnerTextStyle(const RenderStyle* startStyle, RenderStyle* textBlockStyle) const
 {
     // The inner block, if present, always has its direction set to LTR,
@@ -88,8 +81,16 @@ void RenderTextControl::adjustInnerTextStyle(const RenderStyle* startStyle, Rend
     textBlockStyle->setDirection(style().direction());
     textBlockStyle->setUnicodeBidi(style().unicodeBidi());
 
-    bool disabled = updateUserModifyProperty(textFormControlElement(), textBlockStyle);
-    if (disabled)
+    HTMLTextFormControlElement& control = textFormControlElement();
+    if (HTMLElement* innerText = control.innerTextElement()) {
+        if (const StyleProperties* properties = innerText->presentationAttributeStyle()) {
+            RefPtr<CSSValue> value = properties->getPropertyCSSValue(CSSPropertyWebkitUserModify);
+            if (value && value->isPrimitiveValue())
+                textBlockStyle->setUserModify(toCSSPrimitiveValue(*value));
+        }
+    }
+
+    if (control.isDisabledFormControl())
         textBlockStyle->setColor(theme().disabledTextColor(textBlockStyle->visitedDependentColor(CSSPropertyColor), startStyle->visitedDependentColor(CSSPropertyBackgroundColor)));
 #if PLATFORM(IOS)
     if (textBlockStyle->textSecurity() != TSNONE && !textBlockStyle->isLeftToRightDirection()) {
@@ -135,13 +136,6 @@ int RenderTextControl::textBlockLogicalWidth() const
     return unitWidth;
 }
 
-void RenderTextControl::updateFromElement()
-{
-    TextControlInnerTextElement* innerText = innerTextElement();
-    if (innerText && innerText->renderer())
-        updateUserModifyProperty(textFormControlElement(), &innerText->renderer()->style());
-}
-
 int RenderTextControl::scrollbarThickness() const
 {
     // FIXME: We should get the size of the scrollbar from the RenderTheme instead.
index 1f230bc7d8b244b4bf73ee78573a67e02fdc2cda..ddfb06957ab7fc5b0169492c1f5188c7abe98f3b 100644 (file)
@@ -67,7 +67,6 @@ protected:
     virtual LayoutUnit preferredContentLogicalWidth(float charWidth) const = 0;
     virtual LayoutUnit computeControlLogicalHeight(LayoutUnit lineHeight, LayoutUnit nonContentHeight) const = 0;
 
-    virtual void updateFromElement() override;
     virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const override;
     virtual RenderObject* layoutSpecialExcludedChild(bool relayoutChildren) override;