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.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96168
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-09-27 Luke Macpherson <macpherson@chromium.org>
+
+ 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.
+
2011-09-27 Kent Tamura <tkent@chromium.org>
[V8] element.dataset.nonExistingKey should return undefined.
public:
static const CSSStyleApplyProperty& sharedCSSStyleApplyProperty();
- void applyInheritValue(CSSPropertyID property, CSSStyleSelector* selector) const
- {
- ASSERT(implements(property));
- propertyHandler(property)->applyInheritValue(selector);
- }
-
- void applyInitialValue(CSSPropertyID property, CSSStyleSelector* selector) const
- {
- ASSERT(implements(property));
- propertyHandler(property)->applyInitialValue(selector);
- }
-
- void applyValue(CSSPropertyID property, CSSStyleSelector* selector, CSSValue* value) const
- {
- ASSERT(implements(property));
- propertyHandler(property)->applyValue(selector, value);
- }
-
- bool implements(CSSPropertyID property) const
+ ApplyPropertyBase* propertyHandler(CSSPropertyID property) const
{
- return propertyHandler(property);
+ ASSERT(valid(property));
+ return m_propertyMap[index(property)];
}
-
private:
CSSStyleApplyProperty();
static int index(CSSPropertyID property)
m_propertyMap[index(newProperty)] = m_propertyMap[index(equivalentProperty)];
}
- ApplyPropertyBase* propertyHandler(CSSPropertyID property) const
- {
- ASSERT(valid(property));
- return m_propertyMap[index(property)];
- }
-
ApplyPropertyBase* m_propertyMap[numCSSProperties];
};
CSSPropertyID property = static_cast<CSSPropertyID>(id);
// check lookup table for implementations and use when available
- if (m_applyProperty.implements(property)) {
+ if (ApplyPropertyBase* handler = m_applyProperty.propertyHandler(property)) {
if (isInherit)
- m_applyProperty.applyInheritValue(property, this);
+ handler->applyInheritValue(this);
else if (isInitial)
- m_applyProperty.applyInitialValue(property, this);
+ handler->applyInitialValue(this);
else
- m_applyProperty.applyValue(property, this, value);
+ handler->applyValue(this, value);
return;
}