mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 15:16:14 +00:00
LibWeb: Prevent painting grid items twice as a stacking context
We paint grid item nodes as a stacking context when they have no `z-index` style set. However, a grid item could already have a stacking context established - for example, when the `filter` style is applied. This causes these nodes to be drawn twice. Skip painting grid item nodes if a stacking context is already present.
This commit is contained in:
committed by
Alexander Kalenik
parent
185335ac63
commit
a0ee86db04
16
Tests/LibWeb/Ref/grid-item-and-css-filter.html
Normal file
16
Tests/LibWeb/Ref/grid-item-and-css-filter.html
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<link rel="match" href="reference/grid-item-and-css-filter-ref.html" />
|
||||||
|
<style>
|
||||||
|
#a {
|
||||||
|
background-color: #000;
|
||||||
|
color: #fff;
|
||||||
|
display: grid;
|
||||||
|
}
|
||||||
|
#b {
|
||||||
|
filter: blur(5px);
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div id="a">
|
||||||
|
<div id="b">
|
||||||
|
Ladybird
|
||||||
14
Tests/LibWeb/Ref/reference/grid-item-and-css-filter-ref.html
Normal file
14
Tests/LibWeb/Ref/reference/grid-item-and-css-filter-ref.html
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<style>
|
||||||
|
#a {
|
||||||
|
background-color: #000;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
#b {
|
||||||
|
filter: blur(5px);
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div id="a">
|
||||||
|
<div id="b">
|
||||||
|
Ladybird
|
||||||
@@ -120,6 +120,9 @@ void StackingContext::paint_descendants(PaintContext& context, Paintable const&
|
|||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (stacking_context)
|
||||||
|
return IterationDecision::Continue;
|
||||||
|
|
||||||
// NOTE: Grid specification https://www.w3.org/TR/css-grid-2/#z-order says that grid items should be treated
|
// NOTE: Grid specification https://www.w3.org/TR/css-grid-2/#z-order says that grid items should be treated
|
||||||
// the same way as CSS2 defines for inline-blocks:
|
// the same way as CSS2 defines for inline-blocks:
|
||||||
// "For each one of these, treat the element as if it created a new stacking context, but any positioned
|
// "For each one of these, treat the element as if it created a new stacking context, but any positioned
|
||||||
@@ -133,8 +136,6 @@ void StackingContext::paint_descendants(PaintContext& context, Paintable const&
|
|||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stacking_context)
|
|
||||||
return IterationDecision::Continue;
|
|
||||||
if (child.is_positioned() && z_index.value_or(0) == 0)
|
if (child.is_positioned() && z_index.value_or(0) == 0)
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user