Title: [175464] trunk/Source/WebCore
Revision
175464
Author
[email protected]
Date
2014-11-02 14:47:30 -0800 (Sun, 02 Nov 2014)

Log Message

Move string-typed properties to the new StyleBuilder
https://bugs.webkit.org/show_bug.cgi?id=138295

Reviewed by Antti Koivisto.

Move string-typed properties to the new StyleBuilder:
-webkit-hyphenate-character
-webkit-line-grid
-webkit-flow-into
-webkit-flow-from

No new tests, no behavior change.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (175463 => 175464)


--- trunk/Source/WebCore/ChangeLog	2014-11-02 18:19:33 UTC (rev 175463)
+++ trunk/Source/WebCore/ChangeLog	2014-11-02 22:47:30 UTC (rev 175464)
@@ -1,5 +1,20 @@
 2014-11-02  Chris Dumez  <[email protected]>
 
+        Move string-typed properties to the new StyleBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=138295
+
+        Reviewed by Antti Koivisto.
+
+        Move string-typed properties to the new StyleBuilder:
+        -webkit-hyphenate-character
+        -webkit-line-grid
+        -webkit-flow-into
+        -webkit-flow-from
+
+        No new tests, no behavior change.
+
+2014-11-02  Chris Dumez  <[email protected]>
+
         Unreviewed, rebaseline bindings tests after r175462.
 
         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:

Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (175463 => 175464)


--- trunk/Source/WebCore/css/CSSPropertyNames.in	2014-11-02 18:19:33 UTC (rev 175463)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in	2014-11-02 22:47:30 UTC (rev 175464)
@@ -387,7 +387,7 @@
 -webkit-grid-template-areas
 -webkit-grid-auto-flow
 #endif
--webkit-hyphenate-character [Inherited]
+-webkit-hyphenate-character [Inherited, NewStyleBuilder, NameForMethods=HyphenationString, Converter=StringOrAuto]
 -webkit-hyphenate-limit-after [Inherited, NewStyleBuilder, NameForMethods=HyphenationLimitAfter, Converter=Number<short>]
 -webkit-hyphenate-limit-before [Inherited, NewStyleBuilder, NameForMethods=HyphenationLimitBefore, Converter=Number<short>]
 -webkit-hyphenate-limit-lines [Inherited, NewStyleBuilder, NameForMethods=HyphenationLimitLines, Converter=WebkitHyphenateLimitLines]
@@ -398,7 +398,7 @@
 -webkit-line-align [Inherited, NewStyleBuilder, TypeName=LineAlign]
 -webkit-line-break [Inherited, NewStyleBuilder, TypeName=LineBreak]
 -webkit-line-clamp [NewStyleBuilder, TypeName=LineClampValue]
--webkit-line-grid [Inherited]
+-webkit-line-grid [Inherited, NewStyleBuilder, Converter=StringOrNone]
 -webkit-line-snap [Inherited, NewStyleBuilder, TypeName=LineSnap]
 -webkit-logical-width
 -webkit-logical-height
@@ -504,8 +504,8 @@
 -webkit-user-modify [Inherited, NewStyleBuilder]
 -webkit-user-select [Inherited, NewStyleBuilder]
 #if defined(ENABLE_CSS_REGIONS) && ENABLE_CSS_REGIONS
--webkit-flow-into
--webkit-flow-from
+-webkit-flow-into [NewStyleBuilder, NameForMethods=FlowThread, Converter=StringOrNone]
+-webkit-flow-from [NewStyleBuilder, NameForMethods=RegionThread, Converter=StringOrNone]
 -webkit-region-fragment [NewStyleBuilder, TypeName=RegionFragment]
 -webkit-region-break-after [NewStyleBuilder, TypeName=EPageBreak, Initial=initialPageBreak]
 -webkit-region-break-before [NewStyleBuilder, TypeName=EPageBreak, Initial=initialPageBreak]

Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (175463 => 175464)


