Title: [94625] trunk/Source/WebCore
Revision
94625
Author
[email protected]
Date
2011-09-06 19:07:03 -0700 (Tue, 06 Sep 2011)

Log Message

Implement list style properties in CSSStyleApplyProperty.
https://bugs.webkit.org/show_bug.cgi?id=67103

Reviewed by Eric Seidel.

No new tests / no behavioral changes.

* css/CSSStyleApplyProperty.cpp:
Add class to wrap call to CSSStyleSelector::styleImage().
(WebCore::ApplyPropertyStyleImage::ApplyPropertyStyleImage):
(WebCore::ApplyPropertyStyleImage::applyValue):
(WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):
Initialize handlers for list style properties.
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
Remove existing property implementations.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (94624 => 94625)


--- trunk/Source/WebCore/ChangeLog	2011-09-07 02:05:51 UTC (rev 94624)
+++ trunk/Source/WebCore/ChangeLog	2011-09-07 02:07:03 UTC (rev 94625)
@@ -1,3 +1,22 @@
+2011-09-06  Luke Macpherson   <[email protected]>
+
+        Implement list style properties in CSSStyleApplyProperty.
+        https://bugs.webkit.org/show_bug.cgi?id=67103
+
+        Reviewed by Eric Seidel.
+
+        No new tests / no behavioral changes.
+
+        * css/CSSStyleApplyProperty.cpp:
+        Add class to wrap call to CSSStyleSelector::styleImage().
+        (WebCore::ApplyPropertyStyleImage::ApplyPropertyStyleImage):
+        (WebCore::ApplyPropertyStyleImage::applyValue):
+        (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):
+        Initialize handlers for list style properties.
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyProperty):
+        Remove existing property implementations.
+
 2011-09-06  Alexis Menard  <[email protected]>
 
         [Qt] Move away from QPointer as it is slow and it has a replacement QWeakPointer.

Modified: trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp (94624 => 94625)


--- trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2011-09-07 02:05:51 UTC (rev 94624)
+++ trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2011-09-07 02:07:03 UTC (rev 94625)
@@ -79,12 +79,12 @@
     ApplyPropertyBase* m_propertyMap[5];
 };
 
-template <typename T>
+template <typename GetterType, typename SetterType = GetterType, typename InitialType = GetterType>
 class ApplyPropertyDefaultBase : public ApplyPropertyBase {
 public:
-    typedef T (RenderStyle::*GetterFunction)() const;
-    typedef void (RenderStyle::*SetterFunction)(T);
-    typedef T (*InitialFunction)();
+    typedef GetterType (RenderStyle::*GetterFunction)() const;
+    typedef void (RenderStyle::*SetterFunction)(SetterType);
+    typedef InitialType (*InitialFunction)();
 
     ApplyPropertyDefaultBase(GetterFunction getter, SetterFunction setter, InitialFunction initial)
         : m_getter(getter)
@@ -105,17 +105,17 @@
     }
 
 protected:
-    void setValue(RenderStyle* style, T value) const
+    void setValue(RenderStyle* style, SetterType value) const
     {
         (style->*m_setter)(value);
     }
 
-    T value(RenderStyle* style) const
+    GetterType value(RenderStyle* style) const
     {
         return (style->*m_getter)();
     }
 
-    T initial() const
+    InitialType initial() const
     {
         return (*m_initial)();
     }
@@ -142,6 +142,23 @@
     }
 };
 
