mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 21:08:12 +00:00
LibWeb: Cache the viewport rect across all of style computation
Fetching the viewport rect is currently somewhat expensive, since it requires finding the navigable the document is active in. We can avoid the cost of repeated calls by simply allowing StyleComputer to cache the viewport rect at the start of style computation.
This commit is contained in:
parent
3cd455e554
commit
f0722671c3
3 changed files with 9 additions and 8 deletions
|
@ -1129,6 +1129,9 @@ void Document::update_style()
|
|||
if (m_created_for_appropriate_template_contents)
|
||||
return;
|
||||
|
||||
// Fetch the viewport rect once, instead of repeatedly, during style computation.
|
||||
style_computer().set_viewport_rect({}, viewport_rect());
|
||||
|
||||
evaluate_media_rules();
|
||||
|
||||
auto invalidation = update_style_recursively(*this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue