From fb66abba74df33d05eaf7a2a5e8ad8f2c88aff41 Mon Sep 17 00:00:00 2001 From: Felipe Lacerda Date: Tue, 27 Sep 2016 20:07:32 +0200 Subject: [PATCH] combine normal and keep-all into a single strategy --- components/layout/fragment.rs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) 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) } } }