Title: [128128] trunk/Source/WebCore
Revision
128128
Author
[email protected]
Date
2012-09-10 16:26:34 -0700 (Mon, 10 Sep 2012)

Log Message

Reduce the number of treeScope queries when matching rules.
https://bugs.webkit.org/show_bug.cgi?id=96315

Reviewed by Eric Seidel.

In the worst case, treeScope() requires a HashMap lookup, which could be slow. Since the value is always the same for the element,
we can just ask for it once.

No new tests, no change in behavior.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::collectMatchingRulesForList): Moved the call to treeScope out of the loop.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (128127 => 128128)


--- trunk/Source/WebCore/ChangeLog	2012-09-10 23:23:36 UTC (rev 128127)
+++ trunk/Source/WebCore/ChangeLog	2012-09-10 23:26:34 UTC (rev 128128)
@@ -1,3 +1,18 @@
+2012-09-10  Dimitri Glazkov  <[email protected]>
+
+        Reduce the number of treeScope queries when matching rules.
+        https://bugs.webkit.org/show_bug.cgi?id=96315
+
+        Reviewed by Eric Seidel.
+
+        In the worst case, treeScope() requires a HashMap lookup, which could be slow. Since the value is always the same for the element,
+        we can just ask for it once.
+
+        No new tests, no change in behavior.
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::collectMatchingRulesForList): Moved the call to treeScope out of the loop.
+
 2012-09-10  Adam Barth  <[email protected]>
 
         [V8] V8PerIsolateData::m_toStringTemplate leaks memory

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (128127 => 128128)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2012-09-10 23:23:36 UTC (rev 128127)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2012-09-10 23:26:34 UTC (rev 128128)
@@ -1071,6 +1071,9 @@
 {
     if (!rules)
         return;
+
+    TreeScope* treeScope = m_element->treeScope();
+
     // In some cases we may end up looking up style for random elements in the middle of a recursive tree resolve.
     // Ancestor identifier filter won't be up-to-date in that case and we can't use the fast path.
     bool canUseFastReject = m_checker.parentStackIsConsistent(m_parentNode);
@@ -1093,7 +1096,6 @@
             // b) the tree scope allows author rules
             // c) the rules comes from a scoped style sheet within the same tree scope
             // d) the rule contains shadow-ID pseudo elements
-            TreeScope* treeScope = m_element->treeScope();
             if (!MatchingUARulesScope::isMatchingUARules()
                 && !treeScope->applyAuthorStyles()
 #if ENABLE(STYLE_SCOPED)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to