Title: [121349] trunk/Source/WebCore
Revision
121349
Author
[email protected]
Date
2012-06-27 10:45:24 -0700 (Wed, 27 Jun 2012)

Log Message

Move CSSWrapShape style resolution from StyleResolver to StyleBuilder
https://bugs.webkit.org/show_bug.cgi?id=89668

Patch by Hans Muller <[email protected]> on 2012-06-27
Reviewed by Andreas Kling.

Moved the resolution of the shapeInside and shapeOutside CSS properties
from the StyleResolver class to StyleBuilder. This is just refactoring
in preparation for fixing https://bugs.webkit.org/show_bug.cgi?id=89670.

No new tests were required.

* css/StyleBuilder.cpp:
(WebCore):
(ApplyPropertyWrapShape):
(WebCore::ApplyPropertyWrapShape::setValue):
(WebCore::ApplyPropertyWrapShape::applyValue):
(WebCore::ApplyPropertyWrapShape::createHandler):
(WebCore::StyleBuilder::StyleBuilder):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::collectMatchingRulesForList):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (121348 => 121349)


--- trunk/Source/WebCore/ChangeLog	2012-06-27 17:38:05 UTC (rev 121348)
+++ trunk/Source/WebCore/ChangeLog	2012-06-27 17:45:24 UTC (rev 121349)
@@ -1,3 +1,26 @@
+2012-06-27  Hans Muller  <[email protected]>
+
+        Move CSSWrapShape style resolution from StyleResolver to StyleBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=89668
+
+        Reviewed by Andreas Kling.
+
+        Moved the resolution of the shapeInside and shapeOutside CSS properties
+        from the StyleResolver class to StyleBuilder. This is just refactoring
+        in preparation for fixing https://bugs.webkit.org/show_bug.cgi?id=89670.
+
+        No new tests were required.
+
+        * css/StyleBuilder.cpp:
+        (WebCore):
+        (ApplyPropertyWrapShape):
+        (WebCore::ApplyPropertyWrapShape::setValue):
+        (WebCore::ApplyPropertyWrapShape::applyValue):
+        (WebCore::ApplyPropertyWrapShape::createHandler):
+        (WebCore::StyleBuilder::StyleBuilder):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::collectMatchingRulesForList):
+
 2012-06-27  Alexandru Chiculita  <[email protected]>
 
         Blur filter causes issues when scrolling

Modified: trunk/Source/WebCore/css/StyleBuilder.cpp (121348 => 121349)


--- trunk/Source/WebCore/css/StyleBuilder.cpp	2012-06-27 17:38:05 UTC (rev 121348)
+++ trunk/Source/WebCore/css/StyleBuilder.cpp	2012-06-27 17:45:24 UTC (rev 121349)
@@ -1780,6 +1780,29 @@
 
 };
 
