LibWeb: Extract device_pixels_per_css_pixel getter from loop

This reduces time spent in StyleComputer::compute_property_values() by
~10% when loading https://html.spec.whatwg.org/
This commit is contained in:
Tim Ledbetter 2025-11-11 06:56:17 +00:00 committed by Jelle Raaijmakers
parent df23b42b37
commit 0ec97eabab
Notes: github-actions[bot] 2025-11-12 10:22:17 +00:00

View file

@ -2149,8 +2149,9 @@ void StyleComputer::compute_property_values(ComputedProperties& style, Optional<
return style.property(property_id);
};
auto device_pixels_per_css_pixel = m_document->page().client().device_pixels_per_css_pixel();
style.for_each_property([&](PropertyID property_id, auto& specified_value) {
auto const& computed_value = compute_value_of_property(property_id, specified_value, get_property_specified_value, computation_context, m_document->page().client().device_pixels_per_css_pixel());
auto const& computed_value = compute_value_of_property(property_id, specified_value, get_property_specified_value, computation_context, device_pixels_per_css_pixel);
style.set_property_without_modifying_flags(property_id, computed_value);
});