Title: [280521] trunk/Source/WebCore
Revision
280521
Author
m...@apple.com
Date
2021-07-31 15:48:18 -0700 (Sat, 31 Jul 2021)

Log Message

ListAttributeTargetObserver is needlessly created even when there is no list attribute
https://bugs.webkit.org/show_bug.cgi?id=228541

Reviewed by Yusuke Suzuki.

No new tests because no behavior change.

This is possibly a small improvement (~0.5%) on Speedometer subtests that do innerHTML, but not statistically significant.

Ported from a Chromium change by Adithya Srinivasan

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::resetListAttributeTargetObserver): check if there's a list attribute before making an observer.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (280520 => 280521)


--- trunk/Source/WebCore/ChangeLog	2021-07-31 20:47:46 UTC (rev 280520)
+++ trunk/Source/WebCore/ChangeLog	2021-07-31 22:48:18 UTC (rev 280521)
@@ -1,3 +1,19 @@
+2021-07-31  Maciej Stachowiak  <m...@apple.com>
+
+        ListAttributeTargetObserver is needlessly created even when there is no list attribute
+        https://bugs.webkit.org/show_bug.cgi?id=228541
+
+        Reviewed by Yusuke Suzuki.
+
+        No new tests because no behavior change.
+
+        This is possibly a small improvement (~0.5%) on Speedometer subtests that do innerHTML, but not statistically significant.
+
+        Ported from a Chromium change by Adithya Srinivasan
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::resetListAttributeTargetObserver): check if there's a list attribute before making an observer.
+
 2021-07-31  Youenn Fablet  <you...@apple.com>
 
         Improve LocalSampleBufferDisplayLayer logging

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (280520 => 280521)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2021-07-31 20:47:46 UTC (rev 280520)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2021-07-31 22:48:18 UTC (rev 280521)
@@ -1682,10 +1682,14 @@
 
 void HTMLInputElement::resetListAttributeTargetObserver()
 {
-    if (isConnected())
-        m_listAttributeTargetObserver = makeUnique<ListAttributeTargetObserver>(attributeWithoutSynchronization(listAttr), this);
-    else
-        m_listAttributeTargetObserver = nullptr;
+    if (isConnected()) {
+        if (auto& listAttrValue = attributeWithoutSynchronization(listAttr); !listAttrValue.isNull()) {
+            m_listAttributeTargetObserver = makeUnique<ListAttributeTargetObserver>(listAttrValue, this);
+            return;
+        }
+    }
+
+    m_listAttributeTargetObserver = nullptr;
 }
 
 void HTMLInputElement::dataListMayHaveChanged()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to