Title: [176861] trunk/Source/WebCore
Revision
176861
Author
[email protected]
Date
2014-12-05 12:27:37 -0800 (Fri, 05 Dec 2014)

Log Message

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

Reviewed by Sam Weinig.

Move 'text-emphasis-style' CSS property to the new StyleBuilder by
using custom code.

No new tests, no behavior change.

* css/CSSPropertyNames.in:
* css/DeprecatedStyleBuilder.cpp:
(WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
(WebCore::ApplyPropertyTextEmphasisStyle::applyInheritValue): Deleted.
(WebCore::ApplyPropertyTextEmphasisStyle::applyInitialValue): Deleted.
(WebCore::ApplyPropertyTextEmphasisStyle::applyValue): Deleted.
(WebCore::ApplyPropertyTextEmphasisStyle::createHandler): Deleted.
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyInitialWebkitTextEmphasisStyle):
(WebCore::StyleBuilderCustom::applyInheritWebkitTextEmphasisStyle):
(WebCore::StyleBuilderCustom::applyValueWebkitTextEmphasisStyle):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (176860 => 176861)


--- trunk/Source/WebCore/ChangeLog	2014-12-05 19:47:09 UTC (rev 176860)
+++ trunk/Source/WebCore/ChangeLog	2014-12-05 20:27:37 UTC (rev 176861)
@@ -1,3 +1,27 @@
+2014-12-05  Chris Dumez  <[email protected]>
+
+        Move 'text-emphasis-style' CSS property to the new StyleBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=139285
+
+        Reviewed by Sam Weinig.
+
+        Move 'text-emphasis-style' CSS property to the new StyleBuilder by
+        using custom code.
+
+        No new tests, no behavior change.
+
+        * css/CSSPropertyNames.in:
+        * css/DeprecatedStyleBuilder.cpp:
+        (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
+        (WebCore::ApplyPropertyTextEmphasisStyle::applyInheritValue): Deleted.
+        (WebCore::ApplyPropertyTextEmphasisStyle::applyInitialValue): Deleted.
+        (WebCore::ApplyPropertyTextEmphasisStyle::applyValue): Deleted.
+        (WebCore::ApplyPropertyTextEmphasisStyle::createHandler): Deleted.
+        * css/StyleBuilderCustom.h:
+        (WebCore::StyleBuilderCustom::applyInitialWebkitTextEmphasisStyle):
+        (WebCore::StyleBuilderCustom::applyInheritWebkitTextEmphasisStyle):
+        (WebCore::StyleBuilderCustom::applyValueWebkitTextEmphasisStyle):
+
 2014-12-05  Eric Carlson  <[email protected]>
 
         [iOS] remove "enter optimized fullscreen" gesture

Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (176860 => 176861)


--- trunk/Source/WebCore/css/CSSPropertyNames.in	2014-12-05 19:47:09 UTC (rev 176860)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in	2014-12-05 20:27:37 UTC (rev 176861)
@@ -505,7 +505,7 @@
 text-emphasis-color = -webkit-text-emphasis-color
 -webkit-text-emphasis-position [Inherited, Converter=TextEmphasisPosition]
 text-emphasis-position = -webkit-text-emphasis-position
--webkit-text-emphasis-style [Inherited, LegacyStyleBuilder]
+-webkit-text-emphasis-style [Inherited, Custom=All]
 -epub-text-emphasis-style = -webkit-text-emphasis-style
 text-emphasis-style = -webkit-text-emphasis-style
 -webkit-text-fill-color [Inherited, LegacyStyleBuilder]

Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (176860 => 176861)


--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-12-05 19:47:09 UTC (rev 176860)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-12-05 20:27:37 UTC (rev 176861)
@@ -780,69 +780,6 @@
     }
 };
 
