From f941b7aefe029c034f9bc3046128e0f8e0cf0a80 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 13 Sep 2022 19:51:47 +0200 Subject: [PATCH] LibWeb: Create stacking context for flex/grid items with z-index != auto --- Userland/Libraries/LibWeb/Layout/Node.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp index e566b683a6..565348eb4d 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.cpp +++ b/Userland/Libraries/LibWeb/Layout/Node.cpp @@ -89,6 +89,15 @@ bool Node::establishes_stacking_context() const return true; if (!computed_values().transformations().is_empty()) return true; + + // Element that is a child of a flex container, with z-index value other than auto. + if (parent() && parent()->computed_values().display().is_flex_inside() && computed_values().z_index().has_value()) + return true; + + // Element that is a child of a grid container, with z-index value other than auto. + if (parent() && parent()->computed_values().display().is_grid_inside() && computed_values().z_index().has_value()) + return true; + return computed_values().opacity() < 1.0f; }