Changeset 172711 in webkit
- Timestamp:
- Aug 18, 2014 11:18:16 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r172709 r172711 1 2014-08-18 Dirk Schulze <krit@webkit.org> 2 3 calc() doesn't work for SVG CSS properties 4 https://bugs.webkit.org/show_bug.cgi?id=136026 5 6 Reviewed by Andreas Kling. 7 8 Test calc() on length properties for SVG. 9 10 * svg/css/getComputedStyle-basic-expected.txt: 11 * svg/css/parse-calc-length-expected.txt: Added. 12 * svg/css/parse-calc-length.html: Added. 13 1 14 2014-08-18 Andy Estes <aestes@apple.com> 2 15 -
trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt
r170996 r172711 241 241 stroke: none; 242 242 stroke-dasharray: none; 243 stroke-dashoffset: 0 ;243 stroke-dashoffset: 0px; 244 244 stroke-linecap: butt; 245 245 stroke-linejoin: miter; 246 246 stroke-miterlimit: 4; 247 247 stroke-opacity: 1; 248 stroke-width: 1 ;248 stroke-width: 1px; 249 249 alignment-baseline: auto; 250 250 baseline-shift: baseline; -
trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
r170996 r172711 240 240 stroke: none 241 241 stroke-dasharray: none 242 stroke-dashoffset: 0 242 stroke-dashoffset: 0px 243 243 stroke-linecap: butt 244 244 stroke-linejoin: miter 245 245 stroke-miterlimit: 4 246 246 stroke-opacity: 1 247 stroke-width: 1 247 stroke-width: 1px 248 248 alignment-baseline: auto 249 249 baseline-shift: baseline -
trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt
r171341 r172711 479 479 rect: style.getPropertyValue(stroke-dasharray) : none 480 480 rect: style.getPropertyCSSValue(stroke-dasharray) : [object CSSPrimitiveValue] 481 rect: style.getPropertyValue(stroke-dashoffset) : 0 481 rect: style.getPropertyValue(stroke-dashoffset) : 0px 482 482 rect: style.getPropertyCSSValue(stroke-dashoffset) : [object CSSPrimitiveValue] 483 483 rect: style.getPropertyValue(stroke-linecap) : butt … … 991 991 g: style.getPropertyValue(stroke-dasharray) : none 992 992 g: style.getPropertyCSSValue(stroke-dasharray) : [object CSSPrimitiveValue] 993 g: style.getPropertyValue(stroke-dashoffset) : 0 993 g: style.getPropertyValue(stroke-dashoffset) : 0px 994 994 g: style.getPropertyCSSValue(stroke-dashoffset) : [object CSSPrimitiveValue] 995 995 g: style.getPropertyValue(stroke-linecap) : butt -
trunk/Source/WebCore/ChangeLog
r172709 r172711 1 2014-08-18 Dirk Schulze <krit@webkit.org> 2 3 calc() doesn't work for SVG CSS properties 4 https://bugs.webkit.org/show_bug.cgi?id=136026 5 6 Reviewed by Andreas Kling. 7 8 Make calc() work on SVG CSS properties as well. stroke-width and 9 stroke-dashoffset used SVGLength. SVGLength doesn't work together with 10 cross units length arguments like % and px (just returns 0 in these 11 cases). I moved these properties over to Length. All modified files 12 beside to SVGCSSParser are related to this switch. 13 14 Test: svg/css/parse-calc-length.html 15 16 * css/CSSComputedStyleDeclaration.cpp: 17 (WebCore::ComputedStyleExtractor::propertyValue): 18 * css/DeprecatedStyleBuilder.cpp: 19 (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder): 20 * css/SVGCSSComputedStyleDeclaration.cpp: 21 (WebCore::ComputedStyleExtractor::svgPropertyValue): 22 * css/SVGCSSParser.cpp: 23 (WebCore::CSSParser::parseSVGValue): 24 * css/SVGCSSStyleSelector.cpp: 25 (WebCore::StyleResolver::applySVGProperty): 26 * page/animation/CSSPropertyAnimation.cpp: 27 (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): 28 * rendering/style/RenderStyle.h: 29 * rendering/style/SVGRenderStyle.h: 30 (WebCore::SVGRenderStyle::setStrokeWidth): 31 (WebCore::SVGRenderStyle::setStrokeDashOffset): 32 (WebCore::SVGRenderStyle::strokeWidth): 33 (WebCore::SVGRenderStyle::strokeDashOffset): 34 (WebCore::SVGRenderStyle::initialStrokeDashOffset): Deleted. 35 (WebCore::SVGRenderStyle::initialStrokeWidth): Deleted. 36 * rendering/style/SVGRenderStyleDefs.cpp: 37 (WebCore::StyleStrokeData::StyleStrokeData): 38 * rendering/style/SVGRenderStyleDefs.h: 39 * rendering/svg/RenderSVGShape.cpp: 40 (WebCore::RenderSVGShape::strokeWidth): 41 * rendering/svg/RenderSVGText.cpp: 42 (WebCore::RenderSVGText::strokeBoundingBox): 43 * rendering/svg/SVGRenderSupport.cpp: 44 (WebCore::SVGRenderSupport::applyStrokeStyleToContext): 45 * rendering/svg/SVGRenderTreeAsText.cpp: 46 (WebCore::writeStyle): 47 * svg/SVGLengthContext.cpp: 48 (WebCore::SVGLengthContext::valueForLength): 49 1 50 2014-08-18 Andy Estes <aestes@apple.com> 2 51 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r172642 r172711 2971 2971 break; 2972 2972 2973 // New positioningproperties for SVG.2973 // Length properties for SVG. 2974 2974 case CSSPropertyCx: 2975 2975 return zoomAdjustedPixelValueForLength(style->svgStyle().cx(), style.get()); … … 2982 2982 case CSSPropertyRy: 2983 2983 return zoomAdjustedPixelValueForLength(style->svgStyle().ry(), style.get()); 2984 case CSSPropertyStrokeWidth: 2985 return zoomAdjustedPixelValueForLength(style->svgStyle().strokeWidth(), style.get()); 2986 case CSSPropertyStrokeDashoffset: 2987 return zoomAdjustedPixelValueForLength(style->svgStyle().strokeDashOffset(), style.get()); 2984 2988 case CSSPropertyX: 2985 2989 return zoomAdjustedPixelValueForLength(style->svgStyle().x(), style.get()); … … 3104 3108 case CSSPropertyStroke: 3105 3109 case CSSPropertyStrokeDasharray: 3106 case CSSPropertyStrokeDashoffset:3107 3110 case CSSPropertyStrokeLinecap: 3108 3111 case CSSPropertyStrokeLinejoin: 3109 3112 case CSSPropertyStrokeMiterlimit: 3110 3113 case CSSPropertyStrokeOpacity: 3111 case CSSPropertyStrokeWidth:3112 3114 case CSSPropertyAlignmentBaseline: 3113 3115 case CSSPropertyBaselineShift: -
trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp
r172642 r172711 2600 2600 setPropertyHandler(CSSPropertyRx, ApplyPropertyLength<&RenderStyle::rx, &RenderStyle::setRx, &RenderStyle::initialZeroLength>::createHandler()); 2601 2601 setPropertyHandler(CSSPropertyRy, ApplyPropertyLength<&RenderStyle::ry, &RenderStyle::setRy, &RenderStyle::initialZeroLength>::createHandler()); 2602 setPropertyHandler(CSSPropertyStrokeWidth, ApplyPropertyLength<&RenderStyle::strokeWidth, &RenderStyle::setStrokeWidth, &RenderStyle::initialOneLength>::createHandler()); 2603 setPropertyHandler(CSSPropertyStrokeDashoffset, ApplyPropertyLength<&RenderStyle::strokeDashOffset, &RenderStyle::setStrokeDashOffset, &RenderStyle::initialZeroLength>::createHandler()); 2602 2604 setPropertyHandler(CSSPropertyX, ApplyPropertyLength<&RenderStyle::x, &RenderStyle::setX, &RenderStyle::initialZeroLength>::createHandler()); 2603 2605 setPropertyHandler(CSSPropertyY, ApplyPropertyLength<&RenderStyle::y, &RenderStyle::setY, &RenderStyle::initialZeroLength>::createHandler()); -
trunk/Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp
r172536 r172711 191 191 case CSSPropertyStrokeDasharray: 192 192 return strokeDashArrayToCSSValueList(svgStyle.strokeDashArray()); 193 case CSSPropertyStrokeDashoffset:194 return SVGLength::toCSSPrimitiveValue(svgStyle.strokeDashOffset());195 case CSSPropertyStrokeWidth:196 return SVGLength::toCSSPrimitiveValue(svgStyle.strokeWidth());197 193 case CSSPropertyBaselineShift: { 198 194 switch (svgStyle.baselineShift()) { -
trunk/Source/WebCore/css/SVGCSSParser.cpp
r172642 r172711 325 325 else if (value->unit >= CSSParserValue::Q_EMS) 326 326 parsedValue = CSSPrimitiveValue::createAllowingMarginQuirk(value->fValue, CSSPrimitiveValue::CSS_EMS); 327 if (isCalculation(value)) { 328 // FIXME calc() http://webkit.org/b/16662 : actually create a CSSPrimitiveValue here, ie 329 // parsedValue = CSSPrimitiveValue::create(m_parsedCalculation.release()); 330 m_parsedCalculation.release(); 331 parsedValue = 0; 332 } 327 if (isCalculation(value)) 328 parsedValue = CSSPrimitiveValue::create(m_parsedCalculation.release()); 333 329 m_valueList->next(); 334 330 } -
trunk/Source/WebCore/css/SVGCSSStyleSelector.cpp
r170774 r172711 290 290 break; 291 291 } 292 case CSSPropertyStrokeWidth:293 {294 HANDLE_INHERIT_AND_INITIAL(strokeWidth, StrokeWidth)295 if (primitiveValue)296 svgStyle.setStrokeWidth(SVGLength::fromCSSPrimitiveValue(primitiveValue));297 break;298 }299 292 case CSSPropertyStrokeDasharray: 300 293 { … … 319 312 320 313 svgStyle.setStrokeDashArray(array); 321 break;322 }323 case CSSPropertyStrokeDashoffset:324 {325 HANDLE_INHERIT_AND_INITIAL(strokeDashOffset, StrokeDashOffset)326 if (primitiveValue)327 svgStyle.setStrokeDashOffset(SVGLength::fromCSSPrimitiveValue(primitiveValue));328 314 break; 329 315 } -
trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp
r172642 r172711 1252 1252 new PropertyWrapperSVGPaint(CSSPropertyStroke, &RenderStyle::strokePaintType, &RenderStyle::strokePaintColor, &RenderStyle::setStrokePaintColor), 1253 1253 new PropertyWrapper<float>(CSSPropertyStrokeOpacity, &RenderStyle::strokeOpacity, &RenderStyle::setStrokeOpacity), 1254 new PropertyWrapper<SVGLength>(CSSPropertyStrokeWidth, &RenderStyle::strokeWidth, &RenderStyle::setStrokeWidth),1255 1254 new PropertyWrapper< Vector<SVGLength>>(CSSPropertyStrokeDasharray, &RenderStyle::strokeDashArray, &RenderStyle::setStrokeDashArray), 1256 new PropertyWrapper<SVGLength>(CSSPropertyStrokeDashoffset, &RenderStyle::strokeDashOffset, &RenderStyle::setStrokeDashOffset),1257 1255 new PropertyWrapper<float>(CSSPropertyStrokeMiterlimit, &RenderStyle::strokeMiterLimit, &RenderStyle::setStrokeMiterLimit), 1258 1256 … … 1262 1260 new LengthPropertyWrapper<Length>(CSSPropertyRx, &RenderStyle::rx, &RenderStyle::setRx), 1263 1261 new LengthPropertyWrapper<Length>(CSSPropertyRy, &RenderStyle::ry, &RenderStyle::setRy), 1262 new LengthPropertyWrapper<Length>(CSSPropertyStrokeDashoffset, &RenderStyle::strokeDashOffset, &RenderStyle::setStrokeDashOffset), 1263 new LengthPropertyWrapper<Length>(CSSPropertyStrokeWidth, &RenderStyle::strokeWidth, &RenderStyle::setStrokeWidth), 1264 1264 new LengthPropertyWrapper<Length>(CSSPropertyX, &RenderStyle::x, &RenderStyle::setX), 1265 1265 new LengthPropertyWrapper<Length>(CSSPropertyY, &RenderStyle::y, &RenderStyle::setY), -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r172656 r172711 1657 1657 float strokeOpacity() const { return svgStyle().strokeOpacity(); } 1658 1658 void setStrokeOpacity(float f) { accessSVGStyle().setStrokeOpacity(f); } 1659 SVGLengthstrokeWidth() const { return svgStyle().strokeWidth(); }1660 void setStrokeWidth( SVGLength w) { accessSVGStyle().setStrokeWidth(w); }1659 const Length& strokeWidth() const { return svgStyle().strokeWidth(); } 1660 void setStrokeWidth(Length w) { accessSVGStyle().setStrokeWidth(w); } 1661 1661 Vector<SVGLength> strokeDashArray() const { return svgStyle().strokeDashArray(); } 1662 1662 void setStrokeDashArray(Vector<SVGLength> array) { accessSVGStyle().setStrokeDashArray(array); } 1663 SVGLengthstrokeDashOffset() const { return svgStyle().strokeDashOffset(); }1664 void setStrokeDashOffset( SVGLength d) { accessSVGStyle().setStrokeDashOffset(d); }1663 const Length& strokeDashOffset() const { return svgStyle().strokeDashOffset(); } 1664 void setStrokeDashOffset(Length d) { accessSVGStyle().setStrokeDashOffset(d); } 1665 1665 float strokeMiterLimit() const { return svgStyle().strokeMiterLimit(); } 1666 1666 void setStrokeMiterLimit(float f) { accessSVGStyle().setStrokeMiterLimit(f); } … … 1837 1837 static Length initialTextIndent() { return Length(Fixed); } 1838 1838 static Length initialZeroLength() { return Length(Fixed); } 1839 static Length initialOneLength() { return Length(1, Fixed); } 1839 1840 #if ENABLE(CSS3_TEXT) 1840 1841 static TextIndentLine initialTextIndentLine() { return TextIndentFirstLine; } -
trunk/Source/WebCore/rendering/style/SVGRenderStyle.h
r172642 r172711 113 113 } 114 114 115 static SVGLength initialStrokeDashOffset()116 {117 SVGLength length;118 length.newValueSpecifiedUnits(LengthTypeNumber, 0, ASSERT_NO_EXCEPTION);119 return length;120 }121 122 static SVGLength initialStrokeWidth()123 {124 SVGLength length;125 length.newValueSpecifiedUnits(LengthTypeNumber, 1, ASSERT_NO_EXCEPTION);126 return length;127 }128 129 115 // SVG CSS Property setters 130 116 void setAlignmentBaseline(EAlignmentBaseline val) { svg_noninherited_flags.f._alignmentBaseline = val; } … … 247 233 } 248 234 249 void setStrokeWidth(const SVGLength& obj)235 void setStrokeWidth(const Length& obj) 250 236 { 251 237 if (!(stroke->width == obj)) … … 253 239 } 254 240 255 void setStrokeDashOffset(const SVGLength& obj)241 void setStrokeDashOffset(const Length& obj) 256 242 { 257 243 if (!(stroke->dashOffset == obj)) … … 369 355 Vector<SVGLength> strokeDashArray() const { return stroke->dashArray; } 370 356 float strokeMiterLimit() const { return stroke->miterLimit; } 371 SVGLengthstrokeWidth() const { return stroke->width; }372 SVGLengthstrokeDashOffset() const { return stroke->dashOffset; }357 const Length& strokeWidth() const { return stroke->width; } 358 const Length& strokeDashOffset() const { return stroke->dashOffset; } 373 359 SVGLength kerning() const { return text->kerning; } 374 360 float stopOpacity() const { return stops->opacity; } -
trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp
r172642 r172711 77 77 : opacity(SVGRenderStyle::initialStrokeOpacity()) 78 78 , miterLimit(SVGRenderStyle::initialStrokeMiterLimit()) 79 , width( SVGRenderStyle::initialStrokeWidth())80 , dashOffset( SVGRenderStyle::initialStrokeDashOffset())79 , width(RenderStyle::initialOneLength()) 80 , dashOffset(RenderStyle::initialZeroLength()) 81 81 , dashArray(SVGRenderStyle::initialStrokeDashArray()) 82 82 , paintType(SVGRenderStyle::initialStrokePaintType()) -
trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.h
r172642 r172711 154 154 float miterLimit; 155 155 156 SVGLength width;157 SVGLength dashOffset;156 Length width; 157 Length dashOffset; 158 158 Vector<SVGLength> dashArray; 159 159 -
trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp
r170774 r172711 433 433 { 434 434 SVGLengthContext lengthContext(&graphicsElement()); 435 return style().svgStyle().strokeWidth().value(lengthContext);435 return lengthContext.valueForLength(style().svgStyle().strokeWidth()); 436 436 } 437 437 -
trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp
r170774 r172711 517 517 518 518 SVGLengthContext lengthContext(&textElement()); 519 strokeBoundaries.inflate( svgStyle.strokeWidth().value(lengthContext));519 strokeBoundaries.inflate(lengthContext.valueForLength(svgStyle.strokeWidth())); 520 520 return strokeBoundaries; 521 521 } -
trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp
r171046 r172711 413 413 414 414 SVGLengthContext lengthContext(toSVGElement(renderer.element())); 415 context->setStrokeThickness( svgStyle.strokeWidth().value(lengthContext));415 context->setStrokeThickness(lengthContext.valueForLength(svgStyle.strokeWidth())); 416 416 context->setLineCap(svgStyle.capStyle()); 417 417 context->setLineJoin(svgStyle.joinStyle()); … … 428 428 dashArray.uncheckedAppend(dash.value(lengthContext)); 429 429 430 context->setLineDash(dashArray, svgStyle.strokeDashOffset().value(lengthContext));430 context->setLineDash(dashArray, lengthContext.valueForLength(svgStyle.strokeDashOffset())); 431 431 } 432 432 } -
trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp
r167568 r172711 269 269 270 270 SVGLengthContext lengthContext(&shape.graphicsElement()); 271 double dashOffset = svgStyle.strokeDashOffset().value(lengthContext);272 double strokeWidth = svgStyle.strokeWidth().value(lengthContext);271 double dashOffset = lengthContext.valueForLength(svgStyle.strokeDashOffset()); 272 double strokeWidth = lengthContext.valueForLength(svgStyle.strokeWidth()); 273 273 const Vector<SVGLength>& dashes = svgStyle.strokeDashArray(); 274 274 -
trunk/Source/WebCore/svg/SVGLengthContext.cpp
r171591 r172711 90 90 float SVGLengthContext::valueForLength(const Length& length, SVGLengthMode mode) 91 91 { 92 if (length.isPercent() )92 if (length.isPercent() && !length.isCalculated()) 93 93 return convertValueFromPercentageToUserUnits(length.value() / 100, mode, IGNORE_EXCEPTION); 94 94 if (length.isAuto())
Note: See TracChangeset
for help on using the changeset viewer.