1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

LibWeb: Rename CSS::StyleResolver => StyleComputer

Resolved style is a spec concept that refers to the weird mix of
computed style and used style reflected by getComputedStyle().

The purpose of this class is to produce the *computed* style for a given
element, so let's call it StyleComputer.
This commit is contained in:
Andreas Kling 2021-09-24 13:49:57 +02:00
parent 3dc6f0bc47
commit f8dd3e14ba
22 changed files with 59 additions and 59 deletions

View file

@ -16,9 +16,9 @@ StyleInvalidator::StyleInvalidator(DOM::Document& document)
{
if (!m_document.should_invalidate_styles_on_attribute_changes())
return;
auto& style_resolver = m_document.style_resolver();
auto& style_computer = m_document.style_computer();
m_document.for_each_in_inclusive_subtree_of_type<DOM::Element>([&](auto& element) {
m_elements_and_matching_rules_before.set(&element, style_resolver.collect_matching_rules(element));
m_elements_and_matching_rules_before.set(&element, style_computer.collect_matching_rules(element));
return IterationDecision::Continue;
});
}
@ -27,7 +27,7 @@ StyleInvalidator::~StyleInvalidator()
{
if (!m_document.should_invalidate_styles_on_attribute_changes())
return;
auto& style_resolver = m_document.style_resolver();
auto& style_computer = m_document.style_computer();
m_document.for_each_in_inclusive_subtree_of_type<DOM::Element>([&](auto& element) {
auto maybe_matching_rules_before = m_elements_and_matching_rules_before.get(&element);
if (!maybe_matching_rules_before.has_value()) {
@ -35,13 +35,13 @@ StyleInvalidator::~StyleInvalidator()
return IterationDecision::Continue;
}
auto& matching_rules_before = maybe_matching_rules_before.value();
auto matching_rules_after = style_resolver.collect_matching_rules(element);
auto matching_rules_after = style_computer.collect_matching_rules(element);
if (matching_rules_before.size() != matching_rules_after.size()) {
element.set_needs_style_update(true);
return IterationDecision::Continue;
}
style_resolver.sort_matching_rules(matching_rules_before);
style_resolver.sort_matching_rules(matching_rules_after);
style_computer.sort_matching_rules(matching_rules_before);
style_computer.sort_matching_rules(matching_rules_after);
for (size_t i = 0; i < matching_rules_before.size(); ++i) {
if (matching_rules_before[i].rule != matching_rules_after[i].rule) {
element.set_needs_style_update(true);