Просмотр исходного кода

LibWeb: Make floating boxes in IFC occupy horizontal margin box

Previously, we only allowed floats to take up its own border box's worth
of horizontal space when laid out inside an IFC.

We should instead consume the full margin box horizonally. This fixes an
issue where a floated box on Acid3 had {width:20px; margin-right:-20px;}
but still consumed 20px of the previously available space, despite being
moved out of the way by its own negative margin.
Andreas Kling 3 лет назад
Родитель
Сommit
9711e1b303
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp

+ 2 - 2
Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp

@@ -606,9 +606,9 @@ void BlockFormattingContext::layout_floating_box(Box const& box, BlockContainer
     // If we have a LineBuilder, we're in the middle of inline layout, otherwise this is block layout.
     if (line_builder) {
         float y_offset = box_state.margin_box_top();
-        line_builder->break_if_needed(layout_mode, box_state.border_box_width());
+        line_builder->break_if_needed(layout_mode, box_state.margin_box_width());
         box_state.offset.set_y(line_builder->current_y() + y_offset);
-        line_builder->adjust_last_line_after_inserting_floating_box({}, box.computed_values().float_(), box_state.border_box_width());
+        line_builder->adjust_last_line_after_inserting_floating_box({}, box.computed_values().float_(), box_state.margin_box_width());
     } else {
         place_block_level_element_in_normal_flow_vertically(box, containing_block);
         place_block_level_element_in_normal_flow_horizontally(box, containing_block);