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

LibWeb: Put BFC floating object state into a struct

This patch adds a BFC::FloatSideData struct so we can contain left and
right floating object layout state in a struct. This is preparation for
adding more per-side state.
This commit is contained in:
Andreas Kling 2022-01-22 15:19:18 +01:00
parent 70a56d21dc
commit 0ea438e45b
3 changed files with 28 additions and 24 deletions

View file

@ -35,8 +35,8 @@ InlineFormattingContext::AvailableSpaceForLineInfo InlineFormattingContext::avai
auto const& bfc = static_cast<BlockFormattingContext const&>(*parent());
for (ssize_t i = bfc.left_floating_boxes().size() - 1; i >= 0; --i) {
auto& floating_box = *bfc.left_floating_boxes().at(i);
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 = floating_box.margin_box_as_relative_rect();
if (rect.contains_vertically(y)) {
info.left = rect.right() + 1;
@ -46,8 +46,8 @@ InlineFormattingContext::AvailableSpaceForLineInfo InlineFormattingContext::avai
info.right = containing_block().width();
for (ssize_t i = bfc.right_floating_boxes().size() - 1; i >= 0; --i) {
auto& floating_box = *bfc.right_floating_boxes().at(i);
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 = floating_box.margin_box_as_relative_rect();
if (rect.contains_vertically(y)) {
info.right = rect.left() - 1;