Title: [164526] trunk
Revision
164526
Author
[email protected]
Date
2014-02-21 20:09:28 -0800 (Fri, 21 Feb 2014)

Log Message

Inner text element should not use -webkit-user-modify
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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (164525 => 164526)


--- trunk/LayoutTests/ChangeLog	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/LayoutTests/ChangeLog	2014-02-22 04:09:28 UTC (rev 164526)
@@ -1,3 +1,25 @@
+2014-02-21  Ryosuke Niwa  <[email protected]>
+
+        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  <[email protected]>
 
         After copy and paste, cursor may appear to be above the bottom of content

Modified: trunk/LayoutTests/editing/input/paste-text-ending-with-interchange-newline-expected.txt (164525 => 164526)


--- trunk/LayoutTests/editing/input/paste-text-ending-with-interchange-newline-expected.txt	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/LayoutTests/editing/input/paste-text-ending-with-interchange-newline-expected.txt	2014-02-22 04:09:28 UTC (rev 164526)
@@ -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"

Modified: trunk/LayoutTests/editing/inserting/5607069-2-expected.txt (164525 => 164526)


--- trunk/LayoutTests/editing/inserting/5607069-2-expected.txt	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/LayoutTests/editing/inserting/5607069-2-expected.txt	2014-02-22 04:09:28 UTC (rev 164526)
@@ -4,9 +4,11 @@
 |   this.value=""
 |   <shadow:root>
 |     <div>
+|       contenteditable="plaintext-only"
 | <br>
 | <input>
 |   type="text"
 |   this.value=""
 |   <shadow:root>
 |     <div>
+|       contenteditable="plaintext-only"

Modified: trunk/LayoutTests/editing/inserting/5607069-3-expected.txt (164525 => 164526)


--- trunk/LayoutTests/editing/inserting/5607069-3-expected.txt	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/LayoutTests/editing/inserting/5607069-3-expected.txt	2014-02-22 04:09:28 UTC (rev 164526)
@@ -6,6 +6,7 @@
 |     this.value=""
 |     <shadow:root>
 |       <div>
+|         contenteditable="plaintext-only"
 |   "x"
 |   <br>
 |   "<#selection-caret>x"
@@ -14,3 +15,4 @@
 |     this.value=""
 |     <shadow:root>
 |       <div>
+|         contenteditable="plaintext-only"

Modified: trunk/LayoutTests/editing/pasteboard/copy-image-with-alt-text-expected.txt (164525 => 164526)


--- trunk/LayoutTests/editing/pasteboard/copy-image-with-alt-text-expected.txt	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/LayoutTests/editing/pasteboard/copy-image-with-alt-text-expected.txt	2014-02-22 04:09:28 UTC (rev 164526)
@@ -3,6 +3,7 @@
 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 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].
 
 "

Modified: trunk/LayoutTests/editing/pasteboard/copy-null-characters-expected.txt (164525 => 164526)


--- trunk/LayoutTests/editing/pasteboard/copy-null-characters-expected.txt	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/LayoutTests/editing/pasteboard/copy-null-characters-expected.txt	2014-02-22 04:09:28 UTC (rev 164526)
@@ -40,6 +40,7 @@
 green"
 |   <shadow:root>
 |     <div>
+|       contenteditable="plaintext-only"
 |       "Copy paste mebold
 
 Copy paste me

Modified: trunk/LayoutTests/editing/pasteboard/nested-blocks-with-text-area-expected.txt (164525 => 164526)


--- trunk/LayoutTests/editing/pasteboard/nested-blocks-with-text-area-expected.txt	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/LayoutTests/editing/pasteboard/nested-blocks-with-text-area-expected.txt	2014-02-22 04:09:28 UTC (rev 164526)
@@ -25,6 +25,7 @@
 |       " "
 |       <shadow:root>
 |         <div>
+|           contenteditable="plaintext-only"
 |           " "
 |     " 
 x<#selection-caret>

Modified: trunk/LayoutTests/editing/pasteboard/nested-blocks-with-text-field-expected.txt (164525 => 164526)


