Title: [124260] trunk/Source/WebCore
Revision
124260
Author
[email protected]
Date
2012-07-31 15:55:18 -0700 (Tue, 31 Jul 2012)

Log Message

StyleResolver::canShareStyleWithElement does not need to use getAttribute for classAttr in the non-SVG case
https://bugs.webkit.org/show_bug.cgi?id=92687

Reviewed by Antti Koivisto.

Previously 10% of samples in canShareStyleWithElement hit this line, after this change < 1% do.
This is a small speedup for the non-SVG case.  Since this call is made for every element
when style is resolved, any small speedup in this function matters on large documents.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::collectMatchingRulesForList):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (124259 => 124260)


--- trunk/Source/WebCore/ChangeLog	2012-07-31 22:44:53 UTC (rev 124259)
+++ trunk/Source/WebCore/ChangeLog	2012-07-31 22:55:18 UTC (rev 124260)
@@ -1,3 +1,17 @@
+2012-07-31  Eric Seidel  <[email protected]>
+
+        StyleResolver::canShareStyleWithElement does not need to use getAttribute for classAttr in the non-SVG case
+        https://bugs.webkit.org/show_bug.cgi?id=92687
+
+        Reviewed by Antti Koivisto.
+
+        Previously 10% of samples in canShareStyleWithElement hit this line, after this change < 1% do.
+        This is a small speedup for the non-SVG case.  Since this call is made for every element
+        when style is resolved, any small speedup in this function matters on large documents.
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::collectMatchingRulesForList):
+
 2012-07-31  Luke Macpherson   <[email protected]>
 
         Heap-use-after-free in WebCore::StyleResolver::loadPendingImage

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (124259 => 124260)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2012-07-31 22:44:53 UTC (rev 124259)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2012-07-31 22:55:18 UTC (rev 124260)
@@ -1480,8 +1480,17 @@
     if (elementHasDirectionAuto(element) || elementHasDirectionAuto(m_element))
         return false;
 
-    if (element->hasClass() && m_element->getAttribute(classAttr) != element->getAttribute(classAttr))
-        return false;
+    if (element->hasClass()) {
+#if ENABLE(SVG)
+        // SVG elements require a (slow!) getAttribute comparision because "class" is an animatable attribute for SVG.
+        if (element->isSVGElement()) {
+            if (element->getAttribute(classAttr) != m_element->getAttribute(classAttr))
+                return false;
+        } else
+#endif
+        if (element->fastGetAttribute(classAttr) != m_element->fastGetAttribute(classAttr))
+            return false;
+    }
 
     if (element->attributeStyle() && !attributeStylesEqual(element->attributeStyle(), m_styledElement->attributeStyle()))
         return false;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to