Skip to content

Commit

Permalink
[Gap Decorations]: Parse the column-rule-style property
Browse files Browse the repository at this point in the history
This CL updates the parsing of the `column-rule-style` property to
support the CSS Gap Decorations syntax[1]. To achieve this, a new type
is added to the `CSSGapDecorationPropertyType` enum to represent the
style property. Following this, `ConsumeIdent` is called when handling
cases where the `column-rule-style` property is consumed in
`ConsumeGapDecorationPropertyValue`.

It's important to note that the 'column-rule-style' property was
previously parsed exclusively using the fast parse path through
`CSSParserFastPaths::handled_by_keyword_fast_paths_properties_` and
`CSSParserFastPaths::IsValidKeywordPropertyAndValue`. However, this
approach is no longer sufficient when parsing multiple values, as
supported by the new grammar.

To maintain some parts of the fast parse, the
`CSSParserFastPaths::MaybeParseValue()` path is utilized. This allows
for fast parsing when possible, and falls back to the property's
`ParseSingleValue` path when necessary.

The code is exercised through `gap-decorations-style-valid.html` and
`gap-decorations-style-invalid.html`.

Additionally, the `column-rule-style-invalid.txt` file has been
re-baselined to accommodate the new grammar.

[1]: https://kbabbitt.github.io/css-gap-decorations/original-proposal/index.html#column-row-rule-style

Bug: 357648037
Change-Id: I74548f8dc8628b0c794bb07a3238e8843c934d8d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6065079
Reviewed-by: Kevin Babbitt <[email protected]>
Commit-Queue: Sam Davis Omekara <[email protected]>
Reviewed-by: Kurt Catti-Schmidt <[email protected]>
Reviewed-by: Alison Maher <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1393647}
  • Loading branch information
Sam Davis Omekara (from Dev Box) authored and chromium-wpt-export-bot committed Dec 9, 2024
1 parent 24e7bf1 commit 73fd679
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,18 @@
test_computed_value("column-rule-style", "ridge");
test_computed_value("column-rule-style", "inset");

// TODO(crbug.com/357648037): Add tests for multiple values when parsing is implemented.
test_computed_value("column-rule-style", "dotted dashed solid");
test_computed_value("column-rule-style", "repeat(10, double)");
test_computed_value("column-rule-style", "repeat(3, groove) repeat(4, ridge)");
test_computed_value("column-rule-style", "repeat(auto, solid)");
test_computed_value("column-rule-style", "repeat(auto, dotted solid inset)");
test_computed_value("column-rule-style", "repeat(4, none ridge solid) repeat(auto, hidden)");
test_computed_value("column-rule-style", "inset repeat(auto, solid ridge) repeat(4, none groove hidden)");
test_computed_value("column-rule-style", "repeat(calc(5 + 3), ridge)", "repeat(8, ridge)");
test_computed_value("column-rule-style", "repeat(4, dotted double dashed) repeat(auto, solid) ridge");
test_computed_value("column-rule-style", "repeat(4, dotted double dashed) repeat(auto, solid) repeat(4, none groove hidden)");
test_computed_value("column-rule-style", "ridge repeat(auto, solid)");
test_computed_value("column-rule-style", "ridge repeat(auto, solid) ridge");

</script>
</body>
Expand Down
24 changes: 24 additions & 0 deletions css/css-gaps/tentative/parsing/gap-decorations-style-invalid.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Gap Decorations: column-rule-style parsing</title>
<link rel="help" href="https://kbabbitt.github.io/css-gap-decorations/pr-11115/Overview.html#column-row-rule-style">
<link rel="author" title="Sam Davis Omekara Jr." href="mailto:[email protected]">
<meta name="assert" content="column-rule-style supports only the grammar '[ <line-style-list> | <auto-line-style-list> ]'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("column-rule-style", "auto");

test_invalid_value("column-rule-style", "dashed, dotted, solid");
test_invalid_value("column-rule-style", "repeat(auto, groove, dotted, ridge)");
test_invalid_value("column-rule-style", "repeat(0, dotted, solid, double)");
test_invalid_value("column-rule-style", "repeat(-1, dotted, dashed, double)");
test_invalid_value("column-rule-style", "repeat(auto, dotted) red repeat(auto, ridge)");
</script>
</body>
</html>
43 changes: 43 additions & 0 deletions css/css-gaps/tentative/parsing/gap-decorations-style-valid.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Gap Decorations: parsing column-rule-style with valid values</title>
<link rel="help" href="https://kbabbitt.github.io/css-gap-decorations/pr-11115/Overview.html#column-row-rule-style">
<link rel="author" title="Sam Davis Omekara Jr." href="mailto:[email protected]">
<meta name="assert" content="column-rule-style supports the full grammar '[ <line-style-list> | <auto-line-style-list> ]'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
// <repeat-line-style> = repeat( [ <integer [1,∞]> ] , [ <style> ]+ )
test_valid_value("column-rule-style", "repeat(4, dotted)");
test_valid_value("column-rule-style", "repeat(3, dashed double dotted)");
test_valid_value("column-rule-style", "repeat(1, dashed double dotted solid)");

// <line-style-or-repeat> = [ <style> | <repeat-line-style> ]
test_valid_value("column-rule-style", "dashed");
test_valid_value("column-rule-style", "repeat(4, double)");

// <line-style-list> = [ <line-style-or-repeat> ]+
test_valid_value("column-rule-style", "dotted ridge");
test_valid_value("column-rule-style", "dotted dashed solid groove ridge");
test_valid_value("column-rule-style", "repeat(3, groove) repeat(4, ridge)");
test_valid_value("column-rule-style", "inset repeat(3, ridge) none repeat(4, groove hidden dashed)");
test_valid_value("column-rule-style", "repeat(4, none ridge solid) repeat(5, hidden) double");

// <auto-repeat-line-style> = repeat( auto , [ <style> ]+ )
test_valid_value("column-rule-style", "repeat(auto, solid)");
test_valid_value("column-rule-style", "repeat(auto, dotted solid inset)");

// <auto-line-style-list> = [ <line-style-or-repeat> ]*
// <auto-repeat-line-style>
// [ <line-style-or-repeat> ]*
test_valid_value("column-rule-style", "repeat(auto, dashed groove) ridge");
test_valid_value("column-rule-style", "repeat(4, dotted double dashed) repeat(auto, solid)");
test_valid_value("column-rule-style", "inset repeat(auto, solid ridge) repeat(4, none groove hidden)");
</script>
</body>
</html>

0 comments on commit 73fd679

Please sign in to comment.