Turn r/rx/ry to presentation attributes
authorkrit@webkit.org <krit@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Aug 2014 19:42:38 +0000 (19:42 +0000)
committerkrit@webkit.org <krit@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Aug 2014 19:42:38 +0000 (19:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=135978

Patch by Dirk Schulze <krit@webkit.org> on 2014-08-15
Reviewed by Dean Jackson.

This follows the patch for width and height presentation attributes and
Source/WebCore:

turns rx, ry and r to presentation attributes as well:

​http://trac.webkit.org/changeset/171341

Extended existing tests.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSParser.cpp:
(WebCore::isSimpleLengthPropertyID):
* css/DeprecatedStyleBuilder.cpp:
(WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
* css/SVGCSSParser.cpp:
(WebCore::CSSParser::parseSVGValue):
* css/SVGCSSPropertyNames.in:
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* rendering/style/RenderStyle.h:
* rendering/style/SVGRenderStyle.h:
(WebCore::SVGRenderStyle::setR):
(WebCore::SVGRenderStyle::setRx):
(WebCore::SVGRenderStyle::setRy):
(WebCore::SVGRenderStyle::r):
(WebCore::SVGRenderStyle::rx):
(WebCore::SVGRenderStyle::ry):
* rendering/style/SVGRenderStyleDefs.cpp:
(WebCore::StyleLayoutData::StyleLayoutData):
(WebCore::StyleLayoutData::operator==):
* rendering/style/SVGRenderStyleDefs.h:
* rendering/svg/RenderSVGEllipse.cpp:
(WebCore::RenderSVGEllipse::calculateRadiiAndCenter):
* rendering/svg/SVGPathData.cpp:
(WebCore::updatePathFromCircleElement):
(WebCore::updatePathFromEllipseElement):
(WebCore::updatePathFromRectElement):
(WebCore::updatePathFromLineElement): Deleted.
* svg/SVGCircleElement.cpp:
(WebCore::SVGCircleElement::svgAttributeChanged):
* svg/SVGElement.cpp:
(WebCore::populateAttributeNameToCSSPropertyIDMap):
(WebCore::populateCSSPropertyWithSVGDOMNameToAnimatedPropertyTypeMap):
* svg/SVGEllipseElement.cpp:
(WebCore::SVGEllipseElement::svgAttributeChanged):
* svg/SVGRectElement.cpp:
(WebCore::SVGRectElement::svgAttributeChanged):

LayoutTests:

turns r, rx and ry to presentation attributes as well:

​http://trac.webkit.org/changeset/171341

* svg/css/parse-length.html:
* transitions/svg-layout-transition-expected.txt:
* transitions/svg-layout-transition.html:

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

21 files changed:
LayoutTests/ChangeLog
LayoutTests/svg/css/parse-length.html
LayoutTests/transitions/svg-layout-transition-expected.txt
LayoutTests/transitions/svg-layout-transition.html
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/DeprecatedStyleBuilder.cpp
Source/WebCore/css/SVGCSSParser.cpp
Source/WebCore/css/SVGCSSPropertyNames.in
Source/WebCore/page/animation/CSSPropertyAnimation.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/SVGRenderStyle.h
Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp
Source/WebCore/rendering/style/SVGRenderStyleDefs.h
Source/WebCore/rendering/svg/RenderSVGEllipse.cpp
Source/WebCore/rendering/svg/SVGPathData.cpp
Source/WebCore/svg/SVGCircleElement.cpp
Source/WebCore/svg/SVGElement.cpp
Source/WebCore/svg/SVGEllipseElement.cpp
Source/WebCore/svg/SVGRectElement.cpp

index 2da1b8b..0c0f2ae 100644 (file)
@@ -1,5 +1,21 @@
 2014-08-15  Dirk Schulze  <krit@webkit.org>
 
+        Turn r/rx/ry to presentation attributes
+        https://bugs.webkit.org/show_bug.cgi?id=135978
+
+        Reviewed by Dean Jackson.
+
+        This follows the patch for width and height presentation attributes and
+        turns r, rx and ry to presentation attributes as well:
+
+        ​http://trac.webkit.org/changeset/171341
+
+        * svg/css/parse-length.html:
+        * transitions/svg-layout-transition-expected.txt:
+        * transitions/svg-layout-transition.html:
+
+2014-08-15  Dirk Schulze  <krit@webkit.org>
+
         Turn cx/cy to presentation attributes
         https://bugs.webkit.org/show_bug.cgi?id=135975
 
index 35e2443..c77a39d 100644 (file)
@@ -50,6 +50,33 @@ testComputed("cy", "1ex", "12.800000190734863px");
 testComputed("cy", "20%", "20%");
 testComputed("cy", "-200px", "-200px");
 
+// Test 'r'.
+testComputed("r", "  100", "100px");
+testComputed("r", "100   ", "100px");
+testComputed("r", "100px", "100px");
+testComputed("r", "1em", "16px");
+testComputed("r", "1ex", "12.800000190734863px");
+testComputed("r", "20%", "20%");
+testComputed("r", "-200px", "-200px");
+
+// Test 'rx'.
+testComputed("rx", "  100", "100px");
+testComputed("rx", "100   ", "100px");
+testComputed("rx", "100px", "100px");
+testComputed("rx", "1em", "16px");
+testComputed("rx", "1ex", "12.800000190734863px");
+testComputed("rx", "20%", "20%");
+testComputed("rx", "-200px", "-200px");
+
+// Test 'ry'.
+testComputed("ry", "  100", "100px");
+testComputed("ry", "100   ", "100px");
+testComputed("ry", "100px", "100px");
+testComputed("ry", "1em", "16px");
+testComputed("ry", "1ex", "12.800000190734863px");
+testComputed("ry", "20%", "20%");
+testComputed("ry", "-200px", "-200px");
+
 // Test 'width'.
 testComputed("width", "auto", "auto");
 testComputed("width", "  100", "100px");
@@ -94,6 +121,27 @@ negativeTestZero("cy", "100px;");
 negativeTestZero("cy", "100px !important");
 negativeTestZero("cy", "{ 100px }");
 
+// Negative tests for 'r'.
+negativeTestZero("r", "auto", "auto");
+negativeTestZero("r", "100   px");
+negativeTestZero("r", "100px;");
+negativeTestZero("r", "100px !important");
+negativeTestZero("r", "{ 100px }");
+
+// Negative tests for 'rx'.
+negativeTestZero("rx", "auto", "auto");
+negativeTestZero("rx", "100   px");
+negativeTestZero("rx", "100px;");
+negativeTestZero("rx", "100px !important");
+negativeTestZero("rx", "{ 100px }");
+
+// Negative tests for 'ry'.
+negativeTestZero("ry", "auto");
+negativeTestZero("ry", "100   px");
+negativeTestZero("ry", "100px;");
+negativeTestZero("ry", "100px !important");
+negativeTestZero("ry", "{ 100px }");
+
 // Negative tests for 'width'.
 negativeTest("width", "100   px");
 negativeTest("width", "100px;");
index 38af03d..545edf7 100644 (file)
@@ -1,5 +1,8 @@
 PASS - "cx" property for "cx" element at 0.5s saw something close to: 150
 PASS - "cy" property for "cy" element at 0.5s saw something close to: 150
+PASS - "r" property for "r" element at 0.5s saw something close to: 150
+PASS - "rx" property for "rx" element at 0.5s saw something close to: 150
+PASS - "ry" property for "ry" element at 0.5s saw something close to: 150
 PASS - "x" property for "x" element at 0.5s saw something close to: 150
 PASS - "y" property for "y" element at 0.5s saw something close to: 150
 PASS - "width" property for "width" element at 0.5s saw something close to: 150
index b4aa711..0058ab5 100644 (file)
     #cy.final {
       cy: 200px;
     }
-    
+
+    #r {
+      -webkit-transition-property: r;
+    }
+    #r.final {
+      r: 200px;
+    }
+
+    #rx {
+      -webkit-transition-property: rx;
+    }
+    #rx.final {
+      rx: 200px;
+    }
+
+    #ry {
+      -webkit-transition-property: ry;
+    }
+    #ry.final {
+      ry: 200px;
+    }
+
     #x {
       -webkit-transition-property: x;
     }