-class ApplyPropertyTextEmphasisStyle {
-public:
-    static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        styleResolver->style()->setTextEmphasisFill(styleResolver->parentStyle()->textEmphasisFill());
-        styleResolver->style()->setTextEmphasisMark(styleResolver->parentStyle()->textEmphasisMark());
-        styleResolver->style()->setTextEmphasisCustomMark(styleResolver->parentStyle()->textEmphasisCustomMark());
-    }
-
-    static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        styleResolver->style()->setTextEmphasisFill(RenderStyle::initialTextEmphasisFill());
-        styleResolver->style()->setTextEmphasisMark(RenderStyle::initialTextEmphasisMark());
-        styleResolver->style()->setTextEmphasisCustomMark(RenderStyle::initialTextEmphasisCustomMark());
-    }
-
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (is<CSSValueList>(*value)) {
-            CSSValueList& list = downcast<CSSValueList>(*value);
-            ASSERT(list.length() == 2);
-            if (list.length() != 2)
-                return;
-            for (unsigned i = 0; i < 2; ++i) {
-                CSSValue* item = list.itemWithoutBoundsCheck(i);
-                if (!is<CSSPrimitiveValue>(*item))
-                    continue;
-
-                CSSPrimitiveValue& value = downcast<CSSPrimitiveValue>(*item);
-                if (value.getValueID() == CSSValueFilled || value.getValueID() == CSSValueOpen)
-                    styleResolver->style()->setTextEmphasisFill(value);
-                else
-                    styleResolver->style()->setTextEmphasisMark(value);
-            }
-            styleResolver->style()->setTextEmphasisCustomMark(nullAtom);
-            return;
-        }
-
-        if (!is<CSSPrimitiveValue>(*value))
-            return;
-        CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);
-
-        if (primitiveValue.isString()) {
-            styleResolver->style()->setTextEmphasisFill(TextEmphasisFillFilled);
-            styleResolver->style()->setTextEmphasisMark(TextEmphasisMarkCustom);
-            styleResolver->style()->setTextEmphasisCustomMark(primitiveValue.getStringValue());
-            return;
-        }
-
-        styleResolver->style()->setTextEmphasisCustomMark(nullAtom);
-
-        if (primitiveValue.getValueID() == CSSValueFilled || primitiveValue.getValueID() == CSSValueOpen) {
-            styleResolver->style()->setTextEmphasisFill(primitiveValue);
-            styleResolver->style()->setTextEmphasisMark(TextEmphasisMarkAuto);
-        } else {
-            styleResolver->style()->setTextEmphasisFill(TextEmphasisFillFilled);
-            styleResolver->style()->setTextEmphasisMark(primitiveValue);
-        }
-    }
-
-    static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
-};
-
 template <typename T,
           T (Animation::*getterFunction)() const,
           void (Animation::*setterFunction)(T),
@@ -1001,7 +938,6 @@
     setPropertyHandler(CSSPropertyWebkitMaskSourceType, ApplyPropertyFillLayer<EMaskSourceType, CSSPropertyWebkitMaskSourceType, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isMaskSourceTypeSet, &FillLayer::maskSourceType, &FillLayer::setMaskSourceType, &FillLayer::clearMaskSourceType, &FillLayer::initialMaskSourceType, &CSSToStyleMap::mapFillMaskSourceType>::createHandler());
     setPropertyHandler(CSSPropertyWebkitPerspectiveOrigin, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitPerspectiveOriginX, CSSPropertyWebkitPerspectiveOriginY>::createHandler());
     setPropertyHandler(CSSPropertyWebkitTextEmphasisColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textEmphasisColor, &RenderStyle::setTextEmphasisColor, &RenderStyle::setVisitedLinkTextEmphasisColor, &RenderStyle::color>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitTextEmphasisStyle, ApplyPropertyTextEmphasisStyle::createHandler());
     setPropertyHandler(CSSPropertyWebkitTextFillColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textFillColor, &RenderStyle::setTextFillColor, &RenderStyle::setVisitedLinkTextFillColor, &RenderStyle::color>::createHandler());
     setPropertyHandler(CSSPropertyWebkitTextStrokeColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textStrokeColor, &RenderStyle::setTextStrokeColor, &RenderStyle::setVisitedLinkTextStrokeColor, &RenderStyle::color>::createHandler());
     setPropertyHandler(CSSPropertyWebkitTransitionDelay, ApplyPropertyAnimation<double, &Animation::delay, &Animation::setDelay, &Animation::isDelaySet, &Animation::clearDelay, &Animation::initialAnimationDelay, &CSSToStyleMap::mapAnimationDelay, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());

Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (176860 => 176861)