--- trunk/LayoutTests/editing/pasteboard/nested-blocks-with-text-field-expected.txt	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/LayoutTests/editing/pasteboard/nested-blocks-with-text-field-expected.txt	2014-02-22 04:09:28 UTC (rev 164526)
@@ -25,6 +25,7 @@
 |       this.value=""
 |       <shadow:root>
 |         <div>
+|           contenteditable="plaintext-only"
 |     " 
 x<#selection-caret>
 "

Modified: trunk/LayoutTests/editing/selection/dump-as-markup-expected.txt (164525 => 164526)


--- trunk/LayoutTests/editing/selection/dump-as-markup-expected.txt	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/LayoutTests/editing/selection/dump-as-markup-expected.txt	2014-02-22 04:09:28 UTC (rev 164526)
@@ -20,6 +20,7 @@
 |       this.value=""
 |       <shadow:root>
 |         <div>
+|           contenteditable="plaintext-only"
 |     "
 "
 |     <div>

Modified: trunk/LayoutTests/editing/selection/dump-as-markup-form-text-expected.txt (164525 => 164526)


--- trunk/LayoutTests/editing/selection/dump-as-markup-form-text-expected.txt	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/LayoutTests/editing/selection/dump-as-markup-form-text-expected.txt	2014-02-22 04:09:28 UTC (rev 164526)
@@ -13,6 +13,7 @@
 |       this.value="replaced"
 |       <shadow:root>
 |         <div>
+|           contenteditable="plaintext-only"
 |           "replaced"
 |     "
 "
@@ -21,6 +22,7 @@
 |       "original"
 |       <shadow:root>
 |         <div>
+|           contenteditable="plaintext-only"
 |           "replaced"
 |     "
 "

Modified: trunk/LayoutTests/fast/forms/suggested-value-after-setvalue-expected.txt (164525 => 164526)


--- trunk/LayoutTests/fast/forms/suggested-value-after-setvalue-expected.txt	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/LayoutTests/fast/forms/suggested-value-after-setvalue-expected.txt	2014-02-22 04:09:28 UTC (rev 164526)
@@ -8,6 +8,7 @@
 |   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 @@
 |   this.value="new value"
 |   <shadow:root>
 |     <div>
+|       contenteditable="plaintext-only"
 |       "new value"
 | "input.value: new value"
 | "internals.suggestedValue(input): "

Modified: trunk/LayoutTests/fast/forms/suggested-value-expected.txt (164525 => 164526)


--- trunk/LayoutTests/fast/forms/suggested-value-expected.txt	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/LayoutTests/fast/forms/suggested-value-expected.txt	2014-02-22 04:09:28 UTC (rev 164526)
@@ -7,6 +7,7 @@
 |   this.value="initial value"
 |   <shadow:root>
 |     <div>
+|       contenteditable="plaintext-only"
 |       "suggested value"
 | "input.value: initial value"
 | "internals.suggestedValue(input): suggested value"

Modified: trunk/LayoutTests/fast/parser/object-with-textarea-fallback-expected.txt (164525 => 164526)


--- trunk/LayoutTests/fast/parser/object-with-textarea-fallback-expected.txt	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/LayoutTests/fast/parser/object-with-textarea-fallback-expected.txt	2014-02-22 04:09:28 UTC (rev 164526)
@@ -15,6 +15,7 @@
 |         this.value=""
 |         <shadow:root>
 |           <div>
+|             contenteditable="plaintext-only"
 |       "
 "
 |     "

Modified: trunk/Source/WebCore/ChangeLog (164525 => 164526)


--- trunk/Source/WebCore/ChangeLog	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/Source/WebCore/ChangeLog	2014-02-22 04:09:28 UTC (rev 164526)
@@ -1,3 +1,48 @@
+2014-02-21  Ryosuke Niwa  <[email protected]>
+
+        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  <[email protected]>
 
         [GTK] Support WEBGL_draw_buffers extension.

Modified: trunk/Source/WebCore/html/HTMLFieldSetElement.cpp (164525 => 164526)


