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

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

Issue 2817403002: [Omnibox] Elide omnibox text (Closed)
Patch Set: Move line clearing to OnDisplayTextAttributeChanged Created 3 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
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 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 } 1173 }
1174 1174
1175 void RenderTextHarfBuzz::OnLayoutTextAttributeChanged(bool text_changed) { 1175 void RenderTextHarfBuzz::OnLayoutTextAttributeChanged(bool text_changed) {
1176 update_layout_run_list_ = true; 1176 update_layout_run_list_ = true;
1177 OnDisplayTextAttributeChanged(); 1177 OnDisplayTextAttributeChanged();
1178 } 1178 }
1179 1179
1180 void RenderTextHarfBuzz::OnDisplayTextAttributeChanged() { 1180 void RenderTextHarfBuzz::OnDisplayTextAttributeChanged() {
1181 update_display_text_ = true; 1181 update_display_text_ = true;
1182 update_grapheme_iterator_ = true; 1182 update_grapheme_iterator_ = true;
1183 std::vector<internal::Line> empty_lines;
1184 set_lines(&empty_lines);
1183 } 1185 }
1184 1186
1185 void RenderTextHarfBuzz::EnsureLayout() { 1187 void RenderTextHarfBuzz::EnsureLayout() {
1186 EnsureLayoutRunList(); 1188 EnsureLayoutRunList();
1187 1189
1188 if (update_display_run_list_) { 1190 if (update_display_run_list_) {
1189 DCHECK(text_elided()); 1191 DCHECK(text_elided());
1190 const base::string16& display_text = GetDisplayText(); 1192 const base::string16& display_text = GetDisplayText();
1191 display_run_list_.reset(new internal::TextRunList); 1193 display_run_list_.reset(new internal::TextRunList);
1192 1194
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 ItemizeTextToRuns(text, &layout_run_list_); 1644 ItemizeTextToRuns(text, &layout_run_list_);
1643 1645
1644 // TODO(ckocagil): Remove ScopedTracker below once crbug.com/441028 is 1646 // TODO(ckocagil): Remove ScopedTracker below once crbug.com/441028 is
1645 // fixed. 1647 // fixed.
1646 tracked_objects::ScopedTracker tracking_profile( 1648 tracked_objects::ScopedTracker tracking_profile(
1647 FROM_HERE_WITH_EXPLICIT_FUNCTION("441028 ShapeRunList() 2")); 1649 FROM_HERE_WITH_EXPLICIT_FUNCTION("441028 ShapeRunList() 2"));
1648 ShapeRunList(text, &layout_run_list_); 1650 ShapeRunList(text, &layout_run_list_);
1649 } 1651 }
1650 1652
1651 std::vector<internal::Line> empty_lines; 1653 std::vector<internal::Line> empty_lines;
1652 set_lines(&empty_lines); 1654 set_lines(&empty_lines);
msw 2017/04/17 23:51:44 Instead of adding a similar operation in RenderTex
simonhong 2017/04/18 13:33:33 Yes, it's much better place. Done.
1653 display_run_list_.reset(); 1655 display_run_list_.reset();
1654 update_display_text_ = true; 1656 update_display_text_ = true;
1655 update_layout_run_list_ = false; 1657 update_layout_run_list_ = false;
1656 } 1658 }
1657 if (update_display_text_) { 1659 if (update_display_text_) {
1658 UpdateDisplayText(multiline() ? 0 : layout_run_list_.width()); 1660 UpdateDisplayText(multiline() ? 0 : layout_run_list_.width());
1659 update_display_text_ = false; 1661 update_display_text_ = false;
1660 update_display_run_list_ = text_elided(); 1662 update_display_run_list_ = text_elided();
1661 } 1663 }
1662 } 1664 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 1706
1705 attribute.strike = run.strike; 1707 attribute.strike = run.strike;
1706 attribute.diagonal_strike = run.diagonal_strike; 1708 attribute.diagonal_strike = run.diagonal_strike;
1707 decorated_text->attributes.push_back(attribute); 1709 decorated_text->attributes.push_back(attribute);
1708 } 1710 }
1709 } 1711 }
1710 return true; 1712 return true;
1711 } 1713 }
1712 1714
1713 } // namespace gfx 1715 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698