mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-25 20:22:18 +03:00
LibWeb: Make Element::inline_style() return specific declaration type
This removes a bunch of RTTI checks in StyleComputer.
This commit is contained in:
parent
25c22bb5e5
commit
4679dbc9df
Notes:
sideshowbarker
2024-07-16 22:14:49 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/4679dbc9df Pull-request: https://github.com/SerenityOS/serenity/pull/23634 Reviewed-by: https://github.com/AtkinsSJ ✅
@ -742,7 +742,7 @@ void StyleComputer::cascade_declarations(StyleProperties& style, DOM::Element& e
|
||||
}
|
||||
|
||||
if (cascade_origin == CascadeOrigin::Author && !pseudo_element.has_value()) {
|
||||
if (auto const* inline_style = verify_cast<ElementInlineCSSStyleDeclaration>(element.inline_style())) {
|
||||
if (auto const inline_style = element.inline_style()) {
|
||||
for (auto const& property : inline_style->properties()) {
|
||||
if (important != property.important)
|
||||
continue;
|
||||
@ -769,7 +769,7 @@ static void cascade_custom_properties(DOM::Element& element, Optional<CSS::Selec
|
||||
needed_capacity += verify_cast<PropertyOwningCSSStyleDeclaration>(matching_rule.rule->declaration()).custom_properties().size();
|
||||
|
||||
if (!pseudo_element.has_value()) {
|
||||
if (auto const* inline_style = verify_cast<PropertyOwningCSSStyleDeclaration>(element.inline_style()))
|
||||
if (auto const inline_style = element.inline_style())
|
||||
needed_capacity += inline_style->custom_properties().size();
|
||||
}
|
||||
|
||||
@ -782,7 +782,7 @@ static void cascade_custom_properties(DOM::Element& element, Optional<CSS::Selec
|
||||
}
|
||||
|
||||
if (!pseudo_element.has_value()) {
|
||||
if (auto const* inline_style = verify_cast<PropertyOwningCSSStyleDeclaration>(element.inline_style())) {
|
||||
if (auto const inline_style = element.inline_style()) {
|
||||
for (auto const& it : inline_style->custom_properties())
|
||||
custom_properties.set(it.key, it.value);
|
||||
}
|
||||
|
@ -443,11 +443,6 @@ JS::GCPtr<Layout::Node> Element::create_layout_node_for_display_type(DOM::Docume
|
||||
return document.heap().allocate_without_realm<Layout::InlineNode>(document, element, move(style));
|
||||
}
|
||||
|
||||
CSS::CSSStyleDeclaration const* Element::inline_style() const
|
||||
{
|
||||
return m_inline_style.ptr();
|
||||
}
|
||||
|
||||
void Element::run_attribute_change_steps(FlyString const& local_name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
|
||||
{
|
||||
attribute_change_steps(local_name, old_value, value, namespace_);
|
||||
|
@ -183,7 +183,7 @@ public:
|
||||
|
||||
void reset_animated_css_properties();
|
||||
|
||||
CSS::CSSStyleDeclaration const* inline_style() const;
|
||||
JS::GCPtr<CSS::ElementInlineCSSStyleDeclaration const> inline_style() const { return m_inline_style; }
|
||||
|
||||
CSS::CSSStyleDeclaration* style_for_bindings();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user