From 7bea2b68f49950c2fcd17d28cd63d8946d3c295c Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Sun, 28 Apr 2024 22:05:30 +0200 Subject: [PATCH] LibWeb: Paint non-positioned SC with z-index=0 in paint_descendants() Fixes the bug when non-positioned boxes that establish a stacking context and have z-index=0 are ignored during paint commands recording. --- .../non-positioned-stacking-context-with-z-index-0.html | 7 +++++++ ...non-positioned-stacking-context-with-z-index-0-ref.html | 5 +++++ Userland/Libraries/LibWeb/Painting/StackingContext.cpp | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 Tests/LibWeb/Ref/non-positioned-stacking-context-with-z-index-0.html create mode 100644 Tests/LibWeb/Ref/reference/non-positioned-stacking-context-with-z-index-0-ref.html diff --git a/Tests/LibWeb/Ref/non-positioned-stacking-context-with-z-index-0.html b/Tests/LibWeb/Ref/non-positioned-stacking-context-with-z-index-0.html new file mode 100644 index 00000000000..ebbd9b040eb --- /dev/null +++ b/Tests/LibWeb/Ref/non-positioned-stacking-context-with-z-index-0.html @@ -0,0 +1,7 @@ + + +
Hello diff --git a/Tests/LibWeb/Ref/reference/non-positioned-stacking-context-with-z-index-0-ref.html b/Tests/LibWeb/Ref/reference/non-positioned-stacking-context-with-z-index-0-ref.html new file mode 100644 index 00000000000..0880cf296c1 --- /dev/null +++ b/Tests/LibWeb/Ref/reference/non-positioned-stacking-context-with-z-index-0-ref.html @@ -0,0 +1,5 @@ + +
Hello diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp index 6e09d50d292..5751d25ac10 100644 --- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp @@ -107,7 +107,7 @@ void StackingContext::paint_descendants(PaintContext& context, Paintable const& return; } - if (stacking_context && z_index.has_value()) + if (stacking_context && z_index.value_or(0) != 0) return; if (child.is_positioned() && !z_index.has_value()) return;