Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
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
- Loading branch information
Showing
9 changed files
with
61 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters