Index: ui/gfx/render_text_harfbuzz.cc |
diff --git a/ui/gfx/render_text_harfbuzz.cc b/ui/gfx/render_text_harfbuzz.cc |
index 63b0e4e0cd79d009e83cb9989e680f987def1e06..0cd2dadea630cd2f5f9b1f3d09f893497d38477d 100644 |
--- a/ui/gfx/render_text_harfbuzz.cc |
+++ b/ui/gfx/render_text_harfbuzz.cc |
@@ -223,6 +223,7 @@ class HarfBuzzLineBreaker { |
int min_baseline, |
float min_height, |
bool multiline, |
+ bool allow_character_break, |
const base::string16& text, |
const BreakList<size_t>* words, |
const internal::TextRunList& run_list) |
@@ -230,6 +231,7 @@ class HarfBuzzLineBreaker { |
min_baseline_(min_baseline), |
min_height_(min_height), |
multiline_(multiline), |
+ allow_character_break_(allow_character_break), |
text_(text), |
words_(words), |
run_list_(run_list), |
@@ -335,7 +337,7 @@ class HarfBuzzLineBreaker { |
word_width += char_width; |
if (*width > available_width) { |
- if (line_x_ != 0 || word_width < *width) { |
+ if (!allow_character_break_ && (line_x_ != 0 || word_width < *width)) { |
msw
2015/03/25 20:54:15
I don't think this matches the current Label behav
Jun Mukai
2015/03/26 01:35:08
Rewritten the logic, and enriched the tests. PTAL.
|
// Roll back one word. |
*width -= word_width; |
*next_char = std::max(word->first, start_char); |
@@ -444,6 +446,7 @@ class HarfBuzzLineBreaker { |
const int min_baseline_; |
const float min_height_; |
const bool multiline_; |
+ const bool allow_character_break_; |
const base::string16& text_; |
const BreakList<size_t>* const words_; |
const internal::TextRunList& run_list_; |
@@ -986,7 +989,8 @@ void RenderTextHarfBuzz::EnsureLayout() { |
HarfBuzzLineBreaker line_breaker( |
display_rect().width(), font_list().GetBaseline(), |
std::max(font_list().GetHeight(), min_line_height()), multiline(), |
- GetDisplayText(), multiline() ? &GetLineBreaks() : nullptr, *run_list); |
+ allow_character_break(), GetDisplayText(), |
+ multiline() ? &GetLineBreaks() : nullptr, *run_list); |
// TODO(vadimt): Remove ScopedTracker below once crbug.com/431326 is fixed. |
tracked_objects::ScopedTracker tracking_profile3( |