Move the -webkit-transform property to the new StyleBuilder
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 1 Nov 2014 22:18:38 +0000 (22:18 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 1 Nov 2014 22:18:38 +0000 (22:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=138283

Reviewed by Chris Dumez.

Move the -webkit-transform property from StyleResolver to the new
generated StyleBuilder. Adds a converter for TransformOperations.

* css/CSSPropertyNames.in:
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertTransform):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::applyProperty):
* css/TransformFunctions.cpp:
(WebCore::transformsForValue):
* css/TransformFunctions.h:
* css/WebKitCSSMatrix.cpp:
(WebCore::WebKitCSSMatrix::setMatrixValue):

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

Source/WebCore/ChangeLog
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/StyleBuilderConverter.h
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/TransformFunctions.cpp
Source/WebCore/css/TransformFunctions.h
Source/WebCore/css/WebKitCSSMatrix.cpp

index e64a2d4..b2c87f9 100644 (file)
@@ -1,3 +1,24 @@
+2014-11-01  Sam Weinig  <sam@webkit.org>
+
+        Move the -webkit-transform property to the new StyleBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=138283
+
+        Reviewed by Chris Dumez.
+
+        Move the -webkit-transform property from StyleResolver to the new
+        generated StyleBuilder. Adds a converter for TransformOperations.
+
+        * css/CSSPropertyNames.in:
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertTransform):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::applyProperty):
+        * css/TransformFunctions.cpp:
+        (WebCore::transformsForValue):
+        * css/TransformFunctions.h:
+        * css/WebKitCSSMatrix.cpp:
+        (WebCore::WebKitCSSMatrix::setMatrixValue):
+
 2014-11-01  Benjamin Poulain  <bpoulain@apple.com>
 
         Fix the specificity of the extended :not() selector
index 9a543ad..53c6211 100644 (file)
@@ -489,7 +489,7 @@ text-emphasis-style = -webkit-text-emphasis-style
 -webkit-text-stroke [Inherited]
 -webkit-text-stroke-color [Inherited]
 -webkit-text-stroke-width [Inherited]
--webkit-transform
+-webkit-transform [NewStyleBuilder, Converter=Transform]
 -webkit-transform-origin
 -webkit-transform-origin-x [NewStyleBuilder, Converter=Length]
 -webkit-transform-origin-y [NewStyleBuilder, Converter=Length]
index 7fbad32..3553987 100644 (file)
@@ -32,6 +32,7 @@
 #include "Length.h"
 #include "Pair.h"
 #include "StyleResolver.h"
+#include "TransformFunctions.h"
 
 namespace WebCore {
 
@@ -51,6 +52,7 @@ public:
     template <CSSPropertyID property> static NinePieceImage convertBorderImage(StyleResolver&, CSSValue&);
     template <CSSPropertyID property> static NinePieceImage convertBorderMask(StyleResolver&, CSSValue&);
     template <CSSPropertyID property> static PassRefPtr<StyleImage> convertBorderImageSource(StyleResolver&, CSSValue&);
+    static TransformOperations convertTransform(StyleResolver&, CSSValue&);
 
 private:
     static Length convertToRadiusLength(CSSToLengthConversionData&, CSSPrimitiveValue&);
@@ -240,6 +242,13 @@ inline PassRefPtr<StyleImage> StyleBuilderConverter::convertBorderImageSource(St
     return styleResolver.styleImage(property, &value);
 }
 
+inline TransformOperations StyleBuilderConverter::convertTransform(StyleResolver& styleResolver, CSSValue& value)
+{
+    TransformOperations operations;
+    transformsForValue(value, styleResolver.state().cssToLengthConversionData(), operations);
+    return operations;
+}
+
 } // namespace WebCore
 
 #endif // StyleBuilderConverter_h
index 57bed1f..163742f 100644 (file)
@@ -2553,13 +2553,6 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
         state.style()->setTextStrokeWidth(width);
         return;
     }
-    case CSSPropertyWebkitTransform: {
-        HANDLE_INHERIT_AND_INITIAL(transform, Transform);
-        TransformOperations operations;
-        transformsForValue(value, state.cssToLengthConversionData(), operations);
-        state.style()->setTransform(operations);
-        return;
-    }
     case CSSPropertyWebkitPerspective: {
         HANDLE_INHERIT_AND_INITIAL(perspective, Perspective)
 
index 668b148..4528dfc 100644 (file)
@@ -81,15 +81,15 @@ static Length convertToFloatLength(const CSSPrimitiveValue* primitiveValue, cons
     return primitiveValue ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion | CalculatedConversion>(conversionData) : Length(Undefined);
 }
 
-bool transformsForValue(CSSValue* value, const CSSToLengthConversionData& conversionData, TransformOperations& outOperations)
+bool transformsForValue(CSSValue& value, const CSSToLengthConversionData& conversionData, TransformOperations& outOperations)
 {
-    if (!value || !value->isValueList()) {
+    if (!value.isValueList()) {
         outOperations.clear();
         return false;
     }
 
     TransformOperations operations;
-    for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
+    for (CSSValueListIterator i = &value; i.hasMore(); i.advance()) {
         CSSValue& currValue = *i.value();
 
         if (!is<WebKitCSSTransformValue>(currValue))
index a3b4753..ed7f122 100644 (file)
@@ -39,7 +39,7 @@ class CSSValue;
 class RenderStyle;
 class WebKitCSSTransformValue;
 
-bool transformsForValue(CSSValue*, const CSSToLengthConversionData&, TransformOperations&);
+bool transformsForValue(CSSValue&, const CSSToLengthConversionData&, TransformOperations&);
 
 }
 #endif
index c6d5999..2f7e271 100644 (file)
@@ -67,7 +67,7 @@ void WebKitCSSMatrix::setMatrixValue(const String& string, ExceptionCode& ec)
             return;
 
         TransformOperations operations;
-        if (!transformsForValue(value.get(), CSSToLengthConversionData(), operations)) {
+        if (!transformsForValue(*value, CSSToLengthConversionData(), operations)) {
             ec = SYNTAX_ERR;
             return;
         }