LibWeb: Only apply box offset if the box is not already the ancestor

When determining the content/margin box rects within their ancestor's
coordinate space, we were returning early if the passed in values
already belonged to the requested ancestor. Unfortunately, we had
already applied the used values' offset to the rect, which is the offset
to the ancestor's ancestor.

This simplifies the logic to always apply the rect offset after checking
if we've reached the ancestor. Fixes determining float intrusions inside
block elements with `margin: auto` set.

Fixes #4083.
This commit is contained in:
Jelle Raaijmakers 2025-04-04 11:28:03 +02:00
commit 99df80f81e
Notes: github-actions[bot] 2025-04-04 13:36:19 +00:00
5 changed files with 57 additions and 16 deletions

View file

@ -67,6 +67,8 @@ struct LayoutState {
void set_content_width(CSSPixels);
void set_content_height(CSSPixels);
CSSPixelSize content_size() const { return { content_width(), content_height() }; }
void set_indefinite_content_width();
void set_indefinite_content_height();