Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 36071c56fa58a4258963e403263ab1e3d984f82c https://github.com/WebKit/WebKit/commit/36071c56fa58a4258963e403263ab1e3d984f82c Author: Chris Dumez <cdu...@apple.com> Date: 2022-12-20 (Tue, 20 Dec 2022)
Changed paths: M LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/stroke-dasharray-expected.txt M LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/stroke-dasharray.html M LayoutTests/imported/w3c/web-platform-tests/svg/painting/parsing/stroke-dasharray-invalid-expected.txt M Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp M Source/WebCore/css/parser/CSSPropertyParserHelpers.h M Source/WebCore/css/typedom/CSSUnitValue.cpp M Source/WebCore/style/StyleBuilderConverter.h M Source/WebCore/svg/SVGLengthValue.cpp M Source/WebCore/svg/SVGLengthValue.h Log Message: ----------- Align `stroke-dasharray` CSS property parsing with the specification https://bugs.webkit.org/show_bug.cgi?id=249615 Reviewed by Simon Fraser. Align `stroke-dasharray` CSS property parsing with the specification: - https://svgwg.org/svg2-draft/painting.html#StrokeDashing - https://svgwg.org/svg2-draft/painting.html#DataTypeDasharray * LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/stroke-dasharray-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/stroke-dasharray.html: Update stroke-dasharray css-typed-on WPT test to match the specification. In particular, <length> | <percentage> | <number> should be allowed. Negative values shouldn't be allowed. Also, computed values should be converted to lengths if numbers were provided. * LayoutTests/imported/w3c/web-platform-tests/svg/painting/parsing/stroke-dasharray-invalid-expected.txt: Rebaseline WPT test now that more checks are passing. * Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp: Update LengthRawKnownTokenTypeNumberConsumer::consume() to stop ignoring the UnitlessZeroQuirk parameter. Previously, no matter what value the caller was passing for this parameter, we were allowing unitless zero. Update call sites to pass UnitlessZeroQuirk::Allow to maintain pre-existing behavior for now. However, I made sure to pass UnitlessZeroQuirk::Forbid in consumeStrokeDasharray() since we want to make sure "0" gets parsed as a <number>, not a <length> (covered by stroke-dasharray-valid.html WPT test). (WebCore::CSSPropertyParserHelpers::consumeStrokeDasharray): Fallback to parsing input as a <number> if parsing it as a <length-percentage>, as per the specification. * Source/WebCore/css/typedom/CSSUnitValue.cpp: (WebCore::isValueOutOfRangeForProperty): Update isValueOutOfRangeForProperty() to properly indicate that stroke-dasharray doesn't allow negative values. * Source/WebCore/style/StyleBuilderConverter.h: (WebCore::Style::BuilderConverter::convertSVGLengthValue): (WebCore::Style::BuilderConverter::convertSVGLengthVector): (WebCore::Style::BuilderConverter::convertStrokeDashArray): Update our style builder converter to: - Deal with stroke-dasharray values coming from CSS-Typed-OM, which may not have been converted to a CSSValueList yet (unlike values coming from the CSS parser). - Request that numbers get converted to lengths (by using 'px' unit), now that we allow numbers at parser level (per the specification). * Source/WebCore/svg/SVGLengthValue.cpp: (WebCore::SVGLengthValue::fromCSSPrimitiveValue): * Source/WebCore/svg/SVGLengthValue.h: Canonical link: https://commits.webkit.org/258136@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes