1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:37:44 +00:00

LibWeb: Move use pseudo element styles from TreeBuilder to StyleComputer

The styling of elements using the `use_pseudo_element()` was only
applied on layout. When an element style was recomputed later that
styling was not overruled with the pseudo element selector styles.
This moves the styling override from `TreeBuilder.cpp` to
`StyleComputer.cpp`. Now the styles are always correctly applied.
I also removed the method `property_id_by_index()` because it was
not needed anymore.

Als some calls to `invalidate_layout()` in the Meter, Progress and
Select elements where not needed anymore because the style values
are update on the changing of the style attribute.

This fixes issue #22278.
This commit is contained in:
Bastiaan van der Plaat 2023-12-17 21:03:28 +01:00 committed by Andreas Kling
parent 7578620f25
commit a05fd28b7b
11 changed files with 44 additions and 49 deletions

View file

@ -55,7 +55,6 @@ WebIDL::ExceptionOr<void> HTMLMeterElement::set_value(double value)
{
TRY(set_attribute(HTML::AttributeNames::value, MUST(String::number(value))));
update_meter_value_element();
document().invalidate_layout();
return {};
}
@ -74,7 +73,6 @@ WebIDL::ExceptionOr<void> HTMLMeterElement::set_min(double value)
{
TRY(set_attribute(HTML::AttributeNames::min, MUST(String::number(value))));
update_meter_value_element();
document().invalidate_layout();
return {};
}
@ -96,7 +94,6 @@ WebIDL::ExceptionOr<void> HTMLMeterElement::set_max(double value)
{
TRY(set_attribute(HTML::AttributeNames::max, MUST(String::number(value))));
update_meter_value_element();
document().invalidate_layout();
return {};
}
@ -120,7 +117,6 @@ WebIDL::ExceptionOr<void> HTMLMeterElement::set_low(double value)
{
TRY(set_attribute(HTML::AttributeNames::low, MUST(String::number(value))));
update_meter_value_element();
document().invalidate_layout();
return {};
}
@ -144,7 +140,6 @@ WebIDL::ExceptionOr<void> HTMLMeterElement::set_high(double value)
{
TRY(set_attribute(HTML::AttributeNames::high, MUST(String::number(value))));
update_meter_value_element();
document().invalidate_layout();
return {};
}
@ -168,7 +163,6 @@ WebIDL::ExceptionOr<void> HTMLMeterElement::set_optimum(double value)
{
TRY(set_attribute(HTML::AttributeNames::optimum, MUST(String::number(value))));
update_meter_value_element();
document().invalidate_layout();
return {};
}

View file

@ -53,7 +53,6 @@ WebIDL::ExceptionOr<void> HTMLProgressElement::set_value(double value)
TRY(set_attribute(HTML::AttributeNames::value, MUST(String::number(value))));
update_progress_value_element();
document().invalidate_layout();
return {};
}
@ -74,7 +73,6 @@ WebIDL::ExceptionOr<void> HTMLProgressElement::set_max(double value)
TRY(set_attribute(HTML::AttributeNames::max, MUST(String::number(value))));
update_progress_value_element();
document().invalidate_layout();
return {};
}

View file

@ -213,7 +213,6 @@ WebIDL::ExceptionOr<void> HTMLSelectElement::set_value(String const& value)
for (auto const& option_element : list_of_options())
option_element->set_selected(option_element->value() == value);
update_inner_text_element();
document().invalidate_layout();
// When the user agent is to send select update notifications, queue an element task on the user interaction task source given the select element to run these steps:
queue_an_element_task(HTML::Task::Source::UserInteraction, [this] {
@ -323,7 +322,6 @@ void HTMLSelectElement::form_associated_element_was_inserted()
if (options.size() > 0) {
options.at(0)->set_selected(true);
update_inner_text_element();
document().invalidate_layout();
}
}
});