diff options
author | MacDue <macdue@dueutil.tech> | 2022-10-10 21:28:57 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-10-13 11:16:27 +0200 |
commit | 450792018744299782c59ce400c9e03a7c361aeb (patch) | |
tree | e75289b2e7ed611648617f836542d74a01f9dbba /Userland/Libraries/LibWeb/Painting/CanvasPaintable.cpp | |
parent | f5e68fcc2056f3deae6183a3906dcf66f05107f2 (diff) | |
download | serenity-450792018744299782c59ce400c9e03a7c361aeb.zip |
LibWeb: Fix position: fixed canvases/images disappearing when scrolling
This fixes the Serenity logo vanishing after scrolling on the 4th
birthday post.
The previous check did not account for any translation in the painter.
This now uses the painter's clip rect and translation to work out
if a rect is visible. It also makes use of `absolute_paint_rect()`
rather than `absolute_rect()` which can account for things like
box-shadows.
Diffstat (limited to 'Userland/Libraries/LibWeb/Painting/CanvasPaintable.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/Painting/CanvasPaintable.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/Painting/CanvasPaintable.cpp b/Userland/Libraries/LibWeb/Painting/CanvasPaintable.cpp index 8e7977f501..82253eaa09 100644 --- a/Userland/Libraries/LibWeb/Painting/CanvasPaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/CanvasPaintable.cpp @@ -34,8 +34,8 @@ void CanvasPaintable::paint(PaintContext& context, PaintPhase phase) const auto canvas_rect = absolute_rect().to_rounded<int>(); ScopedCornerRadiusClip corner_clip { context.painter(), canvas_rect, normalized_border_radii_data(ShrinkRadiiForBorders::Yes) }; - // FIXME: This should be done at a different level. Also rect() does not include padding etc! - if (!context.viewport_rect().intersects(canvas_rect)) + // FIXME: This should be done at a different level. + if (is_out_of_view(context)) return; if (layout_box().dom_node().bitmap()) { |