mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-25 03:36:36 +00:00
LibWeb: Ensure inline CSS loaded from HTML is ElementInline
This commit changes inline CSS loaded from style attributes of HTML elements to be loaded as CSS::ElementInlineCSSStyleDeclaration instead of CSS::CSSStyleDeclaration, fixing a crash when the style of that element is changed from JavaScript.
This commit is contained in:
parent
afcd053b68
commit
0fdfdbed9f
Notes:
sideshowbarker
2024-07-18 05:39:57 +09:00
Author: https://github.com/DoubleNegation
Commit: 0fdfdbed9f
Pull-request: https://github.com/SerenityOS/serenity/pull/8952
Reviewed-by: https://github.com/awesomekling
3 changed files with 14 additions and 2 deletions
|
@ -158,8 +158,11 @@ void Element::parse_attribute(const FlyString& name, const String& value)
|
|||
m_classes.unchecked_append(new_class);
|
||||
}
|
||||
} else if (name == HTML::AttributeNames::style) {
|
||||
m_inline_style = parse_css_declaration(CSS::ParsingContext(document()), value);
|
||||
set_needs_style_update(true);
|
||||
auto parsed_style = parse_css_declaration(CSS::ParsingContext(document()), value);
|
||||
if (!parsed_style.is_null()) {
|
||||
m_inline_style = CSS::ElementInlineCSSStyleDeclaration::create_and_take_properties_from(*this, parsed_style.release_nonnull());
|
||||
set_needs_style_update(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue