| 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 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 return; | 1157 return; |
| 1158 } | 1158 } |
| 1159 | 1159 |
| 1160 // Temporarily apply composition underlines and selection colors. | 1160 // Temporarily apply composition underlines and selection colors. |
| 1161 ApplyCompositionAndSelectionStyles(); | 1161 ApplyCompositionAndSelectionStyles(); |
| 1162 | 1162 |
| 1163 // Build the run list from the script items and ranged styles and baselines. | 1163 // Build the run list from the script items and ranged styles and baselines. |
| 1164 // Use an empty color BreakList to avoid breaking runs at color boundaries. | 1164 // Use an empty color BreakList to avoid breaking runs at color boundaries. |
| 1165 BreakList<SkColor> empty_colors; | 1165 BreakList<SkColor> empty_colors; |
| 1166 empty_colors.SetMax(text.length()); | 1166 empty_colors.SetMax(text.length()); |
| 1167 DCHECK_LE(text.size(), baselines().max()); |
| 1168 for (const BreakList<bool>& style : styles()) |
| 1169 DCHECK_LE(text.size(), style.max()); |
| 1167 internal::StyleIterator style(empty_colors, baselines(), styles()); | 1170 internal::StyleIterator style(empty_colors, baselines(), styles()); |
| 1168 | 1171 |
| 1169 for (size_t run_break = 0; run_break < text.length();) { | 1172 for (size_t run_break = 0; run_break < text.length();) { |
| 1170 internal::TextRunHarfBuzz* run = new internal::TextRunHarfBuzz; | 1173 internal::TextRunHarfBuzz* run = new internal::TextRunHarfBuzz; |
| 1171 run->range.set_start(run_break); | 1174 run->range.set_start(run_break); |
| 1172 run->font_style = (style.style(BOLD) ? Font::BOLD : 0) | | 1175 run->font_style = (style.style(BOLD) ? Font::BOLD : 0) | |
| 1173 (style.style(ITALIC) ? Font::ITALIC : 0); | 1176 (style.style(ITALIC) ? Font::ITALIC : 0); |
| 1174 run->baseline_type = style.baseline(); | 1177 run->baseline_type = style.baseline(); |
| 1175 run->strike = style.style(STRIKE); | 1178 run->strike = style.style(STRIKE); |
| 1176 run->diagonal_strike = style.style(DIAGONAL_STRIKE); | 1179 run->diagonal_strike = style.style(DIAGONAL_STRIKE); |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1525 DCHECK(!update_layout_run_list_); | 1528 DCHECK(!update_layout_run_list_); |
| 1526 DCHECK(!update_display_run_list_); | 1529 DCHECK(!update_display_run_list_); |
| 1527 return text_elided() ? display_run_list_.get() : &layout_run_list_; | 1530 return text_elided() ? display_run_list_.get() : &layout_run_list_; |
| 1528 } | 1531 } |
| 1529 | 1532 |
| 1530 const internal::TextRunList* RenderTextHarfBuzz::GetRunList() const { | 1533 const internal::TextRunList* RenderTextHarfBuzz::GetRunList() const { |
| 1531 return const_cast<RenderTextHarfBuzz*>(this)->GetRunList(); | 1534 return const_cast<RenderTextHarfBuzz*>(this)->GetRunList(); |
| 1532 } | 1535 } |
| 1533 | 1536 |
| 1534 } // namespace gfx | 1537 } // namespace gfx |
| OLD | NEW |