mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
layout: Take into account text-indent
for justification (#31777)
This change makes it so that when calculating the space added between words for justification, text-indent is taken into account. Fixes #31775.
This commit is contained in:
parent
755701f4f6
commit
841bd91784
7 changed files with 142 additions and 1 deletions
|
@ -989,13 +989,18 @@ impl<'a, 'b> InlineFormattingContextState<'a, 'b> {
|
|||
match self.current_line.count_justification_opportunities() {
|
||||
0 => Length::zero(),
|
||||
num_justification_opportunities => {
|
||||
(available_space - line_length) / (num_justification_opportunities as f32)
|
||||
(available_space - text_indent - line_length) /
|
||||
(num_justification_opportunities as f32)
|
||||
},
|
||||
}
|
||||
},
|
||||
_ => Length::zero(),
|
||||
};
|
||||
|
||||
// If the content overflows the line, then justification adjustment will become negative. In
|
||||
// that case, do not make any adjustment for justification.
|
||||
let justification_adjustment = justification_adjustment.max(Length::zero());
|
||||
|
||||
(adjusted_line_start, justification_adjustment)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue