Title: [172641] trunk
Revision
172641
Author
k...@webkit.org
Date
2014-08-15 12:38:10 -0700 (Fri, 15 Aug 2014)

Log Message

Turn cx/cy to presentation attributes
https://bugs.webkit.org/show_bug.cgi?id=135975

Reviewed by Dean Jackson.

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

turns x and y 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::setCx):
(WebCore::SVGRenderStyle::setCy):
(WebCore::SVGRenderStyle::cx):
(WebCore::SVGRenderStyle::cy):
* 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):
* svg/SVGCircleElement.cpp:
(WebCore::SVGCircleElement::svgAttributeChanged):
(WebCore::SVGCircleElement::selfHasRelativeLengths): Deleted.
* svg/SVGCircleElement.h:
* svg/SVGElement.cpp:
(WebCore::populateAttributeNameToCSSPropertyIDMap):
(WebCore::populateCSSPropertyWithSVGDOMNameToAnimatedPropertyTypeMap):
* svg/SVGEllipseElement.cpp:
(WebCore::SVGEllipseElement::svgAttributeChanged):
(WebCore::SVGEllipseElement::selfHasRelativeLengths): Deleted.
* svg/SVGEllipseElement.h:

LayoutTests:

turns cx and cy to presentation attributes as well:

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

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

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (172640 => 172641)


--- trunk/LayoutTests/ChangeLog	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/LayoutTests/ChangeLog	2014-08-15 19:38:10 UTC (rev 172641)
@@ -1,3 +1,20 @@
+2014-08-15  Dirk Schulze  <k...@webkit.org>
+
+        Turn cx/cy to presentation attributes
+        https://bugs.webkit.org/show_bug.cgi?id=135975
+
+        Reviewed by Dean Jackson.
+
+        This follows the patch for width and height presentation attributes and
+        turns cx and cy to presentation attributes as well:
+
+        ​http://trac.webkit.org/changeset/171341
+
+        * svg/css/parse-length-expected.txt:
+        * svg/css/parse-length.html:
+        * transitions/svg-layout-transition-expected.txt:
+        * transitions/svg-layout-transition.html:
+
 2014-08-14  Benjamin Poulain  <benja...@webkit.org>
 
         CSS JIT: compile the :empty pseudo class

Modified: trunk/LayoutTests/svg/css/parse-length-expected.txt (172640 => 172641)


--- trunk/LayoutTests/svg/css/parse-length-expected.txt	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/LayoutTests/svg/css/parse-length-expected.txt	2014-08-15 19:38:10 UTC (rev 172641)
@@ -25,6 +25,20 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+PASS computedStyle("cx", "  100") is "100px"
+PASS computedStyle("cx", "100   ") is "100px"
+PASS computedStyle("cx", "100px") is "100px"
+PASS computedStyle("cx", "1em") is "16px"
+PASS computedStyle("cx", "1ex") is "12.800000190734863px"
+PASS computedStyle("cx", "20%") is "20%"
+PASS computedStyle("cx", "-200px") is "-200px"
+PASS computedStyle("cy", "  100") is "100px"
+PASS computedStyle("cy", "100   ") is "100px"
+PASS computedStyle("cy", "100px") is "100px"
+PASS computedStyle("cy", "1em") is "16px"
+PASS computedStyle("cy", "1ex") is "12.800000190734863px"
+PASS computedStyle("cy", "20%") is "20%"
+PASS computedStyle("cy", "-200px") is "-200px"
 PASS computedStyle("width", "auto") is "auto"
 PASS computedStyle("width", "  100") is "100px"
 PASS computedStyle("width", "100   ") is "100px"
@@ -46,6 +60,16 @@
 PASS computedStyle("y", "1ex") is "12.800000190734863px"
 PASS computedStyle("y", "20%") is "20%"
 PASS computedStyle("y", "-200px") is "-200px"
+PASS computedStyle("cx", "auto") is "0px"
+PASS computedStyle("cx", "100   px") is "0px"
+PASS computedStyle("cx", "100px;") is "0px"
+PASS computedStyle("cx", "100px !important") is "0px"
+PASS computedStyle("cx", "{ 100px }") is "0px"
+PASS computedStyle("cy", "auto") is "0px"
+PASS computedStyle("cy", "100   px") is "0px"
+PASS computedStyle("cy", "100px;") is "0px"
+PASS computedStyle("cy", "100px !important") is "0px"
+PASS computedStyle("cy", "{ 100px }") is "0px"
 PASS computedStyle("width", "100   px") is "auto"
 PASS computedStyle("width", "100px;") is "auto"
 PASS computedStyle("width", "100px !important") is "auto"

