Skip to content

Commit

Permalink
web/core: Respect flow position when positioning floats
Browse files Browse the repository at this point in the history
  • Loading branch information
simonwuelker committed Dec 7, 2023
1 parent ef2a5e6 commit 6976edb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crates/web/core/src/css/layout/flow/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,6 @@ impl InFlowBlockBox {
.margin
.surround(dimensions.border.surround(padding_area));

// Lower the float ceiling: New floats may not be positioned above this element
formatting_context
.float_context
.lower_float_ceiling(top_left.y);

BoxFragment::new(
self.node.clone(),
self.style().clone(),
Expand Down Expand Up @@ -303,6 +298,11 @@ impl<'box_tree, 'formatting_context> BlockFlowState<'box_tree, 'formatting_conte
pub fn visit_block_box(&mut self, block_box: &'box_tree BlockLevelBox) {
match block_box {
BlockLevelBox::Floating(float_box) => {
// Floats are placed at or below the flow position
self.block_formatting_context
.float_context
.lower_float_ceiling(self.cursor.y);

let box_fragment = float_box.layout(
self.containing_block,
self.ctx,
Expand Down

0 comments on commit 6976edb

Please sign in to comment.