Move '-webkit-text-decoration-skip' to the new StyleBuilder
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Dec 2014 17:59:42 +0000 (17:59 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Dec 2014 17:59:42 +0000 (17:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=139633

Reviewed by Darin Adler.

Move '-webkit-text-decoration-skip' to the new StyleBuilder by
introducing a new TextDecorationSkip converter.

No new tests, no behavior change.

* css/CSSPropertyNames.in:
* css/DeprecatedStyleBuilder.cpp:
(WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
(WebCore::valueToDecorationSkip): Deleted.
(WebCore::ApplyPropertyTextDecorationSkip::applyValue): Deleted.
(WebCore::ApplyPropertyTextDecorationSkip::createHandler): Deleted.
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::valueToDecorationSkip):
(WebCore::StyleBuilderConverter::convertTextDecorationSkip):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@177282 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/DeprecatedStyleBuilder.cpp
Source/WebCore/css/StyleBuilderConverter.h

index 21f5242..1d199ac 100644 (file)
@@ -1,3 +1,25 @@
+2014-12-15  Chris Dumez  <cdumez@apple.com>
+
+        Move '-webkit-text-decoration-skip' to the new StyleBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=139633
+
+        Reviewed by Darin Adler.
+
+        Move '-webkit-text-decoration-skip' to the new StyleBuilder by
+        introducing a new TextDecorationSkip converter.
+
+        No new tests, no behavior change.
+
+        * css/CSSPropertyNames.in:
+        * css/DeprecatedStyleBuilder.cpp:
+        (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
+        (WebCore::valueToDecorationSkip): Deleted.
+        (WebCore::ApplyPropertyTextDecorationSkip::applyValue): Deleted.
+        (WebCore::ApplyPropertyTextDecorationSkip::createHandler): Deleted.
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::valueToDecorationSkip):
+        (WebCore::StyleBuilderConverter::convertTextDecorationSkip):
+
 2014-12-15  Bartlomiej Gajda  <b.gajda@samsung.com>
 
         [MSE] Prevent SourceBuffer monitoring algorithm from triggering a HAVE_NOTHING to HAVE_METADATA transition.
index 93de536..53a093e 100644 (file)
@@ -494,7 +494,7 @@ order [TypeName=int]
 -webkit-text-decoration-line [NameForMethods=TextDecoration, Converter=TextDecoration]
 -webkit-text-decoration-style [TypeName=TextDecorationStyle]
 -webkit-text-decoration-color [LegacyStyleBuilder]
--webkit-text-decoration-skip [Inherited, LegacyStyleBuilder]
+-webkit-text-decoration-skip [Inherited, Converter=TextDecorationSkip]
 -webkit-text-underline-position [Inherited, Converter=TextUnderlinePosition]
 -webkit-text-decorations-in-effect [Inherited, LegacyStyleBuilder]
 -webkit-text-emphasis [Inherited, LegacyStyleBuilder]
index f181bb0..e0cb956 100644 (file)
@@ -670,50 +670,6 @@ public:
     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
 };
 
-static TextDecorationSkip valueToDecorationSkip(CSSPrimitiveValue& primitiveValue)
-{
-    ASSERT(primitiveValue.isValueID());
-
-    switch (primitiveValue.getValueID()) {
-    case CSSValueAuto:
-        return TextDecorationSkipAuto;
-    case CSSValueNone:
-        return TextDecorationSkipNone;
-    case CSSValueInk:
-        return TextDecorationSkipInk;
-    case CSSValueObjects:
-        return TextDecorationSkipObjects;
-    default:
-        break;
-    }
-
-    ASSERT_NOT_REACHED();
-    return TextDecorationSkipNone;
-}
-
-class ApplyPropertyTextDecorationSkip {
-public:
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (is<CSSPrimitiveValue>(*value)) {
-            styleResolver->style()->setTextDecorationSkip(valueToDecorationSkip(downcast<CSSPrimitiveValue>(*value)));
-            return;
-        }
-
-        TextDecorationSkip skip = RenderStyle::initialTextDecorationSkip();
-        if (is<CSSValueList>(*value)) {
-            for (auto& currentValue : downcast<CSSValueList>(*value))
-                skip |= valueToDecorationSkip(downcast<CSSPrimitiveValue>(currentValue.get()));
-        }
-        styleResolver->style()->setTextDecorationSkip(skip);
-    }
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefaultBase<TextDecorationSkip, &RenderStyle::textDecorationSkip, TextDecorationSkip, &RenderStyle::setTextDecorationSkip, TextDecorationSkip, &RenderStyle::initialTextDecorationSkip>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
 template <typename T,
           T (Animation::*getterFunction)() const,
           void (Animation::*setterFunction)(T),
@@ -827,7 +783,6 @@ DeprecatedStyleBuilder::DeprecatedStyleBuilder()
     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(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());
 
     setPropertyHandler(CSSPropertyAnimationDelay, ApplyPropertyAnimation<double, &Animation::delay, &Animation::setDelay, &Animation::isDelaySet, &Animation::clearDelay, &Animation::initialAnimationDelay, &CSSToStyleMap::mapAnimationDelay, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
index fbf8bec..c7adb55 100644 (file)
@@ -73,10 +73,12 @@ public:
     static IntSize convertInitialLetter(StyleResolver&, CSSValue&);
     static float convertTextStrokeWidth(StyleResolver&, CSSValue&);
     static LineBoxContain convertLineBoxContain(StyleResolver&, CSSValue&);
+    static TextDecorationSkip convertTextDecorationSkip(StyleResolver&, CSSValue&);
 
 private:
     static Length convertToRadiusLength(CSSToLengthConversionData&, CSSPrimitiveValue&);
     static TextEmphasisPosition valueToEmphasisPosition(CSSPrimitiveValue&);
+    static TextDecorationSkip valueToDecorationSkip(const CSSPrimitiveValue&);
 };
 
 inline Length StyleBuilderConverter::convertLength(StyleResolver& styleResolver, CSSValue& value)
@@ -552,6 +554,38 @@ inline LineBoxContain StyleBuilderConverter::convertLineBoxContain(StyleResolver
     return downcast<CSSLineBoxContainValue>(value).value();
 }
 
+inline TextDecorationSkip StyleBuilderConverter::valueToDecorationSkip(const CSSPrimitiveValue& primitiveValue)
+{
+    ASSERT(primitiveValue.isValueID());
+
+    switch (primitiveValue.getValueID()) {
+    case CSSValueAuto:
+        return TextDecorationSkipAuto;
+    case CSSValueNone:
+        return TextDecorationSkipNone;
+    case CSSValueInk:
+        return TextDecorationSkipInk;
+    case CSSValueObjects:
+        return TextDecorationSkipObjects;
+    default:
+        break;
+    }
+
+    ASSERT_NOT_REACHED();
+    return TextDecorationSkipNone;
+}
+
+inline TextDecorationSkip StyleBuilderConverter::convertTextDecorationSkip(StyleResolver&, CSSValue& value)
+{
+    if (is<CSSPrimitiveValue>(value))
+        return valueToDecorationSkip(downcast<CSSPrimitiveValue>(value));
+
+    TextDecorationSkip skip = RenderStyle::initialTextDecorationSkip();
+    for (auto& currentValue : downcast<CSSValueList>(value))
+        skip |= valueToDecorationSkip(downcast<CSSPrimitiveValue>(currentValue.get()));
+    return skip;
+}
+
 
 } // namespace WebCore