Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Side by Side Diff: ui/gfx/render_text_harfbuzz.cc

Issue 1037573006: Fix accidental updates of host's baselines_ in Elide(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 8
9 #include "base/i18n/bidi_line_iterator.h" 9 #include "base/i18n/bidi_line_iterator.h"
10 #include "base/i18n/break_iterator.h" 10 #include "base/i18n/break_iterator.h"
(...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 return; 1146 return;
1147 } 1147 }
1148 1148
1149 // Temporarily apply composition underlines and selection colors. 1149 // Temporarily apply composition underlines and selection colors.
1150 ApplyCompositionAndSelectionStyles(); 1150 ApplyCompositionAndSelectionStyles();
1151 1151
1152 // Build the run list from the script items and ranged styles and baselines. 1152 // Build the run list from the script items and ranged styles and baselines.
1153 // Use an empty color BreakList to avoid breaking runs at color boundaries. 1153 // Use an empty color BreakList to avoid breaking runs at color boundaries.
1154 BreakList<SkColor> empty_colors; 1154 BreakList<SkColor> empty_colors;
1155 empty_colors.SetMax(text.length()); 1155 empty_colors.SetMax(text.length());
1156 DCHECK_LE(text.size(), baselines().max());
1157 for (const BreakList<bool>& style : styles())
1158 DCHECK_LE(text.size(), style.max());
1156 internal::StyleIterator style(empty_colors, baselines(), styles()); 1159 internal::StyleIterator style(empty_colors, baselines(), styles());
1157 1160
1158 for (size_t run_break = 0; run_break < text.length();) { 1161 for (size_t run_break = 0; run_break < text.length();) {
1159 internal::TextRunHarfBuzz* run = new internal::TextRunHarfBuzz; 1162 internal::TextRunHarfBuzz* run = new internal::TextRunHarfBuzz;
1160 run->range.set_start(run_break); 1163 run->range.set_start(run_break);
1161 run->font_style = (style.style(BOLD) ? Font::BOLD : 0) | 1164 run->font_style = (style.style(BOLD) ? Font::BOLD : 0) |
1162 (style.style(ITALIC) ? Font::ITALIC : 0); 1165 (style.style(ITALIC) ? Font::ITALIC : 0);
1163 run->baseline_type = style.baseline(); 1166 run->baseline_type = style.baseline();
1164 run->strike = style.style(STRIKE); 1167 run->strike = style.style(STRIKE);
1165 run->diagonal_strike = style.style(DIAGONAL_STRIKE); 1168 run->diagonal_strike = style.style(DIAGONAL_STRIKE);
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 DCHECK(!update_layout_run_list_); 1522 DCHECK(!update_layout_run_list_);
1520 DCHECK(!update_display_run_list_); 1523 DCHECK(!update_display_run_list_);
1521 return text_elided() ? display_run_list_.get() : &layout_run_list_; 1524 return text_elided() ? display_run_list_.get() : &layout_run_list_;
1522 } 1525 }
1523 1526
1524 const internal::TextRunList* RenderTextHarfBuzz::GetRunList() const { 1527 const internal::TextRunList* RenderTextHarfBuzz::GetRunList() const {
1525 return const_cast<RenderTextHarfBuzz*>(this)->GetRunList(); 1528 return const_cast<RenderTextHarfBuzz*>(this)->GetRunList();
1526 } 1529 }
1527 1530
1528 } // namespace gfx 1531 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698