Title: [149047] trunk/Source/WebCore
Revision
149047
Author
akl...@apple.com
Date
2013-04-24 10:43:14 -0700 (Wed, 24 Apr 2013)

Log Message

CSS attribute selectors cause unnecessary style recalc when setting attribute to same value.
<http://webkit.org/b/115116>
<rdar://problem/13727709>

Reviewed by Simon Fraser.

The logic that dirties the style if there's a relevant attribute selector in the document
shouldn't run if the attribute is being overwritten with an identical value.
Move this into willModifyAttribute() instead, since we need access to both the old and the new value.

This reduces unnecessary style recalculation in Mac App Store content.

* dom/Element.cpp:
(WebCore::Element::attributeChanged):
(WebCore::Element::willModifyAttribute):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (149046 => 149047)


--- trunk/Source/WebCore/ChangeLog	2013-04-24 17:07:01 UTC (rev 149046)
+++ trunk/Source/WebCore/ChangeLog	2013-04-24 17:43:14 UTC (rev 149047)
@@ -1,3 +1,21 @@
+2013-04-24  Andreas Kling  <akl...@apple.com>
+
+        CSS attribute selectors cause unnecessary style recalc when setting attribute to same value.
+        <http://webkit.org/b/115116>
+        <rdar://problem/13727709>
+
+        Reviewed by Simon Fraser.
+
+        The logic that dirties the style if there's a relevant attribute selector in the document
+        shouldn't run if the attribute is being overwritten with an identical value.
+        Move this into willModifyAttribute() instead, since we need access to both the old and the new value.
+
+        This reduces unnecessary style recalculation in Mac App Store content.
+
+        * dom/Element.cpp:
+        (WebCore::Element::attributeChanged):
+        (WebCore::Element::willModifyAttribute):
+
 2013-04-24  Jonathan Feldstein <jfeldst...@blackberry.com>
 
         [BlackBerry] Fixes the San Angeles demo on khronos.org

Modified: trunk/Source/WebCore/dom/Element.cpp (149046 => 149047)


--- trunk/Source/WebCore/dom/Element.cpp	2013-04-24 17:07:01 UTC (rev 149046)
+++ trunk/Source/WebCore/dom/Element.cpp	2013-04-24 17:43:14 UTC (rev 149047)
@@ -875,7 +875,6 @@
     else if (name == HTMLNames::pseudoAttr)
         shouldInvalidateStyle |= testShouldInvalidateStyle && isInShadowTree();
 
-    shouldInvalidateStyle |= testShouldInvalidateStyle && styleResolver->hasSelectorForAttribute(name.localName());
 
     invalidateNodeListCachesInAncestors(&name, this);
 
@@ -2721,6 +2720,11 @@
             updateLabel(scope, oldValue, newValue);
     }
 
+    if (oldValue != newValue) {
+        if (attached() && document()->styleResolver() && document()->styleResolver()->hasSelectorForAttribute(name.localName()))
+            setNeedsStyleRecalc();
+    }
+
     if (OwnPtr<MutationObserverInterestGroup> recipients = MutationObserverInterestGroup::createForAttributesMutation(this, name))
         recipients->enqueueMutationRecord(MutationRecord::createAttributes(this, name, oldValue));
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to