Title: [96168] trunk/Source/WebCore
Revision
96168
Author
macpher...@chromium.org
Date
2011-09-27 16:24:53 -0700 (Tue, 27 Sep 2011)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (96167 => 96168)


--- trunk/Source/WebCore/ChangeLog	2011-09-27 23:11:49 UTC (rev 96167)
+++ trunk/Source/WebCore/ChangeLog	2011-09-27 23:24:53 UTC (rev 96168)
@@ -1,3 +1,19 @@
+2011-09-27  Luke Macpherson   <macpher...@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  <tk...@chromium.org>
 
         [V8] element.dataset.nonExistingKey should return undefined.

Modified: trunk/Source/WebCore/css/CSSStyleApplyProperty.h (96167 => 96168)


--- trunk/Source/WebCore/css/CSSStyleApplyProperty.h	2011-09-27 23:11:49 UTC (rev 96167)
+++ trunk/Source/WebCore/css/CSSStyleApplyProperty.h	2011-09-27 23:24:53 UTC (rev 96168)
@@ -49,29 +49,11 @@
 public:
     static const CSSStyleApplyProperty& sharedCSSStyleApplyProperty();
 
-    void applyInheritValue(CSSPropertyID property, CSSStyleSelector* selector) const
+    ApplyPropertyBase* propertyHandler(CSSPropertyID property) const
     {
-        ASSERT(implements(property));
-        propertyHandler(property)->applyInheritValue(selector);
+        ASSERT(valid(property));
+        return m_propertyMap[index(property)];
     }
-
-    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
-    {
-        return propertyHandler(property);
-    }
-
 private:
     CSSStyleApplyProperty();
     static int index(CSSPropertyID property)
@@ -100,12 +82,6 @@
         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];
 };
 

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (96167 => 96168)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-09-27 23:11:49 UTC (rev 96167)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-09-27 23:24:53 UTC (rev 96168)
@@ -2371,13 +2371,13 @@
     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;
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to