Truly independent web browser
LibWeb: Size a float's line ceiling from the float's value
Aliaksandr Kalenik309c0990aef4
diff --git a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rsindex c2e3f822623..1acf2055a7a 100644--- a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs+++ b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs@@ -4520,8 +4520,9 @@ impl<'pass> BlockFormattingContext<'pass> {formatting_context::leave_child_unplaced(run, fragment_arrival);return;};+ let float_box = self.run.records.box_metrics_of(node);let mut margin_box_ceiling = if let Some(line_builder) = line_builder.as_deref_mut() {- line_builder.ceiling_for_float_to_be_inserted_here(node)+ line_builder.ceiling_for_float_to_be_inserted_here(float_box.margin_box_inline_size(false))} else {block_offset};@@ -4540,7 +4541,6 @@ impl<'pass> BlockFormattingContext<'pass> {+ self.block_offset_adjustment_from_pending_ancestor_block_start_margins(last.box_),);}- let float_box = self.run.records.box_metrics_of(node);let placement = self.place_float(side,&float_box,diff --git a/Libraries/LibWeb/Rust/src/layout/line_builder.rs b/Libraries/LibWeb/Rust/src/layout/line_builder.rsindex af6fa2da35a..7506b3088fa 100644--- a/Libraries/LibWeb/Rust/src/layout/line_builder.rs+++ b/Libraries/LibWeb/Rust/src/layout/line_builder.rs@@ -583,8 +583,9 @@ impl<'builder, 'context> LineBuilder<'builder, 'context> {self.begin_new_line(false, true, ForcedBreak::No);}- pub(crate) fn ceiling_for_float_to_be_inserted_here(&mut self, node: Node) -> CssPixels {- let float_inline_size = self.context().box_metrics(node).margin_box_inline_size(false);+ /// The block offset a float whose margin box is `float_inline_size` wide is placed at: beside the content of the+ /// current line where the float fits there, and below that line otherwise.+ pub(crate) fn ceiling_for_float_to_be_inserted_here(&mut self, float_inline_size: CssPixels) -> CssPixels {let mut candidate = self.current_block_offset;let line_index = self.ensure_last_line_index();let mut line = self.line_mut(line_index);