From d21c5631aa5d3bebcf828e893f0d7da031481894 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 19 Oct 2024 17:03:56 +0200 Subject: [PATCH] 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(). --- Userland/Libraries/LibWeb/CSS/StyleComputer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index 705c81ae861..62c05fc6a45 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -2310,8 +2310,7 @@ RefPtr 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); }