1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:48:11 +00:00

LibWeb: Cache the used CSS 'position' value on LayoutNodeWithStyle

This avoids having to query the StyleProperties hash map whenever we
need to know if an element is absolutely positioned. This was extremely
hot in interactive window resize profiles.
This commit is contained in:
Andreas Kling 2020-06-23 23:15:23 +02:00
parent d0312f6208
commit 9b8464f455
4 changed files with 27 additions and 12 deletions

View file

@ -323,7 +323,7 @@ bool LayoutBox::establishes_stacking_context() const
return false;
if (node() == document().root())
return true;
auto position = style().position();
auto position = this->position();
auto z_index = style().z_index();
if (position == CSS::Position::Absolute || position == CSS::Position::Relative) {
if (z_index.has_value())