| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gfx/render_text_harfbuzz.h" | 5 #include "ui/gfx/render_text_harfbuzz.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/i18n/bidi_line_iterator.h" | 10 #include "base/i18n/bidi_line_iterator.h" |
| (...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1152 void RenderTextHarfBuzz::ItemizeTextToRuns( | 1152 void RenderTextHarfBuzz::ItemizeTextToRuns( |
| 1153 const base::string16& text, | 1153 const base::string16& text, |
| 1154 internal::TextRunList* run_list_out) { | 1154 internal::TextRunList* run_list_out) { |
| 1155 const bool is_text_rtl = GetTextDirection(text) == base::i18n::RIGHT_TO_LEFT; | 1155 const bool is_text_rtl = GetTextDirection(text) == base::i18n::RIGHT_TO_LEFT; |
| 1156 DCHECK_NE(0U, text.length()); | 1156 DCHECK_NE(0U, text.length()); |
| 1157 | 1157 |
| 1158 // If ICU fails to itemize the text, we create a run that spans the entire | 1158 // If ICU fails to itemize the text, we create a run that spans the entire |
| 1159 // text. This is needed because leaving the runs set empty causes some clients | 1159 // text. This is needed because leaving the runs set empty causes some clients |
| 1160 // to misbehave since they expect non-zero text metrics from a non-empty text. | 1160 // to misbehave since they expect non-zero text metrics from a non-empty text. |
| 1161 base::i18n::BiDiLineIterator bidi_iterator; | 1161 base::i18n::BiDiLineIterator bidi_iterator; |
| 1162 if (!bidi_iterator.Open(text, is_text_rtl, false)) { | 1162 if (!bidi_iterator.Open(text, is_text_rtl)) { |
| 1163 internal::TextRunHarfBuzz* run = new internal::TextRunHarfBuzz; | 1163 internal::TextRunHarfBuzz* run = new internal::TextRunHarfBuzz; |
| 1164 run->range = Range(0, text.length()); | 1164 run->range = Range(0, text.length()); |
| 1165 run_list_out->add(run); | 1165 run_list_out->add(run); |
| 1166 run_list_out->InitIndexMap(); | 1166 run_list_out->InitIndexMap(); |
| 1167 return; | 1167 return; |
| 1168 } | 1168 } |
| 1169 | 1169 |
| 1170 // Temporarily apply composition underlines and selection colors. | 1170 // Temporarily apply composition underlines and selection colors. |
| 1171 ApplyCompositionAndSelectionStyles(); | 1171 ApplyCompositionAndSelectionStyles(); |
| 1172 | 1172 |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1479 DCHECK(!update_layout_run_list_); | 1479 DCHECK(!update_layout_run_list_); |
| 1480 DCHECK(!update_display_run_list_); | 1480 DCHECK(!update_display_run_list_); |
| 1481 return text_elided() ? display_run_list_.get() : &layout_run_list_; | 1481 return text_elided() ? display_run_list_.get() : &layout_run_list_; |
| 1482 } | 1482 } |
| 1483 | 1483 |
| 1484 const internal::TextRunList* RenderTextHarfBuzz::GetRunList() const { | 1484 const internal::TextRunList* RenderTextHarfBuzz::GetRunList() const { |
| 1485 return const_cast<RenderTextHarfBuzz*>(this)->GetRunList(); | 1485 return const_cast<RenderTextHarfBuzz*>(this)->GetRunList(); |
| 1486 } | 1486 } |
| 1487 | 1487 |
| 1488 } // namespace gfx | 1488 } // namespace gfx |
| OLD | NEW |