--- trunk/Source/WebCore/css/StyleBuilderCustom.h	2014-12-05 19:47:09 UTC (rev 176860)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h	2014-12-05 20:27:37 UTC (rev 176861)
@@ -130,6 +130,10 @@
     static void applyInheritWebkitAspectRatio(StyleResolver&);
     static void applyValueWebkitAspectRatio(StyleResolver&, CSSValue&);
 
+    static void applyInitialWebkitTextEmphasisStyle(StyleResolver&);
+    static void applyInheritWebkitTextEmphasisStyle(StyleResolver&);
+    static void applyValueWebkitTextEmphasisStyle(StyleResolver&, CSSValue&);
+
 private:
     static void resetEffectiveZoom(StyleResolver&);
     static CSSToLengthConversionData csstoLengthConversionDataWithTextZoomFactor(StyleResolver&);
@@ -1046,6 +1050,56 @@
     styleResolver.style()->setAspectRatioNumerator(aspectRatioValue.numeratorValue());
 }
 
+inline void StyleBuilderCustom::applyInitialWebkitTextEmphasisStyle(StyleResolver& styleResolver)
+{
+    styleResolver.style()->setTextEmphasisFill(RenderStyle::initialTextEmphasisFill());
+    styleResolver.style()->setTextEmphasisMark(RenderStyle::initialTextEmphasisMark());
+    styleResolver.style()->setTextEmphasisCustomMark(RenderStyle::initialTextEmphasisCustomMark());
+}
+
+inline void StyleBuilderCustom::applyInheritWebkitTextEmphasisStyle(StyleResolver& styleResolver)
+{
+    styleResolver.style()->setTextEmphasisFill(styleResolver.parentStyle()->textEmphasisFill());
+    styleResolver.style()->setTextEmphasisMark(styleResolver.parentStyle()->textEmphasisMark());
+    styleResolver.style()->setTextEmphasisCustomMark(styleResolver.parentStyle()->textEmphasisCustomMark());
+}
+
+inline void StyleBuilderCustom::applyValueWebkitTextEmphasisStyle(StyleResolver& styleResolver, CSSValue& value)
+{
+    if (is<CSSValueList>(value)) {
+        auto& list = downcast<CSSValueList>(value);
+        ASSERT(list.length() == 2);
+
+        for (auto& item : list) {
+            CSSPrimitiveValue& value = downcast<CSSPrimitiveValue>(item.get());
+            if (value.getValueID() == CSSValueFilled || value.getValueID() == CSSValueOpen)
+                styleResolver.style()->setTextEmphasisFill(value);
+            else
+                styleResolver.style()->setTextEmphasisMark(value);
+        }
+        styleResolver.style()->setTextEmphasisCustomMark(nullAtom);
+        return;
+    }
+
+    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+    if (primitiveValue.isString()) {
+        styleResolver.style()->setTextEmphasisFill(TextEmphasisFillFilled);
+        styleResolver.style()->setTextEmphasisMark(TextEmphasisMarkCustom);
+        styleResolver.style()->setTextEmphasisCustomMark(primitiveValue.getStringValue());
+        return;
+    }
+
+    styleResolver.style()->setTextEmphasisCustomMark(nullAtom);
+
+    if (primitiveValue.getValueID() == CSSValueFilled || primitiveValue.getValueID() == CSSValueOpen) {
+        styleResolver.style()->setTextEmphasisFill(primitiveValue);
+        styleResolver.style()->setTextEmphasisMark(TextEmphasisMarkAuto);
+    } else {
+        styleResolver.style()->setTextEmphasisFill(TextEmphasisFillFilled);
+        styleResolver.style()->setTextEmphasisMark(primitiveValue);
+    }
+}
+
 } // namespace WebCore
 
 #endif // StyleBuilderCustom_h
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to