Changeset 172642 in webkit
- Timestamp:
- Aug 15, 2014 12:42:38 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r172641 r172642 1 2014-08-15 Dirk Schulze <krit@webkit.org> 2 3 Turn r/rx/ry to presentation attributes 4 https://bugs.webkit.org/show_bug.cgi?id=135978 5 6 Reviewed by Dean Jackson. 7 8 This follows the patch for width and height presentation attributes and 9 turns r, rx and ry to presentation attributes as well: 10 11 http://trac.webkit.org/changeset/171341 12 13 * svg/css/parse-length.html: 14 * transitions/svg-layout-transition-expected.txt: 15 * transitions/svg-layout-transition.html: 16 1 17 2014-08-15 Dirk Schulze <krit@webkit.org> 2 18 -
trunk/LayoutTests/svg/css/parse-length.html
r172641 r172642 51 51 testComputed("cy", "-200px", "-200px"); 52 52 53 // Test 'r'. 54 testComputed("r", " 100", "100px"); 55 testComputed("r", "100 ", "100px"); 56 testComputed("r", "100px", "100px"); 57 testComputed("r", "1em", "16px"); 58 testComputed("r", "1ex", "12.800000190734863px"); 59 testComputed("r", "20%", "20%"); 60 testComputed("r", "-200px", "-200px"); 61 62 // Test 'rx'. 63 testComputed("rx", " 100", "100px"); 64 testComputed("rx", "100 ", "100px"); 65 testComputed("rx", "100px", "100px"); 66 testComputed("rx", "1em", "16px"); 67 testComputed("rx", "1ex", "12.800000190734863px"); 68 testComputed("rx", "20%", "20%"); 69 testComputed("rx", "-200px", "-200px"); 70 71 // Test 'ry'. 72 testComputed("ry", " 100", "100px"); 73 testComputed("ry", "100 ", "100px"); 74 testComputed("ry", "100px", "100px"); 75 testComputed("ry", "1em", "16px"); 76 testComputed("ry", "1ex", "12.800000190734863px"); 77 testComputed("ry", "20%", "20%"); 78 testComputed("ry", "-200px", "-200px"); 79 53 80 // Test 'width'. 54 81 testComputed("width", "auto", "auto"); … … 95 122 negativeTestZero("cy", "{ 100px }"); 96 123 124 // Negative tests for 'r'. 125 negativeTestZero("r", "auto", "auto"); 126 negativeTestZero("r", "100 px"); 127 negativeTestZero("r", "100px;"); 128 negativeTestZero("r", "100px !important"); 129 negativeTestZero("r", "{ 100px }"); 130 131 // Negative tests for 'rx'. 132 negativeTestZero("rx", "auto", "auto"); 133 negativeTestZero("rx", "100 px"); 134 negativeTestZero("rx", "100px;"); 135 negativeTestZero("rx", "100px !important"); 136 negativeTestZero("rx", "{ 100px }"); 137 138 // Negative tests for 'ry'. 139 negativeTestZero("ry", "auto"); 140 negativeTestZero("ry", "100 px"); 141 negativeTestZero("ry", "100px;"); 142 negativeTestZero("ry", "100px !important"); 143 negativeTestZero("ry", "{ 100px }"); 144 97 145 // Negative tests for 'width'. 98 146 negativeTest("width", "100 px"); -
trunk/LayoutTests/transitions/svg-layout-transition-expected.txt
r172641 r172642 1 1 PASS - "cx" property for "cx" element at 0.5s saw something close to: 150 2 2 PASS - "cy" property for "cy" element at 0.5s saw something close to: 150 3 PASS - "r" property for "r" element at 0.5s saw something close to: 150 4 PASS - "rx" property for "rx" element at 0.5s saw something close to: 150 5 PASS - "ry" property for "ry" element at 0.5s saw something close to: 150 3 6 PASS - "x" property for "x" element at 0.5s saw something close to: 150 4 7 PASS - "y" property for "y" element at 0.5s saw something close to: 150 -
trunk/LayoutTests/transitions/svg-layout-transition.html
r172641 r172642 22 22 cy: 200px; 23 23 } 24 24 25 #r { 26 -webkit-transition-property: r; 27 } 28 #r.final { 29 r: 200px; 30 } 31 32 #rx { 33 -webkit-transition-property: rx; 34 } 35 #rx.final { 36 rx: 200px; 37 } 38 39 #ry { 40 -webkit-transition-property: ry; 41 } 42 #ry.final { 43 ry: 200px; 44 } 45 25 46 #x { 26 47 -webkit-transition-property: x; … … 59 80 [0.5, 'cx', 'cx', 150, 20], 60 81 [0.5, 'cy', 'cy', 150, 20], 82 [0.5, 'r', 'r', 150, 20], 83 [0.5, 'rx', 'rx', 150, 20], 84 [0.5, 'ry', 'ry', 150, 20], 61 85 [0.5, 'x', 'x', 150, 20], 62 86 [0.5, 'y', 'y', 150, 20], … … 69 93 document.getElementById('cx').setAttribute('class', 'init final'); 70 94 document.getElementById('cy').setAttribute('class', 'init final'); 95 document.getElementById('r').setAttribute('class', 'init final'); 96 document.getElementById('rx').setAttribute('class', 'init final'); 97 document.getElementById('ry').setAttribute('class', 'init final'); 71 98 document.getElementById('x').setAttribute('class', 'init final'); 72 99 document.getElementById('y').setAttribute('class', 'init final'); … … 82 109 <circle cx="100" cy="100" r="100" class="init" id="cx"/> 83 110 <circle cx="100" cy="100" r="100" class="init" id="cy"/> 111 <circle cx="100" cy="100" r="100" class="init" id="r"/> 112 <ellipse cx="100" cy="100" rx="100" ry="100" class="init" id="rx"/> 113 <ellipse cx="100" cy="100" rx="100" ry="100" class="init" id="ry"/> 84 114 <rect x="100" y="100" width="100" height="100" class="init" id="x"/> 85 115 <rect x="100" y="100" width="100" height="100" class="init" id="y"/> -
trunk/Source/WebCore/ChangeLog
r172641 r172642 1 2014-08-15 Dirk Schulze <krit@webkit.org> 2 3 Turn r/rx/ry to presentation attributes 4 https://bugs.webkit.org/show_bug.cgi?id=135978 5 6 Reviewed by Dean Jackson. 7 8 This follows the patch for width and height presentation attributes and 9 turns rx, ry and r to presentation attributes as well: 10 11 http://trac.webkit.org/changeset/171341 12 13 Extended existing tests. 14 15 * css/CSSComputedStyleDeclaration.cpp: 16 (WebCore::ComputedStyleExtractor::propertyValue): 17 * css/CSSParser.cpp: 18 (WebCore::isSimpleLengthPropertyID): 19 * css/DeprecatedStyleBuilder.cpp: 20 (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder): 21 * css/SVGCSSParser.cpp: 22 (WebCore::CSSParser::parseSVGValue): 23 * css/SVGCSSPropertyNames.in: 24 * page/animation/CSSPropertyAnimation.cpp: 25 (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): 26 * rendering/style/RenderStyle.h: 27 * rendering/style/SVGRenderStyle.h: 28 (WebCore::SVGRenderStyle::setR): 29 (WebCore::SVGRenderStyle::setRx): 30 (WebCore::SVGRenderStyle::setRy): 31 (WebCore::SVGRenderStyle::r): 32 (WebCore::SVGRenderStyle::rx): 33 (WebCore::SVGRenderStyle::ry): 34 * rendering/style/SVGRenderStyleDefs.cpp: 35 (WebCore::StyleLayoutData::StyleLayoutData): 36 (WebCore::StyleLayoutData::operator==): 37 * rendering/style/SVGRenderStyleDefs.h: 38 * rendering/svg/RenderSVGEllipse.cpp: 39 (WebCore::RenderSVGEllipse::calculateRadiiAndCenter): 40 * rendering/svg/SVGPathData.cpp: 41 (WebCore::updatePathFromCircleElement): 42 (WebCore::updatePathFromEllipseElement): 43 (WebCore::updatePathFromRectElement): 44 (WebCore::updatePathFromLineElement): Deleted. 45 * svg/SVGCircleElement.cpp: 46 (WebCore::SVGCircleElement::svgAttributeChanged): 47 * svg/SVGElement.cpp: 48 (WebCore::populateAttributeNameToCSSPropertyIDMap): 49 (WebCore::populateCSSPropertyWithSVGDOMNameToAnimatedPropertyTypeMap): 50 * svg/SVGEllipseElement.cpp: 51 (WebCore::SVGEllipseElement::svgAttributeChanged): 52 * svg/SVGRectElement.cpp: 53 (WebCore::SVGRectElement::svgAttributeChanged): 54 1 55 2014-08-15 Dirk Schulze <krit@webkit.org> 2 56 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r172641 r172642 425 425 CSSPropertyMaskType, 426 426 CSSPropertyPaintOrder, 427 CSSPropertyR, 428 CSSPropertyRx, 429 CSSPropertyRy, 427 430 CSSPropertyShapeRendering, 428 431 CSSPropertyStroke, … … 2973 2976 case CSSPropertyCy: 2974 2977 return zoomAdjustedPixelValueForLength(style->svgStyle().cy(), style.get()); 2978 case CSSPropertyR: 2979 return zoomAdjustedPixelValueForLength(style->svgStyle().r(), style.get()); 2980 case CSSPropertyRx: 2981 return zoomAdjustedPixelValueForLength(style->svgStyle().rx(), style.get()); 2982 case CSSPropertyRy: 2983 return zoomAdjustedPixelValueForLength(style->svgStyle().ry(), style.get()); 2975 2984 case CSSPropertyX: 2976 2985 return zoomAdjustedPixelValueForLength(style->svgStyle().x(), style.get()); -
trunk/Source/WebCore/css/CSSParser.cpp
r172641 r172642 570 570 case CSSPropertyMarginRight: 571 571 case CSSPropertyMarginTop: 572 case CSSPropertyR: 573 case CSSPropertyRx: 574 case CSSPropertyRy: 572 575 case CSSPropertyRight: 573 576 case CSSPropertyTop: -
trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp
r172641 r172642 2597 2597 setPropertyHandler(CSSPropertyCx, ApplyPropertyLength<&RenderStyle::cx, &RenderStyle::setCx, &RenderStyle::initialZeroLength>::createHandler()); 2598 2598 setPropertyHandler(CSSPropertyCy, ApplyPropertyLength<&RenderStyle::cy, &RenderStyle::setCy, &RenderStyle::initialZeroLength>::createHandler()); 2599 setPropertyHandler(CSSPropertyR, ApplyPropertyLength<&RenderStyle::r, &RenderStyle::setR, &RenderStyle::initialZeroLength>::createHandler()); 2600 setPropertyHandler(CSSPropertyRx, ApplyPropertyLength<&RenderStyle::rx, &RenderStyle::setRx, &RenderStyle::initialZeroLength>::createHandler()); 2601 setPropertyHandler(CSSPropertyRy, ApplyPropertyLength<&RenderStyle::ry, &RenderStyle::setRy, &RenderStyle::initialZeroLength>::createHandler()); 2599 2602 setPropertyHandler(CSSPropertyX, ApplyPropertyLength<&RenderStyle::x, &RenderStyle::setX, &RenderStyle::initialZeroLength>::createHandler()); 2600 2603 setPropertyHandler(CSSPropertyY, ApplyPropertyLength<&RenderStyle::y, &RenderStyle::setY, &RenderStyle::initialZeroLength>::createHandler()); -
trunk/Source/WebCore/css/SVGCSSParser.cpp
r172641 r172642 302 302 case CSSPropertyCx: 303 303 case CSSPropertyCy: 304 case CSSPropertyR: 305 case CSSPropertyRx: 306 case CSSPropertyRy: 304 307 case CSSPropertyX: 305 308 case CSSPropertyY: -
trunk/Source/WebCore/css/SVGCSSPropertyNames.in
r172641 r172642 55 55 cx 56 56 cy 57 r 58 rx 59 ry 57 60 x 58 61 y -
trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp
r172641 r172642 1259 1259 new LengthPropertyWrapper<Length>(CSSPropertyCx, &RenderStyle::cx, &RenderStyle::setCx), 1260 1260 new LengthPropertyWrapper<Length>(CSSPropertyCy, &RenderStyle::cy, &RenderStyle::setCy), 1261 new LengthPropertyWrapper<Length>(CSSPropertyR, &RenderStyle::r, &RenderStyle::setR), 1262 new LengthPropertyWrapper<Length>(CSSPropertyRx, &RenderStyle::rx, &RenderStyle::setRx), 1263 new LengthPropertyWrapper<Length>(CSSPropertyRy, &RenderStyle::ry, &RenderStyle::setRy), 1261 1264 new LengthPropertyWrapper<Length>(CSSPropertyX, &RenderStyle::x, &RenderStyle::setX), 1262 1265 new LengthPropertyWrapper<Length>(CSSPropertyY, &RenderStyle::y, &RenderStyle::setY), -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r172641 r172642 1670 1670 const Length& cy() const { return svgStyle().cy(); } 1671 1671 void setCy(Length cy) { accessSVGStyle().setCy(cy); } 1672 const Length& r() const { return svgStyle().r(); } 1673 void setR(Length r) { accessSVGStyle().setR(r); } 1674 const Length& rx() const { return svgStyle().rx(); } 1675 void setRx(Length rx) { accessSVGStyle().setRx(rx); } 1676 const Length& ry() const { return svgStyle().ry(); } 1677 void setRy(Length ry) { accessSVGStyle().setRy(ry); } 1672 1678 const Length& x() const { return svgStyle().x(); } 1673 1679 void setX(Length x) { accessSVGStyle().setX(x); } -
trunk/Source/WebCore/rendering/style/SVGRenderStyle.h
r172641 r172642 157 157 layout.access()->cy = obj; 158 158 } 159 void setR(const Length& obj) 160 { 161 if (!(layout->r == obj)) 162 layout.access()->r = obj; 163 } 164 void setRx(const Length& obj) 165 { 166 if (!(layout->rx == obj)) 167 layout.access()->rx = obj; 168 } 169 void setRy(const Length& obj) 170 { 171 if (!(layout->ry == obj)) 172 layout.access()->ry = obj; 173 } 159 174 void setX(const Length& obj) 160 175 { … … 366 381 const Length& cx() const { return layout->cx; } 367 382 const Length& cy() const { return layout->cy; } 383 const Length& r() const { return layout->r; } 384 const Length& rx() const { return layout->rx; } 385 const Length& ry() const { return layout->ry; } 368 386 const Length& x() const { return layout->x; } 369 387 const Length& y() const { return layout->y; } -
trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp
r172641 r172642 281 281 : cx(RenderStyle::initialZeroLength()) 282 282 , cy(RenderStyle::initialZeroLength()) 283 , r(RenderStyle::initialZeroLength()) 284 , rx(RenderStyle::initialZeroLength()) 285 , ry(RenderStyle::initialZeroLength()) 283 286 , x(RenderStyle::initialZeroLength()) 284 287 , y(RenderStyle::initialZeroLength()) … … 290 293 , cx(other.cx) 291 294 , cy(other.cy) 295 , r(other.r) 296 , rx(other.rx) 297 , ry(other.ry) 292 298 , x(other.x) 293 299 , y(other.y) … … 304 310 return cx == other.cx 305 311 && cy == other.cy 312 && r == other.r 313 && rx == other.rx 314 && ry == other.ry 306 315 && x == other.x 307 316 && y == other.y; -
trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.h
r172641 r172642 305 305 Length cx; 306 306 Length cy; 307 Length r; 308 Length rx; 309 Length ry; 307 310 Length x; 308 311 Length y; -
trunk/Source/WebCore/rendering/svg/RenderSVGEllipse.cpp
r172641 r172642 83 83 lengthContext.valueForLength(style().svgStyle().cy(), LengthModeHeight)); 84 84 if (isSVGCircleElement(graphicsElement())) { 85 SVGCircleElement& circle = toSVGCircleElement(graphicsElement()); 86 SVGLengthContext lengthContext(&circle); 87 float radius = circle.r().value(lengthContext); 85 float radius = lengthContext.valueForLength(style().svgStyle().r()); 88 86 m_radii = FloatSize(radius, radius); 89 87 return; … … 91 89 92 90 ASSERT(isSVGEllipseElement(graphicsElement())); 93 SVGEllipseElement& ellipse = toSVGEllipseElement(graphicsElement()); 94 m_radii = FloatSize(ellipse.rx().value(lengthContext), ellipse.ry().value(lengthContext)); 91 m_radii = FloatSize(lengthContext.valueForLength(style().svgStyle().rx()), lengthContext.valueForLength(style().svgStyle().ry())); 95 92 } 96 93 -
trunk/Source/WebCore/rendering/svg/SVGPathData.cpp
r172641 r172642 41 41 { 42 42 ASSERT(isSVGCircleElement(element)); 43 SVGCircleElement* circle = toSVGCircleElement(element);44 43 45 44 SVGLengthContext lengthContext(element); 46 float r = circle->r().value(lengthContext); 45 RenderElement* renderer = element->renderer(); 46 if (!renderer) 47 return; 48 RenderStyle& style = renderer->style(); 49 float r = lengthContext.valueForLength(style.svgStyle().r()); 47 50 if (r > 0) { 48 RenderElement* renderer = circle->renderer();49 if (!renderer)50 return;51 RenderStyle& style = renderer->style();52 51 float cx = lengthContext.valueForLength(style.svgStyle().cx(), LengthModeWidth); 53 52 float cy = lengthContext.valueForLength(style.svgStyle().cy(), LengthModeHeight); … … 58 57 static void updatePathFromEllipseElement(SVGElement* element, Path& path) 59 58 { 60 SVGEllipseElement* ellipse = toSVGEllipseElement(element); 61 62 SVGLengthContext lengthContext(element); 63 float rx = ellipse->rx().value(lengthContext); 64 if (rx <= 0) 65 return; 66 float ry = ellipse->ry().value(lengthContext); 67 if (ry <= 0) 68 return; 69 RenderElement* renderer = ellipse->renderer(); 59 RenderElement* renderer = element->renderer(); 70 60 if (!renderer) 71 61 return; 72 62 RenderStyle& style = renderer->style(); 63 SVGLengthContext lengthContext(element); 64 float rx = lengthContext.valueForLength(style.svgStyle().rx(), LengthModeWidth); 65 if (rx <= 0) 66 return; 67 float ry = lengthContext.valueForLength(style.svgStyle().ry(), LengthModeHeight); 68 if (ry <= 0) 69 return; 73 70 float cx = lengthContext.valueForLength(style.svgStyle().cx(), LengthModeWidth); 74 71 float cy = lengthContext.valueForLength(style.svgStyle().cy(), LengthModeHeight); … … 120 117 static void updatePathFromRectElement(SVGElement* element, Path& path) 121 118 { 122 SVGRectElement* rect = toSVGRectElement(element); 123 RenderElement* renderer = rect->renderer(); 119 RenderElement* renderer = element->renderer(); 124 120 if (!renderer) 125 121 return; … … 135 131 float x = lengthContext.valueForLength(style.svgStyle().x(), LengthModeWidth); 136 132 float y = lengthContext.valueForLength(style.svgStyle().y(), LengthModeHeight); 137 float rx = rect->rx().value(lengthContext);138 float ry = rect->ry().value(lengthContext);133 float rx = lengthContext.valueForLength(style.svgStyle().rx(), LengthModeWidth); 134 float ry = lengthContext.valueForLength(style.svgStyle().ry(), LengthModeHeight); 139 135 bool hasRx = rx > 0; 140 136 bool hasRy = ry > 0; -
trunk/Source/WebCore/svg/SVGCircleElement.cpp
r172641 r172642 108 108 109 109 if (attrName == SVGNames::cxAttr 110 || attrName == SVGNames::cyAttr) { 110 || attrName == SVGNames::cyAttr 111 || attrName == SVGNames::rAttr) { 111 112 invalidateSVGPresentationAttributeStyle(); 112 113 return; 113 114 } 114 115 115 if (attrName == SVGNames::rAttr)116 updateRelativeLengthsInformation();117 118 116 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); 119 117 if (!renderer) 120 118 return; 121 122 if (attrName == SVGNames::rAttr) {123 renderer->setNeedsShapeUpdate();124 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);125 return;126 }127 119 128 120 if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { -
trunk/Source/WebCore/svg/SVGElement.cpp
r172641 r172642 127 127 &paint_orderAttr, 128 128 &pointer_eventsAttr, 129 &rAttr, 130 &rxAttr, 131 &ryAttr, 129 132 &shape_renderingAttr, 130 133 &stop_colorAttr, … … 249 252 { cxAttr, AnimatedLength }, 250 253 { cyAttr, AnimatedLength }, 254 { rAttr, AnimatedLength }, 255 { rxAttr, AnimatedLength }, 256 { ryAttr, AnimatedLength }, 251 257 { SVGNames::heightAttr, AnimatedLength }, 252 258 { SVGNames::widthAttr, AnimatedLength }, -
trunk/Source/WebCore/svg/SVGEllipseElement.cpp
r172641 r172642 112 112 113 113 if (attrName == SVGNames::cxAttr 114 || attrName == SVGNames::cyAttr) { 114 || attrName == SVGNames::cyAttr 115 || attrName == SVGNames::rxAttr 116 || attrName == SVGNames::ryAttr) { 115 117 invalidateSVGPresentationAttributeStyle(); 116 118 return; 117 119 } 118 120 119 bool isLengthAttribute = attrName == SVGNames::rxAttr120 || attrName == SVGNames::ryAttr;121 122 if (isLengthAttribute)123 updateRelativeLengthsInformation();124 125 121 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); 126 122 if (!renderer) 127 123 return; 128 129 if (isLengthAttribute) {130 renderer->setNeedsShapeUpdate();131 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);132 return;133 }134 124 135 125 if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { -
trunk/Source/WebCore/svg/SVGRectElement.cpp
r171591 r172642 126 126 || attrName == SVGNames::yAttr 127 127 || attrName == SVGNames::widthAttr 128 || attrName == SVGNames::heightAttr) { 128 || attrName == SVGNames::heightAttr 129 || attrName == SVGNames::rxAttr 130 || attrName == SVGNames::ryAttr) { 129 131 invalidateSVGPresentationAttributeStyle(); 130 132 return; 131 133 } 132 134 133 bool isLengthAttribute = attrName == SVGNames::rxAttr134 || attrName == SVGNames::ryAttr;135 136 if (isLengthAttribute)137 updateRelativeLengthsInformation();138 139 135 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); 140 136 if (!renderer) 141 137 return; 142 143 if (isLengthAttribute) {144 renderer->setNeedsShapeUpdate();145 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);146 return;147 }148 138 149 139 if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) {
Note: See TracChangeset
for help on using the changeset viewer.