Modified: trunk/LayoutTests/svg/css/parse-length.html (172640 => 172641)


--- trunk/LayoutTests/svg/css/parse-length.html	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/LayoutTests/svg/css/parse-length.html	2014-08-15 19:38:10 UTC (rev 172641)
@@ -32,6 +32,24 @@
     testComputed(property, value, "0px");
 }
 
+// Test 'cx'.
+testComputed("cx", "  100", "100px");
+testComputed("cx", "100   ", "100px");
+testComputed("cx", "100px", "100px");
+testComputed("cx", "1em", "16px");
+testComputed("cx", "1ex", "12.800000190734863px");
+testComputed("cx", "20%", "20%");
+testComputed("cx", "-200px", "-200px");
+
+// Test 'cx'.
+testComputed("cy", "  100", "100px");
+testComputed("cy", "100   ", "100px");
+testComputed("cy", "100px", "100px");
+testComputed("cy", "1em", "16px");
+testComputed("cy", "1ex", "12.800000190734863px");
+testComputed("cy", "20%", "20%");
+testComputed("cy", "-200px", "-200px");
+
 // Test 'width'.
 testComputed("width", "auto", "auto");
 testComputed("width", "  100", "100px");
@@ -62,6 +80,20 @@
 testComputed("y", "20%", "20%");
 testComputed("y", "-200px", "-200px");
 
+// Negative tests for 'cx'.
+negativeTestZero("cx", "auto", "auto");
+negativeTestZero("cx", "100   px");
+negativeTestZero("cx", "100px;");
+negativeTestZero("cx", "100px !important");
+negativeTestZero("cx", "{ 100px }");
+
+// Negative tests for 'cy'.
+negativeTestZero("cy", "auto");
+negativeTestZero("cy", "100   px");
+negativeTestZero("cy", "100px;");
+negativeTestZero("cy", "100px !important");
+negativeTestZero("cy", "{ 100px }");
+
 // Negative tests for 'width'.
 negativeTest("width", "100   px");
 negativeTest("width", "100px;");

Modified: trunk/LayoutTests/transitions/svg-layout-transition-expected.txt (172640 => 172641)


--- trunk/LayoutTests/transitions/svg-layout-transition-expected.txt	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/LayoutTests/transitions/svg-layout-transition-expected.txt	2014-08-15 19:38:10 UTC (rev 172641)
@@ -1,3 +1,5 @@
+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 - "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

Modified: trunk/LayoutTests/transitions/svg-layout-transition.html (172640 => 172641)


--- trunk/LayoutTests/transitions/svg-layout-transition.html	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/LayoutTests/transitions/svg-layout-transition.html	2014-08-15 19:38:10 UTC (rev 172641)
@@ -8,6 +8,20 @@
       -webkit-transition-timing-function: linear;
     }
     
+    #cx {
+      -webkit-transition-property: cx;
+    }
+    #cx.final {
+      cx: 200px;
+    }
+
+    #cy {
+      -webkit-transition-property: cy;
+    }
+    #cy.final {
+      cy: 200px;
+    }
+    
     #x {
       -webkit-transition-property: x;
     }
