Title: [148645] trunk/Source/WebCore
Revision
148645
Author
k...@webkit.org
Date
2013-04-17 16:29:02 -0700 (Wed, 17 Apr 2013)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (148644 => 148645)


--- trunk/Source/WebCore/ChangeLog	2013-04-17 23:24:53 UTC (rev 148644)
+++ trunk/Source/WebCore/ChangeLog	2013-04-17 23:29:02 UTC (rev 148645)
@@ -1,3 +1,22 @@
+2013-04-17  Dirk Schulze  <k...@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  <bda...@apple.com>
 
         Content inside frames and scrollbars in overflow areas hit-tests incorrectly when 

Modified: trunk/Source/WebCore/css/BasicShapeFunctions.cpp (148644 => 148645)


--- trunk/Source/WebCore/css/BasicShapeFunctions.cpp	2013-04-17 23:24:53 UTC (rev 148644)
+++ trunk/Source/WebCore/css/BasicShapeFunctions.cpp	2013-04-17 23:29:02 UTC (rev 148645)
@@ -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 @@
     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 @@
         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 @@
         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 @@
         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 @@
         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;

Modified: trunk/Source/WebCore/css/BasicShapeFunctions.h (148644 => 148645)


--- trunk/Source/WebCore/css/BasicShapeFunctions.h	2013-04-17 23:24:53 UTC (rev 148644)
+++ trunk/Source/WebCore/css/BasicShapeFunctions.h	2013-04-17 23:29:02 UTC (rev 148645)
@@ -37,10 +37,10 @@
 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

Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (148644 => 148645)


--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2013-04-17 23:24:53 UTC (rev 148644)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2013-04-17 23:29:02 UTC (rev 148645)
@@ -1926,7 +1926,7 @@
             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 @@
             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());
             }
         }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to