summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-03-16 19:02:37 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-16 19:16:45 +0100
commitccc37032a4854d8d0b33fcb6e5783ece1aa84b57 (patch)
tree08928ceac2d76f3d8919374cc03551d08fac2b23 /Userland
parente31d1620a83596eed542584118cc02e8902d7715 (diff)
downloadserenity-ccc37032a4854d8d0b33fcb6e5783ece1aa84b57.zip
LibWeb: Don't call establishes_stacking_context() during painting
By the time we're painting, we've already built the stacking context tree. So instead of asking if a box establishes a stacking context, we can ask if its paintable *has* a stacking context. This was taking up ~6% of the profile when mousing around on the HTML specification. With this change, it disappears completely. :^)
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/Painting/StackingContext.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp
index be08000159..7bdec9607b 100644
--- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp
+++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp
@@ -52,7 +52,8 @@ void StackingContext::paint_descendants(PaintContext& context, Layout::Node& box
}
box.for_each_child([&](auto& child) {
- if (child.establishes_stacking_context())
+ // If `child` establishes its own stacking context, skip over it.
+ if (is<Layout::Box>(child) && child.paintable() && static_cast<Layout::Box const&>(child).paint_box()->stacking_context())
return;
bool child_is_inline_or_replaced = child.is_inline() || is<Layout::ReplacedBox>(child);
switch (phase) {