@@ -42,6 +56,8 @@
 
     const expectedValues = [
       // [time, element-id, property, expected-value, tolerance]
+      [0.5, 'cx', 'cx', 150, 20],
+      [0.5, 'cy', 'cy', 150, 20],
       [0.5, 'x', 'x', 150, 20],
       [0.5, 'y', 'y', 150, 20],
       [0.5, 'width', 'width', 150, 20],
@@ -50,6 +66,8 @@
   
     function setupTest()
     {
+      document.getElementById('cx').setAttribute('class', 'init final');
+      document.getElementById('cy').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');
@@ -61,6 +79,8 @@
 </head>
 <body>
   <svg>
+    <circle cx="100" cy="100" r="100" class="init" id="cx"/>
+    <circle cx="100" cy="100" r="100" class="init" id="cy"/>
     <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"/>

Modified: trunk/Source/WebCore/ChangeLog (172640 => 172641)


--- trunk/Source/WebCore/ChangeLog	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/Source/WebCore/ChangeLog	2014-08-15 19:38:10 UTC (rev 172641)
@@ -1,3 +1,55 @@
+2014-08-15  Dirk Schulze  <k...@webkit.org>
+
+        Turn cx/cy to presentation attributes
+        https://bugs.webkit.org/show_bug.cgi?id=135975
+
+        Reviewed by Dean Jackson.
+
+        This follows the patch for width and height presentation attributes and
+        turns x and y 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::setCx):
+        (WebCore::SVGRenderStyle::setCy):
+        (WebCore::SVGRenderStyle::cx):
+        (WebCore::SVGRenderStyle::cy):
+        * 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):
+        * svg/SVGCircleElement.cpp:
+        (WebCore::SVGCircleElement::svgAttributeChanged):
+        (WebCore::SVGCircleElement::selfHasRelativeLengths): Deleted.
+        * svg/SVGCircleElement.h:
+        * svg/SVGElement.cpp:
+        (WebCore::populateAttributeNameToCSSPropertyIDMap):
+        (WebCore::populateCSSPropertyWithSVGDOMNameToAnimatedPropertyTypeMap):
+        * svg/SVGEllipseElement.cpp:
+        (WebCore::SVGEllipseElement::svgAttributeChanged):
+        (WebCore::SVGEllipseElement::selfHasRelativeLengths): Deleted.
+        * svg/SVGEllipseElement.h:
+
 2014-08-15  Adenilson Cavalcanti  <cavalcan...@gmail.com>
 
         Fix typo in Path comment

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (172640 => 172641)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2014-08-15 19:38:10 UTC (rev 172641)
@@ -404,6 +404,8 @@
     CSSPropertyBufferedRendering,
     CSSPropertyClipPath,
     CSSPropertyClipRule,
+    CSSPropertyCx,
+    CSSPropertyCy,
     CSSPropertyMask,
     CSSPropertyFilter,
     CSSPropertyFloodColor,
@@ -2966,6 +2968,10 @@
             break;
 
         // New positioning properties for SVG.
+        case CSSPropertyCx:
+            return zoomAdjustedPixelValueForLength(style->svgStyle().cx(), style.get());
+        case CSSPropertyCy:
+            return zoomAdjustedPixelValueForLength(style->svgStyle().cy(), style.get());
         case CSSPropertyX:
             return zoomAdjustedPixelValueForLength(style->svgStyle().x(), style.get());
         case CSSPropertyY:

Modified: trunk/Source/WebCore/css/CSSParser.cpp (172640 => 172641)


--- trunk/Source/WebCore/css/CSSParser.cpp	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2014-08-15 19:38:10 UTC (rev 172641)
@@ -562,6 +562,8 @@
         return RuntimeEnabledFeatures::sharedFeatures().cssShapesEnabled();
 #endif
     case CSSPropertyBottom:
+    case CSSPropertyCx:
+    case CSSPropertyCy:
     case CSSPropertyLeft:
     case CSSPropertyMarginBottom:
     case CSSPropertyMarginLeft:

Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (172640 => 172641)


--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-08-15 19:38:10 UTC (rev 172641)
@@ -2594,6 +2594,8 @@
     // UAs must treat 'word-wrap' as an alternate name for the 'overflow-wrap' property. So using the same handlers.
     setPropertyHandler(CSSPropertyWordWrap, ApplyPropertyDefault<EOverflowWrap, &RenderStyle::overflowWrap, EOverflowWrap, &RenderStyle::setOverflowWrap, EOverflowWrap, &RenderStyle::initialOverflowWrap>::createHandler());
 
+    setPropertyHandler(CSSPropertyCx, ApplyPropertyLength<&RenderStyle::cx, &RenderStyle::setCx, &RenderStyle::initialZeroLength>::createHandler());
+    setPropertyHandler(CSSPropertyCy, ApplyPropertyLength<&RenderStyle::cy, &RenderStyle::setCy, &RenderStyle::initialZeroLength>::createHandler());
     setPropertyHandler(CSSPropertyX, ApplyPropertyLength<&RenderStyle::x, &RenderStyle::setX, &RenderStyle::initialZeroLength>::createHandler());
     setPropertyHandler(CSSPropertyY, ApplyPropertyLength<&RenderStyle::y, &RenderStyle::setY, &RenderStyle::initialZeroLength>::createHandler());
 

Modified: trunk/Source/WebCore/css/SVGCSSParser.cpp (172640 => 172641)


