Title: [208653] trunk/Source/WebCore
Revision
208653
Author
[email protected]
Date
2016-11-12 09:54:42 -0800 (Sat, 12 Nov 2016)

Log Message

Speed up setting attributes of input elements of type 'text'
https://bugs.webkit.org/show_bug.cgi?id=164674

Reviewed by Ryosuke Niwa.

Speed up setting attributes of input elements of type 'text' by calling
updateInnerTextValue() only when needed. It was previously called
whenever an attribute was set, no matter it could impact its text value
or not.

No new tests, no Web-exposed behavior change.

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::parseAttribute):
* html/InputType.cpp:
(WebCore::InputType::attributeChanged):
* html/InputType.h:
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::attributeChanged):
* html/TextFieldInputType.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (208652 => 208653)


--- trunk/Source/WebCore/ChangeLog	2016-11-12 17:43:40 UTC (rev 208652)
+++ trunk/Source/WebCore/ChangeLog	2016-11-12 17:54:42 UTC (rev 208653)
@@ -1,3 +1,26 @@
+2016-11-12  Chris Dumez  <[email protected]>
+
+        Speed up setting attributes of input elements of type 'text'
+        https://bugs.webkit.org/show_bug.cgi?id=164674
+
+        Reviewed by Ryosuke Niwa.
+
+        Speed up setting attributes of input elements of type 'text' by calling
+        updateInnerTextValue() only when needed. It was previously called
+        whenever an attribute was set, no matter it could impact its text value
+        or not.
+
+        No new tests, no Web-exposed behavior change.
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::parseAttribute):
+        * html/InputType.cpp:
+        (WebCore::InputType::attributeChanged):
+        * html/InputType.h:
+        * html/TextFieldInputType.cpp:
+        (WebCore::TextFieldInputType::attributeChanged):
+        * html/TextFieldInputType.h:
+
 2016-11-12  Dan Bernstein  <[email protected]>
 
         Tried to fix the 32-bit build.

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (208652 => 208653)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2016-11-12 17:43:40 UTC (rev 208652)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2016-11-12 17:54:42 UTC (rev 208653)
@@ -780,7 +780,8 @@
 #endif
     else
         HTMLTextFormControlElement::parseAttribute(name, value);
-    m_inputType->attributeChanged();
+
+    m_inputType->attributeChanged(name);
 }
 
 void HTMLInputElement::parserDidSetAttributes()

Modified: trunk/Source/WebCore/html/InputType.cpp (208652 => 208653)


--- trunk/Source/WebCore/html/InputType.cpp	2016-11-12 17:43:40 UTC (rev 208652)
+++ trunk/Source/WebCore/html/InputType.cpp	2016-11-12 17:54:42 UTC (rev 208653)
@@ -906,7 +906,7 @@
 {
 }
 
-void InputType::attributeChanged()
+void InputType::attributeChanged(const QualifiedName&)
 {
 }
 

Modified: trunk/Source/WebCore/html/InputType.h (208652 => 208653)


--- trunk/Source/WebCore/html/InputType.h	2016-11-12 17:43:40 UTC (rev 208652)
+++ trunk/Source/WebCore/html/InputType.h	2016-11-12 17:54:42 UTC (rev 208653)
@@ -257,7 +257,7 @@
     virtual bool supportsReadOnly() const;
     virtual void updateInnerTextValue();
     virtual void updatePlaceholderText();
-    virtual void attributeChanged();
+    virtual void attributeChanged(const QualifiedName&);
     virtual void multipleAttributeChanged();
     virtual void disabledAttributeChanged();
     virtual void readonlyAttributeChanged();

Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (208652 => 208653)


--- trunk/Source/WebCore/html/TextFieldInputType.cpp	2016-11-12 17:43:40 UTC (rev 208652)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp	2016-11-12 17:54:42 UTC (rev 208653)
@@ -346,11 +346,10 @@
     m_container = nullptr;
 }
 
-void TextFieldInputType::attributeChanged()
+void TextFieldInputType::attributeChanged(const QualifiedName& attributeName)
 {
-    // FIXME: Updating the inner text on any attribute update should
-    // be unnecessary. We should figure out what attributes affect.
-    updateInnerTextValue();
+    if (attributeName == valueAttr || attributeName == placeholderAttr)
+        updateInnerTextValue();
 }
 
 void TextFieldInputType::disabledAttributeChanged()

Modified: trunk/Source/WebCore/html/TextFieldInputType.h (208652 => 208653)


--- trunk/Source/WebCore/html/TextFieldInputType.h	2016-11-12 17:43:40 UTC (rev 208652)
+++ trunk/Source/WebCore/html/TextFieldInputType.h	2016-11-12 17:54:42 UTC (rev 208653)
@@ -59,7 +59,7 @@
     virtual bool needsContainer() const;
     void createShadowSubtree() override;
     void destroyShadowSubtree() override;
-    void attributeChanged() final;
+    void attributeChanged(const QualifiedName&) final;
     void disabledAttributeChanged() final;
     void readonlyAttributeChanged() final;
     bool supportsReadOnly() const final;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to