Title: [88524] trunk/Source/WebCore
Revision
88524
Author
[email protected]
Date
2011-06-09 23:17:40 -0700 (Thu, 09 Jun 2011)

Log Message

2011-06-09  Luke Macpherson   <[email protected]>

        Reviewed by Eric Seidel.

        Code cleanup - add wrappers for function pointer dereferences to improve readability in ApplyPropertyDefaultBase and derived classes.
        https://bugs.webkit.org/show_bug.cgi?id=62418

        No new tests / cleanup only.

        * css/CSSStyleApplyProperty.cpp:
        (WebCore::ApplyPropertyDefaultBase::applyInheritValue):
        Use new wrapper functions.
        (WebCore::ApplyPropertyDefaultBase::applyInitialValue):
        Use new wrapper functions.
        (WebCore::ApplyPropertyDefaultBase::setValue):
        Wrapper for calling m_setter function pointer.
        (WebCore::ApplyPropertyDefaultBase::value):
        Wrapper for calling m_getter function pointer.
        (WebCore::ApplyPropertyDefaultBase::initial):
        Wrapper for calling m_initial function pointer.
        (WebCore::ApplyPropertyDefault::applyValue):
        Use new setValue function.
        (WebCore::ApplyPropertyLength::applyValue):
        Use new setValue function.
        (WebCore::ApplyPropertyWidth::applyValue):
        Use new setValue function.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (88523 => 88524)


--- trunk/Source/WebCore/ChangeLog	2011-06-10 06:16:18 UTC (rev 88523)
+++ trunk/Source/WebCore/ChangeLog	2011-06-10 06:17:40 UTC (rev 88524)
@@ -1,3 +1,30 @@
+2011-06-09  Luke Macpherson   <[email protected]>
+
+        Reviewed by Eric Seidel.
+
+        Code cleanup - add wrappers for function pointer dereferences to improve readability in ApplyPropertyDefaultBase and derived classes.
+        https://bugs.webkit.org/show_bug.cgi?id=62418
+
+        No new tests / cleanup only.
+
+        * css/CSSStyleApplyProperty.cpp:
+        (WebCore::ApplyPropertyDefaultBase::applyInheritValue):
+        Use new wrapper functions.
+        (WebCore::ApplyPropertyDefaultBase::applyInitialValue):
+        Use new wrapper functions.
+        (WebCore::ApplyPropertyDefaultBase::setValue):
+        Wrapper for calling m_setter function pointer.
+        (WebCore::ApplyPropertyDefaultBase::value):
+        Wrapper for calling m_getter function pointer.
+        (WebCore::ApplyPropertyDefaultBase::initial):
+        Wrapper for calling m_initial function pointer.
+        (WebCore::ApplyPropertyDefault::applyValue):
+        Use new setValue function.
+        (WebCore::ApplyPropertyLength::applyValue):
+        Use new setValue function.
+        (WebCore::ApplyPropertyWidth::applyValue):
+        Use new setValue function.
+
 2011-06-09  Hyowon Kim  <[email protected]>
 
         Reviewed by Antonio Gomes.

Modified: trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp (88523 => 88524)


--- trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2011-06-10 06:16:18 UTC (rev 88523)
+++ trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2011-06-10 06:17:40 UTC (rev 88524)
@@ -92,15 +92,30 @@
 private:
     virtual void applyInheritValue(CSSStyleSelector* selector) const
     {
-        (selector->style()->*m_setter)((selector->parentStyle()->*m_getter)());
+        setValue(selector->style(), value(selector->parentStyle()));
     }
 
     virtual void applyInitialValue(CSSStyleSelector* selector) const
     {
-        (selector->style()->*m_setter)((*m_initial)());
+        setValue(selector->style(), initial());
     }
 
 protected:
+    void setValue(RenderStyle* style, T value) const
+    {
+        (style->*m_setter)(value);
+    }
+
+    T value(RenderStyle* style) const
+    {
+        return (style->*m_getter)();
+    }
+
+    T initial() const
+    {
+        return (*m_initial)();
+    }
+
     GetterFunction m_getter;
     SetterFunction m_setter;
     InitialFunction m_initial;
@@ -119,7 +134,7 @@
     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
     {
         if (value->isPrimitiveValue())
-            (selector->style()->*ApplyPropertyDefaultBase<T>::m_setter)(*static_cast<CSSPrimitiveValue*>(value));
+            ApplyPropertyDefaultBase<T>::setValue(selector->style(), *static_cast<CSSPrimitiveValue*>(value));
     }
 };
 
@@ -217,21 +232,21 @@
         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
         if (noneEnabled && primitiveValue->getIdent() == CSSValueNone)
             if (noneUndefined)
-                (selector->style()->*m_setter)(Length(undefinedLength, Fixed));
+                setValue(selector->style(), Length(undefinedLength, Fixed));
             else
-                (selector->style()->*m_setter)(Length());
+                setValue(selector->style(), Length());
         else if (intrinsicEnabled && primitiveValue->getIdent() == CSSValueIntrinsic)
-            (selector->style()->*m_setter)(Length(Intrinsic));
+            setValue(selector->style(), Length(Intrinsic));
         else if (minIntrinsicEnabled && primitiveValue->getIdent() == CSSValueMinIntrinsic)
-            (selector->style()->*m_setter)(Length(MinIntrinsic));
+            setValue(selector->style(), Length(MinIntrinsic));
         else if (autoEnabled && primitiveValue->getIdent() == CSSValueAuto)
-            (selector->style()->*m_setter)(Length());
+            setValue(selector->style(), Length());
         else {
             int type = primitiveValue->primitiveType();
             if (CSSPrimitiveValue::isUnitTypeLength(type))
-                (selector->style()->*m_setter)(Length(primitiveValue->computeLengthIntForLength(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()), Fixed, primitiveValue->isQuirkValue()));
+                setValue(selector->style(), Length(primitiveValue->computeLengthIntForLength(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()), Fixed, primitiveValue->isQuirkValue()));
             else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
-                (selector->style()->*m_setter)(Length(primitiveValue->getDoubleValue(), Percent));
+                setValue(selector->style(), Length(primitiveValue->getDoubleValue(), Percent));
         }
     }
 };
@@ -365,7 +380,7 @@
             return;
         }
 
-        (selector->style()->*m_setter)(width);
+        setValue(selector->style(), width);
     }
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to