Changeset 172641 in webkit
- Timestamp:
- Aug 15, 2014 12:38:10 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r172619 r172641 1 2014-08-15 Dirk Schulze <krit@webkit.org> 2 3 Turn cx/cy to presentation attributes 4 https://bugs.webkit.org/show_bug.cgi?id=135975 5 6 Reviewed by Dean Jackson. 7 8 This follows the patch for width and height presentation attributes and 9 turns cx and cy to presentation attributes as well: 10 11 http://trac.webkit.org/changeset/171341 12 13 * svg/css/parse-length-expected.txt: 14 * svg/css/parse-length.html: 15 * transitions/svg-layout-transition-expected.txt: 16 * transitions/svg-layout-transition.html: 17 1 18 2014-08-14 Benjamin Poulain <benjamin@webkit.org> 2 19 -
trunk/LayoutTests/svg/css/parse-length-expected.txt
r171592 r172641 26 26 27 27 28 PASS computedStyle("cx", " 100") is "100px" 29 PASS computedStyle("cx", "100 ") is "100px" 30 PASS computedStyle("cx", "100px") is "100px" 31 PASS computedStyle("cx", "1em") is "16px" 32 PASS computedStyle("cx", "1ex") is "12.800000190734863px" 33 PASS computedStyle("cx", "20%") is "20%" 34 PASS computedStyle("cx", "-200px") is "-200px" 35 PASS computedStyle("cy", " 100") is "100px" 36 PASS computedStyle("cy", "100 ") is "100px" 37 PASS computedStyle("cy", "100px") is "100px" 38 PASS computedStyle("cy", "1em") is "16px" 39 PASS computedStyle("cy", "1ex") is "12.800000190734863px" 40 PASS computedStyle("cy", "20%") is "20%" 41 PASS computedStyle("cy", "-200px") is "-200px" 28 42 PASS computedStyle("width", "auto") is "auto" 29 43 PASS computedStyle("width", " 100") is "100px" … … 47 61 PASS computedStyle("y", "20%") is "20%" 48 62 PASS computedStyle("y", "-200px") is "-200px" 63 PASS computedStyle("cx", "auto") is "0px" 64 PASS computedStyle("cx", "100 px") is "0px" 65 PASS computedStyle("cx", "100px;") is "0px" 66 PASS computedStyle("cx", "100px !important") is "0px" 67 PASS computedStyle("cx", "{ 100px }") is "0px" 68 PASS computedStyle("cy", "auto") is "0px" 69 PASS computedStyle("cy", "100 px") is "0px" 70 PASS computedStyle("cy", "100px;") is "0px" 71 PASS computedStyle("cy", "100px !important") is "0px" 72 PASS computedStyle("cy", "{ 100px }") is "0px" 49 73 PASS computedStyle("width", "100 px") is "auto" 50 74 PASS computedStyle("width", "100px;") is "auto" -
trunk/LayoutTests/svg/css/parse-length.html
r171591 r172641 33 33 } 34 34 35 // Test 'cx'. 36 testComputed("cx", " 100", "100px"); 37 testComputed("cx", "100 ", "100px"); 38 testComputed("cx", "100px", "100px"); 39 testComputed("cx", "1em", "16px"); 40 testComputed("cx", "1ex", "12.800000190734863px"); 41 testComputed("cx", "20%", "20%"); 42 testComputed("cx", "-200px", "-200px"); 43 44 // Test 'cx'. 45 testComputed("cy", " 100", "100px"); 46 testComputed("cy", "100 ", "100px"); 47 testComputed("cy", "100px", "100px"); 48 testComputed("cy", "1em", "16px"); 49 testComputed("cy", "1ex", "12.800000190734863px"); 50 testComputed("cy", "20%", "20%"); 51 testComputed("cy", "-200px", "-200px"); 52 35 53 // Test 'width'. 36 54 testComputed("width", "auto", "auto"); … … 63 81 testComputed("y", "-200px", "-200px"); 64 82 83 // Negative tests for 'cx'. 84 negativeTestZero("cx", "auto", "auto"); 85 negativeTestZero("cx", "100 px"); 86 negativeTestZero("cx", "100px;"); 87 negativeTestZero("cx", "100px !important"); 88 negativeTestZero("cx", "{ 100px }"); 89 90 // Negative tests for 'cy'. 91 negativeTestZero("cy", "auto"); 92 negativeTestZero("cy", "100 px"); 93 negativeTestZero("cy", "100px;"); 94 negativeTestZero("cy", "100px !important"); 95 negativeTestZero("cy", "{ 100px }"); 96 65 97 // Negative tests for 'width'. 66 98 negativeTest("width", "100 px"); -
trunk/LayoutTests/transitions/svg-layout-transition-expected.txt
r171591 r172641 1 PASS - "cx" property for "cx" element at 0.5s saw something close to: 150 2 PASS - "cy" property for "cy" element at 0.5s saw something close to: 150 1 3 PASS - "x" property for "x" element at 0.5s saw something close to: 150 2 4 PASS - "y" property for "y" element at 0.5s saw something close to: 150 -
trunk/LayoutTests/transitions/svg-layout-transition.html
r171591 r172641 7 7 -webkit-transition-duration: 1s; 8 8 -webkit-transition-timing-function: linear; 9 } 10 11 #cx { 12 -webkit-transition-property: cx; 13 } 14 #cx.final { 15 cx: 200px; 16 } 17 18 #cy { 19 -webkit-transition-property: cy; 20 } 21 #cy.final { 22 cy: 200px; 9 23 } 10 24 … … 43 57 const expectedValues = [ 44 58 // [time, element-id, property, expected-value, tolerance] 59 [0.5, 'cx', 'cx', 150, 20], 60 [0.5, 'cy', 'cy', 150, 20], 45 61 [0.5, 'x', 'x', 150, 20], 46 62 [0.5, 'y', 'y', 150, 20], … … 51 67 function setupTest() 52 68 { 69 document.getElementById('cx').setAttribute('class', 'init final'); 70 document.getElementById('cy').setAttribute('class', 'init final'); 53 71 document.getElementById('x').setAttribute('class', 'init final'); 54 72 document.getElementById('y').setAttribute('class', 'init final'); … … 62 80 <body> 63 81 <svg> 82 <circle cx="100" cy="100" r="100" class="init" id="cx"/> 83 <circle cx="100" cy="100" r="100" class="init" id="cy"/> 64 84 <rect x="100" y="100" width="100" height="100" class="init" id="x"/> 65 85 <rect x="100" y="100" width="100" height="100" class="init" id="y"/> -
trunk/Source/WebCore/ChangeLog
r172626 r172641 1 2014-08-15 Dirk Schulze <krit@webkit.org> 2 3 Turn cx/cy to presentation attributes 4 https://bugs.webkit.org/show_bug.cgi?id=135975 5 6 Reviewed by Dean Jackson. 7 8 This follows the patch for width and height presentation attributes and 9 turns x and y 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::setCx): 29 (WebCore::SVGRenderStyle::setCy): 30 (WebCore::SVGRenderStyle::cx): 31 (WebCore::SVGRenderStyle::cy): 32 * rendering/style/SVGRenderStyleDefs.cpp: 33 (WebCore::StyleLayoutData::StyleLayoutData): 34 (WebCore::StyleLayoutData::operator==): 35 * rendering/style/SVGRenderStyleDefs.h: 36 * rendering/svg/RenderSVGEllipse.cpp: 37 (WebCore::RenderSVGEllipse::calculateRadiiAndCenter): 38 * rendering/svg/SVGPathData.cpp: 39 (WebCore::updatePathFromCircleElement): 40 (WebCore::updatePathFromEllipseElement): 41 * svg/SVGCircleElement.cpp: 42 (WebCore::SVGCircleElement::svgAttributeChanged): 43 (WebCore::SVGCircleElement::selfHasRelativeLengths): Deleted. 44 * svg/SVGCircleElement.h: 45 * svg/SVGElement.cpp: 46 (WebCore::populateAttributeNameToCSSPropertyIDMap): 47 (WebCore::populateCSSPropertyWithSVGDOMNameToAnimatedPropertyTypeMap): 48 * svg/SVGEllipseElement.cpp: 49 (WebCore::SVGEllipseElement::svgAttributeChanged): 50 (WebCore::SVGEllipseElement::selfHasRelativeLengths): Deleted. 51 * svg/SVGEllipseElement.h: 52 1 53 2014-08-15 Adenilson Cavalcanti <cavalcantii@gmail.com> 2 54 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r172536 r172641 405 405 CSSPropertyClipPath, 406 406 CSSPropertyClipRule, 407 CSSPropertyCx, 408 CSSPropertyCy, 407 409 CSSPropertyMask, 408 410 CSSPropertyFilter, … … 2967 2969 2968 2970 // New positioning properties for SVG. 2971 case CSSPropertyCx: 2972 return zoomAdjustedPixelValueForLength(style->svgStyle().cx(), style.get()); 2973 case CSSPropertyCy: 2974 return zoomAdjustedPixelValueForLength(style->svgStyle().cy(), style.get()); 2969 2975 case CSSPropertyX: 2970 2976 return zoomAdjustedPixelValueForLength(style->svgStyle().x(), style.get()); -
trunk/Source/WebCore/css/CSSParser.cpp
r172536 r172641 563 563 #endif 564 564 case CSSPropertyBottom: 565 case CSSPropertyCx: 566 case CSSPropertyCy: 565 567 case CSSPropertyLeft: 566 568 case CSSPropertyMarginBottom: -
trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp
r171871 r172641 2595 2595 setPropertyHandler(CSSPropertyWordWrap, ApplyPropertyDefault<EOverflowWrap, &RenderStyle::overflowWrap, EOverflowWrap, &RenderStyle::setOverflowWrap, EOverflowWrap, &RenderStyle::initialOverflowWrap>::createHandler()); 2596 2596 2597 setPropertyHandler(CSSPropertyCx, ApplyPropertyLength<&RenderStyle::cx, &RenderStyle::setCx, &RenderStyle::initialZeroLength>::createHandler()); 2598 setPropertyHandler(CSSPropertyCy, ApplyPropertyLength<&RenderStyle::cy, &RenderStyle::setCy, &RenderStyle::initialZeroLength>::createHandler()); 2597 2599 setPropertyHandler(CSSPropertyX, ApplyPropertyLength<&RenderStyle::x, &RenderStyle::setX, &RenderStyle::initialZeroLength>::createHandler()); 2598 2600 setPropertyHandler(CSSPropertyY, ApplyPropertyLength<&RenderStyle::y, &RenderStyle::setY, &RenderStyle::initialZeroLength>::createHandler()); -
trunk/Source/WebCore/css/SVGCSSParser.cpp
r172536 r172641 300 300 return true; 301 301 } 302 case CSSPropertyCx: 303 case CSSPropertyCy: 302 304 case CSSPropertyX: 303 305 case CSSPropertyY: -
trunk/Source/WebCore/css/SVGCSSPropertyNames.in
r171591 r172641 53 53 -webkit-svg-shadow 54 54 55 cx 56 cy 55 57 x 56 58 y -
trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp
r171960 r172641 1257 1257 new PropertyWrapper<float>(CSSPropertyStrokeMiterlimit, &RenderStyle::strokeMiterLimit, &RenderStyle::setStrokeMiterLimit), 1258 1258 1259 new LengthPropertyWrapper<Length>(CSSPropertyCx, &RenderStyle::cx, &RenderStyle::setCx), 1260 new LengthPropertyWrapper<Length>(CSSPropertyCy, &RenderStyle::cy, &RenderStyle::setCy), 1259 1261 new LengthPropertyWrapper<Length>(CSSPropertyX, &RenderStyle::x, &RenderStyle::setX), 1260 1262 new LengthPropertyWrapper<Length>(CSSPropertyY, &RenderStyle::y, &RenderStyle::setY), -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r172192 r172641 1666 1666 void setStrokeMiterLimit(float f) { accessSVGStyle().setStrokeMiterLimit(f); } 1667 1667 1668 const Length& cx() const { return svgStyle().cx(); } 1669 void setCx(Length cx) { accessSVGStyle().setCx(cx); } 1670 const Length& cy() const { return svgStyle().cy(); } 1671 void setCy(Length cy) { accessSVGStyle().setCy(cy); } 1668 1672 const Length& x() const { return svgStyle().x(); } 1669 1673 void setX(Length x) { accessSVGStyle().setX(x); } -
trunk/Source/WebCore/rendering/style/SVGRenderStyle.h
r171591 r172641 147 147 void setMaskType(EMaskType val) { svg_noninherited_flags.f.maskType = val; } 148 148 void setPaintOrder(PaintOrder val) { svg_inherited_flags.paintOrder = val; } 149 void setCx(const Length& obj) 150 { 151 if (!(layout->cx == obj)) 152 layout.access()->cx = obj; 153 } 154 void setCy(const Length& obj) 155 { 156 if (!(layout->cy == obj)) 157 layout.access()->cy = obj; 158 } 149 159 void setX(const Length& obj) 150 160 { … … 354 364 SVGLength baselineShiftValue() const { return misc->baselineShiftValue; } 355 365 ShadowData* shadow() const { return shadowSVG->shadow.get(); } 366 const Length& cx() const { return layout->cx; } 367 const Length& cy() const { return layout->cy; } 356 368 const Length& x() const { return layout->x; } 357 369 const Length& y() const { return layout->y; } -
trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp
r171591 r172641 279 279 280 280 StyleLayoutData::StyleLayoutData() 281 : x(RenderStyle::initialZeroLength()) 281 : cx(RenderStyle::initialZeroLength()) 282 , cy(RenderStyle::initialZeroLength()) 283 , x(RenderStyle::initialZeroLength()) 282 284 , y(RenderStyle::initialZeroLength()) 283 285 { … … 286 288 inline StyleLayoutData::StyleLayoutData(const StyleLayoutData& other) 287 289 : RefCounted<StyleLayoutData>() 290 , cx(other.cx) 291 , cy(other.cy) 288 292 , x(other.x) 289 293 , y(other.y) … … 298 302 bool StyleLayoutData::operator==(const StyleLayoutData& other) const 299 303 { 300 return x == other.x 304 return cx == other.cx 305 && cy == other.cy 306 && x == other.x 301 307 && y == other.y; 302 308 } -
trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.h
r171591 r172641 303 303 } 304 304 305 Length cx; 306 Length cy; 305 307 Length x; 306 308 Length y; -
trunk/Source/WebCore/rendering/svg/RenderSVGEllipse.cpp
r171046 r172641 78 78 void RenderSVGEllipse::calculateRadiiAndCenter() 79 79 { 80 SVGLengthContext lengthContext(&graphicsElement()); 81 m_center = FloatPoint( 82 lengthContext.valueForLength(style().svgStyle().cx(), LengthModeWidth), 83 lengthContext.valueForLength(style().svgStyle().cy(), LengthModeHeight)); 80 84 if (isSVGCircleElement(graphicsElement())) { 81 85 SVGCircleElement& circle = toSVGCircleElement(graphicsElement()); … … 83 87 float radius = circle.r().value(lengthContext); 84 88 m_radii = FloatSize(radius, radius); 85 m_center = FloatPoint(circle.cx().value(lengthContext), circle.cy().value(lengthContext));86 89 return; 87 90 } … … 89 92 ASSERT(isSVGEllipseElement(graphicsElement())); 90 93 SVGEllipseElement& ellipse = toSVGEllipseElement(graphicsElement()); 91 92 SVGLengthContext lengthContext(&ellipse);93 94 m_radii = FloatSize(ellipse.rx().value(lengthContext), ellipse.ry().value(lengthContext)); 94 m_center = FloatPoint(ellipse.cx().value(lengthContext), ellipse.cy().value(lengthContext));95 95 } 96 96 -
trunk/Source/WebCore/rendering/svg/SVGPathData.cpp
r171591 r172641 45 45 SVGLengthContext lengthContext(element); 46 46 float r = circle->r().value(lengthContext); 47 if (r > 0) 48 path.addEllipse(FloatRect(circle->cx().value(lengthContext) - r, circle->cy().value(lengthContext) - r, r * 2, r * 2)); 47 if (r > 0) { 48 RenderElement* renderer = circle->renderer(); 49 if (!renderer) 50 return; 51 RenderStyle& style = renderer->style(); 52 float cx = lengthContext.valueForLength(style.svgStyle().cx(), LengthModeWidth); 53 float cy = lengthContext.valueForLength(style.svgStyle().cy(), LengthModeHeight); 54 path.addEllipse(FloatRect(cx - r, cy - r, r * 2, r * 2)); 55 } 49 56 } 50 57 … … 60 67 if (ry <= 0) 61 68 return; 62 path.addEllipse(FloatRect(ellipse->cx().value(lengthContext) - rx, ellipse->cy().value(lengthContext) - ry, rx * 2, ry * 2)); 69 RenderElement* renderer = ellipse->renderer(); 70 if (!renderer) 71 return; 72 RenderStyle& style = renderer->style(); 73 float cx = lengthContext.valueForLength(style.svgStyle().cx(), LengthModeWidth); 74 float cy = lengthContext.valueForLength(style.svgStyle().cy(), LengthModeHeight); 75 path.addEllipse(FloatRect(cx - rx, cy - ry, rx * 2, ry * 2)); 63 76 } 64 77 -
trunk/Source/WebCore/svg/SVGCircleElement.cpp
r170774 r172641 107 107 SVGElementInstance::InvalidationGuard invalidationGuard(this); 108 108 109 bool isLengthAttribute = attrName == SVGNames::cxAttr 110 || attrName == SVGNames::cyAttr 111 || attrName == SVGNames::rAttr; 109 if (attrName == SVGNames::cxAttr 110 || attrName == SVGNames::cyAttr) { 111 invalidateSVGPresentationAttributeStyle(); 112 return; 113 } 112 114 113 if ( isLengthAttribute)115 if (attrName == SVGNames::rAttr) 114 116 updateRelativeLengthsInformation(); 115 117 … … 118 120 return; 119 121 120 if ( isLengthAttribute) {122 if (attrName == SVGNames::rAttr) { 121 123 renderer->setNeedsShapeUpdate(); 122 124 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); … … 132 134 } 133 135 134 bool SVGCircleElement::selfHasRelativeLengths() const135 {136 return cx().isRelative()137 || cy().isRelative()138 || r().isRelative();139 }140 141 136 RenderPtr<RenderElement> SVGCircleElement::createElementRenderer(PassRef<RenderStyle> style) 142 137 { -
trunk/Source/WebCore/svg/SVGCircleElement.h
r168313 r172641 43 43 virtual void svgAttributeChanged(const QualifiedName&) override; 44 44 45 virtual bool selfHasRelativeLengths() const override ;45 virtual bool selfHasRelativeLengths() const override { return true; } 46 46 47 47 virtual RenderPtr<RenderElement> createElementRenderer(PassRef<RenderStyle>) override; -
trunk/Source/WebCore/svg/SVGElement.cpp
r171591 r172641 93 93 &color_renderingAttr, 94 94 &cursorAttr, 95 &cxAttr, 96 &cyAttr, 95 97 &SVGNames::directionAttr, 96 98 &displayAttr, … … 245 247 246 248 static const TableEntry table[] = { 249 { cxAttr, AnimatedLength }, 250 { cyAttr, AnimatedLength }, 247 251 { SVGNames::heightAttr, AnimatedLength }, 248 252 { SVGNames::widthAttr, AnimatedLength }, -
trunk/Source/WebCore/svg/SVGEllipseElement.cpp
r170774 r172641 111 111 SVGElementInstance::InvalidationGuard invalidationGuard(this); 112 112 113 bool isLengthAttribute = attrName == SVGNames::cxAttr 114 || attrName == SVGNames::cyAttr 115 || attrName == SVGNames::rxAttr 113 if (attrName == SVGNames::cxAttr 114 || attrName == SVGNames::cyAttr) { 115 invalidateSVGPresentationAttributeStyle(); 116 return; 117 } 118 119 bool isLengthAttribute = attrName == SVGNames::rxAttr 116 120 || attrName == SVGNames::ryAttr; 117 121 … … 136 140 ASSERT_NOT_REACHED(); 137 141 } 138 139 bool SVGEllipseElement::selfHasRelativeLengths() const140 {141 return cx().isRelative()142 || cy().isRelative()143 || rx().isRelative()144 || ry().isRelative();145 }146 142 147 143 RenderPtr<RenderElement> SVGEllipseElement::createElementRenderer(PassRef<RenderStyle> style) -
trunk/Source/WebCore/svg/SVGEllipseElement.h
r168313 r172641 43 43 virtual void svgAttributeChanged(const QualifiedName&) override; 44 44 45 virtual bool selfHasRelativeLengths() const override ;45 virtual bool selfHasRelativeLengths() const override { return true; }; 46 46 47 47 virtual RenderPtr<RenderElement> createElementRenderer(PassRef<RenderStyle>) override;
Note: See TracChangeset
for help on using the changeset viewer.