Title: [175458] trunk/Source/WebCore
Revision
175458
Author
[email protected]
Date
2014-11-01 22:58:02 -0700 (Sat, 01 Nov 2014)

Log Message

Move "direction" CSS property to the new StyleBuilder
https://bugs.webkit.org/show_bug.cgi?id=138288

Reviewed by Sam Weinig.

Move "direction" CSS property to the new StyleBuilder by using custom
code as it requires special handling to call
Document::setDirectionSetOnDocumentElement() when necessary.

No new tests, no behavior change.

* css/CSSPropertyNames.in:
* css/DeprecatedStyleBuilder.cpp:
(WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
(WebCore::ApplyPropertyDirection::applyValue): Deleted.
(WebCore::ApplyPropertyDirection::createHandler): Deleted.
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderFunctions::applyValueDirection):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (175457 => 175458)


--- trunk/Source/WebCore/ChangeLog	2014-11-02 04:40:18 UTC (rev 175457)
+++ trunk/Source/WebCore/ChangeLog	2014-11-02 05:58:02 UTC (rev 175458)
@@ -1,3 +1,24 @@
+2014-11-01  Chris Dumez  <[email protected]>
+
+        Move "direction" CSS property to the new StyleBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=138288
+
+        Reviewed by Sam Weinig.
+
+        Move "direction" CSS property to the new StyleBuilder by using custom
+        code as it requires special handling to call
+        Document::setDirectionSetOnDocumentElement() when necessary.
+
+        No new tests, no behavior change.
+
+        * css/CSSPropertyNames.in:
+        * css/DeprecatedStyleBuilder.cpp:
+        (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
+        (WebCore::ApplyPropertyDirection::applyValue): Deleted.
+        (WebCore::ApplyPropertyDirection::createHandler): Deleted.
+        * css/StyleBuilderCustom.h:
+        (WebCore::StyleBuilderFunctions::applyValueDirection):
+
 2014-11-01  Sam Weinig  <[email protected]>
 
         Move the -webkit-transform property to the new StyleBuilder

Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (175457 => 175458)


--- trunk/Source/WebCore/css/CSSPropertyNames.in	2014-11-02 04:40:18 UTC (rev 175457)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in	2014-11-02 05:58:02 UTC (rev 175458)
@@ -54,7 +54,7 @@
 // high-priority property names have to be listed first, to simplify the check
 // for applying them first.
 color [Inherited]
-direction [Inherited]
+direction [Inherited, NewStyleBuilder, Custom=Value]
 display
 font [Inherited]
 font-family [Inherited]

Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (175457 => 175458)


--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-11-02 04:40:18 UTC (rev 175457)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-11-02 05:58:02 UTC (rev 175458)
@@ -302,24 +302,6 @@
     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
 };
 
-template <TextDirection (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(TextDirection), TextDirection (*initialFunction)()>
-class ApplyPropertyDirection {
-public:
-    static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        ApplyPropertyDefault<TextDirection, getterFunction, TextDirection, setterFunction, TextDirection, initialFunction>::applyValue(propertyID, styleResolver, value);
-        Element* element = styleResolver->element();
-        if (element && styleResolver->element() == element->document().documentElement())
-            element->document().setDirectionSetOnDocumentElement(true);
-    }
-
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefault<TextDirection, getterFunction, TextDirection, setterFunction, TextDirection, initialFunction>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
 enum StringIdentBehavior { NothingMapsToNull = 0, MapNoneToNull, MapAutoToNull };
 template <StringIdentBehavior identBehavior, const AtomicString& (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(const AtomicString&), const AtomicString& (*initialFunction)()>
 class ApplyPropertyString {
@@ -2089,7 +2071,6 @@
     setPropertyHandler(CSSPropertyCounterIncrement, ApplyPropertyCounter<Increment>::createHandler());
     setPropertyHandler(CSSPropertyCounterReset, ApplyPropertyCounter<Reset>::createHandler());
     setPropertyHandler(CSSPropertyCursor, ApplyPropertyCursor::createHandler());
-    setPropertyHandler(CSSPropertyDirection, ApplyPropertyDirection<&RenderStyle::direction, &RenderStyle::setDirection, RenderStyle::initialDirection>::createHandler());
     setPropertyHandler(CSSPropertyDisplay, ApplyPropertyDisplay::createHandler());
     setPropertyHandler(CSSPropertyFontFamily, ApplyPropertyFontFamily::createHandler());
     setPropertyHandler(CSSPropertyFontSize, ApplyPropertyFontSize::createHandler());

Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (175457 => 175458)


--- trunk/Source/WebCore/css/StyleBuilderCustom.h	2014-11-02 04:40:18 UTC (rev 175457)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h	2014-11-02 05:58:02 UTC (rev 175458)
@@ -57,6 +57,15 @@
         styleResolver.style()->setMarqueeIncrement(marqueeLength);
 }
 
+inline void applyValueDirection(StyleResolver& styleResolver, CSSValue& value)
+{
+    styleResolver.style()->setDirection(downcast<CSSPrimitiveValue>(value));
+
+    Element* element = styleResolver.element();
+    if (element && styleResolver.element() == element->document().documentElement())
+        element->document().setDirectionSetOnDocumentElement(true);
+}
+
 } // namespace StyleBuilderFunctions
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to