mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
layout: Make all word separators justification opportunities (#30866)
This change adapts both layout and legacy layout to the specification which gives a list of word separators to use as justification opportunities.
This commit is contained in:
parent
8e31daeb6b
commit
709d00583f
8 changed files with 150 additions and 37 deletions
|
@ -976,10 +976,8 @@ impl<'a, 'b> InlineFormattingContextState<'a, 'b> {
|
|||
if is_non_preserved_whitespace {
|
||||
self.current_line_segment.trailing_whitespace_size = inline_advance;
|
||||
}
|
||||
|
||||
if glyph_store.is_whitespace() {
|
||||
self.current_line_segment.justification_opportunities += 1;
|
||||
}
|
||||
self.current_line_segment.justification_opportunities +=
|
||||
glyph_store.total_word_separators() as usize;
|
||||
|
||||
match self.current_line_segment.line_items.last_mut() {
|
||||
Some(LineItem::TextRun(text_run)) => {
|
||||
|
@ -2124,9 +2122,7 @@ impl TextRunLineItem {
|
|||
.text
|
||||
.iter()
|
||||
.map(|glyph_store| {
|
||||
if glyph_store.is_whitespace() {
|
||||
number_of_justification_opportunities += 1
|
||||
}
|
||||
number_of_justification_opportunities += glyph_store.total_word_separators();
|
||||
Length::from(glyph_store.total_advance())
|
||||
})
|
||||
.sum();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue