Take spaces into account in the max-content size of an IFC (#31613)

They were only considered in min-content sizes.
Also avoid some pointless conversions from Au to Length.

Fixes #31605.
This commit is contained in:
Oriol Brufau 2024-03-11 13:01:53 +01:00 committed by GitHub
parent a6e25d555b
commit de7b9bed85
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 12 additions and 21 deletions

View file

@ -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
@ -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.
@ -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;
},
_ => {},
@ -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(),
}

View file

@ -1,2 +0,0 @@
[table-anonymous-objects-118.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[table-anonymous-objects-120.xht]
expected: FAIL

View file

@ -1,6 +1,3 @@
[percentage-size-quirks-002.html]
[.pct 2]
expected: FAIL
[.pct 1]
expected: FAIL

View file

@ -0,0 +1,3 @@
[td-with-subpixel-padding-vertical-rl.html]
[td-with-subpixel-padding-vertical-rl]
expected: FAIL

View file

@ -1,3 +0,0 @@
[td-with-subpixel-padding.html]
[td-with-subpixel-padding]
expected: FAIL