layout: Use BoxFragment border widths for display list generation (#31292)

Instead of using the border widths from the style, use the ones recorded
by the `BoxFragment`. This is necessary because inline layout can
override these border widths during fragmentation. For instance, when a
box is split across two lines only one fragment should have an inline
start border.
This commit is contained in:
Martin Robinson 2024-02-09 00:21:24 +01:00 committed by GitHub
parent eb6c22fff1
commit f6b81a97f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
75 changed files with 8 additions and 155 deletions

View file

@ -685,11 +685,15 @@ impl<'a> BuilderForBoxFragment<'a> {
fn build_border(&mut self, builder: &mut DisplayListBuilder) {
let border = self.fragment.style.get_border();
let border_widths = self
.fragment
.border
.to_physical(self.fragment.style.writing_mode);
let widths = SideOffsets2D::new(
border.border_top_width.to_f32_px(),
border.border_right_width.to_f32_px(),
border.border_bottom_width.to_f32_px(),
border.border_left_width.to_f32_px(),
border_widths.top.px(),
border_widths.right.px(),
border_widths.bottom.px(),
border_widths.left.px(),
);
if widths == SideOffsets2D::zero() {
return;

View file

@ -302,11 +302,6 @@ impl InlineBoxLineItem {
border.inline_start = Length::zero();
margin.inline_start = Length::zero();
}
if !self.is_last_fragment_of_ib_split {
padding.inline_end = Length::zero();
border.inline_end = Length::zero();
margin.inline_end = Length::zero();
}
let pbm_sums = &(&padding + &border) + &margin;
state.inline_position += pbm_sums.inline_start;