Truly independent web browser
LibWeb: Find a float's margin box left edge from its band entry
Aliaksandr Kalenikfa265c946443
diff --git a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rsindex 2e42162500f..c9cba7d4b18 100644--- a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs+++ b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs@@ -340,6 +340,17 @@ pub(crate) struct FloatingBox {percentage_basis_inline_size: Option<CssPixels>,}+impl FloatingBox {+ fn margin_box_left_in_root_coordinate_space(&self) -> CssPixels {+ let containing_block_rect = self.containing_block_rect_in_root_coordinate_space;+ if self.side == FloatSide::Left {+ containing_block_rect.x + self.offset_from_edge - self.left_margin_edge_to_content_edge+ } else {+ containing_block_rect.right() - self.offset_from_edge - self.left_margin_edge_to_content_edge+ }+ }+}+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]pub(crate) struct FloatBand {pub(crate) block_start: CssPixels,@@ -1617,21 +1628,6 @@ impl<'pass> BlockFormattingContext<'pass> {self.rebuild_float_bands();}- fn margin_box_left_of_float_in_root(- &self,- floating_box: FloatingBox,- containing_block_rect_in_root: CssPixelRect,- ) -> CssPixels {- if floating_box.side == FloatSide::Left {- containing_block_rect_in_root.x + floating_box.offset_from_edge- - floating_box.left_margin_edge_to_content_edge- } else {- containing_block_rect_in_root.right()- - floating_box.offset_from_edge- - floating_box.left_margin_edge_to_content_edge- }- }-fn border_box_left_of_box_avoiding_floats(&self,node: Node,@@ -4355,13 +4351,6 @@ impl<'pass> BlockFormattingContext<'pass> {outcome.is_none_or(|outcome| outcome.collapses_through)}- fn margin_box_left_of_float_record(&self, floating_box: FloatingBox) -> CssPixels {- self.margin_box_left_of_float_in_root(- floating_box,- floating_box.containing_block_rect_in_root_coordinate_space,- )- }-// Run-prelude inline sizing for a block-level root: commits the result of the parent's winning// float-avoidance probe, or reproduces that probe when it did not resolve an inline size.pub(crate) fn commit_block_level_root_inline_size(&self, node: Node, input: &LayoutInput) {@@ -4568,7 +4557,7 @@ impl<'pass> BlockFormattingContext<'pass> {containing_block_rect_in_root_coordinate_space: containing_block_rect,percentage_basis_inline_size: input.containing_block_constraints.percentage_basis_inline_size,};- margin_box_rect.x = self.margin_box_left_of_float_record(floating_box);+ margin_box_rect.x = floating_box.margin_box_left_in_root_coordinate_space();let mut floating_box = floating_box;floating_box.margin_box_rect_in_root_coordinate_space = margin_box_rect;self.floats.borrow_mut().push(floating_box);