From 73fd679bba753839932a62a8b33988e79494f088 Mon Sep 17 00:00:00 2001 From: "Sam Davis Omekara (from Dev Box)" <samomekarajr@microsoft.com> Date: Mon, 9 Dec 2024 07:12:55 -0800 Subject: [PATCH] [Gap Decorations]: Parse the `column-rule-style` property 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 <kbabbitt@microsoft.com> Commit-Queue: Sam Davis Omekara <samomekarajr@microsoft.com> Reviewed-by: Kurt Catti-Schmidt <kschmi@microsoft.com> Reviewed-by: Alison Maher <almaher@microsoft.com> Cr-Commit-Position: refs/heads/main@{#1393647} --- .../gap-decorations-style-computed.html | 13 +++++- .../gap-decorations-style-invalid.html | 24 +++++++++++ .../parsing/gap-decorations-style-valid.html | 43 +++++++++++++++++++ 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 css/css-gaps/tentative/parsing/gap-decorations-style-invalid.html create mode 100644 css/css-gaps/tentative/parsing/gap-decorations-style-valid.html diff --git a/css/css-gaps/tentative/parsing/gap-decorations-style-computed.html b/css/css-gaps/tentative/parsing/gap-decorations-style-computed.html index 379fb89c071774..60600bdb8a7fdf 100644 --- a/css/css-gaps/tentative/parsing/gap-decorations-style-computed.html +++ b/css/css-gaps/tentative/parsing/gap-decorations-style-computed.html @@ -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> diff --git a/css/css-gaps/tentative/parsing/gap-decorations-style-invalid.html b/css/css-gaps/tentative/parsing/gap-decorations-style-invalid.html new file mode 100644 index 00000000000000..d2a11f6c0d3220 --- /dev/null +++ b/css/css-gaps/tentative/parsing/gap-decorations-style-invalid.html @@ -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:samomekarajr@microsoft.com"> +<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> diff --git a/css/css-gaps/tentative/parsing/gap-decorations-style-valid.html b/css/css-gaps/tentative/parsing/gap-decorations-style-valid.html new file mode 100644 index 00000000000000..74d243bd6da188 --- /dev/null +++ b/css/css-gaps/tentative/parsing/gap-decorations-style-valid.html @@ -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:samomekarajr@microsoft.com"> +<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>