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

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

Issue 7574023: Fix clang build. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/render_text.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 8
9 #include "base/i18n/break_iterator.h" 9 #include "base/i18n/break_iterator.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 CaretPlacement placement) { 123 CaretPlacement placement) {
124 selection_start_ = start; 124 selection_start_ = start;
125 selection_end_ = end; 125 selection_end_ = end;
126 caret_pos_ = pos; 126 caret_pos_ = pos;
127 caret_placement_ = placement; 127 caret_placement_ = placement;
128 } 128 }
129 129
130 RenderText::~RenderText() { 130 RenderText::~RenderText() {
131 } 131 }
132 132
133 void RenderText::set_display_rect(const Rect& r) {
134 display_rect_ = r;
135 }
136
133 void RenderText::SetText(const string16& text) { 137 void RenderText::SetText(const string16& text) {
134 size_t old_text_length = text_.length(); 138 size_t old_text_length = text_.length();
135 text_ = text; 139 text_ = text;
136 140
137 // Update the style ranges as needed. 141 // Update the style ranges as needed.
138 if (text_.empty()) { 142 if (text_.empty()) {
139 style_ranges_.clear(); 143 style_ranges_.clear();
140 } else if (style_ranges_.empty()) { 144 } else if (style_ranges_.empty()) {
141 ApplyDefaultStyle(); 145 ApplyDefaultStyle();
142 } else if (text_.length() > old_text_length) { 146 } else if (text_.length() > old_text_length) {
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 } else if ((display_offset_.x() + cursor_bounds_.right()) > display_width) { 612 } else if ((display_offset_.x() + cursor_bounds_.right()) > display_width) {
609 // Pan to show the cursor when it overflows to the right, 613 // Pan to show the cursor when it overflows to the right,
610 display_offset_.set_x(display_width - cursor_bounds_.right()); 614 display_offset_.set_x(display_width - cursor_bounds_.right());
611 } else if ((display_offset_.x() + cursor_bounds_.x()) < 0) { 615 } else if ((display_offset_.x() + cursor_bounds_.x()) < 0) {
612 // Pan to show the cursor when it overflows to the left. 616 // Pan to show the cursor when it overflows to the left.
613 display_offset_.set_x(-cursor_bounds_.x()); 617 display_offset_.set_x(-cursor_bounds_.x());
614 } 618 }
615 } 619 }
616 620
617 } // namespace gfx 621 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/render_text.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698