haikuwebkit/LayoutTests/svg/clip-path/clip-path-shape-circle-2-ex...

8 lines
214 B
XML
Raw Permalink Normal View History

Use -webkit-clip-path shapes to clip SVG elements https://bugs.webkit.org/show_bug.cgi?id=95620 Reviewed by Rob Buis. Source/WebCore: This patch adds a path segment for a BasicShape to a given Path object. This path and it's wind rule are used to clip the context of the SVG element. Tests: svg/clip-path/clip-path-shape-circle-1-expected.svg svg/clip-path/clip-path-shape-circle-1.svg svg/clip-path/clip-path-shape-circle-2-expected.svg svg/clip-path/clip-path-shape-circle-2.svg svg/clip-path/clip-path-shape-ellipse-1-expected.svg svg/clip-path/clip-path-shape-ellipse-1.svg svg/clip-path/clip-path-shape-ellipse-2-expected.svg svg/clip-path/clip-path-shape-ellipse-2.svg svg/clip-path/clip-path-shape-polygon-1-expected.svg svg/clip-path/clip-path-shape-polygon-1.svg svg/clip-path/clip-path-shape-polygon-2-expected.svg svg/clip-path/clip-path-shape-polygon-2.svg svg/clip-path/clip-path-shape-polygon-3-expected.svg svg/clip-path/clip-path-shape-polygon-3.svg svg/clip-path/clip-path-shape-rounded-rect-1-expected.svg svg/clip-path/clip-path-shape-rounded-rect-1.svg svg/clip-path/clip-path-shape-rounded-rect-2-expected.svg svg/clip-path/clip-path-shape-rounded-rect-2.svg * rendering/style/BasicShapes.cpp: Added helper functions that apply path segments to a given path. (WebCore::BasicShapeRectangle::path): (WebCore::BasicShapeCircle::path): (WebCore::BasicShapeEllipse::path): (WebCore::BasicShapePolygon::path): * rendering/style/BasicShapes.h: Make BasicShape virtualized again, since new virtual functions were added. (WebCore::BasicShape::~BasicShape): (BasicShape): (WebCore::BasicShape::windRule): Will return the wind rule of the shape - nonzero by default. (WebCore::BasicShape::BasicShape): (BasicShapeRectangle): (WebCore::BasicShapeRectangle::type): Removed member variable and return type per inheriting class directly. (WebCore::BasicShapeRectangle::BasicShapeRectangle): (BasicShapeCircle): (WebCore::BasicShapeCircle::type): Ditto. (WebCore::BasicShapeCircle::BasicShapeCircle): (BasicShapeEllipse): (WebCore::BasicShapeEllipse::type): Ditto. (WebCore::BasicShapeEllipse::BasicShapeEllipse): (BasicShapePolygon): (WebCore::BasicShapePolygon::windRule): (WebCore::BasicShapePolygon::type): Ditto. (WebCore::BasicShapePolygon::BasicShapePolygon): * rendering/svg/SVGRenderingContext.cpp: If -webkit-clip-path was defined, clip the context to the shape. Right now -webkit-clip-path overrides clip-path, so that people don't use both at the same time. Current clip-path property will be replaced, once -webkit-clip-path gets unprefixed. (WebCore::SVGRenderingContext::prepareToRenderSVGContent): LayoutTests: New tests to check behavior of -webkit-clip-path on SVG elements. * svg/clip-path/clip-path-shape-circle-1-expected.svg: Added. * svg/clip-path/clip-path-shape-circle-1.svg: Added. * svg/clip-path/clip-path-shape-circle-2-expected.svg: Added. * svg/clip-path/clip-path-shape-circle-2.svg: Added. * svg/clip-path/clip-path-shape-ellipse-1-expected.svg: Added. * svg/clip-path/clip-path-shape-ellipse-1.svg: Added. * svg/clip-path/clip-path-shape-ellipse-2-expected.svg: Added. * svg/clip-path/clip-path-shape-ellipse-2.svg: Added. * svg/clip-path/clip-path-shape-polygon-1-expected.svg: Added. * svg/clip-path/clip-path-shape-polygon-1.svg: Added. * svg/clip-path/clip-path-shape-polygon-2-expected.svg: Added. * svg/clip-path/clip-path-shape-polygon-2.svg: Added. * svg/clip-path/clip-path-shape-polygon-3-expected.svg: Added. * svg/clip-path/clip-path-shape-polygon-3.svg: Added. * svg/clip-path/clip-path-shape-rounded-rect-1-expected.svg: Added. * svg/clip-path/clip-path-shape-rounded-rect-1.svg: Added. * svg/clip-path/clip-path-shape-rounded-rect-2-expected.svg: Added. * svg/clip-path/clip-path-shape-rounded-rect-2.svg: Added. Canonical link: https://commits.webkit.org/113541@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@127383 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-09-02 00:15:33 +00:00
<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<clipPath id="clip">
<circle cx="100" cy="75" r="75"/>
</clipPath>
</defs>
<rect width="200" height="150" fill="green" clip-path="url(#clip)"/>
</svg>