Title: [176359] trunk/Source/WebCore
Revision
176359
Author
[email protected]
Date
2014-11-19 15:53:11 -0800 (Wed, 19 Nov 2014)

Log Message

Move 'outline-style' CSS property to the new StyleBuilder
https://bugs.webkit.org/show_bug.cgi?id=138882

Reviewed by Sam Weinig.

Move 'outline-style' CSS property from DeprecatedStyleBuilder to the
new StyleBuilder by using custom code.

No new tests, no behavior change.

* css/CSSPropertyNames.in:
* css/DeprecatedStyleBuilder.cpp:
(WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
(WebCore::ApplyPropertyDefault::setValue): Deleted.
(WebCore::ApplyPropertyDefault::applyValue): Deleted.
(WebCore::ApplyPropertyDefault::createHandler): Deleted.
(WebCore::ApplyPropertyOutlineStyle::applyInheritValue): Deleted.
(WebCore::ApplyPropertyOutlineStyle::applyInitialValue): Deleted.
(WebCore::ApplyPropertyOutlineStyle::applyValue): Deleted.
(WebCore::ApplyPropertyOutlineStyle::createHandler): Deleted.
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderFunctions::applyInheritOutlineStyle):
(WebCore::StyleBuilderFunctions::applyInitialOutlineStyle):
(WebCore::StyleBuilderFunctions::applyValueOutlineStyle):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (176358 => 176359)


--- trunk/Source/WebCore/ChangeLog	2014-11-19 23:49:40 UTC (rev 176358)
+++ trunk/Source/WebCore/ChangeLog	2014-11-19 23:53:11 UTC (rev 176359)
@@ -1,3 +1,30 @@
+2014-11-19  Chris Dumez  <[email protected]>
+
+        Move 'outline-style' CSS property to the new StyleBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=138882
+
+        Reviewed by Sam Weinig.
+
+        Move 'outline-style' CSS property from DeprecatedStyleBuilder to the
+        new StyleBuilder by using custom code.
+
+        No new tests, no behavior change.
+
+        * css/CSSPropertyNames.in:
+        * css/DeprecatedStyleBuilder.cpp:
+        (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
+        (WebCore::ApplyPropertyDefault::setValue): Deleted.
+        (WebCore::ApplyPropertyDefault::applyValue): Deleted.
+        (WebCore::ApplyPropertyDefault::createHandler): Deleted.
+        (WebCore::ApplyPropertyOutlineStyle::applyInheritValue): Deleted.
+        (WebCore::ApplyPropertyOutlineStyle::applyInitialValue): Deleted.
+        (WebCore::ApplyPropertyOutlineStyle::applyValue): Deleted.
+        (WebCore::ApplyPropertyOutlineStyle::createHandler): Deleted.
+        * css/StyleBuilderCustom.h:
+        (WebCore::StyleBuilderFunctions::applyInheritOutlineStyle):
+        (WebCore::StyleBuilderFunctions::applyInitialOutlineStyle):
+        (WebCore::StyleBuilderFunctions::applyValueOutlineStyle):
+
 2014-11-19  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: JSContext inspection Resource search does not work

Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (176358 => 176359)


--- trunk/Source/WebCore/css/CSSPropertyNames.in	2014-11-19 23:49:40 UTC (rev 176358)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in	2014-11-19 23:53:11 UTC (rev 176359)
@@ -202,7 +202,7 @@
 outline
 outline-color
 outline-offset [NewStyleBuilder, Converter=ComputedLength<int>]
-outline-style
+outline-style [NewStyleBuilder, Custom=All]
 outline-width [NewStyleBuilder, Converter=LineWidth<unsigned short>]
 overflow
 overflow-wrap [NewStyleBuilder]

Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (176358 => 176359)


--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-11-19 23:49:40 UTC (rev 176358)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-11-19 23:53:11 UTC (rev 176359)
@@ -145,22 +145,6 @@
     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
 };
 
-template <typename GetterType, GetterType (RenderStyle::*getterFunction)() const, typename SetterType, void (RenderStyle::*setterFunction)(SetterType), typename InitialType, InitialType (*initialFunction)()>
-class ApplyPropertyDefault {
-public:
-    static void setValue(RenderStyle* style, SetterType value) { (style->*setterFunction)(value); }
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (is<CSSPrimitiveValue>(*value))
-            setValue(styleResolver->style(), downcast<CSSPrimitiveValue>(*value));
-    }
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefaultBase<GetterType, getterFunction, SetterType, setterFunction, InitialType, initialFunction>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
 template <StyleImage* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<StyleImage>), StyleImage* (*initialFunction)(), CSSPropertyID property>
 class ApplyPropertyStyleImage {
 public:
@@ -1087,29 +1071,6 @@
     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
 };
 
-class ApplyPropertyOutlineStyle {
-public:
-    static void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
-    {
-        ApplyPropertyDefaultBase<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyInheritValue(propertyID, styleResolver);
-        ApplyPropertyDefaultBase<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyInheritValue(propertyID, styleResolver);
-    }
-
-    static void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
-    {
-        ApplyPropertyDefaultBase<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyInitialValue(propertyID, styleResolver);
-        ApplyPropertyDefaultBase<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyInitialValue(propertyID, styleResolver);
-    }
-
-    static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        ApplyPropertyDefault<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyValue(propertyID, styleResolver, value);
-        ApplyPropertyDefault<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyValue(propertyID, styleResolver, value);
-    }
-
-    static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
-};
-
 class ApplyPropertyAspectRatio {
 public:
     static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
@@ -1240,7 +1201,6 @@
     setPropertyHandler(CSSPropertyListStyleImage, ApplyPropertyStyleImage<&RenderStyle::listStyleImage, &RenderStyle::setListStyleImage, &RenderStyle::initialListStyleImage, CSSPropertyListStyleImage>::createHandler());
     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(CSSPropertyWebkitTextDecorationColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textDecorationColor, &RenderStyle::setTextDecorationColor, &RenderStyle::setVisitedLinkTextDecorationColor, &RenderStyle::color>::createHandler());
     setPropertyHandler(CSSPropertyWebkitTextDecorationSkip, ApplyPropertyTextDecorationSkip::createHandler());
     setPropertyHandler(CSSPropertyTextRendering, ApplyPropertyFont<TextRenderingMode, &FontDescription::textRenderingMode, &FontDescription::setTextRenderingMode, AutoTextRendering>::createHandler());

Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (176358 => 176359)


--- trunk/Source/WebCore/css/StyleBuilderCustom.h	2014-11-19 23:49:40 UTC (rev 176358)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h	2014-11-19 23:53:11 UTC (rev 176359)
@@ -590,6 +590,26 @@
 
 #endif
 
+inline void applyInheritOutlineStyle(StyleResolver& styleResolver)
+{
+    styleResolver.style()->setOutlineStyleIsAuto(styleResolver.parentStyle()->outlineStyleIsAuto());
+    styleResolver.style()->setOutlineStyle(styleResolver.parentStyle()->outlineStyle());
+}
+
+inline void applyInitialOutlineStyle(StyleResolver& styleResolver)
+{
+    styleResolver.style()->setOutlineStyleIsAuto(RenderStyle::initialOutlineStyleIsAuto());
+    styleResolver.style()->setOutlineStyle(RenderStyle::initialBorderStyle());
+}
+
+inline void applyValueOutlineStyle(StyleResolver& styleResolver, CSSValue& value)
+{
+    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+
+    styleResolver.style()->setOutlineStyleIsAuto(primitiveValue);
+    styleResolver.style()->setOutlineStyle(primitiveValue);
+}
+
 } // namespace StyleBuilderFunctions
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to