haikuwebkit/LayoutTests/svg/stroke/zero-length-subpaths-lineca...

124 lines
7.2 KiB
XML
Raw Permalink Normal View History

Linecaps wrong for zero length lines https://bugs.webkit.org/show_bug.cgi?id=71820 Patch by Stephen Chenney <schenney@chromium.org> on 2012-01-25 Reviewed by Nikolas Zimmermann. Total reworking of the method used to draw zero-length linecaps for SVG. This patch works for all zero length sub-paths. Source/WebCore: Tests: svg/stroke/zero-length-path-linecap-rendering.svg svg/stroke/zero-length-subpaths-linecap-rendering.svg * rendering/svg/RenderSVGShape.cpp: Significant refactoring to enable new implementation and clarify code. (WebCore::RenderSVGShape::createShape): (WebCore::RenderSVGShape::strokeContains): (WebCore::RenderSVGShape::shouldStrokeZeroLengthSubpath): (WebCore::RenderSVGShape::zeroLengthSubpathRect): (WebCore::RenderSVGShape::zeroLengthLinecapPath): (WebCore::RenderSVGShape::nonScalingStrokePath): (WebCore::RenderSVGShape::setupNonScalingStrokeTransform): (WebCore::RenderSVGShape::fillShape): (WebCore::RenderSVGShape::strokePath): (WebCore::RenderSVGShape::fillAndStrokePath): (WebCore::RenderSVGShape::updateCachedBoundaries): (WebCore::RenderSVGShape::processZeroLengthSubpaths): * rendering/svg/RenderSVGShape.h: Declarations for new methods. * rendering/svg/SVGSubpathData.h: Class for finding zero length subpaths. * svg/SVGPathBuilder.h: Fix typos * svg/SVGPathConsumer.h: Fix typos * svg/SVGPathSegListBuilder.h: Fix typos * svg/SVGPathTraversalStateBuilder.h: Fix typos LayoutTests: * platform/chromium/test_expectations.txt: Chromium test expectations pending new expected images and text. * platform/mac/svg/stroke/zero-length-path-linecap-rendering-expected.png: Added. * platform/mac/svg/stroke/zero-length-path-linecap-rendering-expected.txt: Added. * platform/mac/svg/stroke/zero-length-subpaths-linecap-rendering-expected.png: Added. * platform/mac/svg/stroke/zero-length-subpaths-linecap-rendering-expected.txt: Added. * platform/mac/test_expectations.txt: Chromium test expectations pending new expected images and text. * svg/stroke/zero-length-path-linecap-rendering.svg: Added. * svg/stroke/zero-length-subpaths-linecap-rendering.svg: Added. Canonical link: https://commits.webkit.org/93881@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@105878 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-01-25 15:31:39 +00:00
<svg id="svg-root" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="test-body-content">
<!-- This test should produce 12 columns, each with 6 rows, with each cell size 50x50 -->
<!-- There should be a solid grey rectangle behind the table. -->
<!-- The 1st and 2nd rows should be empty. All the paths here have zero length and butt linecaps. -->
<!-- The 3rd and 4th rows should consist of green circles, except for row 3 col 10. The paths here -->
<!-- have zero length and round linecaps, with the exception having a lone move. -->
<!-- The 5th and 6th rows should consist of green circles, except for row 5 col 6. The paths here -->
<!-- have zero length and square linecaps, with the exception having a lone move. -->
<def>
<g id="CheckCircles">
<circle cx="25" cy="125" r="20" fill="red" />
<circle cx="25" cy="175" r="20" fill="red" />
<rect x="5" y="205" width="40" height="40" fill="red" />
<rect x="5" y="255" width="40" height="40" fill="red" />
</g>
</def>
<rect x="0" y="0" width="600" height="300" fill="grey" />
<g id="column-1-single-move-tests">
<circle cx="25" cy="125" r="20" fill="red" />
<rect x="5" y="255" width="40" height="40" fill="red" />
<path d="M 25 25 M 25 75 a 20 20 90 0 1 0 0" stroke="red" stroke-width="40" stroke-linecap="butt" />
<path transform="translate(25,125)" d="M 0 0 C 0 0 0 0 0 0 m 0 50" stroke="green" stroke-width="40" stroke-linecap="round" />
<path d="M 25 225 M 25 275 a 0 0 90 0 1 0 0" stroke="green" stroke-width="40" stroke-linecap="square" />
</g>
<g id="column-2-close-move-tests" transform="translate(50, 0)">
<use xlink:href="#CheckCircles" />
<path d="M 25 25 z m 0 50 z" stroke="red" stroke-width="40" stroke-linecap="butt" />
<path transform="translate(25,125)" d="M 0 0 z M 0 50 L 0 50" stroke="green" stroke-width="40" stroke-linecap="round" />
<path d="M 25 225 a 20 20 90 0 0 0 0 m 0 50 z" stroke="green" stroke-width="40" stroke-linecap="square" />
</g>
<g id="column-3-horizontal-tests" transform="translate(100, 0)">
<use xlink:href="#CheckCircles" />
<path d="M 25 25 h 0 M 25 75 v 0" stroke="red" stroke-width="40" stroke-linecap="butt" />
<path transform="translate(25,125)" d="M 0 0 A 0 0 90 0 1 0 0 m 0 50 H 0" stroke="green" stroke-width="40" stroke-linecap="round" />
<path d="M 25 225 h 0 M 25 275 s 0 0 0 0" stroke="green" stroke-width="40" stroke-linecap="square" />
</g>
<g id="column-4-vertical-tests" transform="translate(150, 0)">
<use xlink:href="#CheckCircles" />
<path d="M 25 25 t 0 0 m 0 50 v 0" stroke="red" stroke-width="40" stroke-linecap="butt" />
<path transform="translate(25,125)" d="M 0 0 V 0 M 0 50 T 0 50" stroke="green" stroke-width="40" stroke-linecap="round" />
<path d="M 25 225 a 20 20 90 0 1 0 0 m 0 50 v 0" stroke="green" stroke-width="40" stroke-linecap="square" />
</g>
<g id="column-5-line-tests" transform="translate(200, 0)">
<use xlink:href="#CheckCircles" />
<path d="M 25 25 l 0 0 M 25 75 h 0" stroke="red" stroke-width="40" stroke-linecap="butt" />
<path transform="translate(25,125)" d="M 0 0 A 20 20 90 0 0 0 0 m 0 50 L 0 50" stroke="green" stroke-width="40" stroke-linecap="round" />
<path d="M 25 225 l 0 0 M 25 275 c 0 0 0 0 0 0" stroke="green" stroke-width="40" stroke-linecap="square" />
</g>
<g id="column-6-cubic-tests" transform="translate(250, 0)">
<circle cx="25" cy="125" r="20" fill="red" />
<circle cx="25" cy="175" r="20" fill="red" />
<rect x="5" y="255" width="40" height="40" fill="red" />
<path d="M 25 25 s 0 0 0 0 m 0 50 c 0 0 0 0 0 0" stroke="red" stroke-width="40" stroke-linecap="butt" />
<path transform="translate(25,125)" d="M 0 0 C 0 0 0 0 0 0 M 0 50 Q 0 50 0 50" stroke="green" stroke-width="40" stroke-linecap="round" />
<path d="M 25 225 m 0 50 c 0 0 0 0 0 0" stroke="green" stroke-width="40" stroke-linecap="square" />
</g>
<g id="column-7-smooth-cubic-tests" transform="translate(300, 0)">
<use xlink:href="#CheckCircles" />
<path d="M 25 25 s 0 0 0 0 M 25 75" stroke="red" stroke-width="40" stroke-linecap="butt" />
<path transform="translate(25,125)" d="M 0 0 S 0 0 0 0 m 0 50 S 0 50 0 50" stroke="green" stroke-width="40" stroke-linecap="round" />
<path d="M 25 225 s 0 0 0 0 M 25 275 q 0 0 0 0" stroke="green" stroke-width="40" stroke-linecap="square" />
</g>
<g id="column-8-quadratic-tests" transform="translate(350, 0)">
<use xlink:href="#CheckCircles" />
<path d="M 25 25 a 0 0 90 0 1 0 0 m 0 50 q 0 0 0 0" stroke="red" stroke-width="40" stroke-linecap="butt" />
<path transform="translate(25,125)" d="M 0 0 Q 0 0 0 0 M 0 50 H 0" stroke="green" stroke-width="40" stroke-linecap="round" />
<path d="M 25 225 t 0 0 m 0 50 q 0 0 0 0" stroke="green" stroke-width="40" stroke-linecap="square" />
</g>
<g id="column-9-quadratic-tests" transform="translate(400, 0)">
<use xlink:href="#CheckCircles" />
<path d="M 25 25 t 0 0 M 25 75 q 0 0 0 0" stroke="red" stroke-width="40" stroke-linecap="butt" />
<path transform="translate(25,125)" d="M 0 0 z m 0 50 T 0 50" stroke="green" stroke-width="40" stroke-linecap="round" />
<path d="M 25 225 t 0 0 M 25 275 l 0 0" stroke="green" stroke-width="40" stroke-linecap="square" />
</g>
<g id="column-10-arc-tests-sweep-1" transform="translate(450, 0)">
<circle cx="25" cy="125" r="20" fill="red" />
<rect x="5" y="205" width="40" height="40" fill="red" />
<rect x="5" y="255" width="40" height="40" fill="red" />
<path d="M 25 25 c 0 0 0 0 0 0 m 0 50 a 20 20 90 0 1 0 0" stroke="red" stroke-width="40" stroke-linecap="butt" />
<path transform="translate(25,125)" d="M 0 0 A 20 20 90 0 1 0 0 M 0 50" stroke="green" stroke-width="40" stroke-linecap="round" />
<path d="M 25 225 h 0 m 0 50 a 20 20 90 0 1 0 0" stroke="green" stroke-width="40" stroke-linecap="square" />
</g>
<g id="column-11-arc-tests-sweep-0" transform="translate(500, 0)">
<use xlink:href="#CheckCircles" />
<path d="M 25 25 a 20 20 90 0 0 0 0 M 25 75 l 0 0" stroke="red" stroke-width="40" stroke-linecap="butt" />
<path transform="translate(25,125)" d="M 0 0 V 0 m 0 50 A 20 20 90 0 0 0 50" stroke="green" stroke-width="40" stroke-linecap="round" />
<path d="M 25 225 a 20 20 90 0 0 0 0 M 25 275 z" stroke="green" stroke-width="40" stroke-linecap="square" />
</g>
<g id="column-12-arc-tests-zero-rad" transform="translate(550, 0)">
<use xlink:href="#CheckCircles" />
<path d="M 25 25 a 20 20 90 0 1 0 0 m 0 50 a 0 0 90 0 1 0 0" stroke="red" stroke-width="40" stroke-linecap="butt" />
<path transform="translate(25,125)" d="M 0 0 A 0 0 90 0 1 0 0 M 0 50 A 20 20 90 0 1 0 50" stroke="green" stroke-width="40" stroke-linecap="round" />
<path d="M 25 225 v 0 m 0 50 a 0 0 90 0 1 0 0" stroke="green" stroke-width="40" stroke-linecap="square" />
</g>
</g>
</svg>