haikuwebkit/LayoutTests/transforms/2d/translate-and-transform-css...

3 lines
175 B
XML
Raw Permalink Normal View History

Add non-animated support for the CSS translate property https://bugs.webkit.org/show_bug.cgi?id=216997 <rdar://problem/69597083> Reviewed by Simon Fraser. LayoutTests/imported/w3c: WPT progressions showing the correct parsing and computed style output of a non-animated "translate" property. We are also adding some more tests to the invalid "translate" parsing to check that we bail once we get junk for optional values after valid values. * web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt: * web-platform-tests/css/css-transforms/animation/translate-composition-expected.txt: * web-platform-tests/css/css-transforms/animation/translate-interpolation-expected.txt: * web-platform-tests/css/css-transforms/parsing/translate-parsing-invalid-expected.txt: * web-platform-tests/css/css-transforms/parsing/translate-parsing-invalid.html: * web-platform-tests/css/css-transforms/parsing/translate-parsing-valid-expected.txt: * web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt: Source/WebCore: We add non-animated support for the CSS "translate" property as specifed in by the CSS Transforms Level 2 specification (​https://drafts.csswg.org/css-transforms-2/#propdef-translate). Tests: transforms/2d/translate-and-transform-attribute-in-svg-expected.svg transforms/2d/translate-and-transform-attribute-in-svg.svg transforms/2d/translate-and-transform-css-property-in-svg-expected.svg transforms/2d/translate-and-transform-css-property-in-svg.svg transforms/2d/translate-in-svg-expected.svg transforms/2d/translate-in-svg.svg transforms/2d/translate-transform-order.html transforms/2d/translate-transform-origin-order.html * Headers.cmake: * css/CSSComputedStyleDeclaration.cpp: (WebCore::rendererCanBeTransformed): (WebCore::computedTransform): (WebCore::computedTranslate): Create a CSSValueList to print out the computed value for the "translate" property. (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): * css/CSSProperties.json: Define the "translate" property with the condition that the runtime setting for individual CSS transform properties is set. * css/TransformFunctions.cpp: (WebCore::translateForValue): Convert a CSSValue to a TranslateTransformOperation when parsing a "translate" property value. * css/TransformFunctions.h: * css/parser/CSSParserContext.cpp: (WebCore::CSSParserContext::CSSParserContext): Add a new flag indicating whether the runtime setting for individual CSS transform properties is set. (WebCore::operator==): * css/parser/CSSParserContext.h: (WebCore::CSSParserContextHash::hash): * css/parser/CSSPropertyParser.cpp: (WebCore::consumeTranslate): Create a CSSValueList when parsing a "translate" property value. (WebCore::CSSPropertyParser::parseSingleValue): * platform/graphics/transforms/TranslateTransformOperation.h: Promote the apply() method to be public so that it can be called from Style::ComputedStyleExtractor::valueForPropertyInStyle(). * rendering/RenderObject.h: (WebCore::RenderObject::hasTransform const): Consider that having the "translate" property is akin to having a "transform" property in the render tree. * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::setTranslate): (WebCore::RenderStyle::applyTransform const): Account for the RenderStyle::translate() value in the right order, after applying the transform origin, but before applying the main transform. * rendering/style/RenderStyle.h: (WebCore::RenderStyle::translate const): (WebCore::RenderStyle::hasTransformRelatedProperty const): (WebCore::RenderStyle::initialTranslate): * rendering/style/StyleRareNonInheritedData.h: * rendering/style/WillChangeData.cpp: (WebCore::WillChangeData::propertyCreatesStackingContext): * style/StyleBuilderConverter.h: (WebCore::Style::BuilderConverter::convertTranslate): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::animatedLocalTransform const): Account for the RenderStyle::translate() value when rendering SVG, ensuring that it is applied before the transform specified by either the "transform" CSS property or SVG attribute. LayoutTests: Add tests checking that the "translate" CSS property is applied in the correct order related to "transform-origin" and "transform" and that it is applied in SVG as well. * platform/ios-13/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt: * platform/ios-wk2/imported/w3c/web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt: * transforms/2d/translate-and-transform-attribute-in-svg-expected.svg: Added. * transforms/2d/translate-and-transform-attribute-in-svg.svg: Added. * transforms/2d/translate-and-transform-css-property-in-svg-expected.svg: Added. * transforms/2d/translate-and-transform-css-property-in-svg.svg: Added. * transforms/2d/translate-in-svg-expected.svg: Added. * transforms/2d/translate-in-svg.svg: Added. * transforms/2d/translate-transform-order-expected.html: Added. * transforms/2d/translate-transform-order.html: Added. * transforms/2d/translate-transform-origin-order-expected.html: Added. * transforms/2d/translate-transform-origin-order.html: Added. Canonical link: https://commits.webkit.org/230048@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267937 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-03 22:07:03 +00:00
<svg xmlns="http://www.w3.org/2000/svg" width="800" height="600">
<rect width="100" height="100" fill="black" transform="scale(2)" style="translate: 100px 100px" />
</svg>