LibWeb: Don't generate layer for background-image none entry

Reduces the time spent in `background_layers()` from 1.5% to 0.04% when
loading https://en.wikipedia.org/wiki/2023_in_American_television
This commit is contained in:
Callum Law
2025-12-28 22:13:28 +13:00
committed by Sam Atkins
parent 1708ce2e2b
commit 79740b04b3
Notes: github-actions[bot] 2026-01-05 11:36:46 +00:00
6 changed files with 23 additions and 28 deletions

View File

@@ -45,12 +45,7 @@ bool HTMLHtmlElement::should_use_body_background_properties() const
auto background_color = layout_node()->computed_values().background_color();
auto const& background_layers = layout_node()->background_layers();
for (auto& layer : background_layers) {
if (layer.background_image)
return false;
}
return (background_color == Color::Transparent);
return background_layers.is_empty() && background_color == Color::Transparent;
}
}