diff options
author | Andreas Kling <kling@serenityos.org> | 2022-02-21 20:40:55 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-21 20:42:34 +0100 |
commit | bb1f26c149f74729f8141a8e09c46db8686dbc50 (patch) | |
tree | 67859932a30d73284557c07c290ca70a1ee1caa8 | |
parent | 8c2a4a2a3def9bf05f44bd99588a55522323a94e (diff) | |
download | serenity-bb1f26c149f74729f8141a8e09c46db8686dbc50.zip |
LibWeb: Use correct coordinate space when measuring space between floats
When calculating how much space is available for inline content between
left and right floated elements, we have to use coordinates in the
containing block's coordinate space, since that's what floats use.
This fixes an issue where text would sometimes overlap floats.
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp index 9ff6e190dd..52ac009543 100644 --- a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp @@ -48,7 +48,7 @@ InlineFormattingContext::AvailableSpaceForLineInfo InlineFormattingContext::avai for (ssize_t i = bfc.left_side_floats().boxes.size() - 1; i >= 0; --i) { auto const& floating_box = bfc.left_side_floats().boxes.at(i); - auto rect = margin_box_rect(floating_box, m_state); + auto rect = margin_box_rect_in_ancestor_coordinate_space(floating_box, parent().root(), m_state); if (rect.contains_vertically(y_in_root)) { info.left = rect.right() + 1; break; @@ -59,7 +59,7 @@ InlineFormattingContext::AvailableSpaceForLineInfo InlineFormattingContext::avai for (ssize_t i = bfc.right_side_floats().boxes.size() - 1; i >= 0; --i) { auto const& floating_box = bfc.right_side_floats().boxes.at(i); - auto rect = margin_box_rect(floating_box, m_state); + auto rect = margin_box_rect_in_ancestor_coordinate_space(floating_box, parent().root(), m_state); if (rect.contains_vertically(y_in_root)) { info.right = rect.left() - 1; break; |