diff options
author | Oriol Brufau <obrufau@igalia.com> | 2024-09-12 01:50:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-11 23:50:45 +0000 |
commit | d9be9d6bd464c664e7ddad86937a9aa54a6c7baf (patch) | |
tree | 350b21d5917f60db261aae34c0e9716db818c7db /components/layout_2020/flow/inline/text_run.rs | |
parent | 777fb81260ed10e016370dcd83fc750367e97535 (diff) | |
download | servo-d9be9d6bd464c664e7ddad86937a9aa54a6c7baf.tar.gz servo-d9be9d6bd464c664e7ddad86937a9aa54a6c7baf.zip |
Handle all `white-space` values when intrinsically sizing an IFC (#33343)
There were various cases like `text-wrap-mode: nowrap` and
`white-space-collapse: break-spaces` that weren't handled well.
Fixes #33335
flexbox_flex-formatting-interop.html fails now because we don't support
`table-layout: fixed`.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Diffstat (limited to 'components/layout_2020/flow/inline/text_run.rs')
-rw-r--r-- | components/layout_2020/flow/inline/text_run.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/components/layout_2020/flow/inline/text_run.rs b/components/layout_2020/flow/inline/text_run.rs index e9b9385d23f..250a7591248 100644 --- a/components/layout_2020/flow/inline/text_run.rs +++ b/components/layout_2020/flow/inline/text_run.rs @@ -217,6 +217,8 @@ impl TextRunSegment { continue; } + let mut options = *shaping_options; + // Extend the slice to the next UAX#14 line break opportunity. let mut slice = last_slice.end..*break_index; let word = &formatting_context_text[slice.clone()]; @@ -247,6 +249,9 @@ impl TextRunSegment { !can_break_anywhere { whitespace.start += first_white_space_character.len_utf8(); + options + .flags + .insert(ShapingFlags::ENDS_WITH_WHITESPACE_SHAPING_FLAG); } slice.end = whitespace.start; @@ -267,17 +272,17 @@ impl TextRunSegment { // Push the non-whitespace part of the range. if !slice.is_empty() { - self.shape_and_push_range(&slice, formatting_context_text, &font, shaping_options); + self.shape_and_push_range(&slice, formatting_context_text, &font, &options); } if whitespace.is_empty() { continue; } - let mut options = *shaping_options; - options - .flags - .insert(ShapingFlags::IS_WHITESPACE_SHAPING_FLAG); + options.flags.insert( + ShapingFlags::IS_WHITESPACE_SHAPING_FLAG | + ShapingFlags::ENDS_WITH_WHITESPACE_SHAPING_FLAG, + ); // If `white-space-collapse: break-spaces` is active, insert a line breaking opportunity // between each white space character in the white space that we trimmed off. |