Changeset 214787 in webkit
- Timestamp:
- Apr 3, 2017 6:17:11 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r214731 r214787 1 2017-04-03 Per Arne Vollan <pvollan@apple.com> 2 3 Implement stroke-miterlimit. 4 https://bugs.webkit.org/show_bug.cgi?id=169078 5 6 Reviewed by Dean Jackson. 7 8 * fast/css/stroke-miterlimit-default-expected.html: Added. 9 * fast/css/stroke-miterlimit-default.html: Added. 10 * fast/css/stroke-miterlimit-large-expected-mismatch.html: Added. 11 * fast/css/stroke-miterlimit-large.html: Added. 12 * fast/css/stroke-miterlimit-zero-expected-mismatch.html: Added. 13 * fast/css/stroke-miterlimit-zero.html: Added. 14 1 15 2017-04-02 Alexey Proskuryakov <ap@apple.com> 2 16 -
trunk/Source/WebCore/ChangeLog
r214772 r214787 1 2017-04-03 Per Arne Vollan <pvollan@apple.com> 2 3 Implement stroke-miterlimit. 4 https://bugs.webkit.org/show_bug.cgi?id=169078 5 6 Reviewed by Dean Jackson. 7 8 Support stroke-miterlimit for text rendering, see https://drafts.fxtf.org/paint/. 9 10 Tests: fast/css/stroke-miterlimit-default.html 11 fast/css/stroke-miterlimit-large.html 12 fast/css/stroke-miterlimit-zero.html 13 14 * css/CSSComputedStyleDeclaration.cpp: 15 (WebCore::ComputedStyleExtractor::propertyValue): 16 * css/CSSProperties.json: 17 * css/SVGCSSComputedStyleDeclaration.cpp: 18 (WebCore::ComputedStyleExtractor::svgPropertyValue): 19 * rendering/TextPaintStyle.cpp: 20 (WebCore::computeTextPaintStyle): 21 (WebCore::updateGraphicsContext): 22 * rendering/TextPaintStyle.h: 23 * rendering/style/RenderStyle.cpp: 24 (WebCore::RenderStyle::diff): 25 * rendering/style/RenderStyle.h: 26 (WebCore::RenderStyle::strokeMiterLimit): 27 (WebCore::RenderStyle::setStrokeMiterLimit): 28 (WebCore::RenderStyle::initialStrokeMiterLimit): 29 (WebCore::RenderStyle::setStrokeDashOffset): 30 * rendering/style/RenderStyleConstants.cpp: 31 * rendering/style/RenderStyleConstants.h: 32 * rendering/style/SVGRenderStyle.cpp: 33 (WebCore::SVGRenderStyle::diff): 34 * rendering/style/SVGRenderStyle.h: 35 (WebCore::SVGRenderStyle::initialStrokeDashArray): 36 (WebCore::SVGRenderStyle::strokeDashArray): 37 (WebCore::SVGRenderStyle::initialStrokeMiterLimit): Deleted. 38 (WebCore::SVGRenderStyle::strokeMiterLimit): Deleted. 39 (WebCore::SVGRenderStyle::setStrokeMiterLimit): Deleted. 40 * rendering/style/SVGRenderStyleDefs.cpp: 41 (WebCore::StyleStrokeData::StyleStrokeData): 42 (WebCore::StyleStrokeData::operator==): 43 * rendering/style/SVGRenderStyleDefs.h: 44 * rendering/style/StyleRareInheritedData.cpp: 45 (WebCore::StyleRareInheritedData::StyleRareInheritedData): 46 (WebCore::StyleRareInheritedData::operator==): 47 * rendering/style/StyleRareInheritedData.h: 48 * rendering/svg/RenderSVGShape.cpp: 49 (WebCore::RenderSVGShape::hasSmoothStroke): 50 * rendering/svg/SVGRenderSupport.cpp: 51 (WebCore::SVGRenderSupport::applyStrokeStyleToContext): 52 * rendering/svg/SVGRenderTreeAsText.cpp: 53 (WebCore::writeStyle): 54 1 55 2017-04-03 Alejandro G. Castro <alex@igalia.com> 2 56 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r214624 r214787 3918 3918 case CSSPropertyStrokeWidth: 3919 3919 return zoomAdjustedPixelValueForLength(style->strokeWidth(), *style); 3920 case CSSPropertyStrokeMiterlimit: 3921 return CSSPrimitiveValue::create(style->strokeMiterLimit(), CSSPrimitiveValue::CSS_NUMBER); 3920 3922 3921 3923 /* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */ … … 4019 4021 case CSSPropertyStroke: 4020 4022 case CSSPropertyStrokeDasharray: 4021 case CSSPropertyStrokeMiterlimit:4022 4023 case CSSPropertyStrokeOpacity: 4023 4024 case CSSPropertyAlignmentBaseline: -
trunk/Source/WebCore/css/CSSProperties.json
r214364 r214787 3024 3024 "codegen-properties": { 3025 3025 "name-for-methods": "StrokeMiterLimit", 3026 "converter": "Number<float>", 3027 "svg": true 3026 "converter": "Number<float>" 3028 3027 }, 3029 3028 "specification": { -
trunk/Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp
r212562 r214787 114 114 case CSSPropertyShapeRendering: 115 115 return CSSPrimitiveValue::create(svgStyle.shapeRendering()); 116 case CSSPropertyStrokeMiterlimit:117 return CSSPrimitiveValue::create(svgStyle.strokeMiterLimit(), CSSPrimitiveValue::CSS_NUMBER);118 116 case CSSPropertyStrokeOpacity: 119 117 return CSSPrimitiveValue::create(svgStyle.strokeOpacity(), CSSPrimitiveValue::CSS_NUMBER); -
trunk/Source/WebCore/rendering/TextPaintStyle.cpp
r213634 r214787 73 73 paintStyle.lineJoin = lineStyle.joinStyle(); 74 74 paintStyle.lineCap = lineStyle.capStyle(); 75 paintStyle.miterLimit = lineStyle.strokeMiterLimit(); 75 76 76 77 if (paintInfo.forceTextColor()) { … … 201 202 context.setLineJoin(paintStyle.lineJoin); 202 203 context.setLineCap(paintStyle.lineCap); 203 } 204 } 205 206 } 204 if (paintStyle.lineJoin == MiterJoin) 205 context.setMiterLimit(paintStyle.miterLimit); 206 } 207 } 208 209 } -
trunk/Source/WebCore/rendering/TextPaintStyle.h
r213614 r214787 53 53 LineJoin lineJoin { MiterJoin }; 54 54 LineCap lineCap { ButtCap }; 55 float miterLimit { defaultMiterLimit }; 55 56 }; 56 57 -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r214435 r214787 643 643 if (textStrokeWidth() != other.textStrokeWidth()) 644 644 return true; 645 646 // These properties affect the cached stroke bounding box rects. 647 if (m_rareInheritedData->capStyle != other.m_rareInheritedData->capStyle 648 || m_rareInheritedData->joinStyle != other.m_rareInheritedData->joinStyle 649 || m_rareInheritedData->strokeWidth != other.m_rareInheritedData->strokeWidth 650 || m_rareInheritedData->miterLimit != other.m_rareInheritedData->miterLimit) 651 return true; 645 652 } 646 653 … … 910 917 return svgChange; 911 918 } 912 913 // These properties affect the cached stroke bounding box rects.914 if (m_rareInheritedData->capStyle != other.m_rareInheritedData->capStyle915 || m_rareInheritedData->joinStyle != other.m_rareInheritedData->joinStyle916 || m_rareInheritedData->strokeWidth != other.m_rareInheritedData->strokeWidth)917 return StyleDifferenceLayout;918 919 919 920 if (changeRequiresLayout(other, changedContextSensitiveProperties)) -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r214435 r214787 1246 1246 #endif 1247 1247 1248 // Support for paint-order, stroke-linecap, and stroke-linejoinfrom https://drafts.fxtf.org/paint/.1248 // Support for paint-order, stroke-linecap, stroke-linejoin, and stroke-miterlimit from https://drafts.fxtf.org/paint/. 1249 1249 void setPaintOrder(PaintOrder order) { SET_VAR(m_rareInheritedData, paintOrder, static_cast<unsigned>(order)); } 1250 1250 PaintOrder paintOrder() const { return static_cast<PaintOrder>(m_rareInheritedData->paintOrder); } … … 1269 1269 bool hasPositiveStrokeWidth() const; 1270 1270 1271 1271 float strokeMiterLimit() const { return m_rareInheritedData->miterLimit; } 1272 void setStrokeMiterLimit(float f) { SET_VAR(m_rareInheritedData, miterLimit, f); } 1273 static float initialStrokeMiterLimit() { return defaultMiterLimit; } 1274 1275 1272 1276 const SVGRenderStyle& svgStyle() const { return m_svgStyle; } 1273 1277 SVGRenderStyle& accessSVGStyle() { return m_svgStyle.access(); } … … 1288 1292 const Length& strokeDashOffset() const { return svgStyle().strokeDashOffset(); } 1289 1293 void setStrokeDashOffset(Length&& d) { accessSVGStyle().setStrokeDashOffset(WTFMove(d)); } 1290 float strokeMiterLimit() const { return svgStyle().strokeMiterLimit(); }1291 void setStrokeMiterLimit(float f) { accessSVGStyle().setStrokeMiterLimit(f); }1292 1294 1293 1295 const Length& cx() const { return svgStyle().cx(); } -
trunk/Source/WebCore/rendering/style/RenderStyleConstants.cpp
r196960 r214787 102 102 } 103 103 104 const float defaultMiterLimit = 4; 105 104 106 } // namespace WebCore -
trunk/Source/WebCore/rendering/style/RenderStyleConstants.h
r212808 r214787 744 744 }; 745 745 746 extern const float defaultMiterLimit; 747 746 748 } // namespace WebCore -
trunk/Source/WebCore/rendering/style/SVGRenderStyle.cpp
r212562 r214787 189 189 || m_strokeData->paintColor != other.m_strokeData->paintColor 190 190 || m_strokeData->paintUri != other.m_strokeData->paintUri 191 || m_strokeData->miterLimit != other.m_strokeData->miterLimit192 191 || m_strokeData->dashArray != other.m_strokeData->dashArray 193 192 || m_strokeData->dashOffset != other.m_strokeData->dashOffset -
trunk/Source/WebCore/rendering/style/SVGRenderStyle.h
r212562 r214787 72 72 static String initialStrokePaintUri() { return String(); } 73 73 static Vector<SVGLengthValue> initialStrokeDashArray() { return { }; } 74 static float initialStrokeMiterLimit() { return 4; }75 74 static float initialStopOpacity() { return 1; } 76 75 static Color initialStopColor() { return Color(0, 0, 0); } … … 117 116 118 117 void setStrokeDashArray(const Vector<SVGLengthValue>&); 119 void setStrokeMiterLimit(float);120 118 void setStrokeDashOffset(const Length&); 121 119 void setKerning(const SVGLengthValue&); … … 162 160 const String& strokePaintUri() const { return m_strokeData->paintUri; } 163 161 Vector<SVGLengthValue> strokeDashArray() const { return m_strokeData->dashArray; } 164 float strokeMiterLimit() const { return m_strokeData->miterLimit; }165 162 const Length& strokeDashOffset() const { return m_strokeData->dashOffset; } 166 163 SVGLengthValue kerning() const { return m_textData->kerning; } … … 375 372 } 376 373 377 inline void SVGRenderStyle::setStrokeMiterLimit(float limit)378 {379 if (!(m_strokeData->miterLimit == limit))380 m_strokeData.access().miterLimit = limit;381 }382 383 374 inline void SVGRenderStyle::setStrokeDashOffset(const Length& offset) 384 375 { -
trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp
r212562 r214787 77 77 StyleStrokeData::StyleStrokeData() 78 78 : opacity(SVGRenderStyle::initialStrokeOpacity()) 79 , miterLimit(SVGRenderStyle::initialStrokeMiterLimit())80 79 , dashOffset(RenderStyle::initialZeroLength()) 81 80 , dashArray(SVGRenderStyle::initialStrokeDashArray()) … … 92 91 : RefCounted<StyleStrokeData>() 93 92 , opacity(other.opacity) 94 , miterLimit(other.miterLimit)95 93 , dashOffset(other.dashOffset) 96 94 , dashArray(other.dashArray) … … 112 110 { 113 111 return opacity == other.opacity 114 && miterLimit == other.miterLimit115 112 && dashOffset == other.dashOffset 116 113 && dashArray == other.dashArray -
trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.h
r212808 r214787 138 138 139 139 float opacity; 140 float miterLimit;141 140 142 141 Length dashOffset; -
trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp
r213634 r214787 131 131 , hasSetStrokeWidth(false) 132 132 , strokeWidth(RenderStyle::initialOneLength()) 133 , miterLimit(RenderStyle::initialStrokeMiterLimit()) 133 134 , hyphenationLimitBefore(-1) 134 135 , hyphenationLimitAfter(-1) … … 218 219 , hasSetStrokeWidth(o.hasSetStrokeWidth) 219 220 , strokeWidth(o.strokeWidth) 221 , miterLimit(o.miterLimit) 220 222 , hyphenationString(o.hyphenationString) 221 223 , hyphenationLimitBefore(o.hyphenationLimitBefore) … … 329 331 && hasSetStrokeWidth == o.hasSetStrokeWidth 330 332 && strokeWidth == o.strokeWidth 333 && miterLimit == o.miterLimit 331 334 && customProperties == o.customProperties 332 335 && arePointingToEqualData(listStyleImage, o.listStyleImage); -
trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h
r213634 r214787 142 142 unsigned hasSetStrokeWidth : 1; 143 143 Length strokeWidth; 144 float miterLimit; 144 145 145 146 AtomicString hyphenationString; -
trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp
r212808 r214787 446 446 const SVGRenderStyle& svgStyle = style().svgStyle(); 447 447 return svgStyle.strokeDashArray().isEmpty() 448 && s vgStyle.strokeMiterLimit() == svgStyle.initialStrokeMiterLimit()448 && style().strokeMiterLimit() == style().initialStrokeMiterLimit() 449 449 && style().joinStyle() == style().initialJoinStyle() 450 450 && style().capStyle() == style().initialCapStyle(); -
trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp
r212562 r214787 432 432 context->setLineJoin(style.joinStyle()); 433 433 if (style.joinStyle() == MiterJoin) 434 context->setMiterLimit(s vgStyle.strokeMiterLimit());434 context->setMiterLimit(style.strokeMiterLimit()); 435 435 436 436 const Vector<SVGLengthValue>& dashes = svgStyle.strokeDashArray(); -
trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp
r212562 r214787 197 197 writeIfNotDefault(ts, "opacity", svgStyle.strokeOpacity(), 1.0f); 198 198 writeIfNotDefault(ts, "stroke width", strokeWidth, 1.0); 199 writeIfNotDefault(ts, "miter limit", s vgStyle.strokeMiterLimit(), 4.0f);199 writeIfNotDefault(ts, "miter limit", style.strokeMiterLimit(), 4.0f); 200 200 writeIfNotDefault(ts, "line cap", style.capStyle(), ButtCap); 201 201 writeIfNotDefault(ts, "line join", style.joinStyle(), MiterJoin);
Note: See TracChangeset
for help on using the changeset viewer.