mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 01:29:17 +00:00
LibWeb: Ensure floats are correctly placed under the preceding float
Previously floats would be placed next to the highest float that fitted the new float on its line. However, this violates the rule that floats should be placed under the preceding float if it does not fit next to it.
This commit is contained in:
parent
3bf7f94150
commit
09f5ce42f6
Notes:
github-actions[bot]
2025-05-23 08:59:19 +00:00
Author: https://github.com/rubenqwertyuiop 🔰
Commit: 09f5ce42f6
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4805
Reviewed-by: https://github.com/gmta ✅
5 changed files with 94 additions and 17 deletions
|
@ -129,6 +129,14 @@ CSSPixels LineBuilder::y_for_float_to_be_inserted_here(Box const& box)
|
|||
// Then, look for the next Y position where we can fit the new float.
|
||||
auto box_in_root_rect = m_context.parent().content_box_rect_in_ancestor_coordinate_space(box_state, m_context.parent().root());
|
||||
|
||||
// New floats will always be placed vertically at or below the lowest float.
|
||||
// This applies to all floats, so the last inserted float will always be the lowest.
|
||||
auto last_float = m_context.parent().last_inserted_float();
|
||||
if (last_float.has_value()) {
|
||||
auto float_box_top = last_float->margin_box_rect_in_root_coordinate_space.top() - box_in_root_rect.y();
|
||||
candidate_block_offset = max(candidate_block_offset, float_box_top);
|
||||
}
|
||||
|
||||
HashMap<CSSPixels, AvailableSize> available_space_cache;
|
||||
for (;;) {
|
||||
Optional<CSSPixels> highest_intersection_bottom;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue