Changeset 117034 in webkit


Ignore:
Timestamp:
May 14, 2012 11:36:25 PM (12 years ago)
Author:
macpherson@chromium.org
Message:

Make StyleResolver::applyMatchedProperties and ::applyProperties use enum template parameter instead of bool.
https://bugs.webkit.org/show_bug.cgi?id=86424

Reviewed by Dimitri Glazkov.

This patch changes from using a boolean template parameter for StyleResolver::applyMatchedProperties and
StyleResolver::applyProperties functions. The motivation for this change is that it paves the way for
CSS Variables to make the value tri-state, which is a requirement because variable definitions must occur
before high priority CSS properties such that they can be referenced by the latter. This change affects
only the type signatures of those functions, and not their behavior.

  • css/StyleResolver.cpp:

(WebCore::StyleResolver::collectMatchingRulesForList):

  • css/StyleResolver.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r117033 r117034  
     12012-05-14  Luke Macpherson  <macpherson@chromium.org>
     2
     3        Make StyleResolver::applyMatchedProperties and ::applyProperties use enum template parameter instead of bool.
     4        https://bugs.webkit.org/show_bug.cgi?id=86424
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        This patch changes from using a boolean template parameter for StyleResolver::applyMatchedProperties and
     9        StyleResolver::applyProperties functions. The motivation for this change is that it paves the way for
     10        CSS Variables to make the value tri-state, which is a requirement because variable definitions must occur
     11        before high priority CSS properties such that they can be referenced by the latter. This change affects
     12        only the type signatures of those functions, and not their behavior.
     13
     14        * css/StyleResolver.cpp:
     15        (WebCore::StyleResolver::collectMatchingRulesForList):
     16        * css/StyleResolver.h:
     17
    1182012-05-14  MORITA Hajime  <morrita@google.com>
    219
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r116751 r117034  
    16931693    bool inheritedOnly = false;
    16941694    if (keyframe->properties())
    1695         applyMatchedProperties<true>(result, false, 0, result.matchedProperties.size() - 1, inheritedOnly);
     1695        applyMatchedProperties<HighPriorityProperties>(result, false, 0, result.matchedProperties.size() - 1, inheritedOnly);
    16961696
    16971697    // If our font got dirtied, go ahead and update it now.
     
    17041704    // Now do rest of the properties.
    17051705    if (keyframe->properties())
    1706         applyMatchedProperties<false>(result, false, 0, result.matchedProperties.size() - 1, inheritedOnly);
     1706        applyMatchedProperties<LowPriorityProperties>(result, false, 0, result.matchedProperties.size() - 1, inheritedOnly);
    17071707
    17081708    // If our font got dirtied by one of the non-essential font props,
     
    18611861    m_lineHeightValue = 0;
    18621862    bool inheritedOnly = false;
    1863     applyMatchedProperties<true>(result, false, 0, result.matchedProperties.size() - 1, inheritedOnly);
     1863    applyMatchedProperties<HighPriorityProperties>(result, false, 0, result.matchedProperties.size() - 1, inheritedOnly);
    18641864
    18651865    // If our font got dirtied, go ahead and update it now.
     
    18701870        applyProperty(CSSPropertyLineHeight, m_lineHeightValue);
    18711871
    1872     applyMatchedProperties<false>(result, false, 0, result.matchedProperties.size() - 1, inheritedOnly);
     1872    applyMatchedProperties<LowPriorityProperties>(result, false, 0, result.matchedProperties.size() - 1, inheritedOnly);
    18731873
    18741874    // Start loading images referenced by this style.
     
    26272627}
    26282628
    2629 template <bool applyFirst>
     2629template <StyleResolver::StyleApplicationPass pass>
    26302630void StyleResolver::applyProperties(const StylePropertySet* properties, StyleRule* rule, bool isImportant, bool inheritedOnly, bool filterRegionProperties)
    26312631{
     
    26502650            continue;
    26512651
    2652         if (applyFirst) {
     2652        if (pass == HighPriorityProperties) {
    26532653            COMPILE_ASSERT(firstCSSProperty == CSSPropertyColor, CSS_color_is_first_property);
    26542654            COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 18, CSS_zoom_is_end_of_first_prop_range);
     
    26712671}
    26722672
    2673 template <bool applyFirst>
     2673template <StyleResolver::StyleApplicationPass pass>
    26742674void StyleResolver::applyMatchedProperties(const MatchResult& matchResult, bool isImportant, int startIndex, int endIndex, bool inheritedOnly)
    26752675{
     
    26852685            m_applyPropertyToVisitedLinkStyle = linkMatchType & SelectorChecker::MatchVisited;
    26862686
    2687             applyProperties<applyFirst>(matchedProperties.properties.get(), matchResult.matchedRules[i], isImportant, inheritedOnly, matchedProperties.isInRegionRule);
     2687            applyProperties<pass>(matchedProperties.properties.get(), matchResult.matchedRules[i], isImportant, inheritedOnly, matchedProperties.isInRegionRule);
    26882688        }
    26892689        m_applyPropertyToRegularStyle = true;
     
    26932693    for (int i = startIndex; i <= endIndex; ++i) {
    26942694        const MatchedProperties& matchedProperties = matchResult.matchedProperties[i];
    2695         applyProperties<applyFirst>(matchedProperties.properties.get(), matchResult.matchedRules[i], isImportant, inheritedOnly, matchedProperties.isInRegionRule);
     2695        applyProperties<pass>(matchedProperties.properties.get(), matchResult.matchedRules[i], isImportant, inheritedOnly, matchedProperties.isInRegionRule);
    26962696    }
    26972697}
     
    28162816    // and (4) normal important.
    28172817    m_lineHeightValue = 0;
    2818     applyMatchedProperties<true>(matchResult, false, 0, matchResult.matchedProperties.size() - 1, applyInheritedOnly);
    2819     applyMatchedProperties<true>(matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly);
    2820     applyMatchedProperties<true>(matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
    2821     applyMatchedProperties<true>(matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
     2818    applyMatchedProperties<HighPriorityProperties>(matchResult, false, 0, matchResult.matchedProperties.size() - 1, applyInheritedOnly);
     2819    applyMatchedProperties<HighPriorityProperties>(matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly);
     2820    applyMatchedProperties<HighPriorityProperties>(matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
     2821    applyMatchedProperties<HighPriorityProperties>(matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
    28222822
    28232823    if (cacheItem && cacheItem->renderStyle->effectiveZoom() != m_style->effectiveZoom()) {
     
    28382838
    28392839    // Now do the normal priority UA properties.
    2840     applyMatchedProperties<false>(matchResult, false, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
     2840    applyMatchedProperties<LowPriorityProperties>(matchResult, false, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
    28412841   
    28422842    // Cache our border and background so that we can examine them later.
     
    28442844   
    28452845    // Now do the author and user normal priority properties and all the !important properties.
    2846     applyMatchedProperties<false>(matchResult, false, matchResult.ranges.lastUARule + 1, matchResult.matchedProperties.size() - 1, applyInheritedOnly);
    2847     applyMatchedProperties<false>(matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly);
    2848     applyMatchedProperties<false>(matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
    2849     applyMatchedProperties<false>(matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
     2846    applyMatchedProperties<LowPriorityProperties>(matchResult, false, matchResult.ranges.lastUARule + 1, matchResult.matchedProperties.size() - 1, applyInheritedOnly);
     2847    applyMatchedProperties<LowPriorityProperties>(matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly);
     2848    applyMatchedProperties<LowPriorityProperties>(matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
     2849    applyMatchedProperties<LowPriorityProperties>(matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
    28502850   
    28512851    loadPendingImages();
  • trunk/Source/WebCore/css/StyleResolver.h

    r116471 r117034  
    354354    bool checkRegionSelector(CSSSelector* regionSelector, Element* regionElement);
    355355    void applyMatchedProperties(const MatchResult&);
    356     template <bool firstPass>
     356    enum StyleApplicationPass {
     357        HighPriorityProperties,
     358        LowPriorityProperties
     359    };
     360    template <StyleApplicationPass pass>
    357361    void applyMatchedProperties(const MatchResult&, bool important, int startIndex, int endIndex, bool inheritedOnly);
    358     template <bool firstPass>
     362    template <StyleApplicationPass pass>
    359363    void applyProperties(const StylePropertySet* properties, StyleRule*, bool isImportant, bool inheritedOnly, bool filterRegionProperties);
    360364
Note: See TracChangeset for help on using the changeset viewer.