Commit Graph

8 Commits

Author SHA1 Message Date
Jelle Raaijmakers
90a211bf47 LibWeb: Use device-pixel coordinates in display list and AVC
Stop converting between CSS and device pixels as part of rendering - the
display list should be as simple as possible, so convert to DevicePixels
once when constructing the display list.
2026-02-26 07:43:00 +01:00
Aliaksandr Kalenik
af58b00922 LibWeb: Restrict direct access to ScrollFrame's own_offset
Remove the public own_offset() getter from ScrollFrame and the
own_offset_for_frame_with_id() helper from ScrollState. The snapshot
creation in ScrollStateSnapshot now accesses m_own_offset directly
through a friend declaration. This ensures scroll offsets in the
painting pipeline are only read through snapshots.
2026-02-01 16:13:13 +01:00
Aliaksandr Kalenik
d6695d7331 LibWeb: Remove unused cumulative_offset from scroll state tracking
The cumulative_offset was being tracked in ScrollStateSnapshot and
ScrollState but was never actually used. This simplifies the code by
removing cumulative_offset_for_frame_with_id() methods and storing
only own_offset values in ScrollStateSnapshot.
2026-01-23 13:18:39 +01:00
Aliaksandr Kalenik
d4feeb1cad LibWeb: Preserve paintable tree across relayouts
Reuse existing paintables during relayout to reduce GC allocation
pressure. Each paintable subclass implements reset_for_relayout()
to clear state before reuse.
2026-01-21 10:00:17 +01:00
Aliaksandr Kalenik
8d47c98ed3 LibWeb: Cache scroll state snapshot in ViewportPaintable
Cache the scroll state snapshot in ViewportPaintable when
refresh_scroll_state() is called.

The upcoming AccumulatedVisualContext integration requires access to
the scroll state snapshot during hit testing to transform screen
coordinates through scroll frames. Without caching, each hit test would
allocate a new snapshot (a Vector<Entry>), causing many temporary
allocations during mouse movement. Caching the snapshot eliminates this
overhead.
2026-01-15 19:50:53 +01:00
Jelle Raaijmakers
6f50c35d68 LibWeb: Misc. cleanup of code
Some things I came across while working on a bugfix. No functional
changes.
2025-10-27 16:42:27 -07:00
Aliaksandr Kalenik
6507d23e29 LibWeb: Save ScrollState snapshot in DisplayList to avoid race condition
With this change we save a copy of of scroll state at the time of
recording a display list, instead of actual ScrollState pointer that
could be modifed by the main thread while display list is beings
rasterized on the rendering thread, which leads to a frame painted with
inconsistent scroll state.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/4288
2025-04-12 02:55:18 +02:00
Timothy Flynn
93712b24bf Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00