@@ -58,6 +79,9 @@
       // [time, element-id, property, expected-value, tolerance]
       [0.5, 'cx', 'cx', 150, 20],
       [0.5, 'cy', 'cy', 150, 20],
+      [0.5, 'r', 'r', 150, 20],
+      [0.5, 'rx', 'rx', 150, 20],
+      [0.5, 'ry', 'ry', 150, 20],
       [0.5, 'x', 'x', 150, 20],
       [0.5, 'y', 'y', 150, 20],
       [0.5, 'width', 'width', 150, 20],
@@ -68,6 +92,9 @@
     {
       document.getElementById('cx').setAttribute('class', 'init final');
       document.getElementById('cy').setAttribute('class', 'init final');
+      document.getElementById('r').setAttribute('class', 'init final');
+      document.getElementById('rx').setAttribute('class', 'init final');
+      document.getElementById('ry').setAttribute('class', 'init final');
       document.getElementById('x').setAttribute('class', 'init final');
       document.getElementById('y').setAttribute('class', 'init final');
       document.getElementById('width').setAttribute('class', 'init final');
   <svg>
     <circle cx="100" cy="100" r="100" class="init" id="cx"/>
     <circle cx="100" cy="100" r="100" class="init" id="cy"/>
+    <circle cx="100" cy="100" r="100" class="init" id="r"/>
+    <ellipse cx="100" cy="100" rx="100" ry="100" class="init" id="rx"/>
+    <ellipse cx="100" cy="100" rx="100" ry="100" class="init" id="ry"/>
     <rect x="100" y="100" width="100" height="100" class="init" id="x"/>
     <rect x="100" y="100" width="100" height="100" class="init" id="y"/>
     <rect x="100" y="100" width="100" height="100" class="init" id="width"/>
index f3f8d71..c6744b7 100644 (file)
@@ -1,5 +1,59 @@
 2014-08-15  Dirk Schulze  <krit@webkit.org>
 
+        Turn r/rx/ry to presentation attributes
+        https://bugs.webkit.org/show_bug.cgi?id=135978
+
+        Reviewed by Dean Jackson.
+
+        This follows the patch for width and height presentation attributes and
+        turns rx, ry and r to presentation attributes as well:
+
+        ​http://trac.webkit.org/changeset/171341
+
+        Extended existing tests.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::ComputedStyleExtractor::propertyValue):
+        * css/CSSParser.cpp:
+        (WebCore::isSimpleLengthPropertyID):
+        * css/DeprecatedStyleBuilder.cpp:
+        (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
+        * css/SVGCSSParser.cpp:
+        (WebCore::CSSParser::parseSVGValue):
+        * css/SVGCSSPropertyNames.in:
+        * page/animation/CSSPropertyAnimation.cpp:
+        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
+        * rendering/style/RenderStyle.h:
+        * rendering/style/SVGRenderStyle.h:
+        (WebCore::SVGRenderStyle::setR):
+        (WebCore::SVGRenderStyle::setRx):
+        (WebCore::SVGRenderStyle::setRy):
+        (WebCore::SVGRenderStyle::r):
+        (WebCore::SVGRenderStyle::rx):
+        (WebCore::SVGRenderStyle::ry):
+        * rendering/style/SVGRenderStyleDefs.cpp:
+        (WebCore::StyleLayoutData::StyleLayoutData):
+        (WebCore::StyleLayoutData::operator==):
+        * rendering/style/SVGRenderStyleDefs.h:
+        * rendering/svg/RenderSVGEllipse.cpp:
+        (WebCore::RenderSVGEllipse::calculateRadiiAndCenter):
+        * rendering/svg/SVGPathData.cpp:
+        (WebCore::updatePathFromCircleElement):
+        (WebCore::updatePathFromEllipseElement):
+        (WebCore::updatePathFromRectElement):
+        (WebCore::updatePathFromLineElement): Deleted.
+        * svg/SVGCircleElement.cpp:
+        (WebCore::SVGCircleElement::svgAttributeChanged):
+        * svg/SVGElement.cpp:
+        (WebCore::populateAttributeNameToCSSPropertyIDMap):
+        (WebCore::populateCSSPropertyWithSVGDOMNameToAnimatedPropertyTypeMap):
+        * svg/SVGEllipseElement.cpp:
+        (WebCore::SVGEllipseElement::svgAttributeChanged):
+        * svg/SVGRectElement.cpp:
+        (WebCore::SVGRectElement::svgAttributeChanged):
+
+2014-08-15  Dirk Schulze  <krit@webkit.org>
+
         Turn cx/cy to presentation attributes
         https://bugs.webkit.org/show_bug.cgi?id=135975
 
index 0d460d5..6a110a3 100644 (file)
@@ -424,6 +424,9 @@ static const CSSPropertyID computedProperties[] = {
     CSSPropertyMarkerStart,
     CSSPropertyMaskType,
     CSSPropertyPaintOrder,
+    CSSPropertyR,
+    CSSPropertyRx,
+    CSSPropertyRy,
     CSSPropertyShapeRendering,
     CSSPropertyStroke,
     CSSPropertyStrokeDasharray,
@@ -2972,6 +2975,12 @@ PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propert
             return zoomAdjustedPixelValueForLength(style->svgStyle().cx(), style.get());
         case CSSPropertyCy:
             return zoomAdjustedPixelValueForLength(style->svgStyle().cy(), style.get());
+        case CSSPropertyR:
+            return zoomAdjustedPixelValueForLength(style->svgStyle().r(), style.get());
+        case CSSPropertyRx:
+            return zoomAdjustedPixelValueForLength(style->svgStyle().rx(), style.get());
+        case CSSPropertyRy:
+            return zoomAdjustedPixelValueForLength(style->svgStyle().ry(), style.get());
         case CSSPropertyX:
             return zoomAdjustedPixelValueForLength(style->svgStyle().x(), style.get());
         case CSSPropertyY:
index a232b66..ddf0d70 100644 (file)
@@ -569,6 +569,9 @@ static inline bool isSimpleLengthPropertyID(CSSPropertyID propertyId, bool& acce
     case CSSPropertyMarginLeft:
     case CSSPropertyMarginRight:
     case CSSPropertyMarginTop:
+    case CSSPropertyR:
+    case CSSPropertyRx:
+    case CSSPropertyRy:
     case CSSPropertyRight:
     case CSSPropertyTop:
     case CSSPropertyWebkitMarginAfter:
index 2051186..87256fa 100644 (file)
@@ -2596,6 +2596,9 @@ DeprecatedStyleBuilder::DeprecatedStyleBuilder()
 
     setPropertyHandler(CSSPropertyCx, ApplyPropertyLength<&RenderStyle::cx, &RenderStyle::setCx, &RenderStyle::initialZeroLength>::createHandler());
     setPropertyHandler(CSSPropertyCy, ApplyPropertyLength<&RenderStyle::cy, &RenderStyle::setCy, &RenderStyle::initialZeroLength>::createHandler());
+    setPropertyHandler(CSSPropertyR, ApplyPropertyLength<&RenderStyle::r, &RenderStyle::setR, &RenderStyle::initialZeroLength>::createHandler());
+    setPropertyHandler(CSSPropertyRx, ApplyPropertyLength<&RenderStyle::rx, &RenderStyle::setRx, &RenderStyle::initialZeroLength>::createHandler());
+    setPropertyHandler(CSSPropertyRy, ApplyPropertyLength<&RenderStyle::ry, &RenderStyle::setRy, &RenderStyle::initialZeroLength>::createHandler());
     setPropertyHandler(CSSPropertyX, ApplyPropertyLength<&RenderStyle::x, &RenderStyle::setX, &RenderStyle::initialZeroLength>::createHandler());
     setPropertyHandler(CSSPropertyY, ApplyPropertyLength<&RenderStyle::y, &RenderStyle::setY, &RenderStyle::initialZeroLength>::createHandler());
 
index 9753e10..b5bba5a 100644 (file)
@@ -301,6 +301,9 @@ bool CSSParser::parseSVGValue(CSSPropertyID propId, bool important)
     }
     case CSSPropertyCx:
     case CSSPropertyCy:
+    case CSSPropertyR:
+    case CSSPropertyRx:
+    case CSSPropertyRy:
     case CSSPropertyX:
     case CSSPropertyY:
         valid_primitive = (!id && validUnit(value, FLength | FPercent));
index 943db5d..cde2441 100644 (file)
@@ -1258,6 +1258,9 @@ CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap()
 
         new LengthPropertyWrapper<Length>(CSSPropertyCx, &RenderStyle::cx, &RenderStyle::setCx),
         new LengthPropertyWrapper<Length>(CSSPropertyCy, &RenderStyle::cy, &RenderStyle::setCy),
+        new LengthPropertyWrapper<Length>(CSSPropertyR, &RenderStyle::r, &RenderStyle::setR),
+        new LengthPropertyWrapper<Length>(CSSPropertyRx, &RenderStyle::rx, &RenderStyle::setRx),
+        new LengthPropertyWrapper<Length>(CSSPropertyRy, &RenderStyle::ry, &RenderStyle::setRy),
         new LengthPropertyWrapper<Length>(CSSPropertyX, &RenderStyle::x, &RenderStyle::setX),
         new LengthPropertyWrapper<Length>(CSSPropertyY, &RenderStyle::y, &RenderStyle::setY),
 
index 18e4213..8e0c1a7 100644 (file)
@@ -1669,6 +1669,12 @@ public:
     void setCx(Length cx) { accessSVGStyle().setCx(cx); }
     const Length& cy() const { return svgStyle().cy(); }
     void setCy(Length cy) { accessSVGStyle().setCy(cy); }
+    const Length& r() const { return svgStyle().r(); }
+    void setR(Length r) { accessSVGStyle().setR(r); }
+    const Length& rx() const { return svgStyle().rx(); }
+    void setRx(Length rx) { accessSVGStyle().setRx(rx); }
+    const Length& ry() const { return svgStyle().ry(); }
+    void setRy(Length ry) { accessSVGStyle().setRy(ry); }
     const Length& x() const { return svgStyle().x(); }
     void setX(Length x) { accessSVGStyle().setX(x); }
     const Length& y() const { return svgStyle().y(); }
index 88188f1..daa7e6b 100644 (file)
@@ -156,6 +156,21 @@ public:
         if (!(layout->cy == obj))
             layout.access()->cy = obj;
     }
+    void setR(const Length& obj)
+    {
+        if (!(layout->r == obj))
+            layout.access()->r = obj;
+    }
+    void setRx(const Length& obj)
+    {
+        if (!(layout->rx == obj))
+            layout.access()->rx = obj;
+    }
+    void setRy(const Length& obj)
+    {
+        if (!(layout->ry == obj))
+            layout.access()->ry = obj;
+    }
     void setX(const Length& obj)
     {
         if (!(layout->x == obj))
@@ -365,6 +380,9 @@ public:
     ShadowData* shadow() const { return shadowSVG->shadow.get(); }
     const Length& cx() const { return layout->cx; }
     const Length& cy() const { return layout->cy; }
+    const Length& r() const { return layout->r; }
+    const Length& rx() const { return layout->rx; }
+    const Length& ry() const { return layout->ry; }
     const Length& x() const { return layout->x; }
     const Length& y() const { return layout->y; }
     String clipperResource() const { return resources->clipper; }
index d777e0c..25e7ccd 100644 (file)
@@ -280,6 +280,9 @@ bool StyleInheritedResourceData::operator==(const StyleInheritedResourceData& ot
 StyleLayoutData::StyleLayoutData()
     : cx(RenderStyle::initialZeroLength())
     , cy(RenderStyle::initialZeroLength())
+    , r(RenderStyle::initialZeroLength())
+    , rx(RenderStyle::initialZeroLength())
+    , ry(RenderStyle::initialZeroLength())
     , x(RenderStyle::initialZeroLength())
     , y(RenderStyle::initialZeroLength())
 {
@@ -289,6 +292,9 @@ inline StyleLayoutData::StyleLayoutData(const StyleLayoutData& other)
     : RefCounted<StyleLayoutData>()
     , cx(other.cx)
     , cy(other.cy)
+    , r(other.r)
+    , rx(other.rx)
+    , ry(other.ry)
     , x(other.x)
     , y(other.y)
 {
@@ -303,6 +309,9 @@ bool StyleLayoutData::operator==(const StyleLayoutData& other) const
 {
     return cx == other.cx
         && cy == other.cy
+        && r == other.r
+        && rx == other.rx
+        && ry == other.ry
         && x == other.x
         && y == other.y;
 }
index 2784d47..4d772f0 100644 (file)
@@ -304,6 +304,9 @@ namespace WebCore {
 
         Length cx;
         Length cy;
+        Length r;
+        Length rx;
+        Length ry;
         Length x;
         Length y;
 
index 043b314..d6697ce 100644 (file)
@@ -82,16 +82,13 @@ void RenderSVGEllipse::calculateRadiiAndCenter()
         lengthContext.valueForLength(style().svgStyle().cx(), LengthModeWidth),
         lengthContext.valueForLength(style().svgStyle().cy(), LengthModeHeight));
     if (isSVGCircleElement(graphicsElement())) {
-        SVGCircleElement& circle = toSVGCircleElement(graphicsElement());
-        SVGLengthContext lengthContext(&circle);
-        float radius = circle.r().value(lengthContext);
+        float radius = lengthContext.valueForLength(style().svgStyle().r());
         m_radii = FloatSize(radius, radius);
         return;
     }
 
     ASSERT(isSVGEllipseElement(graphicsElement()));
-    SVGEllipseElement& ellipse = toSVGEllipseElement(graphicsElement());
-    m_radii = FloatSize(ellipse.rx().value(lengthContext), ellipse.ry().value(lengthContext));
+    m_radii = FloatSize(lengthContext.valueForLength(style().svgStyle().rx()), lengthContext.valueForLength(style().svgStyle().ry()));
 }
 
 void RenderSVGEllipse::fillShape(GraphicsContext* context) const
index 1e14c91..7bc5122 100644 (file)
@@ -40,15 +40,14 @@ namespace WebCore {
 static void updatePathFromCircleElement(SVGElement* element, Path& path)
 {
     ASSERT(isSVGCircleElement(element));
-    SVGCircleElement* circle = toSVGCircleElement(element);
 
     SVGLengthContext lengthContext(element);
-    float r = circle->r().value(lengthContext);
+    RenderElement* renderer = element->renderer();
+    if (!renderer)
+        return;
+    RenderStyle& style = renderer->style();
+    float r = lengthContext.valueForLength(style.svgStyle().r());
     if (r > 0) {
-        RenderElement* renderer = circle->renderer();
-        if (!renderer)
-            return;
-        RenderStyle& style = renderer->style();
         float cx = lengthContext.valueForLength(style.svgStyle().cx(), LengthModeWidth);
         float cy = lengthContext.valueForLength(style.svgStyle().cy(), LengthModeHeight);
         path.addEllipse(FloatRect(cx - r, cy - r, r * 2, r * 2));
@@ -57,19 +56,17 @@ static void updatePathFromCircleElement(SVGElement* element, Path& path)
 
 static void updatePathFromEllipseElement(SVGElement* element, Path& path)
 {
-    SVGEllipseElement* ellipse = toSVGEllipseElement(element);
-
+    RenderElement* renderer = element->renderer();
+    if (!renderer)
+        return;
+    RenderStyle& style = renderer->style();
     SVGLengthContext lengthContext(element);
-    float rx = ellipse->rx().value(lengthContext);
+    float rx = lengthContext.valueForLength(style.svgStyle().rx(), LengthModeWidth);
     if (rx <= 0)
         return;
-    float ry = ellipse->ry().value(lengthContext);
+    float ry = lengthContext.valueForLength(style.svgStyle().ry(), LengthModeHeight);
     if (ry <= 0)
         return;
-    RenderElement* renderer = ellipse->renderer();
-    if (!renderer)
-        return;
-    RenderStyle& style = renderer->style();
     float cx = lengthContext.valueForLength(style.svgStyle().cx(), LengthModeWidth);
     float cy = lengthContext.valueForLength(style.svgStyle().cy(), LengthModeHeight);
     path.addEllipse(FloatRect(cx - rx, cy - ry, rx * 2, ry * 2));
@@ -119,8 +116,7 @@ static void updatePathFromPolylineElement(SVGElement* element, Path& path)
 
 static void updatePathFromRectElement(SVGElement* element, Path& path)
 {
-    SVGRectElement* rect = toSVGRectElement(element);
-    RenderElement* renderer = rect->renderer();
+    RenderElement* renderer = element->renderer();
     if (!renderer)
         return;
 
@@ -134,8 +130,8 @@ static void updatePathFromRectElement(SVGElement* element, Path& path)
         return;
     float x = lengthContext.valueForLength(style.svgStyle().x(), LengthModeWidth);
     float y = lengthContext.valueForLength(style.svgStyle().y(), LengthModeHeight);
-    float rx = rect->rx().value(lengthContext);
-    float ry = rect->ry().value(lengthContext);
+    float rx = lengthContext.valueForLength(style.svgStyle().rx(), LengthModeWidth);
+    float ry = lengthContext.valueForLength(style.svgStyle().ry(), LengthModeHeight);
     bool hasRx = rx > 0;
     bool hasRy = ry > 0;
     if (hasRx || hasRy) {
index fe3f0e7..55130ec 100644 (file)
@@ -107,24 +107,16 @@ void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName)
     SVGElementInstance::InvalidationGuard invalidationGuard(this);
 
     if (attrName == SVGNames::cxAttr
-        || attrName == SVGNames::cyAttr) {
+        || attrName == SVGNames::cyAttr
+        || attrName == SVGNames::rAttr) {
         invalidateSVGPresentationAttributeStyle();
         return;
     }
 
-    if (attrName == SVGNames::rAttr)
-        updateRelativeLengthsInformation();
-
     RenderSVGShape* renderer = toRenderSVGShape(this->renderer());
     if (!renderer)
         return;
 
-    if (attrName == SVGNames::rAttr) {
-        renderer->setNeedsShapeUpdate();
-        RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
-        return;
-    }
-
     if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) {
         RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
         return;
index 10307dc..33d8b4e 100644 (file)
@@ -126,6 +126,9 @@ static NEVER_INLINE void populateAttributeNameToCSSPropertyIDMap(HashMap<AtomicS
         &overflowAttr,
         &paint_orderAttr,
         &pointer_eventsAttr,
+        &rAttr,
+        &rxAttr,
+        &ryAttr,
         &shape_renderingAttr,
         &stop_colorAttr,
         &stop_opacityAttr,
@@ -248,6 +251,9 @@ static NEVER_INLINE void populateCSSPropertyWithSVGDOMNameToAnimatedPropertyType
     static const TableEntry table[] = {
         { cxAttr, AnimatedLength },
         { cyAttr, AnimatedLength },
+        { rAttr, AnimatedLength },
+        { rxAttr, AnimatedLength },
+        { ryAttr, AnimatedLength },
         { SVGNames::heightAttr, AnimatedLength },
         { SVGNames::widthAttr, AnimatedLength },
         { xAttr, AnimatedLength },
index 74594fd..156d623 100644 (file)
@@ -111,27 +111,17 @@ void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName)
     SVGElementInstance::InvalidationGuard invalidationGuard(this);
 
     if (attrName == SVGNames::cxAttr
-        || attrName == SVGNames::cyAttr) {
+        || attrName == SVGNames::cyAttr
+        || attrName == SVGNames::rxAttr
+        || attrName == SVGNames::ryAttr) {
         invalidateSVGPresentationAttributeStyle();
         return;
     }
 
-    bool isLengthAttribute = attrName == SVGNames::rxAttr
-                          || attrName == SVGNames::ryAttr;
-
-    if (isLengthAttribute)
-        updateRelativeLengthsInformation();
-
     RenderSVGShape* renderer = toRenderSVGShape(this->renderer());
     if (!renderer)
         return;
 
-    if (isLengthAttribute) {
-        renderer->setNeedsShapeUpdate();
-        RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
-        return;
-    }
-
     if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) {
         RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
         return;
index aa8d48a..c341327 100644 (file)
@@ -125,27 +125,17 @@ void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName)
     if (attrName == SVGNames::xAttr
         || attrName == SVGNames::yAttr
         || attrName == SVGNames::widthAttr
-        || attrName == SVGNames::heightAttr) {
+        || attrName == SVGNames::heightAttr
+        || attrName == SVGNames::rxAttr
+        || attrName == SVGNames::ryAttr) {
         invalidateSVGPresentationAttributeStyle();
         return;
     }
 
-    bool isLengthAttribute = attrName == SVGNames::rxAttr
-                          || attrName == SVGNames::ryAttr;
-
-    if (isLengthAttribute)
-        updateRelativeLengthsInformation();
-
     RenderSVGShape* renderer = toRenderSVGShape(this->renderer());
     if (!renderer)
         return;
 
-    if (isLengthAttribute) {
-        renderer->setNeedsShapeUpdate();
-        RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
-        return;
-    }
-
     if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) {
         RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
         return;