diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index 2dc8db47f60..f7f46d2fdcc 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -1637,12 +1637,12 @@ impl Fragment { } match self.style().get_inheritedtext().word_break { - word_break::T::normal => { - // Break at normal word boundaries, allowing for soft wrap opportunities. - let soft_wrap_breaking_strategy = + word_break::T::normal | word_break::T::keep_all => { + // Break at normal word boundaries. keep-all forbids soft wrap opportunities. + let natural_word_breaking_strategy = text_fragment_info.run.natural_word_slices_in_range(&text_fragment_info.range); self.calculate_split_position_using_breaking_strategy( - soft_wrap_breaking_strategy, + natural_word_breaking_strategy, max_inline_size, flags) } @@ -1655,15 +1655,6 @@ impl Fragment { character_breaking_strategy, max_inline_size, flags) - }, - word_break::T::keep_all => { - // Break at word boundaries, and forbid soft wrap opportunities. - let natural_word_breaking_strategy = - text_fragment_info.run.natural_word_slices_in_range(&text_fragment_info.range); - self.calculate_split_position_using_breaking_strategy( - natural_word_breaking_strategy, - max_inline_size, - flags) } } }