From dd81a975d71819621e2950c7161b12c51764164d Mon Sep 17 00:00:00 2001 From: Mathis Wiehl Date: Sat, 11 Mar 2023 17:17:17 +0100 Subject: [PATCH] LibWeb: Establish a stacking context for root element Until now we were just creating a stacking context for the tree root, which usually is the viewport element. This lead to weird painting behaviour when negative z-index children of the html element that established their own stacking context were drawn below the canvas background. Now we establish a stacking context for both, the root element and the viewport. --- Userland/Libraries/LibWeb/Layout/Node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp index 1342715d5b..ca474c7441 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.cpp +++ b/Userland/Libraries/LibWeb/Layout/Node.cpp @@ -117,7 +117,7 @@ bool Node::establishes_stacking_context() const if (!has_style()) return false; - if (dom_node() == &document().root()) + if (is_root_element() || dom_node() == &document().root()) return true; auto position = computed_values().position();