--- trunk/Source/WebCore/css/SVGCSSParser.cpp	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/Source/WebCore/css/SVGCSSParser.cpp	2014-08-15 19:38:10 UTC (rev 172641)
@@ -299,6 +299,8 @@
         m_implicitShorthand = false;
         return true;
     }
+    case CSSPropertyCx:
+    case CSSPropertyCy:
     case CSSPropertyX:
     case CSSPropertyY:
         valid_primitive = (!id && validUnit(value, FLength | FPercent));

Modified: trunk/Source/WebCore/css/SVGCSSPropertyNames.in (172640 => 172641)


--- trunk/Source/WebCore/css/SVGCSSPropertyNames.in	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/Source/WebCore/css/SVGCSSPropertyNames.in	2014-08-15 19:38:10 UTC (rev 172641)
@@ -52,6 +52,8 @@
 
 -webkit-svg-shadow
 
+cx
+cy
 x
 y
 

Modified: trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp (172640 => 172641)


--- trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp	2014-08-15 19:38:10 UTC (rev 172641)
@@ -1256,6 +1256,8 @@
         new PropertyWrapper<SVGLength>(CSSPropertyStrokeDashoffset, &RenderStyle::strokeDashOffset, &RenderStyle::setStrokeDashOffset),
         new PropertyWrapper<float>(CSSPropertyStrokeMiterlimit, &RenderStyle::strokeMiterLimit, &RenderStyle::setStrokeMiterLimit),
 
+        new LengthPropertyWrapper<Length>(CSSPropertyCx, &RenderStyle::cx, &RenderStyle::setCx),
+        new LengthPropertyWrapper<Length>(CSSPropertyCy, &RenderStyle::cy, &RenderStyle::setCy),
         new LengthPropertyWrapper<Length>(CSSPropertyX, &RenderStyle::x, &RenderStyle::setX),
         new LengthPropertyWrapper<Length>(CSSPropertyY, &RenderStyle::y, &RenderStyle::setY),
 

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (172640 => 172641)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2014-08-15 19:38:10 UTC (rev 172641)
@@ -1665,6 +1665,10 @@
     float strokeMiterLimit() const { return svgStyle().strokeMiterLimit(); }
     void setStrokeMiterLimit(float f) { accessSVGStyle().setStrokeMiterLimit(f); }
 
+    const Length& cx() const { return svgStyle().cx(); }
+    void setCx(Length cx) { accessSVGStyle().setCx(cx); }
+    const Length& cy() const { return svgStyle().cy(); }
+    void setCy(Length cy) { accessSVGStyle().setCy(cy); }
     const Length& x() const { return svgStyle().x(); }
     void setX(Length x) { accessSVGStyle().setX(x); }
     const Length& y() const { return svgStyle().y(); }

Modified: trunk/Source/WebCore/rendering/style/SVGRenderStyle.h (172640 => 172641)


--- trunk/Source/WebCore/rendering/style/SVGRenderStyle.h	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/Source/WebCore/rendering/style/SVGRenderStyle.h	2014-08-15 19:38:10 UTC (rev 172641)
@@ -146,6 +146,16 @@
     void setGlyphOrientationVertical(EGlyphOrientation val) { svg_inherited_flags._glyphOrientationVertical = val; }
     void setMaskType(EMaskType val) { svg_noninherited_flags.f.maskType = val; }
     void setPaintOrder(PaintOrder val) { svg_inherited_flags.paintOrder = val; }
+    void setCx(const Length& obj)
+    {
+        if (!(layout->cx == obj))
+            layout.access()->cx = obj;
+    }
+    void setCy(const Length& obj)
+    {
+        if (!(layout->cy == obj))
+            layout.access()->cy = obj;
+    }
     void setX(const Length& obj)
     {
         if (!(layout->x == obj))
@@ -353,6 +363,8 @@
     const Color& lightingColor() const { return misc->lightingColor; }
     SVGLength baselineShiftValue() const { return misc->baselineShiftValue; }
     ShadowData* shadow() const { return shadowSVG->shadow.get(); }
+    const Length& cx() const { return layout->cx; }
+    const Length& cy() const { return layout->cy; }
     const Length& x() const { return layout->x; }
     const Length& y() const { return layout->y; }
     String clipperResource() const { return resources->clipper; }

Modified: trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp (172640 => 172641)


--- trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp	2014-08-15 19:38:10 UTC (rev 172641)
@@ -278,13 +278,17 @@
 }
 
 StyleLayoutData::StyleLayoutData()
