LibWeb/Painting: Don't paint invisible paintables

This check technically isn't necessary in
`SVGForeignObjectPaintable::paint()` because
`PaintableWithLines::paint(context, phase);` does the check already, but
I've added it there anyway to save some debugging time if someone does
add more code there. :^)
This commit is contained in:
Sam Atkins 2025-07-03 10:53:01 +01:00 committed by Alexander Kalenik
commit 994bbcaa75
Notes: github-actions[bot] 2025-07-03 10:40:15 +00:00
4 changed files with 33 additions and 0 deletions

View file

@ -32,6 +32,9 @@ constexpr float sin_60_deg = 0.866025403f;
void MarkerPaintable::paint(PaintContext& context, PaintPhase phase) const
{
if (!is_visible())
return;
if (phase == PaintPhase::Overlay)
PaintableBox::paint(context, phase);
if (phase != PaintPhase::Foreground)

View file

@ -33,6 +33,9 @@ TraversalDecision SVGForeignObjectPaintable::hit_test(CSSPixelPoint position, Hi
void SVGForeignObjectPaintable::paint(PaintContext& context, PaintPhase phase) const
{
if (!is_visible())
return;
PaintableWithLines::paint(context, phase);
}

View file

@ -0,0 +1,2 @@
<!DOCTYPE html>
There should be nothing visible below.

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<link rel="match" href="../../expected/css/hidden-list-item-markers-ref.html" />
<style>
.hidden {
visibility: hidden;
}
.display-none {
display: none;
}
#a { color: red; }
#b { color: green; }
#c { color: blue; }
#d { color: orange; }
</style>
There should be nothing visible below.
<ul class="hidden">
<li id="a"></li>
</ul>
<ul class="display-none">
<li id="b"></li>
</ul>
<ul>
<li class="hidden" id="c"></li>
<li class="display-none" id="d"></li>
</ul>