Title: [175467] trunk/Source/WebCore
Revision
175467
Author
cdu...@apple.com
Date
2014-11-03 03:08:33 -0800 (Mon, 03 Nov 2014)

Log Message

Move 'zoom' CSS property to the new StyleBuilder
https://bugs.webkit.org/show_bug.cgi?id=138297

Reviewed by Antti Koivisto.

Move 'zoom' CSS property from DeprecatedStyleBuilder to the new
StyleBuilder by using custom code as it requires special handling.

No new tests, no behavior change.

* css/makeprop.pl:
Add support for Custom=All StyleBuilder option to indicate
that the property requires custom code to set the initial,
inherit and current values.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (175466 => 175467)


--- trunk/Source/WebCore/ChangeLog	2014-11-03 08:22:22 UTC (rev 175466)
+++ trunk/Source/WebCore/ChangeLog	2014-11-03 11:08:33 UTC (rev 175467)
@@ -1,3 +1,20 @@
+2014-11-03  Chris Dumez  <cdu...@apple.com>
+
+        Move 'zoom' CSS property to the new StyleBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=138297
+
+        Reviewed by Antti Koivisto.
+
+        Move 'zoom' CSS property from DeprecatedStyleBuilder to the new
+        StyleBuilder by using custom code as it requires special handling.
+
+        No new tests, no behavior change.
+
+        * css/makeprop.pl:
+        Add support for Custom=All StyleBuilder option to indicate
+        that the property requires custom code to set the initial,
+        inherit and current values.
+
 2014-11-03  Sungmann Cho  <sungmann....@navercorp.com>
 
         AX: Fix some minor typos related to the word "accessibility".

Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (175466 => 175467)


--- trunk/Source/WebCore/css/CSSPropertyNames.in	2014-11-03 08:22:22 UTC (rev 175466)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in	2014-11-03 11:08:33 UTC (rev 175467)
@@ -44,11 +44,13 @@
 // can indicate that a Converter helper function in
 // css/StyleBuilderConverter.h should be used.
 //
-// * Custom=Value:
-// This option is used to indicate that the CSS property requires special
+// * Custom=[Value|All]:
+// Custom=Value option is used to indicate that the CSS property requires special
 // handling to set its value, and a regular Converter helper cannot be
 // used. The Custom code for the property should be located in
 // css/StyleBuilderCustom.h and named applyValue[CSSPropertyName]().
+// If special handling is also needed to apply inherit or initial value, use
+// Custom=All.
 
 
 // high-priority property names have to be listed first, to simplify the check
@@ -75,7 +77,7 @@
 #endif
 -webkit-writing-mode [Inherited]
 -epub-writing-mode = -webkit-writing-mode
-zoom
+zoom [NewStyleBuilder, Custom=All]
 
 // line height needs to be right after the above high-priority properties
 line-height [Inherited]

Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (175466 => 175467)


--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-11-03 08:22:22 UTC (rev 175466)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-11-03 11:08:33 UTC (rev 175467)
@@ -1708,58 +1708,6 @@
     }
 };
 
-class ApplyPropertyZoom {
-private:
-    static void resetEffectiveZoom(StyleResolver* styleResolver)
-    {
-        // Reset the zoom in effect. This allows the setZoom method to accurately compute a new zoom in effect.
-        styleResolver->setEffectiveZoom(styleResolver->parentStyle() ? styleResolver->parentStyle()->effectiveZoom() : RenderStyle::initialZoom());
-    }
-
-public:
-    static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        resetEffectiveZoom(styleResolver);
-        styleResolver->setZoom(styleResolver->parentStyle()->zoom());
-    }
-
-    static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        resetEffectiveZoom(styleResolver);
-        styleResolver->setZoom(RenderStyle::initialZoom());
-    }
-
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);
-
-        if (primitiveValue.getValueID() == CSSValueNormal) {
-            resetEffectiveZoom(styleResolver);
-            styleResolver->setZoom(RenderStyle::initialZoom());
-        } else if (primitiveValue.getValueID() == CSSValueReset) {
-            styleResolver->setEffectiveZoom(RenderStyle::initialZoom());
-            styleResolver->setZoom(RenderStyle::initialZoom());
-        } else if (primitiveValue.getValueID() == CSSValueDocument) {
-            float docZoom = styleResolver->rootElementStyle() ? styleResolver->rootElementStyle()->zoom() : RenderStyle::initialZoom();
-            styleResolver->setEffectiveZoom(docZoom);
-            styleResolver->setZoom(docZoom);
-        } else if (primitiveValue.isPercentage()) {
-            resetEffectiveZoom(styleResolver);
-            if (float percent = primitiveValue.getFloatValue())
-                styleResolver->setZoom(percent / 100.0f);
-        } else if (primitiveValue.isNumber()) {
-            resetEffectiveZoom(styleResolver);
-            if (float number = primitiveValue.getFloatValue())
-                styleResolver->setZoom(number);
-        }
-    }
-
-    static PropertyHandler createHandler()
-    {
-        return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
-    }
-};
-
 class ApplyPropertyDisplay {
 private:
     static inline bool isValidDisplayValue(StyleResolver* styleResolver, EDisplay displayPropertyValue)
@@ -2129,7 +2077,6 @@
     setPropertyHandler(CSSPropertyWordSpacing, ApplyPropertyWordSpacing::createHandler());
 
     setPropertyHandler(CSSPropertyZIndex, ApplyPropertyAuto<int, &RenderStyle::zIndex, &RenderStyle::setZIndex, &RenderStyle::hasAutoZIndex, &RenderStyle::setHasAutoZIndex>::createHandler());
-    setPropertyHandler(CSSPropertyZoom, ApplyPropertyZoom::createHandler());
 }
 
 

Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (175466 => 175467)


