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

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: comments addressed Created 5 years, 8 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
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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
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
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
OLDNEW
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698