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

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

Issue 968923004: Use GetDisplayText() instead of text() for rendering text. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix 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
« no previous file with comments | « no previous file | ui/gfx/render_text_mac.h » ('j') | ui/gfx/render_text_mac.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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.h" 5 #include "ui/gfx/render_text.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <climits> 8 #include <climits>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 size_t cursor = std::min(position, text().length()); 1201 size_t cursor = std::min(position, text().length());
1202 if (IsValidCursorIndex(cursor)) 1202 if (IsValidCursorIndex(cursor))
1203 SetSelectionModel(SelectionModel( 1203 SetSelectionModel(SelectionModel(
1204 Range(select ? selection().start() : cursor, cursor), 1204 Range(select ? selection().start() : cursor, cursor),
1205 (cursor == 0) ? CURSOR_FORWARD : CURSOR_BACKWARD)); 1205 (cursor == 0) ? CURSOR_FORWARD : CURSOR_BACKWARD));
1206 } 1206 }
1207 1207
1208 void RenderText::OnTextAttributeChanged() { 1208 void RenderText::OnTextAttributeChanged() {
1209 layout_text_.clear(); 1209 layout_text_.clear();
1210 display_text_.clear(); 1210 display_text_.clear();
1211 text_elided_ = false;
1211 line_breaks_.SetMax(0); 1212 line_breaks_.SetMax(0);
1212 1213
1213 if (obscured_) { 1214 if (obscured_) {
1214 size_t obscured_text_length = 1215 size_t obscured_text_length =
1215 static_cast<size_t>(UTF16IndexToOffset(text_, 0, text_.length())); 1216 static_cast<size_t>(UTF16IndexToOffset(text_, 0, text_.length()));
1216 layout_text_.assign(obscured_text_length, kPasswordReplacementChar); 1217 layout_text_.assign(obscured_text_length, kPasswordReplacementChar);
1217 1218
1218 if (obscured_reveal_index_ >= 0 && 1219 if (obscured_reveal_index_ >= 0 &&
1219 obscured_reveal_index_ < static_cast<int>(text_.length())) { 1220 obscured_reveal_index_ < static_cast<int>(text_.length())) {
1220 // Gets the index range in |text_| to be revealed. 1221 // Gets the index range in |text_| to be revealed.
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 1454
1454 SetDisplayOffset(display_offset_.x() + delta_x); 1455 SetDisplayOffset(display_offset_.x() + delta_x);
1455 } 1456 }
1456 1457
1457 void RenderText::DrawSelection(Canvas* canvas) { 1458 void RenderText::DrawSelection(Canvas* canvas) {
1458 for (const Rect& s : GetSubstringBounds(selection())) 1459 for (const Rect& s : GetSubstringBounds(selection()))
1459 canvas->FillRect(s, selection_background_focused_color_); 1460 canvas->FillRect(s, selection_background_focused_color_);
1460 } 1461 }
1461 1462
1462 } // namespace gfx 1463 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/render_text_mac.h » ('j') | ui/gfx/render_text_mac.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698