--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-11-02 18:19:33 UTC (rev 175463)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-11-02 22:47:30 UTC (rev 175464)
@@ -302,29 +302,6 @@
     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &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 {
-public:
-    static void setValue(RenderStyle* style, const AtomicString& value) { (style->*setterFunction)(value); }
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (!is<CSSPrimitiveValue>(*value))
-            return;
-        CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);
-        if ((identBehavior == MapNoneToNull && primitiveValue.getValueID() == CSSValueNone)
-            || (identBehavior == MapAutoToNull && primitiveValue.getValueID() == CSSValueAuto))
-            setValue(styleResolver->style(), nullAtom);
-        else
-            setValue(styleResolver->style(), primitiveValue.getStringValue());
-    }
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefaultBase<const AtomicString&, getterFunction, const AtomicString&, setterFunction, const AtomicString&, initialFunction>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
 template <typename T>
 struct FillLayerAccessorTypes {
     typedef T Setter;
@@ -2115,15 +2092,9 @@
     setPropertyHandler(CSSPropertyColumnGap, ApplyPropertyAuto<float, &RenderStyle::columnGap, &RenderStyle::setColumnGap, &RenderStyle::hasNormalColumnGap, &RenderStyle::setHasNormalColumnGap, ComputeLength, CSSValueNormal>::createHandler());
     setPropertyHandler(CSSPropertyColumnRuleColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::columnRuleColor, &RenderStyle::setColumnRuleColor, &RenderStyle::setVisitedLinkColumnRuleColor, &RenderStyle::color>::createHandler());
     setPropertyHandler(CSSPropertyColumnWidth, ApplyPropertyAuto<float, &RenderStyle::columnWidth, &RenderStyle::setColumnWidth, &RenderStyle::hasAutoColumnWidth, &RenderStyle::setHasAutoColumnWidth, ComputeLength>::createHandler());
-#if ENABLE(CSS_REGIONS)
-    setPropertyHandler(CSSPropertyWebkitFlowFrom, ApplyPropertyString<MapNoneToNull, &RenderStyle::regionThread, &RenderStyle::setRegionThread, &RenderStyle::initialRegionThread>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitFlowInto, ApplyPropertyString<MapNoneToNull, &RenderStyle::flowThread, &RenderStyle::setFlowThread, &RenderStyle::initialFlowThread>::createHandler());
-#endif
     setPropertyHandler(CSSPropertyWebkitFontKerning, ApplyPropertyFont<FontDescription::Kerning, &FontDescription::kerning, &FontDescription::setKerning, FontDescription::AutoKerning>::createHandler());
     setPropertyHandler(CSSPropertyWebkitFontSmoothing, ApplyPropertyFont<FontSmoothingMode, &FontDescription::fontSmoothing, &FontDescription::setFontSmoothing, AutoSmoothing>::createHandler());
     setPropertyHandler(CSSPropertyWebkitFontVariantLigatures, ApplyPropertyFontVariantLigatures::createHandler());
-    setPropertyHandler(CSSPropertyWebkitHyphenateCharacter, ApplyPropertyString<MapAutoToNull, &RenderStyle::hyphenationString, &RenderStyle::setHyphenationString, &RenderStyle::initialHyphenationString>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitLineGrid, ApplyPropertyString<MapNoneToNull, &RenderStyle::lineGrid, &RenderStyle::setLineGrid, &RenderStyle::initialLineGrid>::createHandler());
     setPropertyHandler(CSSPropertyWebkitMarqueeRepetition, ApplyPropertyMarqueeRepetition::createHandler());
     setPropertyHandler(CSSPropertyWebkitMarqueeSpeed, ApplyPropertyMarqueeSpeed::createHandler());
     setPropertyHandler(CSSPropertyWebkitMaskBoxImageOutset, ApplyPropertyBorderImageModifier<BorderMask, Outset>::createHandler());

Modified: trunk/Source/WebCore/css/StyleBuilderConverter.h (175463 => 175464)


--- trunk/Source/WebCore/css/StyleBuilderConverter.h	2014-11-02 18:19:33 UTC (rev 175463)
+++ trunk/Source/WebCore/css/StyleBuilderConverter.h	2014-11-02 22:47:30 UTC (rev 175464)
@@ -53,6 +53,9 @@
     template <CSSPropertyID property> static NinePieceImage convertBorderMask(StyleResolver&, CSSValue&);
     template <CSSPropertyID property> static PassRefPtr<StyleImage> convertBorderImageSource(StyleResolver&, CSSValue&);
     static TransformOperations convertTransform(StyleResolver&, CSSValue&);
+    static String convertString(StyleResolver&, CSSValue&);
+    static String convertStringOrAuto(StyleResolver&, CSSValue&);
+    static String convertStringOrNone(StyleResolver&, CSSValue&);
 
 private:
     static Length convertToRadiusLength(CSSToLengthConversionData&, CSSPrimitiveValue&);
@@ -249,6 +252,25 @@
     return operations;
 }
 
+inline String StyleBuilderConverter::convertString(StyleResolver&, CSSValue& value)
+{
+    return downcast<CSSPrimitiveValue>(value).getStringValue();
+}
+
+inline String StyleBuilderConverter::convertStringOrAuto(StyleResolver& styleResolver, CSSValue& value)
+{
+    if (downcast<CSSPrimitiveValue>(value).getValueID() == CSSValueAuto)
+        return nullAtom;
+    return convertString(styleResolver, value);
+}
+
+inline String StyleBuilderConverter::convertStringOrNone(StyleResolver& styleResolver, CSSValue& value)
+{
+    if (downcast<CSSPrimitiveValue>(value).getValueID() == CSSValueNone)
+        return nullAtom;
+    return convertString(styleResolver, value);
+}
+
 } // namespace WebCore
 
 #endif // StyleBuilderConverter_h
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to