diff --git a/components/layout_2020/flow/inline/mod.rs b/components/layout_2020/flow/inline/mod.rs index f03fc94d407..8a0b86c1c7d 100644 --- a/components/layout_2020/flow/inline/mod.rs +++ b/components/layout_2020/flow/inline/mod.rs @@ -2354,7 +2354,6 @@ impl<'layout_data> ContentSizesComputation<'layout_data> { // and start measuring from the inline origin once more. if run.is_single_preserved_newline() { self.forced_line_break(); - self.current_line = ContentSizes::zero(); continue; } if !matches!( @@ -2430,18 +2429,19 @@ impl<'layout_data> ContentSizesComputation<'layout_data> { // it needs to either hang or be removed. If that isn't the case, // `commit_pending_whitespace()` should be called first. self.pending_whitespace.min_content = Au::zero(); - self.paragraph.min_content = - std::cmp::max(self.paragraph.min_content, self.current_line.min_content); - self.current_line.min_content = Au::zero(); + let current_min_content = mem::take(&mut self.current_line.min_content); + self.paragraph.min_content.max_assign(current_min_content); self.had_content_yet_for_min_content = false; } fn forced_line_break(&mut self) { + // Handle the line break for min-content sizes. self.line_break_opportunity(); - self.paragraph.max_content = - std::cmp::max(self.paragraph.max_content, self.current_line.max_content); - self.current_line.max_content = Au::zero(); - self.had_content_yet_for_min_content = false; + + // Repeat the same logic, but now for max-content sizes. + self.pending_whitespace.max_content = Au::zero(); + let current_max_content = mem::take(&mut self.current_line.max_content); + self.paragraph.max_content.max_assign(current_max_content); self.had_content_yet_for_max_content = false; } diff --git a/tests/wpt/meta/MANIFEST.json b/tests/wpt/meta/MANIFEST.json index 66db19e3b25..e35446a99bd 100644 --- a/tests/wpt/meta/MANIFEST.json +++ b/tests/wpt/meta/MANIFEST.json @@ -567209,7 +567209,7 @@ ] ], "white-space-intrinsic-size-021.html": [ - "a209f72c30a5a48ed4c185f9d3962abeb68399fb", + "f9c246d4899b58dbcf2dc08655c8bc1f39995e5a", [ null, {} diff --git a/tests/wpt/tests/css/css-text/white-space/white-space-intrinsic-size-021.html b/tests/wpt/tests/css/css-text/white-space/white-space-intrinsic-size-021.html index a209f72c30a..f9c246d4899 100644 --- a/tests/wpt/tests/css/css-text/white-space/white-space-intrinsic-size-021.html +++ b/tests/wpt/tests/css/css-text/white-space/white-space-intrinsic-size-021.html @@ -26,6 +26,10 @@ hr { clear: both; } +x-br::before { + content: "\a"; + white-space: preserve-breaks; +} .collapse.wrap { white-space: normal; } @@ -152,6 +156,16 @@ hr {
X É
X É
+
+
X É
+
X É
+
X É
+
X É
+
X É
+
X É
+
X É
+
X É
+

@@ -255,6 +269,16 @@ hr {
X É
X É
+
+
X É
+
X É
+
X É
+
X É
+
X É
+
X É
+
X É
+
X É
+