mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +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:
parent
185335ac63
commit
a0ee86db04
Notes:
github-actions[bot]
2024-10-31 00:00:25 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/a0ee86db045 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2069
3 changed files with 33 additions and 2 deletions
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;
|
||||
}
|
||||
|
||||
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
|
||||
// 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
|
||||
|
@ -133,8 +136,6 @@ void StackingContext::paint_descendants(PaintContext& context, Paintable const&
|
|||
return IterationDecision::Continue;
|
||||
}
|
||||
|
||||
if (stacking_context)
|
||||
return IterationDecision::Continue;
|
||||
if (child.is_positioned() && z_index.value_or(0) == 0)
|
||||
return IterationDecision::Continue;
|
||||
|
||||
|
|
Loading…
Reference in a new issue