BasicShapeFunctions should use RenderStyle instead of StyleResolver
authorkrit@webkit.org <krit@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Apr 2013 23:29:02 +0000 (23:29 +0000)
committerkrit@webkit.org <krit@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Apr 2013 23:29:02 +0000 (23:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=114743

Reviewed by Antti Koivisto.

BasicShapeFunctions does include RenderStyle instead of StyleResolver now.
This is a simple refactoring patch, no new tests.

* css/BasicShapeFunctions.cpp:
(WebCore::convertToLength): Use style and rootElementStyle directly.
(WebCore::basicShapeForValue): Ditto.
* css/BasicShapeFunctions.h:
(WebCore):
* css/DeprecatedStyleBuilder.cpp:
(WebCore::ApplyPropertyClipPath::applyValue):
(WebCore::ApplyPropertyExclusionShape::applyValue):

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

Source/WebCore/ChangeLog
Source/WebCore/css/BasicShapeFunctions.cpp
Source/WebCore/css/BasicShapeFunctions.h
Source/WebCore/css/DeprecatedStyleBuilder.cpp

index 6461a7d..83279be 100644 (file)
@@ -1,3 +1,22 @@
+2013-04-17  Dirk Schulze  <krit@webkit.org>
+
+        BasicShapeFunctions should use RenderStyle instead of StyleResolver
+        https://bugs.webkit.org/show_bug.cgi?id=114743
+
+        Reviewed by Antti Koivisto.
+
+        BasicShapeFunctions does include RenderStyle instead of StyleResolver now.
+        This is a simple refactoring patch, no new tests.
+
+        * css/BasicShapeFunctions.cpp:
+        (WebCore::convertToLength): Use style and rootElementStyle directly.
+        (WebCore::basicShapeForValue): Ditto.
+        * css/BasicShapeFunctions.h:
+        (WebCore):
+        * css/DeprecatedStyleBuilder.cpp:
+        (WebCore::ApplyPropertyClipPath::applyValue):
+        (WebCore::ApplyPropertyExclusionShape::applyValue):
+
 2013-04-17  Beth Dakin  <bdakin@apple.com>
 
         Content inside frames and scrollbars in overflow areas hit-tests incorrectly when 
index 3a8f795..9e9a0fc 100644 (file)
@@ -34,7 +34,7 @@
 #include "CSSBasicShapes.h"
 #include "CSSPrimitiveValueMappings.h"
 #include "CSSValuePool.h"
-#include "StyleResolver.h"
+#include "RenderStyle.h"
 
 namespace WebCore {
 
@@ -100,12 +100,12 @@ PassRefPtr<CSSValue> valueForBasicShape(const BasicShape* basicShape)
     return cssValuePool().createValue<PassRefPtr<CSSBasicShape> >(basicShapeValue.release());
 }
 
-static Length convertToLength(const StyleResolver* styleResolver, CSSPrimitiveValue* value)
+static Length convertToLength(const RenderStyle* style, const RenderStyle* rootStyle, CSSPrimitiveValue* value)
 {
-    return value->convertToLength<FixedIntegerConversion | FixedFloatConversion | PercentConversion | ViewportPercentageConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
+    return value->convertToLength<FixedIntegerConversion | FixedFloatConversion | PercentConversion | ViewportPercentageConversion>(style, rootStyle, style->effectiveZoom());
 }
 
-PassRefPtr<BasicShape> basicShapeForValue(const StyleResolver* styleResolver, const CSSBasicShape* basicShapeValue)
+PassRefPtr<BasicShape> basicShapeForValue(const RenderStyle* style, const RenderStyle* rootStyle, const CSSBasicShape* basicShapeValue)
 {
     RefPtr<BasicShape> basicShape;
 
@@ -114,14 +114,14 @@ PassRefPtr<BasicShape> basicShapeForValue(const StyleResolver* styleResolver, co
         const CSSBasicShapeRectangle* rectValue = static_cast<const CSSBasicShapeRectangle *>(basicShapeValue);
         RefPtr<BasicShapeRectangle> rect = BasicShapeRectangle::create();
 
-        rect->setX(convertToLength(styleResolver, rectValue->x()));
-        rect->setY(convertToLength(styleResolver, rectValue->y()));
-        rect->setWidth(convertToLength(styleResolver, rectValue->width()));
-        rect->setHeight(convertToLength(styleResolver, rectValue->height()));
+        rect->setX(convertToLength(style, rootStyle, rectValue->x()));
+        rect->setY(convertToLength(style, rootStyle, rectValue->y()));
+        rect->setWidth(convertToLength(style, rootStyle, rectValue->width()));
+        rect->setHeight(convertToLength(style, rootStyle, rectValue->height()));
         if (rectValue->radiusX()) {
-            rect->setCornerRadiusX(convertToLength(styleResolver, rectValue->radiusX()));
+            rect->setCornerRadiusX(convertToLength(style, rootStyle, rectValue->radiusX()));
             if (rectValue->radiusY())
-                rect->setCornerRadiusY(convertToLength(styleResolver, rectValue->radiusY()));
+                rect->setCornerRadiusY(convertToLength(style, rootStyle, rectValue->radiusY()));
         }
         basicShape = rect.release();
         break;
@@ -130,9 +130,9 @@ PassRefPtr<BasicShape> basicShapeForValue(const StyleResolver* styleResolver, co
         const CSSBasicShapeCircle* circleValue = static_cast<const CSSBasicShapeCircle *>(basicShapeValue);
         RefPtr<BasicShapeCircle> circle = BasicShapeCircle::create();
 
-        circle->setCenterX(convertToLength(styleResolver, circleValue->centerX()));
-        circle->setCenterY(convertToLength(styleResolver, circleValue->centerY()));
-        circle->setRadius(convertToLength(styleResolver, circleValue->radius()));
+        circle->setCenterX(convertToLength(style, rootStyle, circleValue->centerX()));
+        circle->setCenterY(convertToLength(style, rootStyle, circleValue->centerY()));
+        circle->setRadius(convertToLength(style, rootStyle, circleValue->radius()));
 
         basicShape = circle.release();
         break;
@@ -141,10 +141,10 @@ PassRefPtr<BasicShape> basicShapeForValue(const StyleResolver* styleResolver, co
         const CSSBasicShapeEllipse* ellipseValue = static_cast<const CSSBasicShapeEllipse *>(basicShapeValue);
         RefPtr<BasicShapeEllipse> ellipse = BasicShapeEllipse::create();
 
-        ellipse->setCenterX(convertToLength(styleResolver, ellipseValue->centerX()));
-        ellipse->setCenterY(convertToLength(styleResolver, ellipseValue->centerY()));
-        ellipse->setRadiusX(convertToLength(styleResolver, ellipseValue->radiusX()));
-        ellipse->setRadiusY(convertToLength(styleResolver, ellipseValue->radiusY()));
+        ellipse->setCenterX(convertToLength(style, rootStyle, ellipseValue->centerX()));
+        ellipse->setCenterY(convertToLength(style, rootStyle, ellipseValue->centerY()));
+        ellipse->setRadiusX(convertToLength(style, rootStyle, ellipseValue->radiusX()));
+        ellipse->setRadiusY(convertToLength(style, rootStyle, ellipseValue->radiusY()));
 
         basicShape = ellipse.release();
         break;
@@ -156,7 +156,7 @@ PassRefPtr<BasicShape> basicShapeForValue(const StyleResolver* styleResolver, co
         polygon->setWindRule(polygonValue->windRule());
         const Vector<RefPtr<CSSPrimitiveValue> >& values = polygonValue->values();
         for (unsigned i = 0; i < values.size(); i += 2)
-            polygon->appendPoint(convertToLength(styleResolver, values.at(i).get()), convertToLength(styleResolver, values.at(i + 1).get()));
+            polygon->appendPoint(convertToLength(style, rootStyle, values.at(i).get()), convertToLength(style, rootStyle, values.at(i + 1).get()));
 
         basicShape = polygon.release();
         break;
index d3607e9..9bbc7c7 100644 (file)
@@ -37,10 +37,10 @@ namespace WebCore {
 class BasicShape;
 class CSSBasicShape;
 class CSSValue;
-class StyleResolver;
+class RenderStyle;
 
 PassRefPtr<CSSValue> valueForBasicShape(const BasicShape*);
-PassRefPtr<BasicShape> basicShapeForValue(const StyleResolver*, const CSSBasicShape*);
+PassRefPtr<BasicShape> basicShapeForValue(const RenderStyle*, const RenderStyle* rootStyle, const CSSBasicShape*);
 
 }
 #endif
index fb69bc5..280767a 100644 (file)
@@ -1926,7 +1926,7 @@ public:
             if (primitiveValue->getIdent() == CSSValueNone)
                 setValue(styleResolver->style(), 0);
             else if (primitiveValue->isShape()) {
-                setValue(styleResolver->style(), ShapeClipPathOperation::create(basicShapeForValue(styleResolver, primitiveValue->getShapeValue())));
+                setValue(styleResolver->style(), ShapeClipPathOperation::create(basicShapeForValue(styleResolver->style(), styleResolver->rootElementStyle(), primitiveValue->getShapeValue())));
             }
 #if ENABLE(SVG)
             else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_URI) {
@@ -1960,7 +1960,7 @@ public:
             else if (primitiveValue->getIdent() == CSSValueOutsideShape)
                 setValue(styleResolver->style(), ExclusionShapeValue::createOutsideValue());
             else if (primitiveValue->isShape()) {
-                RefPtr<ExclusionShapeValue> shape = ExclusionShapeValue::createShapeValue(basicShapeForValue(styleResolver, primitiveValue->getShapeValue()));
+                RefPtr<ExclusionShapeValue> shape = ExclusionShapeValue::createShapeValue(basicShapeForValue(styleResolver->style(), styleResolver->rootElementStyle(), primitiveValue->getShapeValue()));
                 setValue(styleResolver->style(), shape.release());
             }
         }