-    : x(RenderStyle::initialZeroLength())
+    : cx(RenderStyle::initialZeroLength())
+    , cy(RenderStyle::initialZeroLength())
+    , x(RenderStyle::initialZeroLength())
     , y(RenderStyle::initialZeroLength())
 {
 }
 
 inline StyleLayoutData::StyleLayoutData(const StyleLayoutData& other)
     : RefCounted<StyleLayoutData>()
+    , cx(other.cx)
+    , cy(other.cy)
     , x(other.x)
     , y(other.y)
 {
@@ -297,7 +301,9 @@
 
 bool StyleLayoutData::operator==(const StyleLayoutData& other) const
 {
-    return x == other.x
+    return cx == other.cx
+        && cy == other.cy
+        && x == other.x
         && y == other.y;
 }
 

Modified: trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.h (172640 => 172641)


--- trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.h	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.h	2014-08-15 19:38:10 UTC (rev 172641)
@@ -302,6 +302,8 @@
             return !(*this == other);
         }
 
+        Length cx;
+        Length cy;
         Length x;
         Length y;
 

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGEllipse.cpp (172640 => 172641)


--- trunk/Source/WebCore/rendering/svg/RenderSVGEllipse.cpp	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGEllipse.cpp	2014-08-15 19:38:10 UTC (rev 172641)
@@ -77,21 +77,21 @@
 
 void RenderSVGEllipse::calculateRadiiAndCenter()
 {
+    SVGLengthContext lengthContext(&graphicsElement());
+    m_center = FloatPoint(
+        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);
         m_radii = FloatSize(radius, radius);
-        m_center = FloatPoint(circle.cx().value(lengthContext), circle.cy().value(lengthContext));
         return;
     }
 
     ASSERT(isSVGEllipseElement(graphicsElement()));
     SVGEllipseElement& ellipse = toSVGEllipseElement(graphicsElement());
-
-    SVGLengthContext lengthContext(&ellipse);
     m_radii = FloatSize(ellipse.rx().value(lengthContext), ellipse.ry().value(lengthContext));
-    m_center = FloatPoint(ellipse.cx().value(lengthContext), ellipse.cy().value(lengthContext));
 }
 
 void RenderSVGEllipse::fillShape(GraphicsContext* context) const

Modified: trunk/Source/WebCore/rendering/svg/SVGPathData.cpp (172640 => 172641)


--- trunk/Source/WebCore/rendering/svg/SVGPathData.cpp	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/Source/WebCore/rendering/svg/SVGPathData.cpp	2014-08-15 19:38:10 UTC (rev 172641)
@@ -44,8 +44,15 @@
 
     SVGLengthContext lengthContext(element);
     float r = circle->r().value(lengthContext);
-    if (r > 0)
-        path.addEllipse(FloatRect(circle->cx().value(lengthContext) - r, circle->cy().value(lengthContext) - r, r * 2, r * 2));
+    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));
+    }
 }
 
 static void updatePathFromEllipseElement(SVGElement* element, Path& path)
@@ -59,7 +66,13 @@
     float ry = ellipse->ry().value(lengthContext);
     if (ry <= 0)
         return;
-    path.addEllipse(FloatRect(ellipse->cx().value(lengthContext) - rx, ellipse->cy().value(lengthContext) - ry, rx * 2, ry * 2));
+    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));
 }
 
 static void updatePathFromLineElement(SVGElement* element, Path& path)

Modified: trunk/Source/WebCore/svg/SVGCircleElement.cpp (172640 => 172641)


--- trunk/Source/WebCore/svg/SVGCircleElement.cpp	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/Source/WebCore/svg/SVGCircleElement.cpp	2014-08-15 19:38:10 UTC (rev 172641)
@@ -106,18 +106,20 @@
 
     SVGElementInstance::InvalidationGuard invalidationGuard(this);
 
-    bool isLengthAttribute = attrName == SVGNames::cxAttr
-                          || attrName == SVGNames::cyAttr
-                          || attrName == SVGNames::rAttr;
+    if (attrName == SVGNames::cxAttr
+        || attrName == SVGNames::cyAttr) {
+        invalidateSVGPresentationAttributeStyle();
+        return;
+    }
 
-    if (isLengthAttribute)
+    if (attrName == SVGNames::rAttr)
         updateRelativeLengthsInformation();
 
     RenderSVGShape* renderer = toRenderSVGShape(this->renderer());
     if (!renderer)
         return;
 
