1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:07:36 +00:00

LibWeb: Add a 1-entry lookup cache to FormattingState

This makes repeated lookups of the state for the same box much faster
by bypassing the HashMap.
This commit is contained in:
Andreas Kling 2022-07-06 14:56:10 +02:00
parent e7370443f2
commit 83a6be593c
2 changed files with 39 additions and 16 deletions

View file

@ -111,6 +111,13 @@ struct FormattingState {
FormattingState const* m_parent { nullptr };
FormattingState const& m_root;
struct LookupCache {
NodeWithStyleAndBoxModelMetrics const* box { nullptr };
NodeState* state { nullptr };
bool is_mutable { false };
};
LookupCache m_lookup_cache;
};
Gfx::FloatRect absolute_content_rect(Box const&, FormattingState const&);