mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-01 15:18:06 +00:00
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.
This commit is contained in:
parent
f5e68fcc20
commit
4507920187
Notes:
sideshowbarker
2024-07-17 05:59:44 +09:00
Author: https://github.com/MacDue
Commit: 4507920187
Pull-request: https://github.com/SerenityOS/serenity/pull/15537
Reviewed-by: https://github.com/awesomekling
4 changed files with 13 additions and 4 deletions
|
@ -37,6 +37,13 @@ void PaintableBox::invalidate_stacking_context()
|
|||
m_stacking_context = nullptr;
|
||||
}
|
||||
|
||||
bool PaintableBox::is_out_of_view(PaintContext& context) const
|
||||
{
|
||||
return !enclosing_int_rect(absolute_paint_rect())
|
||||
.translated(context.painter().translation())
|
||||
.intersects(context.painter().clip_rect());
|
||||
}
|
||||
|
||||
PaintableWithLines::PaintableWithLines(Layout::BlockContainer const& layout_box)
|
||||
: PaintableBox(layout_box)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue