LibWeb: Return CSSStyleProperties as a GC::Ref

This commit is contained in:
Sam Atkins 2025-03-18 13:52:01 +00:00
commit 2d220a8bbc
Notes: github-actions[bot] 2025-03-19 13:53:59 +00:00
5 changed files with 6 additions and 6 deletions

View file

@ -43,7 +43,7 @@ void CSSStyleRule::visit_edges(Cell::Visitor& visitor)
} }
// https://drafts.csswg.org/cssom-1/#dom-cssstylerule-style // https://drafts.csswg.org/cssom-1/#dom-cssstylerule-style
CSSStyleProperties* CSSStyleRule::style() GC::Ref<CSSStyleProperties> CSSStyleRule::style()
{ {
return m_declaration; return m_declaration;
} }

View file

@ -30,7 +30,7 @@ public:
String selector_text() const; String selector_text() const;
void set_selector_text(StringView); void set_selector_text(StringView);
CSSStyleProperties* style(); GC::Ref<CSSStyleProperties> style();
[[nodiscard]] FlyString const& qualified_layer_name() const { return parent_layer_internal_qualified_name(); } [[nodiscard]] FlyString const& qualified_layer_name() const { return parent_layer_internal_qualified_name(); }

View file

@ -918,11 +918,11 @@ void Element::set_shadow_root(GC::Ptr<ShadowRoot> shadow_root)
invalidate_style(StyleInvalidationReason::ElementSetShadowRoot); invalidate_style(StyleInvalidationReason::ElementSetShadowRoot);
} }
CSS::CSSStyleProperties* Element::style_for_bindings() GC::Ref<CSS::CSSStyleProperties> Element::style_for_bindings()
{ {
if (!m_inline_style) if (!m_inline_style)
m_inline_style = CSS::CSSStyleProperties::create_element_inline_style({ *this }, {}, {}); m_inline_style = CSS::CSSStyleProperties::create_element_inline_style({ *this }, {}, {});
return m_inline_style; return *m_inline_style;
} }
// https://dom.spec.whatwg.org/#element-html-uppercased-qualified-name // https://dom.spec.whatwg.org/#element-html-uppercased-qualified-name

View file

@ -214,7 +214,7 @@ public:
GC::Ptr<CSS::CSSStyleProperties> inline_style() { return m_inline_style; } GC::Ptr<CSS::CSSStyleProperties> inline_style() { return m_inline_style; }
GC::Ptr<CSS::CSSStyleProperties const> inline_style() const { return m_inline_style; } GC::Ptr<CSS::CSSStyleProperties const> inline_style() const { return m_inline_style; }
CSS::CSSStyleProperties* style_for_bindings(); GC::Ref<CSS::CSSStyleProperties> style_for_bindings();
CSS::StyleSheetList& document_or_shadow_root_style_sheets(); CSS::StyleSheetList& document_or_shadow_root_style_sheets();

View file

@ -2669,7 +2669,7 @@ void justify_the_selection(DOM::Document& document, JustifyAlignment alignment)
element->remove_attribute_ns(Namespace::HTML, HTML::AttributeNames::align); element->remove_attribute_ns(Namespace::HTML, HTML::AttributeNames::align);
// 2. Unset the CSS property "text-align" on element, if it's set by a style attribute. // 2. Unset the CSS property "text-align" on element, if it's set by a style attribute.
auto* inline_style = element->style_for_bindings(); auto inline_style = element->style_for_bindings();
MUST(inline_style->remove_property(CSS::PropertyID::TextAlign)); MUST(inline_style->remove_property(CSS::PropertyID::TextAlign));
// 3. If element is a div or span or center with no attributes, remove it, preserving its descendants. // 3. If element is a div or span or center with no attributes, remove it, preserving its descendants.