-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Directly check values of grid-template-rows and grid-template-columns…
… when serializing grid-template with grid areas https://bugs.webkit.org/show_bug.cgi?id=260494 rdar://114224504 Reviewed by Tim Nguyen. The grid-template shorthand has two different options for its syntax: - [ <'grid-template-rows'> / <'grid-template-columns'> ] - [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]? In the latter version of the syntax, ShorthandSerializer would bail out early (and not serialize any values) if grid-template-areas (the <string> portion of the syntax) was not set by the grid-template shorthand. We should instead check the values of grid-template-rows and grid-template-columns directly to see if they can be expressed inside of this shorthand. For the rows portion we build up the shorthand iteratively, so we can just check if the value is a valid <track-size> and return an empty string if it is not since that would mean the value could not be expressed in the shorthand. A value being a valid <track-size> means that it must be one of: minmax(), fit-content(), length-percentage, flex, min-content, max-content, or auto. If it is not one of these then the value is not a <track-size>. For the columns portion we have to check the entire value of grid-template-columns beforehand since we will end up appending the whole value to the end of the shorthand. To check to see if a value is a valid <explicit-track-list>, we need to make sure the value contains only <line-names>s and <track-size>s with at least one <track-size> in the value. * LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-shorthand-areas-valid-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-shorthand-valid.html: * Source/WebCore/css/ShorthandSerializer.cpp: (WebCore::ShorthandSerializer::commonSerializationChecks): (WebCore::ShorthandSerializer::serializeGridTemplate const): * Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::isGridBreadthIdent): (WebCore::CSSPropertyParserHelpers::consumeGridBreadth): * Source/WebCore/css/parser/CSSPropertyParserHelpers.h: Canonical link: https://commits.webkit.org/267155@main
- Loading branch information
Showing
6 changed files
with
45 additions
and
16 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
.../web-platform-tests/css/css-grid/parsing/grid-template-shorthand-areas-valid-expected.txt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
|
||
PASS grid-template: none / 1px and "grid-template-areas: "a";" should be valid. | ||
PASS grid-template: none / none and "grid-template-areas: "a";" should be valid. | ||
FAIL grid-template: auto / 1px and "grid-template-areas: "a a a";" should be valid. assert_equals: expected "\"a a a\" / 1px" but got "" | ||
FAIL grid-template: auto / auto and "grid-template-areas: "a a a";" should be valid. assert_equals: expected "\"a a a\" / auto" but got "" | ||
FAIL grid-template: 10px 20px 30px / 40px 50px 60px 70px and "grid-template-areas: "a . b ." "c d . e" "f g h .";" should be valid. assert_equals: expected "\"a . b .\" 10px \"c d . e\" 20px \"f g h .\" 30px / 40px 50px 60px 70px" but got "" | ||
PASS grid-template: auto / 1px and "grid-template-areas: "a a a";" should be valid. | ||
PASS grid-template: auto / auto and "grid-template-areas: "a a a";" should be valid. | ||
PASS grid-template: 10px 20px 30px / 40px 50px 60px 70px and "grid-template-areas: "a . b ." "c d . e" "f g h .";" should be valid. | ||
|
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