Changeset 128128 in webkit


Ignore:
Timestamp:
Sep 10, 2012 4:26:34 PM (12 years ago)
Author:
Dimitri Glazkov
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.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r128127 r128128  
     12012-09-10  Dimitri Glazkov  <dglazkov@chromium.org>
     2
     3        Reduce the number of treeScope queries when matching rules.
     4        https://bugs.webkit.org/show_bug.cgi?id=96315
     5
     6        Reviewed by Eric Seidel.
     7
     8        In the worst case, treeScope() requires a HashMap lookup, which could be slow. Since the value is always the same for the element,
     9        we can just ask for it once.
     10
     11        No new tests, no change in behavior.
     12
     13        * css/StyleResolver.cpp:
     14        (WebCore::StyleResolver::collectMatchingRulesForList): Moved the call to treeScope out of the loop.
     15
    1162012-09-10  Adam Barth  <abarth@chromium.org>
    217
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r127869 r128128  
    10721072    if (!rules)
    10731073        return;
     1074
     1075    TreeScope* treeScope = m_element->treeScope();
     1076
    10741077    // In some cases we may end up looking up style for random elements in the middle of a recursive tree resolve.
    10751078    // Ancestor identifier filter won't be up-to-date in that case and we can't use the fast path.
     
    10941097            // c) the rules comes from a scoped style sheet within the same tree scope
    10951098            // d) the rule contains shadow-ID pseudo elements
    1096             TreeScope* treeScope = m_element->treeScope();
    10971099            if (!MatchingUARulesScope::isMatchingUARules()
    10981100                && !treeScope->applyAuthorStyles()
Note: See TracChangeset for help on using the changeset viewer.