Changeset 96168 in webkit


Ignore:
Timestamp:
Sep 27, 2011 4:24:53 PM (13 years ago)
Author:
macpherson@chromium.org
Message:

Slightly improve performance of CSSStyleApplyProperty handler lookup.
https://bugs.webkit.org/show_bug.cgi?id=68868

Reviewed by Eric Seidel.

No new tests as no functionality changed.

  • css/CSSStyleApplyProperty.h:

(WebCore::CSSStyleApplyProperty::propertyHandler):
Make propertyHandler() public and remove redirecting functions.

  • css/CSSStyleSelector.cpp:

(WebCore::CSSStyleSelector::applyProperty):
Perform property handler lookup once and reuse the result.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r96166 r96168  
     12011-09-27  Luke Macpherson   <macpherson@chromium.org>
     2
     3        Slightly improve performance of CSSStyleApplyProperty handler lookup.
     4        https://bugs.webkit.org/show_bug.cgi?id=68868
     5
     6        Reviewed by Eric Seidel.
     7
     8        No new tests as no functionality changed.
     9
     10        * css/CSSStyleApplyProperty.h:
     11        (WebCore::CSSStyleApplyProperty::propertyHandler):
     12        Make propertyHandler() public and remove redirecting functions.
     13        * css/CSSStyleSelector.cpp:
     14        (WebCore::CSSStyleSelector::applyProperty):
     15        Perform property handler lookup once and reuse the result.
     16
    1172011-09-27  Kent Tamura  <tkent@chromium.org>
    218
  • trunk/Source/WebCore/css/CSSStyleApplyProperty.h

    r95901 r96168  
    5050    static const CSSStyleApplyProperty& sharedCSSStyleApplyProperty();
    5151
    52     void applyInheritValue(CSSPropertyID property, CSSStyleSelector* selector) const
     52    ApplyPropertyBase* propertyHandler(CSSPropertyID property) const
    5353    {
    54         ASSERT(implements(property));
    55         propertyHandler(property)->applyInheritValue(selector);
     54        ASSERT(valid(property));
     55        return m_propertyMap[index(property)];
    5656    }
    57 
    58     void applyInitialValue(CSSPropertyID property, CSSStyleSelector* selector) const
    59     {
    60         ASSERT(implements(property));
    61         propertyHandler(property)->applyInitialValue(selector);
    62     }
    63 
    64     void applyValue(CSSPropertyID property, CSSStyleSelector* selector, CSSValue* value) const
    65     {
    66         ASSERT(implements(property));
    67         propertyHandler(property)->applyValue(selector, value);
    68     }
    69 
    70     bool implements(CSSPropertyID property) const
    71     {
    72         return propertyHandler(property);
    73     }
    74 
    7557private:
    7658    CSSStyleApplyProperty();
     
    10183    }
    10284
    103     ApplyPropertyBase* propertyHandler(CSSPropertyID property) const
    104     {
    105         ASSERT(valid(property));
    106         return m_propertyMap[index(property)];
    107     }
    108 
    10985    ApplyPropertyBase* m_propertyMap[numCSSProperties];
    11086};
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r96122 r96168  
    23722372
    23732373    // check lookup table for implementations and use when available
    2374     if (m_applyProperty.implements(property)) {
     2374    if (ApplyPropertyBase* handler = m_applyProperty.propertyHandler(property)) {
    23752375        if (isInherit)
    2376             m_applyProperty.applyInheritValue(property, this);
     2376            handler->applyInheritValue(this);
    23772377        else if (isInitial)
    2378             m_applyProperty.applyInitialValue(property, this);
     2378            handler->applyInitialValue(this);
    23792379        else
    2380             m_applyProperty.applyValue(property, this, value);
     2380            handler->applyValue(this, value);
    23812381        return;
    23822382    }
Note: See TracChangeset for help on using the changeset viewer.