Truly independent web browser
LibWeb: Store Typed OM identifiers in the parser's representation
Andreas Kling8e805588b638
diff --git a/Libraries/LibWeb/CSS/CSSKeywordValue.cpp b/Libraries/LibWeb/CSS/CSSKeywordValue.cppindex 2a1cff52678..79c452bede1 100644--- a/Libraries/LibWeb/CSS/CSSKeywordValue.cpp+++ b/Libraries/LibWeb/CSS/CSSKeywordValue.cpp@@ -85,8 +85,10 @@ WebIDL::ExceptionOr<NonnullRefPtr<StyleValue const>> CSSKeywordValue::create_an_// FIXME: If this is a registered custom property, check if that allows the keyword.return true;}- auto keyword = keyword_from_string(m_value);- return keyword.has_value() && property_accepts_keyword(property.id(), keyword.value());+ // NB: The keywords listed for a property are not all valid on their own, like `hanging` for text-indent,+ // and a property may accept identifiers that are not listed, like a <custom-ident> or the axis keywords+ // of scroll-snap-type. So we check if the property accepts the value, as an identifier, when parsed.+ return parse_css_value(Parser::ParsingParams {}, serialize_an_identifier(m_value), property.id()) != nullptr;}();if (perform_type_check == PerformTypeCheck::Yes && !matches_grammar) {return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, Utf16String::formatted("Property '{}' does not accept the keyword '{}'", property.name(), m_value) };diff --git a/Libraries/LibWeb/CSS/StylePropertyMap.cpp b/Libraries/LibWeb/CSS/StylePropertyMap.cppindex 7b06caa533d..efeb42525b8 100644--- a/Libraries/LibWeb/CSS/StylePropertyMap.cpp+++ b/Libraries/LibWeb/CSS/StylePropertyMap.cpp@@ -197,34 +197,32 @@ WebIDL::ExceptionOr<void> StylePropertyMap::set(Utf16FlyString property_name, Reif (value->is_unresolved() || value->is_pending_substitution() || value->is_guaranteed_invalid() || value->is_css_wide_keyword())return false;- // Some "list-valued" properties have possible values that are not lists, and those should not be wrapped.- if (property.id() == PropertyID::BackdropFilter && value->to_keyword() == Keyword::None)- return false;-- if (first_is_one_of(property.id(), PropertyID::CounterIncrement, PropertyID::CounterReset, PropertyID::CounterSet) && value->to_keyword() == Keyword::None)- return false;-- if (property.id() == PropertyID::Filter && value->to_keyword() == Keyword::None)- return false;-- if (first_is_one_of(property.id(), PropertyID::FontFeatureSettings, PropertyID::FontVariationSettings) && value->to_keyword() == Keyword::Normal)- return false;-- if (property.id() == PropertyID::Quotes && first_is_one_of(value->to_keyword(), Keyword::Auto, Keyword::None, Keyword::MatchParent))- return false;-- if (property.id() == PropertyID::TransitionProperty && value->to_keyword() == Keyword::None)- return false;-- if (property.id() == PropertyID::WillChange && value->to_keyword() == Keyword::Auto)- return false;-return true;};+ // AD-HOC: A single keyword or identifier should be stored the way our parser stores it for the property. That is+ // either the keyword on its own, as for `box-shadow: none`, or a list with the identifier as its only+ // item, as for `container-name: foo`. So we parse it as a value of the property.+ auto const parsed_identifier_value = [&](PropertyNameAndID const& property, NonnullRefPtr<StyleValue const> const& value) -> RefPtr<StyleValue const> {+ if (property.is_custom_property())+ return nullptr;+ if (!value->is_custom_ident() && !(value->is_keyword() && !value->is_css_wide_keyword()))+ return nullptr;+ auto const parsing_params = props.owner_node().has_value()+ ? Parser::ParsingParams { props.owner_node()->element().document() }+ : Parser::ParsingParams {};+ return parse_css_value(parsing_params, value->to_string(SerializationMode::Normal), property.id());+ };+// 10. Set props[property] to values to set.// NOTE: The property is deleted then added back so that it gets put at the end of the ordered map, which gives the// expected behavior in the face of shorthand properties.+ if (values_to_set.size() == 1) {+ if (auto parsed_value = parsed_identifier_value(property.value(), values_to_set.first())) {+ TRY(props.set_property_style_value(property.value(), parsed_value.release_nonnull()));+ return {};+ }+ }if (values_to_set.size() == 1 && !should_wrap_value_in_list(property.value(), values_to_set.first())) {TRY(props.set_property_style_value(property.value(), values_to_set.take_first()));} else {diff --git a/Libraries/LibWeb/CSS/StyleValues/StyleValue.cpp b/Libraries/LibWeb/CSS/StyleValues/StyleValue.cppindex f91ccceb4db..ebd4e76c298 100644--- a/Libraries/LibWeb/CSS/StyleValues/StyleValue.cpp+++ b/Libraries/LibWeb/CSS/StyleValues/StyleValue.cpp@@ -490,6 +490,12 @@ GC::Ref<CSSStyleValue> StyleValue::reify(Utf16FlyString const& associated_propercase Type::Resolution:case Type::Time:return as_dimension().reify(associated_property);+ case Type::BackgroundSize:+ // NB: A background size whose height is `auto` serializes as just its width, so reify it as that width. For+ // example, the `auto` keyword is parsed as a size of `auto auto`.+ if (as_background_size().size_y()->has_auto())+ return as_background_size().size_x()->reify(associated_property);+ break;case Type::Calculated:return as_calculated().reify(associated_property);case Type::CustomIdent:diff --git a/Libraries/LibWeb/Rust/build.rs b/Libraries/LibWeb/Rust/build.rsindex 60007584f2a..d01799a6769 100644--- a/Libraries/LibWeb/Rust/build.rs+++ b/Libraries/LibWeb/Rust/build.rs@@ -1479,8 +1479,8 @@ fn generate_property_metadata(manifest_dir: &Path, out_dir: &Path) -> Result<(),.collect();let expanded_longhand_counts: Vec<usize> = expanded_shorthand_longhands.iter().map(Vec::len).collect();- // Accepted property keywords mirror property_accepts_keyword() in- // generate_libweb_css_property_id.py.+ // Accepted property keywords are a property's valid identifiers and the+ // keywords of the enums in its valid types.let mut accepted_keyword_rows = Vec::new();let mut accepted_value_type_rows = Vec::new();let mut custom_ident_blacklist_rows = Vec::new();diff --git a/Meta/Generators/generate_libweb_css_property_id.py b/Meta/Generators/generate_libweb_css_property_id.pyindex 9baa829398b..a42b6bb81c8 100755--- a/Meta/Generators/generate_libweb_css_property_id.py+++ b/Meta/Generators/generate_libweb_css_property_id.py@@ -17,7 +17,6 @@ from typing import TextIOsys.path.append(str(Path(__file__).resolve().parent.parent))from Utils.utils import camel_casify-from Utils.utils import snake_casifyfrom Utils.utils import title_casifyfrom Utils.utils import underlying_type_for_enumfrom Utils.utils import write_case_insensitive_ascii_string_to_enum_lookup@@ -316,7 +315,6 @@ bool property_is_list_valued(PropertyID);bool property_accepts_type(PropertyID, ValueType);WEB_API NumericRangesByValueType property_accepted_ranges_by_value_type(PropertyID);-bool property_accepts_keyword(PropertyID, Keyword);Optional<ValueType> property_resolves_percentages_relative_to(PropertyID);// These perform range-checking, but are also safe to call with properties that don't accept that type. (They'll just return false.)@@ -721,55 +719,6 @@ NumericRangesByValueType property_accepted_ranges_by_value_type(PropertyID prope}}-bool property_accepts_keyword(PropertyID property_id, Keyword keyword)-{- switch (property_id) {-""")-- for name, value in properties.items():- if is_legacy_alias(value):- continue- out.write(f" case PropertyID::{title_casify(name)}: {{\n")-- valid_identifiers = value.get("valid-identifiers")- if valid_identifiers:- out.write(" switch (keyword) {\n")- for keyword_string in valid_identifiers:- if ">" in keyword_string:- parts = keyword_string.split(">", 1)- keyword_titlecase = title_casify(parts[0])- else:- keyword_titlecase = title_casify(keyword_string)- out.write(f" case Keyword::{keyword_titlecase}:\n")- out.write("""- return true;- default:- break;- }-""")-- valid_types = value.get("valid-types")- if valid_types:- for valid_type in valid_types:- type_name = valid_type.split(" ")[0]- if type_name not in enum_names:- continue- out.write(f"""- if (keyword_to_{snake_casify(type_name)}(keyword).has_value())- return true;-""")-- out.write("""- return false;- }-""")-- out.write("""- default:- return false;- }-}-Optional<ValueType> property_resolves_percentages_relative_to(PropertyID property_id){switch (property_id) {diff --git a/Tests/LibWeb/Text/expected/css/typed-om-keyword-must-match-property-grammar.txt b/Tests/LibWeb/Text/expected/css/typed-om-keyword-must-match-property-grammar.txtnew file mode 100644index 00000000000..f2002800c7b--- /dev/null+++ b/Tests/LibWeb/Text/expected/css/typed-om-keyword-must-match-property-grammar.txt@@ -0,0 +1,5 @@+text-indent: 'hanging' threw TypeError+computed text-indent: 0px+text-indent: 'each-line' threw TypeError+computed text-indent: 0px+computed font-style after setting font to caption: normaldiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/animation-name.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/animation-name.txtindex 148c46708f3..702427e2c81 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/animation-name.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/animation-name.txt@@ -2,15 +2,14 @@ Harness status: OKFound 33 tests-32 Pass-1 Fail+33 PassPass Can set 'animation-name' to CSS-wide keywords: initialPass Can set 'animation-name' to CSS-wide keywords: inheritPass Can set 'animation-name' to CSS-wide keywords: unsetPass Can set 'animation-name' to CSS-wide keywords: revertPass Can set 'animation-name' to var() references: var(--A)Pass Can set 'animation-name' to the 'none' keyword: none-Fail Can set 'animation-name' to the 'custom-ident' keyword: custom-ident+Pass Can set 'animation-name' to the 'custom-ident' keyword: custom-identPass Setting 'animation-name' to a length: 0px throws TypeErrorPass Setting 'animation-name' to a length: -3.14em throws TypeErrorPass Setting 'animation-name' to a length: 3.14cm throws TypeErrordiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/box-shadow.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/box-shadow.txtnew file mode 100644index 00000000000..eb57dae5f92--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/box-shadow.txt@@ -0,0 +1,38 @@+Harness status: OK++Found 33 tests++33 Pass+Pass Can set 'box-shadow' to CSS-wide keywords: initial+Pass Can set 'box-shadow' to CSS-wide keywords: inherit+Pass Can set 'box-shadow' to CSS-wide keywords: unset+Pass Can set 'box-shadow' to CSS-wide keywords: revert+Pass Can set 'box-shadow' to var() references: var(--A)+Pass Can set 'box-shadow' to the 'none' keyword: none+Pass Setting 'box-shadow' to a length: 0px throws TypeError+Pass Setting 'box-shadow' to a length: -3.14em throws TypeError+Pass Setting 'box-shadow' to a length: 3.14cm throws TypeError+Pass Setting 'box-shadow' to a length: calc(0px + 0em) throws TypeError+Pass Setting 'box-shadow' to a percent: 0% throws TypeError+Pass Setting 'box-shadow' to a percent: -3.14% throws TypeError+Pass Setting 'box-shadow' to a percent: 3.14% throws TypeError+Pass Setting 'box-shadow' to a percent: calc(0% + 0%) throws TypeError+Pass Setting 'box-shadow' to a time: 0s throws TypeError+Pass Setting 'box-shadow' to a time: -3.14ms throws TypeError+Pass Setting 'box-shadow' to a time: 3.14s throws TypeError+Pass Setting 'box-shadow' to a time: calc(0s + 0ms) throws TypeError+Pass Setting 'box-shadow' to an angle: 0deg throws TypeError+Pass Setting 'box-shadow' to an angle: 3.14rad throws TypeError+Pass Setting 'box-shadow' to an angle: -3.14deg throws TypeError+Pass Setting 'box-shadow' to an angle: calc(0rad + 0deg) throws TypeError+Pass Setting 'box-shadow' to a flexible length: 0fr throws TypeError+Pass Setting 'box-shadow' to a flexible length: 1fr throws TypeError+Pass Setting 'box-shadow' to a flexible length: -3.14fr throws TypeError+Pass Setting 'box-shadow' to a number: 0 throws TypeError+Pass Setting 'box-shadow' to a number: -3.14 throws TypeError+Pass Setting 'box-shadow' to a number: 3.14 throws TypeError+Pass Setting 'box-shadow' to a number: calc(2 + 3) throws TypeError+Pass Setting 'box-shadow' to a transform: translate(50%, 50%) throws TypeError+Pass Setting 'box-shadow' to a transform: perspective(10em) throws TypeError+Pass Setting 'box-shadow' to a transform: translate3d(0px, 1px, 2px) translate(0px, 1px) rotate3d(1, 2, 3, 45deg) rotate(45deg) scale3d(1, 2, 3) scale(1, 2) skew(1deg, 1deg) skewX(1deg) skewY(45deg) perspective(1px) matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) matrix(1, 2, 3, 4, 5, 6) throws TypeError+Pass 'box-shadow' does not support '10px 5px 5px red'\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/clip-path.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/clip-path.txtindex b5bdee928e6..a6fe0077b48 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/clip-path.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/clip-path.txt@@ -2,21 +2,21 @@ Harness status: OKFound 40 tests-32 Pass-8 Fail+39 Pass+1 FailPass Can set 'clip-path' to CSS-wide keywords: initialPass Can set 'clip-path' to CSS-wide keywords: inheritPass Can set 'clip-path' to CSS-wide keywords: unsetPass Can set 'clip-path' to CSS-wide keywords: revertPass Can set 'clip-path' to var() references: var(--A)Pass Can set 'clip-path' to the 'none' keyword: none-Fail Can set 'clip-path' to the 'fill-box' keyword: fill-box-Fail Can set 'clip-path' to the 'stroke-box' keyword: stroke-box-Fail Can set 'clip-path' to the 'view-box' keyword: view-box-Fail Can set 'clip-path' to the 'margin-box' keyword: margin-box-Fail Can set 'clip-path' to the 'border-box' keyword: border-box-Fail Can set 'clip-path' to the 'padding-box' keyword: padding-box-Fail Can set 'clip-path' to the 'content-box' keyword: content-box+Pass Can set 'clip-path' to the 'fill-box' keyword: fill-box+Pass Can set 'clip-path' to the 'stroke-box' keyword: stroke-box+Pass Can set 'clip-path' to the 'view-box' keyword: view-box+Pass Can set 'clip-path' to the 'margin-box' keyword: margin-box+Pass Can set 'clip-path' to the 'border-box' keyword: border-box+Pass Can set 'clip-path' to the 'padding-box' keyword: padding-box+Pass Can set 'clip-path' to the 'content-box' keyword: content-boxPass Setting 'clip-path' to a length: 0px throws TypeErrorPass Setting 'clip-path' to a length: -3.14em throws TypeErrorPass Setting 'clip-path' to a length: 3.14cm throws TypeErrordiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/color.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/color.txtindex 9898e446a60..7594de07190 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/color.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/color.txt@@ -2,14 +2,13 @@ Harness status: OKFound 37 tests-36 Pass-1 Fail+37 PassPass Can set 'color' to CSS-wide keywords: initialPass Can set 'color' to CSS-wide keywords: inheritPass Can set 'color' to CSS-wide keywords: unsetPass Can set 'color' to CSS-wide keywords: revertPass Can set 'color' to var() references: var(--A)-Fail Can set 'color' to the 'currentcolor' keyword: currentcolor+Pass Can set 'color' to the 'currentcolor' keyword: currentcolorPass Setting 'color' to a length: 0px throws TypeErrorPass Setting 'color' to a length: -3.14em throws TypeErrorPass Setting 'color' to a length: 3.14cm throws TypeErrordiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/container-name.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/container-name.txtnew file mode 100644index 00000000000..2edb795fc6e--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/container-name.txt@@ -0,0 +1,45 @@+Harness status: OK++Found 39 tests++38 Pass+1 Fail+Pass Can set 'container-name' to CSS-wide keywords: initial+Pass Can set 'container-name' to CSS-wide keywords: inherit+Pass Can set 'container-name' to CSS-wide keywords: unset+Pass Can set 'container-name' to CSS-wide keywords: revert+Pass Can set 'container-name' to var() references: var(--A)+Pass Can set 'container-name' to the 'none' keyword: none+Pass Can set 'container-name' to the 'my-container' keyword: my-container+Pass Can set 'container-name' to the 'auto' keyword: auto+Pass Setting 'container-name' to a length: 0px throws TypeError+Pass Setting 'container-name' to a length: -3.14em throws TypeError+Pass Setting 'container-name' to a length: 3.14cm throws TypeError+Pass Setting 'container-name' to a length: calc(0px + 0em) throws TypeError+Pass Setting 'container-name' to a percent: 0% throws TypeError+Pass Setting 'container-name' to a percent: -3.14% throws TypeError+Pass Setting 'container-name' to a percent: 3.14% throws TypeError+Pass Setting 'container-name' to a percent: calc(0% + 0%) throws TypeError+Pass Setting 'container-name' to a time: 0s throws TypeError+Pass Setting 'container-name' to a time: -3.14ms throws TypeError+Pass Setting 'container-name' to a time: 3.14s throws TypeError+Pass Setting 'container-name' to a time: calc(0s + 0ms) throws TypeError+Pass Setting 'container-name' to an angle: 0deg throws TypeError+Pass Setting 'container-name' to an angle: 3.14rad throws TypeError+Pass Setting 'container-name' to an angle: -3.14deg throws TypeError+Pass Setting 'container-name' to an angle: calc(0rad + 0deg) throws TypeError+Pass Setting 'container-name' to a flexible length: 0fr throws TypeError+Pass Setting 'container-name' to a flexible length: 1fr throws TypeError+Pass Setting 'container-name' to a flexible length: -3.14fr throws TypeError+Pass Setting 'container-name' to a number: 0 throws TypeError+Pass Setting 'container-name' to a number: -3.14 throws TypeError+Pass Setting 'container-name' to a number: 3.14 throws TypeError+Pass Setting 'container-name' to a number: calc(2 + 3) throws TypeError+Pass Setting 'container-name' to a transform: translate(50%, 50%) throws TypeError+Pass Setting 'container-name' to a transform: perspective(10em) throws TypeError+Pass Setting 'container-name' to a transform: translate3d(0px, 1px, 2px) translate(0px, 1px) rotate3d(1, 2, 3, 45deg) rotate(45deg) scale3d(1, 2, 3) scale(1, 2) skew(1deg, 1deg) skewX(1deg) skewY(45deg) perspective(1px) matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) matrix(1, 2, 3, 4, 5, 6) throws TypeError+Fail 'container-name' does not support 'name1 name2'+Pass Setting 'container-name' to the 'and' keyword: and throws TypeError+Pass Setting 'container-name' to the 'not' keyword: not throws TypeError+Pass Setting 'container-name' to the 'or' keyword: or throws TypeError+Pass Setting 'container-name' to the 'default' keyword: default throws TypeError\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/d.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/d.txtindex bb8e6ae8143..2d919ea55eb 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/d.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/d.txt@@ -2,14 +2,13 @@ Harness status: OKFound 33 tests-32 Pass-1 Fail+33 PassPass Can set 'd' to CSS-wide keywords: initialPass Can set 'd' to CSS-wide keywords: inheritPass Can set 'd' to CSS-wide keywords: unsetPass Can set 'd' to CSS-wide keywords: revertPass Can set 'd' to var() references: var(--A)-Fail Can set 'd' to the 'none' keyword: none+Pass Can set 'd' to the 'none' keyword: nonePass Setting 'd' to a length: 0px throws TypeErrorPass Setting 'd' to a length: -3.14em throws TypeErrorPass Setting 'd' to a length: 3.14cm throws TypeErrordiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/flex-basis.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/flex-basis.txtindex 31fe8bf466e..207946f44de 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/flex-basis.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/flex-basis.txt@@ -2,8 +2,8 @@ Harness status: OKFound 36 tests-34 Pass-2 Fail+35 Pass+1 FailPass Can set 'flex-basis' to CSS-wide keywords: initialPass Can set 'flex-basis' to CSS-wide keywords: inheritPass Can set 'flex-basis' to CSS-wide keywords: unset@@ -11,7 +11,7 @@ Pass Can set 'flex-basis' to CSS-wide keywords: revertPass Can set 'flex-basis' to var() references: var(--A)Pass Can set 'flex-basis' to the 'auto' keyword: autoPass Can set 'flex-basis' to the 'content' keyword: content-Fail Can set 'flex-basis' to the 'fit-content' keyword: fit-content+Pass Can set 'flex-basis' to the 'fit-content' keyword: fit-contentPass Can set 'flex-basis' to the 'min-content' keyword: min-contentPass Can set 'flex-basis' to the 'max-content' keyword: max-contentPass Can set 'flex-basis' to a length: 0pxdiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/logical.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/logical.txtindex 26479d38160..b1882ab11e6 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/logical.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/logical.txt@@ -2,8 +2,8 @@ Harness status: OKFound 1468 tests-1296 Pass-172 Fail+1300 Pass+168 FailPass Can set 'margin-block-start' to CSS-wide keywords: initialPass Can set 'margin-block-start' to CSS-wide keywords: inheritPass Can set 'margin-block-start' to CSS-wide keywords: unset@@ -633,7 +633,7 @@ Pass Can set 'border-block-start-color' to CSS-wide keywords: inheritPass Can set 'border-block-start-color' to CSS-wide keywords: unsetPass Can set 'border-block-start-color' to CSS-wide keywords: revertPass Can set 'border-block-start-color' to var() references: var(--A)-Fail Can set 'border-block-start-color' to the 'currentcolor' keyword: currentcolor+Pass Can set 'border-block-start-color' to the 'currentcolor' keyword: currentcolorPass Setting 'border-block-start-color' to a length: 0px throws TypeErrorPass Setting 'border-block-start-color' to a length: -3.14em throws TypeErrorPass Setting 'border-block-start-color' to a length: 3.14cm throws TypeError@@ -764,7 +764,7 @@ Pass Can set 'border-block-end-color' to CSS-wide keywords: inheritPass Can set 'border-block-end-color' to CSS-wide keywords: unsetPass Can set 'border-block-end-color' to CSS-wide keywords: revertPass Can set 'border-block-end-color' to var() references: var(--A)-Fail Can set 'border-block-end-color' to the 'currentcolor' keyword: currentcolor+Pass Can set 'border-block-end-color' to the 'currentcolor' keyword: currentcolorPass Setting 'border-block-end-color' to a length: 0px throws TypeErrorPass Setting 'border-block-end-color' to a length: -3.14em throws TypeErrorPass Setting 'border-block-end-color' to a length: 3.14cm throws TypeError@@ -895,7 +895,7 @@ Pass Can set 'border-inline-start-color' to CSS-wide keywords: inheritPass Can set 'border-inline-start-color' to CSS-wide keywords: unsetPass Can set 'border-inline-start-color' to CSS-wide keywords: revertPass Can set 'border-inline-start-color' to var() references: var(--A)-Fail Can set 'border-inline-start-color' to the 'currentcolor' keyword: currentcolor+Pass Can set 'border-inline-start-color' to the 'currentcolor' keyword: currentcolorPass Setting 'border-inline-start-color' to a length: 0px throws TypeErrorPass Setting 'border-inline-start-color' to a length: -3.14em throws TypeErrorPass Setting 'border-inline-start-color' to a length: 3.14cm throws TypeError@@ -1026,7 +1026,7 @@ Pass Can set 'border-inline-end-color' to CSS-wide keywords: inheritPass Can set 'border-inline-end-color' to CSS-wide keywords: unsetPass Can set 'border-inline-end-color' to CSS-wide keywords: revertPass Can set 'border-inline-end-color' to var() references: var(--A)-Fail Can set 'border-inline-end-color' to the 'currentcolor' keyword: currentcolor+Pass Can set 'border-inline-end-color' to the 'currentcolor' keyword: currentcolorPass Setting 'border-inline-end-color' to a length: 0px throws TypeErrorPass Setting 'border-inline-end-color' to a length: -3.14em throws TypeErrorPass Setting 'border-inline-end-color' to a length: 3.14cm throws TypeErrordiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/scroll-snap-type.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/scroll-snap-type.txtindex 1ce62a68f20..4be7d305df9 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/scroll-snap-type.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/scroll-snap-type.txt@@ -2,19 +2,19 @@ Harness status: OKFound 39 tests-32 Pass-7 Fail+38 Pass+1 FailPass Can set 'scroll-snap-type' to CSS-wide keywords: initialPass Can set 'scroll-snap-type' to CSS-wide keywords: inheritPass Can set 'scroll-snap-type' to CSS-wide keywords: unsetPass Can set 'scroll-snap-type' to CSS-wide keywords: revertPass Can set 'scroll-snap-type' to var() references: var(--A)-Fail Can set 'scroll-snap-type' to the 'none' keyword: none-Fail Can set 'scroll-snap-type' to the 'x' keyword: x-Fail Can set 'scroll-snap-type' to the 'y' keyword: y-Fail Can set 'scroll-snap-type' to the 'block' keyword: block-Fail Can set 'scroll-snap-type' to the 'inline' keyword: inline-Fail Can set 'scroll-snap-type' to the 'both' keyword: both+Pass Can set 'scroll-snap-type' to the 'none' keyword: none+Pass Can set 'scroll-snap-type' to the 'x' keyword: x+Pass Can set 'scroll-snap-type' to the 'y' keyword: y+Pass Can set 'scroll-snap-type' to the 'block' keyword: block+Pass Can set 'scroll-snap-type' to the 'inline' keyword: inline+Pass Can set 'scroll-snap-type' to the 'both' keyword: bothPass Setting 'scroll-snap-type' to a length: 0px throws TypeErrorPass Setting 'scroll-snap-type' to a length: -3.14em throws TypeErrorPass Setting 'scroll-snap-type' to a length: 3.14cm throws TypeErrordiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/shape-outside.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/shape-outside.txtindex b6ae33edc0c..2642767a8a7 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/shape-outside.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/shape-outside.txt@@ -2,18 +2,18 @@ Harness status: OKFound 41 tests-35 Pass-6 Fail+40 Pass+1 FailPass Can set 'shape-outside' to CSS-wide keywords: initialPass Can set 'shape-outside' to CSS-wide keywords: inheritPass Can set 'shape-outside' to CSS-wide keywords: unsetPass Can set 'shape-outside' to CSS-wide keywords: revertPass Can set 'shape-outside' to var() references: var(--A)-Fail Can set 'shape-outside' to the 'none' keyword: none-Fail Can set 'shape-outside' to the 'margin-box' keyword: margin-box-Fail Can set 'shape-outside' to the 'border-box' keyword: border-box-Fail Can set 'shape-outside' to the 'padding-box' keyword: padding-box-Fail Can set 'shape-outside' to the 'content-box' keyword: content-box+Pass Can set 'shape-outside' to the 'none' keyword: none+Pass Can set 'shape-outside' to the 'margin-box' keyword: margin-box+Pass Can set 'shape-outside' to the 'border-box' keyword: border-box+Pass Can set 'shape-outside' to the 'padding-box' keyword: padding-box+Pass Can set 'shape-outside' to the 'content-box' keyword: content-boxFail Can set 'shape-outside' to an imagePass Setting 'shape-outside' to a length: 0px throws TypeErrorPass Setting 'shape-outside' to a length: -3.14em throws TypeErrordiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/stroke-dasharray.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/stroke-dasharray.txtindex c0feb58aff1..ffea647ea8d 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/stroke-dasharray.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/stroke-dasharray.txt@@ -2,14 +2,14 @@ Harness status: OKFound 33 tests-20 Pass-13 Fail+21 Pass+12 FailPass Can set 'stroke-dasharray' to CSS-wide keywords: initialPass Can set 'stroke-dasharray' to CSS-wide keywords: inheritPass Can set 'stroke-dasharray' to CSS-wide keywords: unsetPass Can set 'stroke-dasharray' to CSS-wide keywords: revertPass Can set 'stroke-dasharray' to var() references: var(--A)-Fail Can set 'stroke-dasharray' to the 'none' keyword: none+Pass Can set 'stroke-dasharray' to the 'none' keyword: noneFail Can set 'stroke-dasharray' to a length: 0pxFail Can set 'stroke-dasharray' to a length: -3.14emFail Can set 'stroke-dasharray' to a length: 3.14cmdiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/transition-property.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/transition-property.txtnew file mode 100644index 00000000000..5dd3731dde7--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/transition-property.txt@@ -0,0 +1,41 @@+Harness status: OK++Found 35 tests++32 Pass+3 Fail+Pass Can set 'transition-property' to CSS-wide keywords: initial+Pass Can set 'transition-property' to CSS-wide keywords: inherit+Pass Can set 'transition-property' to CSS-wide keywords: unset+Pass Can set 'transition-property' to CSS-wide keywords: revert+Pass Can set 'transition-property' to var() references: var(--A)+Pass Can set 'transition-property' to the 'none' keyword: none+Pass Setting 'transition-property' to a length: 0px throws TypeError+Pass Setting 'transition-property' to a length: -3.14em throws TypeError+Pass Setting 'transition-property' to a length: 3.14cm throws TypeError+Pass Setting 'transition-property' to a length: calc(0px + 0em) throws TypeError+Pass Setting 'transition-property' to a percent: 0% throws TypeError+Pass Setting 'transition-property' to a percent: -3.14% throws TypeError+Pass Setting 'transition-property' to a percent: 3.14% throws TypeError+Pass Setting 'transition-property' to a percent: calc(0% + 0%) throws TypeError+Pass Setting 'transition-property' to a time: 0s throws TypeError+Pass Setting 'transition-property' to a time: -3.14ms throws TypeError+Pass Setting 'transition-property' to a time: 3.14s throws TypeError+Pass Setting 'transition-property' to a time: calc(0s + 0ms) throws TypeError+Pass Setting 'transition-property' to an angle: 0deg throws TypeError+Pass Setting 'transition-property' to an angle: 3.14rad throws TypeError+Pass Setting 'transition-property' to an angle: -3.14deg throws TypeError+Pass Setting 'transition-property' to an angle: calc(0rad + 0deg) throws TypeError+Pass Setting 'transition-property' to a flexible length: 0fr throws TypeError+Pass Setting 'transition-property' to a flexible length: 1fr throws TypeError+Pass Setting 'transition-property' to a flexible length: -3.14fr throws TypeError+Pass Setting 'transition-property' to a number: 0 throws TypeError+Pass Setting 'transition-property' to a number: -3.14 throws TypeError+Pass Setting 'transition-property' to a number: 3.14 throws TypeError+Pass Setting 'transition-property' to a number: calc(2 + 3) throws TypeError+Pass Setting 'transition-property' to a transform: translate(50%, 50%) throws TypeError+Pass Setting 'transition-property' to a transform: perspective(10em) throws TypeError+Pass Setting 'transition-property' to a transform: translate3d(0px, 1px, 2px) translate(0px, 1px) rotate3d(1, 2, 3, 45deg) rotate(45deg) scale3d(1, 2, 3) scale(1, 2) skew(1deg, 1deg) skewX(1deg) skewY(45deg) perspective(1px) matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) matrix(1, 2, 3, 4, 5, 6) throws TypeError+Fail 'transition-property' does not support 'width'+Fail 'transition-property' does not support 'width, height'+Fail 'transition-property' does not support 'all'\ No newline at end of filediff --git a/Tests/LibWeb/Text/input/css/typed-om-keyword-must-match-property-grammar.html b/Tests/LibWeb/Text/input/css/typed-om-keyword-must-match-property-grammar.htmlnew file mode 100644index 00000000000..4bb94b6217f--- /dev/null+++ b/Tests/LibWeb/Text/input/css/typed-om-keyword-must-match-property-grammar.html@@ -0,0 +1,19 @@+<!DOCTYPE html>+<div id="foo"></div>+<script src="../include.js"></script>+<script>+ test(() => {+ for (const keyword of ["hanging", "each-line"]) {+ try {+ foo.attributeStyleMap.set("text-indent", new CSSKeywordValue(keyword));+ println(`FAIL! text-indent accepted '${keyword}' on its own`);+ } catch (e) {+ println(`text-indent: '${keyword}' threw ${e.name}`);+ }+ println(`computed text-indent: ${getComputedStyle(foo).textIndent}`);+ }++ foo.attributeStyleMap.set("font", new CSSKeywordValue("caption"));+ println(`computed font-style after setting font to caption: ${getComputedStyle(foo).fontStyle}`);+ });+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-typed-om/the-stylepropertymap/properties/box-shadow.html b/Tests/LibWeb/Text/input/wpt-import/css/css-typed-om/the-stylepropertymap/properties/box-shadow.htmlnew file mode 100644index 00000000000..c2db8bc92aa--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-typed-om/the-stylepropertymap/properties/box-shadow.html@@ -0,0 +1,24 @@+<!doctype html>+<meta charset="utf-8">+<title>'box-shadow' property</title>+<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get">+<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set">+<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization">+<script src="../../../../resources/testharness.js"></script>+<script src="../../../../resources/testharnessreport.js"></script>+<script src="../../resources/testhelper.js"></script>+<script src="resources/testsuite.js"></script>+<body>+<div id="log"></div>+<script>+'use strict';++runPropertyTests('box-shadow', [+ { syntax: 'none' },+]);++runUnsupportedPropertyTests('box-shadow', [+ '10px 5px 5px red',+]);++</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-typed-om/the-stylepropertymap/properties/container-name.html b/Tests/LibWeb/Text/input/wpt-import/css/css-typed-om/the-stylepropertymap/properties/container-name.htmlnew file mode 100644index 00000000000..9e5a0bf05df--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-typed-om/the-stylepropertymap/properties/container-name.html@@ -0,0 +1,40 @@+<!doctype html>+<meta charset="utf-8">+<title>'contain' property</title>+<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap">+<script src="../../../../resources/testharness.js"></script>+<script src="../../../../resources/testharnessreport.js"></script>+<script src="../../resources/testhelper.js"></script>+<script src="resources/testsuite.js"></script>+<body>+<div id="log"></div>+<script>+'use strict';++runPropertyTests('container-name', [+ { syntax: 'none' },+ // FIXME: This should be <custom-ident>, but the test harness doesn't+ // currently support it.+ { syntax: 'my-container' },+ // 'auto' is a keyword of other properties, but container-name has no such+ // keyword, so here it is an ordinary <custom-ident>: <custom-ident> excludes+ // only the CSS-wide keywords and 'default'.+ { syntax: 'auto' },+]);++runUnsupportedPropertyTests('container-name', [+ 'name1 name2'+]);++// 'and', 'not' and 'or' are excluded from container-name's <custom-ident>+// (https://drafts.csswg.org/css-conditional-5/#container-name), and 'default'+// is excluded from every <custom-ident>. Note that 'none' is excluded as a+// name too, but remains valid as the property's own keyword.+runInvalidKeywordTests('container-name', [+ 'and',+ 'not',+ 'or',+ 'default',+]);++</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-typed-om/the-stylepropertymap/properties/transition-property.html b/Tests/LibWeb/Text/input/wpt-import/css/css-typed-om/the-stylepropertymap/properties/transition-property.htmlnew file mode 100644index 00000000000..5134371786c--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-typed-om/the-stylepropertymap/properties/transition-property.html@@ -0,0 +1,24 @@+<!doctype html>+<meta charset="utf-8">+<title>'transition-property' property</title>+<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get">+<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set">+<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization">+<script src="../../../../resources/testharness.js"></script>+<script src="../../../../resources/testharnessreport.js"></script>+<script src="../../resources/testhelper.js"></script>+<script src="resources/testsuite.js"></script>+<body>+<div id="log"></div>+<script>+'use strict';++runPropertyTests('transition-property', [+ { syntax: 'none' },+]);++runUnsupportedPropertyTests('transition-property', [+ 'width', 'width, height', 'all'+]);++</script>