LibWeb: Make CSS::ComputedProperties GC-allocated

This commit is contained in:
Andreas Kling 2024-12-20 16:35:12 +01:00 committed by Andreas Kling
parent c1cad8fa0e
commit 74469a0c1f
Notes: github-actions[bot] 2024-12-22 09:13:42 +00:00
138 changed files with 337 additions and 339 deletions

View file

@ -99,7 +99,7 @@ GC::Ref<ValidityState const> HTMLInputElement::validity() const
return realm.create<ValidityState>(realm);
}
GC::Ptr<Layout::Node> HTMLInputElement::create_layout_node(CSS::ComputedProperties style)
GC::Ptr<Layout::Node> HTMLInputElement::create_layout_node(GC::Ref<CSS::ComputedProperties> style)
{
if (type_state() == TypeAttributeState::Hidden)
return nullptr;
@ -114,8 +114,8 @@ GC::Ptr<Layout::Node> HTMLInputElement::create_layout_node(CSS::ComputedProperti
// This specification introduces the appearance property to provide some control over this behavior.
// In particular, using appearance: none allows authors to suppress the native appearance of widgets,
// giving them a primitive appearance where CSS can be used to restyle them.
if (style.appearance() == CSS::Appearance::None) {
return Element::create_layout_node_for_display_type(document(), style.display(), style, this);
if (style->appearance() == CSS::Appearance::None) {
return Element::create_layout_node_for_display_type(document(), style->display(), style, this);
}
if (type_state() == TypeAttributeState::SubmitButton || type_state() == TypeAttributeState::Button || type_state() == TypeAttributeState::ResetButton)
@ -127,7 +127,7 @@ GC::Ptr<Layout::Node> HTMLInputElement::create_layout_node(CSS::ComputedProperti
if (type_state() == TypeAttributeState::RadioButton)
return heap().allocate<Layout::RadioButton>(document(), *this, move(style));
return Element::create_layout_node_for_display_type(document(), style.display(), style, this);
return Element::create_layout_node_for_display_type(document(), style->display(), style, this);
}
void HTMLInputElement::adjust_computed_style(CSS::ComputedProperties& style)
@ -1123,16 +1123,16 @@ void HTMLInputElement::create_range_input_shadow_tree()
add_event_listener_without_options(UIEvents::EventNames::mousedown, DOM::IDLEventListener::create(realm(), mousedown_callback));
}
void HTMLInputElement::computed_css_values_changed()
void HTMLInputElement::computed_properties_changed()
{
auto appearance = computed_css_values()->appearance();
auto appearance = computed_properties()->appearance();
if (!appearance.has_value() || *appearance == CSS::Appearance::None)
return;
auto palette = document().page().palette();
auto accent_color = palette.color(ColorRole::Accent).to_string();
auto const& accent_color_property = computed_css_values()->property(CSS::PropertyID::AccentColor);
auto const& accent_color_property = computed_properties()->property(CSS::PropertyID::AccentColor);
if (accent_color_property.has_color())
accent_color = accent_color_property.to_string(CSS::CSSStyleValue::SerializationMode::Normal);