diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt index 68046b120ac..cab0761aed1 100644 --- a/Libraries/LibWeb/CMakeLists.txt +++ b/Libraries/LibWeb/CMakeLists.txt @@ -132,6 +132,8 @@ set(SOURCES CSS/CSSStyleValue.cpp CSS/CSSSupportsRule.cpp CSS/CSSTransition.cpp + CSS/CSSUnparsedValue.cpp + CSS/CSSVariableReferenceValue.cpp CSS/Descriptor.cpp CSS/Display.cpp CSS/EdgeRect.cpp diff --git a/Libraries/LibWeb/CSS/CSSUnparsedValue.cpp b/Libraries/LibWeb/CSS/CSSUnparsedValue.cpp new file mode 100644 index 00000000000..996bd6c3931 --- /dev/null +++ b/Libraries/LibWeb/CSS/CSSUnparsedValue.cpp @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2025, Sam Atkins + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include "CSSUnparsedValue.h" +#include +#include +#include +#include + +namespace Web::CSS { + +GC_DEFINE_ALLOCATOR(CSSUnparsedValue); + +GC::Ref CSSUnparsedValue::create(JS::Realm& realm, Vector value) +{ + // NB: Convert our GC::Roots into GC::Refs. + Vector converted_value; + for (auto const& variant : value) { + variant.visit( + [&](GC::Root const& it) { converted_value.append(GC::Ref { *it }); }, + [&](String const& it) { converted_value.append(it); }); + } + + return realm.create(realm, move(converted_value)); +} + +// https://drafts.css-houdini.org/css-typed-om-1/#dom-cssunparsedvalue-cssunparsedvalue +WebIDL::ExceptionOr> CSSUnparsedValue::construct_impl(JS::Realm& realm, Vector value) +{ + // AD-HOC: There is no spec for this, see https://github.com/w3c/css-houdini-drafts/issues/1146 + + return CSSUnparsedValue::create(realm, move(value)); +} + +CSSUnparsedValue::CSSUnparsedValue(JS::Realm& realm, Vector value) + : CSSStyleValue(realm) + , m_tokens(move(value)) +{ + m_legacy_platform_object_flags = LegacyPlatformObjectFlags { + .supports_indexed_properties = true, + .has_indexed_property_setter = true, + }; +} + +CSSUnparsedValue::~CSSUnparsedValue() = default; + +void CSSUnparsedValue::initialize(JS::Realm& realm) +{ + WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSUnparsedValue); + Base::initialize(realm); +} + +void CSSUnparsedValue::visit_edges(Visitor& visitor) +{ + Base::visit_edges(visitor); + for (auto const& token : m_tokens) { + if (auto* variable = token.get_pointer>()) { + visitor.visit(*variable); + } + } +} + +// https://drafts.css-houdini.org/css-typed-om-1/#dom-cssunparsedvalue-length +WebIDL::UnsignedLong CSSUnparsedValue::length() const +{ + // The length attribute returns the size of the [[tokens]] internal slot. + return m_tokens.size(); +} + +// https://drafts.css-houdini.org/css-typed-om-1/#ref-for-dfn-determine-the-value-of-an-indexed-property +Optional CSSUnparsedValue::item_value(size_t index) const +{ + // To determine the value of an indexed property of a CSSUnparsedValue this and an index n, let tokens be this’s + // [[tokens]] internal slot, and return tokens[n]. + if (index >= m_tokens.size()) + return {}; + auto value = m_tokens[index]; + return value.visit( + [&](GC::Ref const& variable) -> JS::Value { return variable; }, + [&](String const& string) -> JS::Value { return JS::PrimitiveString::create(vm(), string); }); +} + +static WebIDL::ExceptionOr unparsed_segment_from_js_value(JS::VM& vm, JS::Value& value) +{ + if (value.is_object()) { + if (auto* variable_reference = as_if(value.as_object())) { + return GC::Ref { *variable_reference }; + } + } + return TRY(value.to_string(vm)); +} + +// https://drafts.css-houdini.org/css-typed-om-1/#ref-for-dfn-set-the-value-of-an-existing-indexed-property +WebIDL::ExceptionOr CSSUnparsedValue::set_value_of_existing_indexed_property(u32 n, JS::Value value) +{ + // To set the value of an existing indexed property of a CSSUnparsedValue this, an index n, and a value new value, + // let tokens be this’s [[tokens]] internal slot, and set tokens[n] to new value. + m_tokens[n] = TRY(unparsed_segment_from_js_value(vm(), value)); + return {}; +} + +// https://drafts.css-houdini.org/css-typed-om-1/#ref-for-dfn-set-the-value-of-a-new-indexed-property +WebIDL::ExceptionOr CSSUnparsedValue::set_value_of_new_indexed_property(u32 n, JS::Value value) +{ + // To set the value of a new indexed property of a CSSUnparsedValue this, an index n, and a value new value, + // let tokens be this’s [[tokens]] internal slot. If n is not equal to the size of tokens, throw a RangeError. + // Otherwise, append new value to tokens. + if (n != m_tokens.size()) + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::RangeError, "Index out of range"sv }; + + m_tokens.append(TRY(unparsed_segment_from_js_value(vm(), value))); + return {}; +} + +// https://drafts.css-houdini.org/css-typed-om-1/#serialize-a-cssunparsedvalue +String CSSUnparsedValue::to_string() const +{ + // To serialize a CSSUnparsedValue this: + // 1. Let s initially be the empty string. + StringBuilder s; + + // 2. For each item in this’s [[tokens]] internal slot: + for (auto const& item : m_tokens) { + // FIXME: In order to match the expected test behaviour, this should insert comments, with the same rules as + // serialize_a_series_of_component_values(). See https://github.com/w3c/css-houdini-drafts/issues/1148 + item.visit( + // 1. If item is a USVString, append it to s. + [&](String const& string) { + s.append(string); + }, + // 2. Otherwise, item is a CSSVariableReferenceValue. Serialize it, then append the result to s. + [&](GC::Ref const& variable) { + s.append(variable->to_string()); + }); + } + + // 3. Return s. + return s.to_string_without_validation(); +} + +} diff --git a/Libraries/LibWeb/CSS/CSSUnparsedValue.h b/Libraries/LibWeb/CSS/CSSUnparsedValue.h new file mode 100644 index 00000000000..853052cc48c --- /dev/null +++ b/Libraries/LibWeb/CSS/CSSUnparsedValue.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2025, Sam Atkins + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include +#include + +namespace Web::CSS { + +using CSSUnparsedSegment = Variant>; +using GCRootCSSUnparsedSegment = Variant>; + +// https://drafts.css-houdini.org/css-typed-om-1/#cssunparsedvalue +class CSSUnparsedValue : public CSSStyleValue { + WEB_PLATFORM_OBJECT(CSSUnparsedValue, CSSStyleValue); + GC_DECLARE_ALLOCATOR(CSSUnparsedValue); + +public: + [[nodiscard]] static GC::Ref create(JS::Realm&, Vector); + static WebIDL::ExceptionOr> construct_impl(JS::Realm&, Vector); + + virtual ~CSSUnparsedValue() override; + + WebIDL::UnsignedLong length() const; + virtual Optional item_value(size_t index) const override; + virtual WebIDL::ExceptionOr set_value_of_existing_indexed_property(u32, JS::Value) override; + virtual WebIDL::ExceptionOr set_value_of_new_indexed_property(u32, JS::Value) override; + + virtual String to_string() const override; + +private: + explicit CSSUnparsedValue(JS::Realm&, Vector); + + virtual void initialize(JS::Realm&) override; + virtual void visit_edges(Visitor&) override; + + // https://drafts.css-houdini.org/css-typed-om-1/#dom-cssunparsedvalue-tokens-slot + // They have a [[tokens]] internal slot, which is a list of USVStrings and CSSVariableReferenceValue objects. + // This list is the object’s values to iterate over. + Vector m_tokens; +}; + +} diff --git a/Libraries/LibWeb/CSS/CSSUnparsedValue.idl b/Libraries/LibWeb/CSS/CSSUnparsedValue.idl new file mode 100644 index 00000000000..825c67a489c --- /dev/null +++ b/Libraries/LibWeb/CSS/CSSUnparsedValue.idl @@ -0,0 +1,16 @@ +#import +#import + +// https://drafts.css-houdini.org/css-typed-om-1/#cssunparsedvalue +[Exposed=(Window, Worker, PaintWorklet, LayoutWorklet)] +interface CSSUnparsedValue : CSSStyleValue { + constructor(sequence members); + readonly attribute unsigned long length; + getter CSSUnparsedSegment (unsigned long index); + setter undefined (unsigned long index, CSSUnparsedSegment val); + // FIXME: Different order from the spec, because our IDL parser needs the indexed getter to be defined already. + iterable; +}; + +// https://drafts.css-houdini.org/css-typed-om-1/#typedefdef-cssunparsedsegment +typedef (USVString or CSSVariableReferenceValue) CSSUnparsedSegment; diff --git a/Libraries/LibWeb/CSS/CSSVariableReferenceValue.cpp b/Libraries/LibWeb/CSS/CSSVariableReferenceValue.cpp new file mode 100644 index 00000000000..f87de0b7583 --- /dev/null +++ b/Libraries/LibWeb/CSS/CSSVariableReferenceValue.cpp @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2025, Sam Atkins + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include "CSSVariableReferenceValue.h" +#include +#include +#include +#include +#include +#include + +namespace Web::CSS { + +GC_DEFINE_ALLOCATOR(CSSVariableReferenceValue); +GC::Ref CSSVariableReferenceValue::create(JS::Realm& realm, FlyString variable, GC::Ptr fallback) +{ + return realm.create(realm, move(variable), move(fallback)); +} + +// https://drafts.css-houdini.org/css-typed-om-1/#dom-cssvariablereferencevalue-cssvariablereferencevalue +WebIDL::ExceptionOr> CSSVariableReferenceValue::construct_impl(JS::Realm& realm, FlyString variable, GC::Ptr fallback) +{ + // The CSSVariableReferenceValue(variable, fallback) constructor must, when called, perform the following steps: + // 1. If variable is not a custom property name string, throw a TypeError. + if (!is_a_custom_property_name_string(variable)) + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, MUST(String::formatted("'{}' is not a valid CSS custom property name", variable)) }; + + // 2. Return a new CSSVariableReferenceValue with its variable internal slot set to variable and its fallback internal slot set to fallback. + return CSSVariableReferenceValue::create(realm, move(variable), move(fallback)); +} + +CSSVariableReferenceValue::CSSVariableReferenceValue(JS::Realm& realm, FlyString variable, GC::Ptr fallback) + : Bindings::PlatformObject(realm) + , m_variable(move(variable)) + , m_fallback(move(fallback)) +{ +} + +CSSVariableReferenceValue::~CSSVariableReferenceValue() = default; + +void CSSVariableReferenceValue::initialize(JS::Realm& realm) +{ + WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSVariableReferenceValue); + Base::initialize(realm); +} + +void CSSVariableReferenceValue::visit_edges(Visitor& visitor) +{ + Base::visit_edges(visitor); + visitor.visit(m_fallback); +} + +// https://drafts.css-houdini.org/css-typed-om-1/#dom-cssvariablereferencevalue-variable +String CSSVariableReferenceValue::variable() const +{ + // The getter for the variable attribute of a CSSVariableReferenceValue this must return its variable internal slot. + return m_variable.to_string(); +} + +// https://drafts.css-houdini.org/css-typed-om-1/#dom-cssvariablereferencevalue-variable +WebIDL::ExceptionOr CSSVariableReferenceValue::set_variable(FlyString variable) +{ + // The variable attribute of a CSSVariableReferenceValue this must, on setting a variable variable, perform the following steps: + // 1. If variable is not a custom property name string, throw a TypeError. + if (!is_a_custom_property_name_string(variable)) + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, MUST(String::formatted("'{}' is not a valid CSS custom property name", variable)) }; + + // 2. Otherwise, set this’s variable internal slot to variable. + m_variable = move(variable); + return {}; +} + +// https://drafts.css-houdini.org/css-typed-om-1/#dom-cssvariablereferencevalue-fallback +GC::Ptr CSSVariableReferenceValue::fallback() const +{ + // AD-HOC: No spec algorithm, see https://github.com/w3c/css-houdini-drafts/issues/1146#issuecomment-3188550133 + return m_fallback; +} + +// https://drafts.css-houdini.org/css-typed-om-1/#dom-cssvariablereferencevalue-fallback +WebIDL::ExceptionOr CSSVariableReferenceValue::set_fallback(GC::Ptr fallback) +{ + // AD-HOC: No spec algorithm, see https://github.com/w3c/css-houdini-drafts/issues/1146#issuecomment-3188550133 + m_fallback = move(fallback); + return {}; +} + +// https://drafts.css-houdini.org/css-typed-om-1/#serialize-a-cssvariablereferencevalue +String CSSVariableReferenceValue::to_string() const +{ + // To serialize a CSSVariableReferenceValue this: + // 1. Let s initially be "var(". + StringBuilder s; + s.append("var("sv); + + // 2. Append this’s variable internal slot to s. + s.append(m_variable); + + // 3. If this’s fallback internal slot is not null, append ", " to s, then serialize the fallback internal slot and append it to s. + if (m_fallback) { + // AD-HOC: Tested behaviour requires we append "," without the space. https://github.com/w3c/css-houdini-drafts/issues/1148 + s.append(","sv); + s.append(m_fallback->to_string()); + } + + // 4. Append ")" to s and return s. + s.append(")"sv); + return s.to_string_without_validation(); +} + +} diff --git a/Libraries/LibWeb/CSS/CSSVariableReferenceValue.h b/Libraries/LibWeb/CSS/CSSVariableReferenceValue.h new file mode 100644 index 00000000000..5a430cb1cc9 --- /dev/null +++ b/Libraries/LibWeb/CSS/CSSVariableReferenceValue.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2025, Sam Atkins + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include +#include + +namespace Web::CSS { + +class CSSVariableReferenceValue : public Bindings::PlatformObject { + WEB_PLATFORM_OBJECT(CSSVariableReferenceValue, Bindings::PlatformObject); + GC_DECLARE_ALLOCATOR(CSSVariableReferenceValue); + +public: + [[nodiscard]] static GC::Ref create(JS::Realm&, FlyString variable, GC::Ptr fallback = nullptr); + static WebIDL::ExceptionOr> construct_impl(JS::Realm&, FlyString variable, GC::Ptr fallback); + + virtual ~CSSVariableReferenceValue() override; + + String variable() const; + WebIDL::ExceptionOr set_variable(FlyString); + + GC::Ptr fallback() const; + WebIDL::ExceptionOr set_fallback(GC::Ptr); + + String to_string() const; + +private: + CSSVariableReferenceValue(JS::Realm&, FlyString variable, GC::Ptr fallback); + + virtual void initialize(JS::Realm&) override; + virtual void visit_edges(Visitor&) override; + + FlyString m_variable; + GC::Ptr m_fallback; +}; + +} diff --git a/Libraries/LibWeb/CSS/CSSVariableReferenceValue.idl b/Libraries/LibWeb/CSS/CSSVariableReferenceValue.idl new file mode 100644 index 00000000000..1256ce5b21c --- /dev/null +++ b/Libraries/LibWeb/CSS/CSSVariableReferenceValue.idl @@ -0,0 +1,9 @@ +#import + +// https://drafts.css-houdini.org/css-typed-om-1/#cssvariablereferencevalue +[Exposed=(Window, Worker, PaintWorklet, LayoutWorklet)] +interface CSSVariableReferenceValue { + constructor(USVString variable, optional CSSUnparsedValue? fallback = null); + attribute USVString variable; + readonly attribute CSSUnparsedValue? fallback; +}; diff --git a/Libraries/LibWeb/Forward.h b/Libraries/LibWeb/Forward.h index 8fef334ac5a..01ac1d6543e 100644 --- a/Libraries/LibWeb/Forward.h +++ b/Libraries/LibWeb/Forward.h @@ -256,6 +256,8 @@ class CSSStyleRule; class CSSStyleSheet; class CSSStyleValue; class CSSSupportsRule; +class CSSUnparsedValue; +class CSSVariableReferenceValue; class CursorStyleValue; class CustomIdentStyleValue; class DimensionStyleValue; diff --git a/Libraries/LibWeb/idl_files.cmake b/Libraries/LibWeb/idl_files.cmake index 951018654e3..db0d234c283 100644 --- a/Libraries/LibWeb/idl_files.cmake +++ b/Libraries/LibWeb/idl_files.cmake @@ -52,6 +52,8 @@ libweb_js_bindings(CSS/CSSStyleSheet) libweb_js_bindings(CSS/CSSStyleValue) libweb_js_bindings(CSS/CSSSupportsRule) libweb_js_bindings(CSS/CSSTransition) +libweb_js_bindings(CSS/CSSUnparsedValue) +libweb_js_bindings(CSS/CSSVariableReferenceValue) libweb_js_bindings(CSS/FontFace) libweb_js_bindings(CSS/FontFaceSet) libweb_js_bindings(CSS/MediaList) diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index 50e62a0c6bd..2c61336bc10 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -56,6 +56,8 @@ static bool is_platform_object(Type const& type) "CryptoKey"sv, "CSSKeywordValue"sv, "CSSStyleValue"sv, + "CSSUnparsedValue"sv, + "CSSVariableReferenceValue"sv, "CustomStateSet"sv, "DataTransfer"sv, "Document"sv, diff --git a/Tests/LibWeb/Text/expected/all-window-properties.txt b/Tests/LibWeb/Text/expected/all-window-properties.txt index 53138172835..24fad6c3868 100644 --- a/Tests/LibWeb/Text/expected/all-window-properties.txt +++ b/Tests/LibWeb/Text/expected/all-window-properties.txt @@ -64,6 +64,8 @@ CSSStyleSheet CSSStyleValue CSSSupportsRule CSSTransition +CSSUnparsedValue +CSSVariableReferenceValue CacheStorage CanvasGradient CanvasPattern diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-normalization/normalize-tokens.tentative.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-normalization/normalize-tokens.tentative.txt index 6055c864758..a87e807a9cb 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-normalization/normalize-tokens.tentative.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-normalization/normalize-tokens.tentative.txt @@ -1,3 +1,21 @@ -Harness status: Error +Harness status: OK -Found 0 tests +Found 16 tests + +16 Fail +Fail Normalizing "var(--A)" on a CSS property returns correct CSSUnparsedValue +Fail Normalizing "var(--A)" on a shorthand returns correct CSSUnparsedValue +Fail Normalizing "var(--A)" on a list-valued property returns correct CSSUnparsedValue +Fail Normalizing "var(--A)" on a custom property returns correct CSSUnparsedValue +Fail Normalizing "var(--A, 1em)" on a CSS property returns correct CSSUnparsedValue +Fail Normalizing "var(--A, 1em)" on a shorthand returns correct CSSUnparsedValue +Fail Normalizing "var(--A, 1em)" on a list-valued property returns correct CSSUnparsedValue +Fail Normalizing "var(--A, 1em)" on a custom property returns correct CSSUnparsedValue +Fail Normalizing "var(--A, var(--B))" on a CSS property returns correct CSSUnparsedValue +Fail Normalizing "var(--A, var(--B))" on a shorthand returns correct CSSUnparsedValue +Fail Normalizing "var(--A, var(--B))" on a list-valued property returns correct CSSUnparsedValue +Fail Normalizing "var(--A, var(--B))" on a custom property returns correct CSSUnparsedValue +Fail Normalizing "calc(42px + var(--foo, 15em) + var(--bar, var(--far) + 15px))" on a CSS property returns correct CSSUnparsedValue +Fail Normalizing "calc(42px + var(--foo, 15em) + var(--bar, var(--far) + 15px))" on a shorthand returns correct CSSUnparsedValue +Fail Normalizing "calc(42px + var(--foo, 15em) + var(--bar, var(--far) + 15px))" on a list-valued property returns correct CSSUnparsedValue +Fail Normalizing "calc(42px + var(--foo, 15em) + var(--bar, var(--far) + 15px))" on a custom property returns correct CSSUnparsedValue \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-serialization/cssUnparsedValue.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-serialization/cssUnparsedValue.txt index 752d106e930..ba2cc8fe638 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-serialization/cssUnparsedValue.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-serialization/cssUnparsedValue.txt @@ -2,9 +2,10 @@ Harness status: OK Found 5 tests -5 Fail +2 Pass +3 Fail Fail CSSUnparsedValue containing strings serializes to its tokenized contents -Fail CSSUnparsedValue containing variable references serializes its tokenized contents +Pass CSSUnparsedValue containing variable references serializes its tokenized contents Fail CSSUnparsedValue containing mix of strings and variable references serializes to its tokenized contents -Fail CSSUnparsedValue can hold same object in multiple places +Pass CSSUnparsedValue can hold same object in multiple places Fail attributeStyleMap round-trips correctly, though the comment is gone \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-empty.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-empty.txt index 675f14376b3..d5fa80476fd 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-empty.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-empty.txt @@ -2,5 +2,5 @@ Harness status: OK Found 1 tests -1 Fail -Fail Don't crash when serializing empty CSSUnparsedValue \ No newline at end of file +1 Pass +Pass Don't crash when serializing empty CSSUnparsedValue \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-indexed-getter-setter.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-indexed-getter-setter.txt index 3195f54ebe7..0df0a36fa62 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-indexed-getter-setter.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-indexed-getter-setter.txt @@ -2,10 +2,10 @@ Harness status: OK Found 6 tests -6 Fail -Fail Getting invalid index in CSSUnparsedValue returns undefined -Fail Can update fragment in CSSUnparsedValue to a String -Fail Can update fragment in CSSUnparsedValue to a CSSVariableReference -Fail Setting one past the last fragment in a CSSUnparsedValue to a String appends the new fragment -Fail Setting one past the last fragment in a CSSUnparsedValue to a CSSVariableReferenceValue appends the new fragment -Fail Setting out of range index in CSSUnparsedValue throws RangeError \ No newline at end of file +6 Pass +Pass Getting invalid index in CSSUnparsedValue returns undefined +Pass Can update fragment in CSSUnparsedValue to a String +Pass Can update fragment in CSSUnparsedValue to a CSSVariableReference +Pass Setting one past the last fragment in a CSSUnparsedValue to a String appends the new fragment +Pass Setting one past the last fragment in a CSSUnparsedValue to a CSSVariableReferenceValue appends the new fragment +Pass Setting out of range index in CSSUnparsedValue throws RangeError \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-iterable.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-iterable.txt index 8f9e9c6c5ed..a02ca86a0b8 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-iterable.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-iterable.txt @@ -2,6 +2,6 @@ Harness status: OK Found 2 tests -2 Fail -Fail Iterating over an empty CSSUnparsedValue produces nothing -Fail Iterating over a CSSUnparsedValue produces all fragments \ No newline at end of file +2 Pass +Pass Iterating over an empty CSSUnparsedValue produces nothing +Pass Iterating over a CSSUnparsedValue produces all fragments \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-length.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-length.txt index 9985296f77f..7063f3610b3 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-length.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-length.txt @@ -2,8 +2,8 @@ Harness status: OK Found 4 tests -4 Fail -Fail Length of CSSUnparsedValue with no fragments is zero -Fail Length of CSSUnparsedValue with multiple fragments is the number of fragments -Fail Length of CSSUnparsedValue updates when fragments are appended -Fail Length of CSSUnparsedValue does not change when fragments are modified \ No newline at end of file +4 Pass +Pass Length of CSSUnparsedValue with no fragments is zero +Pass Length of CSSUnparsedValue with multiple fragments is the number of fragments +Pass Length of CSSUnparsedValue updates when fragments are appended +Pass Length of CSSUnparsedValue does not change when fragments are modified \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue.txt index 6055c864758..9a64c03ad2c 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue.txt @@ -1,3 +1,9 @@ -Harness status: Error +Harness status: OK -Found 0 tests +Found 4 tests + +4 Pass +Pass CSSUnparsedValue can be constructed from no arguments +Pass CSSUnparsedValue can be constructed from a single empty string +Pass CSSUnparsedValue can be constructed from a single CSSVariableReferenceValue +Pass CSSUnparsedValue can be constructed from a mix of strings and CSSVariableReferenceValues \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-invalid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-invalid.txt index b42f53a904f..0ec3e48f726 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-invalid.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-invalid.txt @@ -2,6 +2,6 @@ Harness status: OK Found 2 tests -2 Fail -Fail Constructing a CSSVariableReferenceValue with an empty variable name throws a TypeError -Fail Constructing a CSSVariableReferenceValue with an invalid variable name throws SyntaxError \ No newline at end of file +2 Pass +Pass Constructing a CSSVariableReferenceValue with an empty variable name throws a TypeError +Pass Constructing a CSSVariableReferenceValue with an invalid variable name throws SyntaxError \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-variable.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-variable.txt index afce80876a3..fe3627f868b 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-variable.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-variable.txt @@ -2,7 +2,7 @@ Harness status: OK Found 3 tests -3 Fail -Fail CSSVariableReferenceValue.variable can updated to a valid custom property name -Fail Updating CSSVariableReferenceValue.variable to the empty string throws TypeError -Fail Updating CSSVariableReferenceValue.variable to an invalid custom property name throws TypeError \ No newline at end of file +3 Pass +Pass CSSVariableReferenceValue.variable can updated to a valid custom property name +Pass Updating CSSVariableReferenceValue.variable to the empty string throws TypeError +Pass Updating CSSVariableReferenceValue.variable to an invalid custom property name throws TypeError \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue.txt index f116de6e0f4..e4622982549 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue.txt @@ -2,7 +2,7 @@ Harness status: OK Found 3 tests -3 Fail -Fail CSSVariableReferenceValue can be constructed with no fallback -Fail CSSVariableReferenceValue can be constructed with null fallback -Fail CSSVariableReferenceValue can be constructed with valid fallback \ No newline at end of file +3 Pass +Pass CSSVariableReferenceValue can be constructed with no fallback +Pass CSSVariableReferenceValue can be constructed with null fallback +Pass CSSVariableReferenceValue can be constructed with valid fallback \ No newline at end of file