1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:57:35 +00:00

LibWeb: Implement CSS declaration block's "updating flag"

This flag is used to prevent reparsing the style attribute after it is
automatically updated after using the CSSOM API to mutate style.
This commit is contained in:
Andreas Kling 2022-04-11 16:56:52 +02:00
parent 66618a666b
commit a8afb883c1
4 changed files with 27 additions and 2 deletions

View file

@ -293,6 +293,11 @@ RefPtr<Layout::Node> Element::create_layout_node_for_display_type(DOM::Document&
TODO();
}
CSS::CSSStyleDeclaration const* Element::inline_style() const
{
return m_inline_style;
}
void Element::parse_attribute(FlyString const& name, String const& value)
{
if (name == HTML::AttributeNames::class_) {
@ -305,6 +310,9 @@ void Element::parse_attribute(FlyString const& name, String const& value)
if (m_class_list)
m_class_list->associated_attribute_changed(value);
} else if (name == HTML::AttributeNames::style) {
// https://drafts.csswg.org/cssom/#ref-for-cssstyledeclaration-updating-flag
if (m_inline_style && m_inline_style->is_updating())
return;
m_inline_style = parse_css_style_attribute(CSS::ParsingContext(document()), value, *this);
set_needs_style_update(true);
}