LibWeb: Avoid a weird reparse of style attributes for pseudo elements

For pseudo elements that represent a browser-generated shadow tree
element, such as ::placeholder, we were reparsing their style attribute
in StyleComputer for some reason.

Instead of doing this, just access the already-parsed version via
Element::inline_style().
This commit is contained in:
Andreas Kling 2024-10-19 17:03:56 +02:00 committed by Andreas Kling
commit d21c5631aa
Notes: github-actions[bot] 2024-10-19 19:15:00 +00:00

View file

@ -2310,8 +2310,7 @@ RefPtr<StyleProperties> StyleComputer::compute_style_impl(DOM::Element& element,
auto style = compute_style(parent_element, *element.use_pseudo_element());
// Merge back inline styles
if (element.has_attribute(HTML::AttributeNames::style)) {
auto* inline_style = parse_css_style_attribute(CSS::Parser::ParsingContext(document()), *element.get_attribute(HTML::AttributeNames::style), element);
if (auto inline_style = element.inline_style()) {
for (auto const& property : inline_style->properties())
style->set_property(property.property_id, property.value);
}