+#if ENABLE(CSS_EXCLUSIONS)
+template <CSSWrapShape* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<CSSWrapShape>), CSSWrapShape* (*initialFunction)()>
+class ApplyPropertyWrapShape {
+public:
+    static void setValue(RenderStyle* style, PassRefPtr<CSSWrapShape> value) { (style->*setterFunction)(value); }
+    static void applyValue(StyleResolver* styleResolver, CSSValue* value)
+    {
+        if (value->isPrimitiveValue()) {
+            CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+            if (primitiveValue->getIdent() == CSSValueAuto)
+                setValue(styleResolver->style(), 0);
+            else if (primitiveValue->isShape())
+                setValue(styleResolver->style(), primitiveValue->getShapeValue());
+        }
+    }
+    static PropertyHandler createHandler()
+    {
+        PropertyHandler handler = ApplyPropertyDefaultBase<CSSWrapShape*, getterFunction, PassRefPtr<CSSWrapShape>, setterFunction, CSSWrapShape*, initialFunction>::createHandler();
+        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
+    }
+};
+#endif
+
 #if ENABLE(CSS_IMAGE_RESOLUTION)
 class ApplyPropertyImageResolution {
 public:
@@ -2094,6 +2117,8 @@
     setPropertyHandler(CSSPropertyWebkitWrapMargin, ApplyPropertyLength<&RenderStyle::wrapMargin, &RenderStyle::setWrapMargin, &RenderStyle::initialWrapMargin>::createHandler());
     setPropertyHandler(CSSPropertyWebkitWrapPadding, ApplyPropertyLength<&RenderStyle::wrapPadding, &RenderStyle::setWrapPadding, &RenderStyle::initialWrapPadding>::createHandler());
     setPropertyHandler(CSSPropertyWebkitWrapThrough, ApplyPropertyDefault<WrapThrough, &RenderStyle::wrapThrough, WrapThrough, &RenderStyle::setWrapThrough, WrapThrough, &RenderStyle::initialWrapThrough>::createHandler());
+    setPropertyHandler(CSSPropertyWebkitShapeInside, ApplyPropertyWrapShape<&RenderStyle::wrapShapeInside, &RenderStyle::setWrapShapeInside, &RenderStyle::initialWrapShapeInside>::createHandler());
+    setPropertyHandler(CSSPropertyWebkitShapeOutside, ApplyPropertyWrapShape<&RenderStyle::wrapShapeOutside, &RenderStyle::setWrapShapeOutside, &RenderStyle::initialWrapShapeOutside>::createHandler());
 #endif
     setPropertyHandler(CSSPropertyWhiteSpace, ApplyPropertyDefault<EWhiteSpace, &RenderStyle::whiteSpace, EWhiteSpace, &RenderStyle::setWhiteSpace, EWhiteSpace, &RenderStyle::initialWhiteSpace>::createHandler());
     setPropertyHandler(CSSPropertyWidows, ApplyPropertyDefault<short, &RenderStyle::widows, short, &RenderStyle::setWidows, short, &RenderStyle::initialWidows>::createHandler());

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (121348 => 121349)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2012-06-27 17:38:05 UTC (rev 121348)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2012-06-27 17:45:24 UTC (rev 121349)
@@ -4075,27 +4075,7 @@
         m_style->setLineBoxContain(lineBoxContainValue->value());
         return;
     }
-#if ENABLE(CSS_EXCLUSIONS)
-    case CSSPropertyWebkitShapeInside:
-        HANDLE_INHERIT_AND_INITIAL(wrapShapeInside, WrapShapeInside);
-        if (!primitiveValue)
-            return;
-        if (primitiveValue->getIdent() == CSSValueAuto)
-            m_style->setWrapShapeInside(0);
-        else if (primitiveValue->isShape())
-            m_style->setWrapShapeInside(primitiveValue->getShapeValue());
-        return;
 
-    case CSSPropertyWebkitShapeOutside:
-        HANDLE_INHERIT_AND_INITIAL(wrapShapeOutside, WrapShapeOutside);
-        if (!primitiveValue)
-            return;
-        if (primitiveValue->getIdent() == CSSValueAuto)
-            m_style->setWrapShapeOutside(0);
-        else if (primitiveValue->isShape())
-            m_style->setWrapShapeOutside(primitiveValue->getShapeValue());
-        return;
-#endif
     // CSS Fonts Module Level 3
     case CSSPropertyWebkitFontFeatureSettings: {
         if (primitiveValue && primitiveValue->getIdent() == CSSValueNormal) {
@@ -4414,6 +4394,8 @@
     case CSSPropertyWebkitWrapMargin:
     case CSSPropertyWebkitWrapPadding:
     case CSSPropertyWebkitWrapThrough:
+    case CSSPropertyWebkitShapeInside:
+    case CSSPropertyWebkitShapeOutside:
 #endif
     case CSSPropertyWhiteSpace:
     case CSSPropertyWidows:
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to