-    if (isLengthAttribute) {
+    if (attrName == SVGNames::rAttr) {
         renderer->setNeedsShapeUpdate();
         RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
         return;
@@ -131,13 +133,6 @@
     ASSERT_NOT_REACHED();
 }
 
-bool SVGCircleElement::selfHasRelativeLengths() const
-{
-    return cx().isRelative()
-        || cy().isRelative()
-        || r().isRelative();
-}
-
 RenderPtr<RenderElement> SVGCircleElement::createElementRenderer(PassRef<RenderStyle> style)
 {
     return createRenderer<RenderSVGEllipse>(*this, WTF::move(style));

Modified: trunk/Source/WebCore/svg/SVGCircleElement.h (172640 => 172641)


--- trunk/Source/WebCore/svg/SVGCircleElement.h	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/Source/WebCore/svg/SVGCircleElement.h	2014-08-15 19:38:10 UTC (rev 172641)
@@ -42,7 +42,7 @@
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
     virtual void svgAttributeChanged(const QualifiedName&) override;
 
-    virtual bool selfHasRelativeLengths() const override;
+    virtual bool selfHasRelativeLengths() const override { return true; }
 
     virtual RenderPtr<RenderElement> createElementRenderer(PassRef<RenderStyle>) override;
 

Modified: trunk/Source/WebCore/svg/SVGElement.cpp (172640 => 172641)


--- trunk/Source/WebCore/svg/SVGElement.cpp	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/Source/WebCore/svg/SVGElement.cpp	2014-08-15 19:38:10 UTC (rev 172641)
@@ -92,6 +92,8 @@
         &color_profileAttr,
         &color_renderingAttr,
         &cursorAttr,
+        &cxAttr,
+        &cyAttr,
         &SVGNames::directionAttr,
         &displayAttr,
         &dominant_baselineAttr,
@@ -244,6 +246,8 @@
     };
 
     static const TableEntry table[] = {
+        { cxAttr, AnimatedLength },
+        { cyAttr, AnimatedLength },
         { SVGNames::heightAttr, AnimatedLength },
         { SVGNames::widthAttr, AnimatedLength },
         { xAttr, AnimatedLength },

Modified: trunk/Source/WebCore/svg/SVGEllipseElement.cpp (172640 => 172641)


--- trunk/Source/WebCore/svg/SVGEllipseElement.cpp	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/Source/WebCore/svg/SVGEllipseElement.cpp	2014-08-15 19:38:10 UTC (rev 172641)
@@ -110,9 +110,13 @@
 
     SVGElementInstance::InvalidationGuard invalidationGuard(this);
 
-    bool isLengthAttribute = attrName == SVGNames::cxAttr
-                          || attrName == SVGNames::cyAttr
-                          || attrName == SVGNames::rxAttr
+    if (attrName == SVGNames::cxAttr
+        || attrName == SVGNames::cyAttr) {
+        invalidateSVGPresentationAttributeStyle();
+        return;
+    }
+
+    bool isLengthAttribute = attrName == SVGNames::rxAttr
                           || attrName == SVGNames::ryAttr;
 
     if (isLengthAttribute)
@@ -135,14 +139,6 @@
 
     ASSERT_NOT_REACHED();
 }
- 
-bool SVGEllipseElement::selfHasRelativeLengths() const
-{
-    return cx().isRelative()
-        || cy().isRelative()
-        || rx().isRelative()
-        || ry().isRelative();
-}
 
 RenderPtr<RenderElement> SVGEllipseElement::createElementRenderer(PassRef<RenderStyle> style)
 {

Modified: trunk/Source/WebCore/svg/SVGEllipseElement.h (172640 => 172641)


--- trunk/Source/WebCore/svg/SVGEllipseElement.h	2014-08-15 19:11:55 UTC (rev 172640)
+++ trunk/Source/WebCore/svg/SVGEllipseElement.h	2014-08-15 19:38:10 UTC (rev 172641)
@@ -42,7 +42,7 @@
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
     virtual void svgAttributeChanged(const QualifiedName&) override;
 
-    virtual bool selfHasRelativeLengths() const override;
+    virtual bool selfHasRelativeLengths() const override { return true; };
 
     virtual RenderPtr<RenderElement> createElementRenderer(PassRef<RenderStyle>) override;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to