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

Side by Side Diff: views/controls/textfield/native_textfield_views.cc

Issue 6121004: Remove wstring from gfx. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | « views/controls/textfield/gtk_views_textview.cc ('k') | views/drag_utils.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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "views/controls/textfield/native_textfield_views.h" 5 #include "views/controls/textfield/native_textfield_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 fragments.begin(); 397 fragments.begin();
398 iter != fragments.end(); 398 iter != fragments.end();
399 iter++) { 399 iter++) {
400 string16 text = model_->GetVisibleText((*iter).begin, (*iter).end); 400 string16 text = model_->GetVisibleText((*iter).begin, (*iter).end);
401 // TODO(oshima): This does not give the accurate position due to 401 // TODO(oshima): This does not give the accurate position due to
402 // kerning. Figure out how webkit does this with skia. 402 // kerning. Figure out how webkit does this with skia.
403 int width = GetFont().GetStringWidth(text); 403 int width = GetFont().GetStringWidth(text);
404 404
405 if ((*iter).selected) { 405 if ((*iter).selected) {
406 canvas->FillRectInt(selection_color, x_offset, y, width, text_height); 406 canvas->FillRectInt(selection_color, x_offset, y, width, text_height);
407 canvas->DrawStringInt( 407 canvas->DrawStringInt(text, GetFont(), kSelectedTextColor,
408 UTF16ToWide(text), GetFont(), kSelectedTextColor, 408 x_offset, y, width, text_height);
409 x_offset, y, width, text_height);
410 } else { 409 } else {
411 canvas->DrawStringInt( 410 canvas->DrawStringInt(text, GetFont(), text_color,
412 UTF16ToWide(text), GetFont(), text_color, 411 x_offset, y, width, text_height);
413 x_offset, y, width, text_height);
414 } 412 }
415 x_offset += width; 413 x_offset += width;
416 } 414 }
417 canvas->Restore(); 415 canvas->Restore();
418 416
419 if (textfield_->IsEnabled() && is_cursor_visible_ && 417 if (textfield_->IsEnabled() && is_cursor_visible_ &&
420 !model_->HasSelection()) { 418 !model_->HasSelection()) {
421 // Paint Cursor. Replace cursor is drawn as rectangle for now. 419 // Paint Cursor. Replace cursor is drawn as rectangle for now.
422 canvas->DrawRectInt(kCursorColor, 420 canvas->DrawRectInt(kCursorColor,
423 cursor_bounds_.x(), 421 cursor_bounds_.x(),
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 } 740 }
743 741
744 void NativeTextfieldViews::TextfieldBorder::SetInsets(int top, 742 void NativeTextfieldViews::TextfieldBorder::SetInsets(int top,
745 int left, 743 int left,
746 int bottom, 744 int bottom,
747 int right) { 745 int right) {
748 insets_.Set(top, left, bottom, right); 746 insets_.Set(top, left, bottom, right);
749 } 747 }
750 748
751 } // namespace views 749 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/textfield/gtk_views_textview.cc ('k') | views/drag_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698