combine normal and keep-all into a single strategy

This commit is contained in:
Felipe Lacerda 2016-09-27 20:07:32 +02:00
parent 44c26e014a
commit fb66abba74

View file

@ -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)
}
}
}