mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
layout: Allocate inline box start space on segment (#32486)
Instead of allocating the inline padding and border space on the line, allocate it on the segment -- which where the inline box start goes. Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
This commit is contained in:
parent
63889b732f
commit
70982dfa5a
5 changed files with 116 additions and 12 deletions
|
@ -771,18 +771,6 @@ impl<'a, 'b> InlineFormattingContextState<'a, 'b> {
|
|||
.map(|index| &self.fonts[index].metrics),
|
||||
);
|
||||
|
||||
if inline_box.is_first_fragment {
|
||||
self.current_line.inline_position += Length::from(
|
||||
inline_box_state.pbm.padding.inline_start +
|
||||
inline_box_state.pbm.border.inline_start,
|
||||
) + inline_box_state
|
||||
.pbm
|
||||
.margin
|
||||
.inline_start
|
||||
.auto_is(Au::zero)
|
||||
.into()
|
||||
}
|
||||
|
||||
// If we are starting a `<br>` element prepare to clear after its deferred linebreak has been
|
||||
// processed. Note that a `<br>` is composed of the element itself and the inner pseudo-element
|
||||
// with the actual linebreak. Both will have this `FragmentFlag`; that's why this code only
|
||||
|
@ -796,6 +784,18 @@ impl<'a, 'b> InlineFormattingContextState<'a, 'b> {
|
|||
self.deferred_br_clear = inline_box_state.base.style.clone_clear();
|
||||
}
|
||||
|
||||
if inline_box.is_first_fragment {
|
||||
self.current_line_segment.inline_size += Length::from(
|
||||
inline_box_state.pbm.padding.inline_start +
|
||||
inline_box_state.pbm.border.inline_start,
|
||||
) + inline_box_state
|
||||
.pbm
|
||||
.margin
|
||||
.inline_start
|
||||
.auto_is(Au::zero)
|
||||
.into()
|
||||
}
|
||||
|
||||
let line_item = inline_box_state
|
||||
.layout_into_line_item(inline_box.is_first_fragment, inline_box.is_last_fragment);
|
||||
self.push_line_item_to_unbreakable_segment(LineItem::StartInlineBox(line_item));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue