Title: [175817] trunk/Source/WebCore
Revision
175817
Author
cdu...@apple.com
Date
2014-11-10 11:56:20 -0800 (Mon, 10 Nov 2014)

Log Message

Move 'resize' CSS property to the new StyleBuilder
https://bugs.webkit.org/show_bug.cgi?id=138550

Reviewed by Andreas Kling.

No new tests, no behavior change.

Move 'resize' CSS property from DeprecatedStyleBuilder to the new
StyleBuilder by adding a new 'Resize' Converter function.

* css/CSSPropertyNames.in:
* css/DeprecatedStyleBuilder.cpp:
(WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
(WebCore::ApplyPropertyResize::applyValue): Deleted.
(WebCore::ApplyPropertyResize::createHandler): Deleted.
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertResize):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (175816 => 175817)


--- trunk/Source/WebCore/ChangeLog	2014-11-10 19:35:40 UTC (rev 175816)
+++ trunk/Source/WebCore/ChangeLog	2014-11-10 19:56:20 UTC (rev 175817)
@@ -1,3 +1,23 @@
+2014-11-10  Chris Dumez  <cdu...@apple.com>
+
+        Move 'resize' CSS property to the new StyleBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=138550
+
+        Reviewed by Andreas Kling.
+
+        No new tests, no behavior change.
+
+        Move 'resize' CSS property from DeprecatedStyleBuilder to the new
+        StyleBuilder by adding a new 'Resize' Converter function.
+
+        * css/CSSPropertyNames.in:
+        * css/DeprecatedStyleBuilder.cpp:
+        (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
+        (WebCore::ApplyPropertyResize::applyValue): Deleted.
+        (WebCore::ApplyPropertyResize::createHandler): Deleted.
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertResize):
+
 2014-11-10  Beth Dakin  <bda...@apple.com>
 
         Speculative build fix.

Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (175816 => 175817)


--- trunk/Source/WebCore/css/CSSPropertyNames.in	2014-11-10 19:35:40 UTC (rev 175816)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in	2014-11-10 19:56:20 UTC (rev 175817)
@@ -208,7 +208,7 @@
 pointer-events [Inherited, NewStyleBuilder]
 position [NewStyleBuilder]
 quotes [Inherited]
-resize [Inherited]
+resize [Inherited, NewStyleBuilder, Converter=Resize]
 right [NewStyleBuilder, Initial=initialOffset, Converter=LengthOrAuto]
 size [NewStyleBuilder, Custom=All]
 src

Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (175816 => 175817)


--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-11-10 19:35:40 UTC (rev 175816)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-11-10 19:56:20 UTC (rev 175817)
@@ -1386,36 +1386,6 @@
     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
 };
 
-class ApplyPropertyResize {
-public:
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (!is<CSSPrimitiveValue>(*value))
-            return;
-
-        CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);
-
-        EResize resize = RESIZE_NONE;
-        switch (primitiveValue.getValueID()) {
-        case 0:
-            return;
-        case CSSValueAuto:
-            if (Settings* settings = styleResolver->document().settings())
-                resize = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NONE;
-            break;
-        default:
-            resize = primitiveValue;
-        }
-        styleResolver->style()->setResize(resize);
-    }
-
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefaultBase<EResize, &RenderStyle::resize, EResize, &RenderStyle::setResize, EResize, &RenderStyle::initialResize>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
 class ApplyPropertyVerticalAlign {
 public:
     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
@@ -1630,7 +1600,6 @@
     setPropertyHandler(CSSPropertyOrphans, ApplyPropertyAuto<short, &RenderStyle::orphans, &RenderStyle::setOrphans, &RenderStyle::hasAutoOrphans, &RenderStyle::setHasAutoOrphans>::createHandler());
     setPropertyHandler(CSSPropertyOutlineColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::outlineColor, &RenderStyle::setOutlineColor, &RenderStyle::setVisitedLinkOutlineColor, &RenderStyle::color>::createHandler());
     setPropertyHandler(CSSPropertyOutlineStyle, ApplyPropertyOutlineStyle::createHandler());
-    setPropertyHandler(CSSPropertyResize, ApplyPropertyResize::createHandler());
     setPropertyHandler(CSSPropertyWebkitTextDecorationColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textDecorationColor, &RenderStyle::setTextDecorationColor, &RenderStyle::setVisitedLinkTextDecorationColor, &RenderStyle::color>::createHandler());
     setPropertyHandler(CSSPropertyWebkitTextDecorationSkip, ApplyPropertyTextDecorationSkip::createHandler());
     setPropertyHandler(CSSPropertyWebkitTextUnderlinePosition, ApplyPropertyTextUnderlinePosition::createHandler());

Modified: trunk/Source/WebCore/css/StyleBuilderConverter.h (175816 => 175817)


--- trunk/Source/WebCore/css/StyleBuilderConverter.h	2014-11-10 19:35:40 UTC (rev 175816)
+++ trunk/Source/WebCore/css/StyleBuilderConverter.h	2014-11-10 19:56:20 UTC (rev 175817)
@@ -32,6 +32,7 @@
 #include "CSSPrimitiveValue.h"
 #include "Length.h"
 #include "Pair.h"
+#include "Settings.h"
 #include "StyleResolver.h"
 #include "TransformFunctions.h"
 
@@ -61,6 +62,7 @@
     static TextEmphasisPosition convertTextEmphasisPosition(StyleResolver&, CSSValue&);
     static ETextAlign convertTextAlign(StyleResolver&, CSSValue&);
     static PassRefPtr<ClipPathOperation> convertClipPath(StyleResolver&, CSSValue&);
+    static EResize convertResize(StyleResolver&, CSSValue&);
 
 private:
     static Length convertToRadiusLength(CSSToLengthConversionData&, CSSPrimitiveValue&);
@@ -371,6 +373,20 @@
     return operation.release();
 }
 
+inline EResize StyleBuilderConverter::convertResize(StyleResolver& styleResolver, CSSValue& value)
+{
+    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+
+    EResize resize = RESIZE_NONE;
+    if (primitiveValue.getValueID() == CSSValueAuto) {
+        if (Settings* settings = styleResolver.document().settings())
+            resize = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NONE;
+    } else
+        resize = primitiveValue;
+
+    return resize;
+}
+
 } // namespace WebCore
 
 #endif // StyleBuilderConverter_h
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to