+class ApplyPropertyStyleImage : public ApplyPropertyDefaultBase<StyleImage*, PassRefPtr<StyleImage> > {
+public:
+    ApplyPropertyStyleImage(GetterFunction getter, SetterFunction setter, InitialFunction initial, CSSPropertyID property)
+        : ApplyPropertyDefaultBase<StyleImage*, PassRefPtr<StyleImage> >(getter, setter, initial)
+        , m_property(property)
+    {
+    }
+
+private:
+    virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
+    {
+        setValue(selector->style(), selector->styleImage(m_property, value));
+    }
+
+    CSSPropertyID m_property;
+};
+
 enum AutoValueType {Number = 0, ComputeLength};
 template <typename T, AutoValueType valueType = Number, int autoIdentity = CSSValueAuto>
 class ApplyPropertyAuto : public ApplyPropertyDefaultBase<T> {
@@ -1021,6 +1038,11 @@
 
     setPropertyHandler(CSSPropertyTextIndent, new ApplyPropertyLength<>(&RenderStyle::textIndent, &RenderStyle::setTextIndent, &RenderStyle::initialTextIndent));
 
+    setPropertyHandler(CSSPropertyListStyleImage, new ApplyPropertyStyleImage(&RenderStyle::listStyleImage, &RenderStyle::setListStyleImage, &RenderStyle::initialListStyleImage, CSSPropertyListStyleImage));
+    setPropertyHandler(CSSPropertyListStylePosition, new ApplyPropertyDefault<EListStylePosition>(&RenderStyle::listStylePosition, &RenderStyle::setListStylePosition, &RenderStyle::initialListStylePosition));
+    setPropertyHandler(CSSPropertyListStyleType, new ApplyPropertyDefault<EListStyleType>(&RenderStyle::listStyleType, &RenderStyle::setListStyleType, &RenderStyle::initialListStyleType));
+    setPropertyHandler(CSSPropertyListStyle, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyListStyleType), propertyHandler(CSSPropertyListStyleImage), propertyHandler(CSSPropertyListStylePosition)));
+
     setPropertyHandler(CSSPropertyMaxHeight, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneEnabled, UndefinedEnabled>(&RenderStyle::maxHeight, &RenderStyle::setMaxHeight, &RenderStyle::initialMaxSize));
     setPropertyHandler(CSSPropertyMaxWidth, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneEnabled, UndefinedEnabled>(&RenderStyle::maxWidth, &RenderStyle::setMaxWidth, &RenderStyle::initialMaxSize));
     setPropertyHandler(CSSPropertyMinHeight, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled>(&RenderStyle::minHeight, &RenderStyle::setMinHeight, &RenderStyle::initialMinSize));

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (94624 => 94625)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-09-07 02:05:51 UTC (rev 94624)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-09-07 02:07:03 UTC (rev 94625)
@@ -3641,12 +3641,6 @@
     case CSSPropertyFloat:
         HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(floating, Floating)
         return;
-    case CSSPropertyListStylePosition:
-        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(listStylePosition, ListStylePosition)
-        return;
-    case CSSPropertyListStyleType:
-        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(listStyleType, ListStyleType)
-        return;
     case CSSPropertyPageBreakBefore:
         HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(pageBreakBefore, PageBreakBefore, PageBreak)
         return;
@@ -3675,12 +3669,6 @@
         HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(whiteSpace, WhiteSpace)
         return;
 // uri || inherit
-    case CSSPropertyListStyleImage:
-    {
-        HANDLE_INHERIT_AND_INITIAL(listStyleImage, ListStyleImage)
-        m_style->setListStyleImage(styleImage(CSSPropertyListStyleImage, value));
-        return;
-    }
     case CSSPropertyBorderImageSource:
     {
         HANDLE_INHERIT_AND_INITIAL(borderImageSource, BorderImageSource)
@@ -4280,19 +4268,7 @@
             applyProperty(CSSPropertyFontFamily, font->family.get());
         }
         return;
-        
-    case CSSPropertyListStyle:
-        if (isInherit) {
-            m_style->setListStyleType(m_parentStyle->listStyleType());
-            m_style->setListStyleImage(m_parentStyle->listStyleImage());
-            m_style->setListStylePosition(m_parentStyle->listStylePosition());
-        }
-        else if (isInitial) {
-            m_style->setListStyleType(RenderStyle::initialListStyleType());
-            m_style->setListStyleImage(RenderStyle::initialListStyleImage());
-            m_style->setListStylePosition(RenderStyle::initialListStylePosition());
-        }
-        return;
+
     case CSSPropertyOutline:
         if (isInherit) {
             m_style->setOutlineWidth(m_parentStyle->outlineWidth());
@@ -5089,6 +5065,10 @@
     case CSSPropertyBottom:
     case CSSPropertyWidth:
     case CSSPropertyMinWidth:
+    case CSSPropertyListStyle:
+    case CSSPropertyListStyleImage:
+    case CSSPropertyListStylePosition:
+    case CSSPropertyListStyleType:
     case CSSPropertyMarginTop:
     case CSSPropertyMarginRight:
     case CSSPropertyMarginBottom:
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to