Implement word-break: keep_all

This commit is contained in:
Felipe 2016-09-24 17:41:11 +02:00 committed by Felipe Lacerda
parent ef1b594f48
commit d5669ead29
3 changed files with 86 additions and 11 deletions

View file

@ -1638,11 +1638,11 @@ impl Fragment {
match self.style().get_inheritedtext().word_break {
word_break::T::normal => {
// Break at normal word boundaries.
let natural_word_breaking_strategy =
text_fragment_info.run.natural_word_slices_in_range(&text_fragment_info.range);
// Break at normal word boundaries, allowing for soft wrap opportunities.
let soft_wrap_breaking_strategy =
text_fragment_info.run.soft_wrap_slices_in_range(&text_fragment_info.range);
self.calculate_split_position_using_breaking_strategy(
natural_word_breaking_strategy,
soft_wrap_breaking_strategy,
max_inline_size,
flags)
}
@ -1655,6 +1655,15 @@ 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)
}
}
}