mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb/CSS: Parse list values as lists in CSSStyleValue parsing
This commit is contained in:
parent
07d77e89dd
commit
7d96fbaf7a
Notes:
github-actions[bot]
2025-11-03 18:22:48 +00:00
Author: https://github.com/AtkinsSJ
Commit: 7d96fbaf7a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6677
Reviewed-by: https://github.com/gmta ✅
2 changed files with 8 additions and 5 deletions
|
|
@ -10,6 +10,7 @@
|
|||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
#include <LibWeb/CSS/PropertyNameAndID.h>
|
||||
#include <LibWeb/CSS/StyleValues/StyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
|
||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
|
@ -85,11 +86,14 @@ WebIDL::ExceptionOr<Variant<GC::Ref<CSSStyleValue>, GC::RootVector<GC::Ref<CSSSt
|
|||
if (!whole_value)
|
||||
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, MUST(String::formatted("Failed to parse '{}' as a value for '{}' property", css_text, property->name())) };
|
||||
|
||||
// FIXME: 4. Subdivide into iterations whole value, according to property, and let values be the result.
|
||||
// 4. Subdivide into iterations whole value, according to property, and let values be the result.
|
||||
auto values = whole_value->subdivide_into_iterations(property.value());
|
||||
|
||||
// 5. For each value in values, replace it with the result of reifying value for property.
|
||||
GC::RootVector<GC::Ref<CSSStyleValue>> reified_values { vm.heap() };
|
||||
reified_values.append(whole_value->reify(*vm.current_realm(), property->name()));
|
||||
for (auto const& value : values) {
|
||||
reified_values.append(value->reify(*vm.current_realm(), property->name()));
|
||||
}
|
||||
|
||||
// 6. If parseMultiple is false, return values[0]. Otherwise, return values.
|
||||
// FIXME: We need to somehow store the source css_text on the returned CSSStyleValue.
|
||||
|
|
|
|||
|
|
@ -2,10 +2,9 @@ Harness status: OK
|
|||
|
||||
Found 5 tests
|
||||
|
||||
4 Pass
|
||||
1 Fail
|
||||
5 Pass
|
||||
Pass CSSStyleValue.parseAll() with a valid property returns a list with a single CSSStyleValue
|
||||
Pass CSSStyleValue.parseAll() is not case sensitive
|
||||
Fail CSSStyleValue.parseAll() with a valid list-valued property returns a list with a single CSSStyleValue
|
||||
Pass CSSStyleValue.parseAll() with a valid list-valued property returns a list with a single CSSStyleValue
|
||||
Pass CSSStyleValue.parseAll() with a valid shorthand property returns a CSSStyleValue
|
||||
Pass CSSStyleValue.parseAll() with a valid custom property returns a list with a single CSSStyleValue
|
||||
Loading…
Add table
Add a link
Reference in a new issue