mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:38:11 +00:00
LibWeb: Treat multi-value CSS properties as StyleValueList by default
Some properties, such as `margin`, take multiple values but are not complicated enough to require special-case handling. These no longer parsed after my previous StyleValue changes, so this fixes that. In the future we may want to configure whether to allow this for each property.
This commit is contained in:
parent
ef2720bcad
commit
46b93174fc
1 changed files with 12 additions and 1 deletions
|
@ -2839,7 +2839,18 @@ RefPtr<StyleValue> Parser::parse_css_value(PropertyID property_id, TokenStream<S
|
|||
if (component_values.size() == 1)
|
||||
return parse_css_value(m_context, property_id, component_values.first());
|
||||
|
||||
dbgln("Unable to parse value for CSS '{}' property.", string_from_property_id(property_id));
|
||||
// We have multiple values, so treat them as a StyleValueList.
|
||||
// FIXME: Specify in Properties.json whether to permit this for each property.
|
||||
NonnullRefPtrVector<StyleValue> parsed_values;
|
||||
for (auto& component_value : component_values) {
|
||||
auto parsed = parse_css_value(m_context, property_id, component_value);
|
||||
if (!parsed)
|
||||
return {};
|
||||
parsed_values.append(parsed.release_nonnull());
|
||||
}
|
||||
if (!parsed_values.is_empty())
|
||||
return StyleValueList::create(move(parsed_values));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue