Auto merge of #29929 - Loirooriol:clearance-on-replaced, r=mrobinson

Fix clearance on replaced elements

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #29928

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2023-06-26 19:49:43 +02:00 committed by GitHub
commit 002fe81cc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 69 additions and 3 deletions

View file

@ -733,10 +733,13 @@ fn layout_in_flow_replaced_block_level<'a>(
let mut clearance = Length::zero();
if let Some(ref mut sequential_layout_state) = sequential_layout_state {
sequential_layout_state.adjoin_assign(&CollapsedMargin::new(margin.block_start));
sequential_layout_state.collapse_margins();
clearance = sequential_layout_state.calculate_clearance(ClearSide::from_style(style));
sequential_layout_state
.advance_block_position(pbm.border.block_sum() + pbm.padding.block_sum() + size.block);
sequential_layout_state.advance_block_position(
pbm.border.block_sum() + pbm.padding.block_sum() + size.block + clearance,
);
sequential_layout_state.adjoin_assign(&CollapsedMargin::new(margin.block_end));
};
let content_rect = Rect {
@ -756,7 +759,7 @@ fn layout_in_flow_replaced_block_level<'a>(
pbm.padding,
pbm.border,
margin,
Length::zero(),
clearance,
block_margins_collapsed_with_children,
)
}