mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:18:11 +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
|
@ -2356,13 +2356,6 @@ void StyleComputer::invalidate_rule_cache()
|
|||
m_user_agent_rule_cache = nullptr;
|
||||
}
|
||||
|
||||
CSSPixelRect StyleComputer::viewport_rect() const
|
||||
{
|
||||
if (auto const navigable = document().navigable())
|
||||
return navigable->viewport_rect();
|
||||
return {};
|
||||
}
|
||||
|
||||
void StyleComputer::did_load_font(FlyString const&)
|
||||
{
|
||||
document().invalidate_style();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue