Implement parsing and animation support for offset-path
https://bugs.webkit.org/show_bug.cgi?id=231801
Patch by Kiet Ho <Kiet Ho> on 2021-11-05
Reviewed by Simon Fraser.
LayoutTests/imported/w3c:
Updated relevant test expectations.
- web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
- web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt:
- web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
- web-platform-tests/css/motion/animation/offset-path-interpolation-001-expected.txt:
- web-platform-tests/css/motion/animation/offset-path-interpolation-002-expected.txt:
- web-platform-tests/css/motion/animation/offset-path-interpolation-003-expected.txt:
- web-platform-tests/css/motion/animation/offset-path-interpolation-004-expected.txt:
- web-platform-tests/css/motion/animation/offset-path-interpolation-005-expected.txt:
- web-platform-tests/css/motion/inheritance-expected.txt:
- web-platform-tests/css/motion/offset-path-serialization-expected.txt:
- web-platform-tests/css/motion/offset-supports-calc-expected.txt:
- web-platform-tests/css/motion/parsing/offset-path-computed-expected.txt:
- web-platform-tests/css/motion/parsing/offset-path-parsing-valid-expected.txt:
- web-platform-tests/css/motion/parsing/offset-shorthand-expected.txt:
Source/WebCore:
Implements parsing and animation support for offset-path based on clip-path.
offset-path additionally supports ray() shape, which will be implemented in a future patch.
Tests: imported/w3c/web-platform-tests/css/motion/inheritance.html
imported/w3c/web-platform-tests/css/motion/offset-path-serialization.html
imported/w3c/web-platform-tests/css/motion/animation/offset-path-interpolation-001.html
imported/w3c/web-platform-tests/css/motion/animation/offset-path-interpolation-002.html
imported/w3c/web-platform-tests/css/motion/animation/offset-path-interpolation-003.html
imported/w3c/web-platform-tests/css/motion/animation/offset-path-interpolation-004.html
imported/w3c/web-platform-tests/css/motion/animation/offset-path-interpolation-005.html
imported/w3c/web-platform-tests/css/motion/parsing/offset-path-computed.html
imported/w3c/web-platform-tests/css/motion/parsing/offset-path-parsing-invalid.html
imported/w3c/web-platform-tests/css/motion/parsing/offset-path-parsing-valid.html
- Sources.txt:
- WebCore.xcodeproj/project.pbxproj:
- animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
Added animation support for offset-path.
- css/BasicShapeFunctions.cpp:
(WebCore::copySVGPathByteStream):
(WebCore::valueForBasicShape): Added enum to specify conversions done on the
resulting SVG path. So far, the only available conversion is converting relative
draw commands in a path to absolute. This is required when getting the computed value of
offset-path.
- css/BasicShapeFunctions.h:
- css/CSSComputedStyleDeclaration.cpp:
(WebCore::valueForPathOperation): Moved logic to get value of PathOperation
into a separate method.
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle): Added support for
offset-path.
- css/CSSProperties.json: Added entry for offset-path.
- css/parser/CSSPropertyParser.cpp:
(WebCore::consumePathOperation): Renamed from consumeClipPath.
(WebCore::CSSPropertyParser::parseSingleValue): Added support for parsing offset-path.
- rendering/style/RenderStyle.h: Added support for offset-path.
(WebCore::RenderStyle::offsetPath const):
(WebCore::RenderStyle::setOffsetPath):
(WebCore::RenderStyle::initialOffsetPath):
- rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator== const):
- rendering/style/StyleRareNonInheritedData.h: Added storage space for offset-path.
- style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertPathOperation): Renamed from convertClipPath
- svg/SVGPathAbsoluteConverter.cpp: Added helper class to convert relative draw
commands in an SVG path to absolute.
(WebCore::SVGPathAbsoluteConverter::SVGPathAbsoluteConverter):
(WebCore::SVGPathAbsoluteConverter::incrementPathSegmentCount):
(WebCore::SVGPathAbsoluteConverter::continueConsuming):
(WebCore::SVGPathAbsoluteConverter::moveTo):
(WebCore::SVGPathAbsoluteConverter::lineTo):
(WebCore::SVGPathAbsoluteConverter::curveToCubic):
(WebCore::SVGPathAbsoluteConverter::closePath):
(WebCore::SVGPathAbsoluteConverter::lineToHorizontal):
(WebCore::SVGPathAbsoluteConverter::lineToVertical):
(WebCore::SVGPathAbsoluteConverter::curveToCubicSmooth):
(WebCore::SVGPathAbsoluteConverter::curveToQuadratic):
(WebCore::SVGPathAbsoluteConverter::curveToQuadraticSmooth):
(WebCore::SVGPathAbsoluteConverter::arcTo):
- svg/SVGPathAbsoluteConverter.h: Added.
- svg/SVGPathUtilities.cpp:
(WebCore::convertSVGPathByteStreamToAbsoluteCoordinates):
LayoutTests:
Updated relevant test expectations.
- platform/gtk/imported/w3c/web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt:
- platform/ios-wk2/imported/w3c/web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt:
- platform/ios/imported/w3c/web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt:
- platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
- platform/wpe/imported/w3c/web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt:
- platform/wpe/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt: