LibWeb: Stop constructing temporary ElementInlineCSSStyleDeclarations

Previously, parse_css_style_attribute() would parse the string, extract
the properties, add them to a newly-created
ElementInlineCSSStyleDeclarations, and then user code would take the
properties back out of it again and throw it away. Instead, just return
the list of properties, and the caller can create an EICSD if it needs
one.
This commit is contained in:
Sam Atkins 2025-03-17 12:55:21 +00:00
commit 50455c2f5e
Notes: github-actions[bot] 2025-03-19 13:54:35 +00:00
5 changed files with 19 additions and 22 deletions

View file

@ -1317,7 +1317,7 @@ Vector<Vector<ComponentValue>> Parser::parse_a_comma_separated_list_of_component
return groups;
}
ElementInlineCSSStyleDeclaration* Parser::parse_as_style_attribute(DOM::Element& element)
Parser::PropertiesAndCustomProperties Parser::parse_as_style_attribute()
{
auto expand_shorthands = [&](Vector<StyleProperty>& properties) -> Vector<StyleProperty> {
Vector<StyleProperty> expanded_properties;
@ -1341,9 +1341,9 @@ ElementInlineCSSStyleDeclaration* Parser::parse_as_style_attribute(DOM::Element&
auto declarations_and_at_rules = parse_a_blocks_contents(m_token_stream);
m_rule_context.take_last();
auto [properties, custom_properties] = extract_properties(declarations_and_at_rules);
auto expanded_properties = expand_shorthands(properties);
return ElementInlineCSSStyleDeclaration::create(element, move(expanded_properties), move(custom_properties));
auto properties = extract_properties(declarations_and_at_rules);
properties.properties = expand_shorthands(properties.properties);
return properties;
}
bool Parser::is_valid_in_the_current_context(Declaration const&) const