Skip to content

Commit

Permalink
Take spaces into account in the max-content size of an IFC
Browse files Browse the repository at this point in the history
They were only considered in min-content sizes.
Also avoid some pointless conversions from Au to Length.

Fixes #31605.
  • Loading branch information
Loirooriol committed Mar 11, 2024
1 parent 0bc685e commit db30a4f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 21 deletions.
20 changes: 9 additions & 11 deletions components/layout_2020/flow/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2215,7 +2215,7 @@ struct ContentSizesComputation<'a> {
paragraph: ContentSizes,
current_line: ContentSizes,
/// Size for whitepsace pending to be added to this line.
pending_whitespace: Length,
pending_whitespace: Au,
/// Whether or not this IFC has seen any non-whitespace content.
had_non_whitespace_content_yet: bool,
/// Stack of ending padding, margin, and border to add to the length
Expand Down Expand Up @@ -2270,14 +2270,13 @@ impl<'a> ContentSizesComputation<'a> {
}

for run in segment.runs.iter() {
let advance = Length::from(run.glyph_store.total_advance());
let advance = run.glyph_store.total_advance();

if !run.glyph_store.is_whitespace() {
self.had_non_whitespace_content_yet = true;
self.current_line.min_content += advance.into();
self.current_line.max_content +=
(self.pending_whitespace + advance).into();
self.pending_whitespace = Length::zero();
self.current_line.min_content += advance;
self.current_line.max_content += self.pending_whitespace + advance;
self.pending_whitespace = Au::zero();
} else {
// If this run is a forced line break, we *must* break the line
// and start measuring from the inline origin once more.
Expand Down Expand Up @@ -2307,10 +2306,9 @@ impl<'a> ContentSizesComputation<'a> {
self.containing_block_writing_mode,
);

self.current_line.min_content +=
(self.pending_whitespace + outer.min_content.into()).into();
self.current_line.max_content += outer.max_content;
self.pending_whitespace = Length::zero();
self.current_line.min_content += self.pending_whitespace + outer.min_content;
self.current_line.max_content += self.pending_whitespace + outer.max_content;
self.pending_whitespace = Au::zero();
self.had_non_whitespace_content_yet = true;
},
_ => {},
Expand Down Expand Up @@ -2349,7 +2347,7 @@ impl<'a> ContentSizesComputation<'a> {
containing_block_writing_mode,
paragraph: ContentSizes::zero(),
current_line: ContentSizes::zero(),
pending_whitespace: Length::zero(),
pending_whitespace: Au::zero(),
had_non_whitespace_content_yet: false,
ending_inline_pbm_stack: Vec::new(),
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[percentage-size-quirks-002.html]
[.pct 2]
expected: FAIL

[.pct 1]
expected: FAIL
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[td-with-subpixel-padding-vertical-rl.html]
[td-with-subpixel-padding-vertical-rl]
expected: FAIL

This file was deleted.

0 comments on commit db30a4f

Please sign in to comment.