1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:47:45 +00:00

LibWeb: Resolve relative offsets *once* after layout

Instead of applying relative offsets (like position:relative insets)
during painting and hit testing, we now do a pass at the end of layout
and assign the final resolved offsets to paintables.

This makes painting and hit testing easier since they don't have to
think about relative offsets, and it also fixes a bug where offsets were
not applied to text fragments inside inline-flow elements that were
themselves position:relative.
This commit is contained in:
Andreas Kling 2023-08-15 15:11:10 +02:00
parent 481fdfee68
commit 25a3d0d643
6 changed files with 117 additions and 24 deletions

View file

@ -112,7 +112,6 @@ public:
Optional<CSSPixelRect> calculate_overflow_clipped_rect() const;
void set_overflow_data(OverflowData data) { m_overflow_data = move(data); }
void set_containing_line_box_fragment(Optional<Layout::LineBoxFragmentCoordinate>);
StackingContext* stacking_context() { return m_stacking_context; }
StackingContext const* stacking_context() const { return m_stacking_context; }
@ -201,9 +200,6 @@ private:
CSSPixelPoint m_offset;
CSSPixelSize m_content_size;
// Some boxes hang off of line box fragments. (inline-block, inline-table, replaced, etc)
Optional<Layout::LineBoxFragmentCoordinate> m_containing_line_box_fragment;
OwnPtr<StackingContext> m_stacking_context;
Optional<CSSPixelRect> mutable m_absolute_rect;