--- trunk/Source/WebCore/html/HTMLFieldSetElement.cpp	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/Source/WebCore/html/HTMLFieldSetElement.cpp	2014-02-22 04:09:28 UTC (rev 164526)
@@ -92,13 +92,13 @@
 
     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);
     }
 }
 

Modified: trunk/Source/WebCore/html/HTMLFormControlElement.cpp (164525 => 164526)


--- trunk/Source/WebCore/html/HTMLFormControlElement.cpp	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.cpp	2014-02-22 04:09:28 UTC (rev 164526)
@@ -135,12 +135,8 @@
     } 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 @@
         renderer()->theme().stateChanged(renderer(), EnabledState);
 }
 
+void HTMLFormControlElement::readOnlyAttributeChanged()
+{
+    setNeedsWillValidateCheck();
+    setNeedsStyleRecalc();
+    if (renderer() && renderer()->style().hasAppearance())
+        renderer()->theme().stateChanged(renderer(), ReadOnlyState);
+}
+
 void HTMLFormControlElement::requiredAttributeChanged()
 {
     setNeedsValidityCheck();

Modified: trunk/Source/WebCore/html/HTMLFormControlElement.h (164525 => 164526)


--- trunk/Source/WebCore/html/HTMLFormControlElement.h	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.h	2014-02-22 04:09:28 UTC (rev 164526)
@@ -123,9 +123,10 @@
     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;

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (164525 => 164526)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2014-02-22 04:09:28 UTC (rev 164526)
@@ -149,6 +149,7 @@
 void HTMLInputElement::didAddUserAgentShadowRoot(ShadowRoot*)
 {
     m_inputType->createShadowSubtree();
+    updateInnerTextElementEditability();
 }
 
 HTMLInputElement::~HTMLInputElement()
@@ -473,6 +474,7 @@
 
     m_inputType = std::move(newType);
     m_inputType->createShadowSubtree();
+    updateInnerTextElementEditability();
 
 #if ENABLE(TOUCH_EVENTS)
     bool hasTouchEventHandler = m_inputType->hasTouchEventHandler();
@@ -735,6 +737,7 @@
     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

Modified: trunk/Source/WebCore/html/HTMLTextAreaElement.cpp (164525 => 164526)


--- trunk/Source/WebCore/html/HTMLTextAreaElement.cpp	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/Source/WebCore/html/HTMLTextAreaElement.cpp	2014-02-22 04:09:28 UTC (rev 164526)
@@ -110,6 +110,7 @@
 void HTMLTextAreaElement::didAddUserAgentShadowRoot(ShadowRoot* root)
 {
     root->appendChild(TextControlInnerTextElement::create(document()), ASSERT_NO_EXCEPTION);
+    updateInnerTextElementEditability();
 }
 
 const AtomicString& HTMLTextAreaElement::formControlType() const

Modified: trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp (164525 => 164526)


--- trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp	2014-02-22 04:09:28 UTC (rev 164526)
@@ -493,6 +493,24 @@
         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())

Modified: trunk/Source/WebCore/html/HTMLTextFormControlElement.h (164525 => 164526)


--- trunk/Source/WebCore/html/HTMLTextFormControlElement.h	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/Source/WebCore/html/HTMLTextFormControlElement.h	2014-02-22 04:09:28 UTC (rev 164526)
@@ -99,6 +99,10 @@
 
     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;

Modified: trunk/Source/WebCore/rendering/RenderTextControl.cpp (164525 => 164526)


--- trunk/Source/WebCore/rendering/RenderTextControl.cpp	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/Source/WebCore/rendering/RenderTextControl.cpp	2014-02-22 04:09:28 UTC (rev 164526)
@@ -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 @@
     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 @@
     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 @@
     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.

Modified: trunk/Source/WebCore/rendering/RenderTextControl.h (164525 => 164526)


--- trunk/Source/WebCore/rendering/RenderTextControl.h	2014-02-22 03:56:33 UTC (rev 164525)
+++ trunk/Source/WebCore/rendering/RenderTextControl.h	2014-02-22 04:09:28 UTC (rev 164526)
@@ -67,7 +67,6 @@
     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;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to