haikuwebkit/LayoutTests/svg/dom/svg-list-properties-parser-...

30 lines
1.0 KiB
Plaintext
Raw Permalink Normal View History

Leading white spaces should be ignored when parsing an SVG list property https://bugs.webkit.org/show_bug.cgi?id=215602 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2020-08-26 Reviewed by Sam Weinig. Source/WebCore: The SVG2.0 specs state that the CSS value definition syntax must be used to define the syntax of the SVG attributes. The CSS syntax states that leading and trailing spaces should be ignored when parsing the primitive data types of all the SVG lists. This has been inconsistency between WebKit and other browsers and within WebKit itself. Parsing the attribute string of an SVGTransformList skips the leading white spaces while the rest of the lists do not do that. All the parsing methods should skip the leading white spaces before looping to parse individual items. The last step of the loop is to skip the trailing spaces and the delimiter which we do already. Tests: svg/custom/feColorMatrix-values-leading-spaces.html svg/dom/svg-list-properties-parser-leading-trailing-spaces.html * svg/SVGLengthList.cpp: (WebCore::SVGLengthList::parse): * svg/SVGNumberList.cpp: (WebCore::SVGNumberList::parse): * svg/SVGStringList.cpp: (WebCore::SVGStringList::parse): * svg/SVGTransformList.cpp: (WebCore::SVGTransformList::parseGeneric): LayoutTests: * svg/custom/feColorMatrix-values-leading-spaces-expected.html: Added. * svg/custom/feColorMatrix-values-leading-spaces.html: Added. * svg/dom/length-list-parser-expected.txt: * svg/dom/svg-list-properties-parser-leading-trailing-spaces-expected.txt: Added. * svg/dom/svg-list-properties-parser-leading-trailing-spaces.html: Added. Canonical link: https://commits.webkit.org/228661@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266206 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-27 00:06:29 +00:00
This test verifies the leading and the trailing spaces are ignored when parising the attributes of an SVG list properties
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Check SVGNumberList parsing
PASS feColorMatrixElement.values.baseVal.length is 20
PASS SVGListToString(feColorMatrixElement.values.baseVal) is "[0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0]"
Check SVGLengthList parsing
PASS textElement.x.baseVal.length is 10
PASS SVGListToString(textElement.x.baseVal) is "[10 20 30 40 50 60 70 80 90 100]"
Check SVGPointList parsing
PASS polylineElement.points.length is 4
PASS SVGListToString(polylineElement.points) is "[0,0 100,0 100,100 0,100]"
Check SVStringList parsing
PASS textElement.systemLanguage.length is 10
PASS SVGListToString(textElement.systemLanguage) is "[1 2 3 4 5 6 7 8 9 10]"
Check SVTransformList parsing
PASS textElement.transform.baseVal.length is 2
PASS SVGListToString(textElement.transform.baseVal) is "[scale(2, 2) translate(10, 10)]"
PASS successfullyParsed is true
TEST COMPLETE