--- trunk/Source/WebCore/css/StyleBuilderCustom.h	2014-11-03 08:22:22 UTC (rev 175466)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h	2014-11-03 11:08:33 UTC (rev 175467)
@@ -66,6 +66,49 @@
         element->document().setDirectionSetOnDocumentElement(true);
 }
 
+static inline void resetEffectiveZoom(StyleResolver& styleResolver)
+{
+    // Reset the zoom in effect. This allows the setZoom method to accurately compute a new zoom in effect.
+    styleResolver.setEffectiveZoom(styleResolver.parentStyle() ? styleResolver.parentStyle()->effectiveZoom() : RenderStyle::initialZoom());
+}
+
+inline void applyInitialZoom(StyleResolver& styleResolver)
+{
+    resetEffectiveZoom(styleResolver);
+    styleResolver.setZoom(RenderStyle::initialZoom());
+}
+
+inline void applyInheritZoom(StyleResolver& styleResolver)
+{
+    resetEffectiveZoom(styleResolver);
+    styleResolver.setZoom(styleResolver.parentStyle()->zoom());
+}
+
+inline void applyValueZoom(StyleResolver& styleResolver, CSSValue& value)
+{
+    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+
+    if (primitiveValue.getValueID() == CSSValueNormal) {
+        resetEffectiveZoom(styleResolver);
+        styleResolver.setZoom(RenderStyle::initialZoom());
+    } else if (primitiveValue.getValueID() == CSSValueReset) {
+        styleResolver.setEffectiveZoom(RenderStyle::initialZoom());
+        styleResolver.setZoom(RenderStyle::initialZoom());
+    } else if (primitiveValue.getValueID() == CSSValueDocument) {
+        float docZoom = styleResolver.rootElementStyle() ? styleResolver.rootElementStyle()->zoom() : RenderStyle::initialZoom();
+        styleResolver.setEffectiveZoom(docZoom);
+        styleResolver.setZoom(docZoom);
+    } else if (primitiveValue.isPercentage()) {
+        resetEffectiveZoom(styleResolver);
+        if (float percent = primitiveValue.getFloatValue())
+            styleResolver.setZoom(percent / 100.0f);
+    } else if (primitiveValue.isNumber()) {
+        resetEffectiveZoom(styleResolver);
+        if (float number = primitiveValue.getFloatValue())
+            styleResolver.setZoom(number);
+    }
+}
+
 } // namespace StyleBuilderFunctions
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/css/makeprop.pl (175466 => 175467)


--- trunk/Source/WebCore/css/makeprop.pl	2014-11-03 08:22:22 UTC (rev 175466)
+++ trunk/Source/WebCore/css/makeprop.pl	2014-11-03 11:08:33 UTC (rev 175467)
@@ -379,6 +379,8 @@
   # Skip properties not using the new style builder yet.
   next unless exists($propertiesUsingNewStyleBuilder{$name});
 
+  next if $propertiesUsingNewStyleBuilder{$name}{"Custom"} eq "All";
+
   my $setValue = "styleResolver.style()->" . $propertiesUsingNewStyleBuilder{$name}{"Setter"};
   print STYLEBUILDER "    inline void applyInitial" . $nameToId{$name} . "(StyleResolver& styleResolver)\n";
   print STYLEBUILDER "    {\n";
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to