haikuwebkit/LayoutTests/css3/masking/clip-path-with-path.html

27 lines
581 B
HTML
Raw Permalink Normal View History

Support bezier paths in clip-path property https://bugs.webkit.org/show_bug.cgi?id=149996 Reviewed by Darin Adler. Source/WebCore: Support path() in the -webkit-clip-path property, as specified in https://drafts.csswg.org/css-shapes-2/#supported-basic-shapes Added BasicShapePath and CSSBasicShapePath, which both represent the path as a SVGPathByteStream and wind rule. Make BasicShape::canBlend() a virtual function, and implement it on each subclass. Make various BasicShape subclass function overrides private, other than windRule() wich is called on derived classes in a few places. Add SVGPathBlender::canBlendPaths() which returns true if the given paths can be interpolated. Uses the same logic as blendAnimatedPath(), without doing any interpolation. RenderElement::createsGroup() is fixed to have clip-path trigger a group, which fixes rendering of clip-path with a descendant compositing layer. Tests: compositing/masks/clip-path-composited-descendent.html css3/masking/clip-path-with-path.html transitions/clip-path-path-transitions.html * css/BasicShapeFunctions.cpp: (WebCore::valueForBasicShape): (WebCore::basicShapeForValue): * css/CSSBasicShapes.cpp: (WebCore::CSSBasicShapePath::CSSBasicShapePath): (WebCore::CSSBasicShapePath::pathData): (WebCore::buildPathString): (WebCore::CSSBasicShapePath::cssText): (WebCore::CSSBasicShapePath::equals): * css/CSSBasicShapes.h: * css/CSSParser.cpp: (WebCore::CSSParser::parseBasicShapePath): (WebCore::CSSParser::parseBasicShape): * css/CSSParser.h: * rendering/RenderElement.h: (WebCore::RenderElement::createsGroup): * rendering/style/BasicShapes.cpp: (WebCore::BasicShapeCircle::canBlend): (WebCore::BasicShapeEllipse::canBlend): (WebCore::BasicShapePolygon::canBlend): (WebCore::BasicShapePath::BasicShapePath): (WebCore::BasicShapePath::path): (WebCore::BasicShapePath::operator==): (WebCore::BasicShapePath::canBlend): (WebCore::BasicShapePath::blend): (WebCore::BasicShapeInset::canBlend): (WebCore::BasicShape::canBlend): Deleted. * rendering/style/BasicShapes.h: * svg/SVGPathBlender.cpp: (WebCore::SVGPathBlender::addAnimatedPath): (WebCore::SVGPathBlender::blendAnimatedPath): (WebCore::SVGPathBlender::canBlendPaths): (WebCore::SVGPathBlender::SVGPathBlender): (WebCore::SVGPathBlender::blendMoveToSegment): (WebCore::SVGPathBlender::blendLineToSegment): (WebCore::SVGPathBlender::blendLineToHorizontalSegment): (WebCore::SVGPathBlender::blendLineToVerticalSegment): (WebCore::SVGPathBlender::blendCurveToCubicSegment): (WebCore::SVGPathBlender::blendCurveToCubicSmoothSegment): (WebCore::SVGPathBlender::blendCurveToQuadraticSegment): (WebCore::SVGPathBlender::blendCurveToQuadraticSmoothSegment): (WebCore::SVGPathBlender::blendArcToSegment): * svg/SVGPathBlender.h: * svg/SVGPathByteStream.h: (WebCore::SVGPathByteStream::operator==): * svg/SVGPathUtilities.cpp: (WebCore::canBlendSVGPathByteStreams): * svg/SVGPathUtilities.h: LayoutTests: Tests for compositing with clip-path and a composited descendant, a ref test which tests clip-paths with evenodd, comparing to SVG rendering, and a transition test to test path blendability. * compositing/masks/clip-path-composited-descendent-expected.txt: Added. * compositing/masks/clip-path-composited-descendent.html: Added. * css3/masking/clip-path-with-path-expected.html: Added. * css3/masking/clip-path-with-path.html: Added. * transitions/clip-path-path-transitions-expected.txt: Added. * transitions/clip-path-path-transitions.html: Added. * transitions/resources/transition-test-helpers.js: Add some basic parsing support for paths. (extractPathValues): (parseClipPath): * transitions/svg-transitions-expected.txt: Canonical link: https://commits.webkit.org/168698@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191551 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-10-26 04:57:46 +00:00
<!DOCTYPE html>
<html>
<head>
<style>
.box {
margin: 20px;
height: 150px;
width: 200px;
-webkit-clip-path: path("M100,40l20,0 0,60 20,0 0,-20 -60,0 0,-20 80,0 0,60 -60,0 0,-80z");
background-color: blue;
}
.box.evenodd {
-webkit-clip-path: path(evenodd, "M100,40l20,0 0,60 20,0 0,-20 -60,0 0,-20 80,0 0,60 -60,0 0,-80z");
background-color: green;
}
</style>
</head>
<body>
<div class="box"></div>
<div class="evenodd box"></div>
</body>
</html>