| OLD | NEW |
| 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 Loading... |
| 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(text, GetFont(), kSelectedTextColor, | 407 canvas->DrawStringInt( |
| 408 x_offset, y, width, text_height); | 408 UTF16ToWide(text), GetFont(), kSelectedTextColor, |
| 409 x_offset, y, width, text_height); |
| 409 } else { | 410 } else { |
| 410 canvas->DrawStringInt(text, GetFont(), text_color, | 411 canvas->DrawStringInt( |
| 411 x_offset, y, width, text_height); | 412 UTF16ToWide(text), GetFont(), text_color, |
| 413 x_offset, y, width, text_height); |
| 412 } | 414 } |
| 413 x_offset += width; | 415 x_offset += width; |
| 414 } | 416 } |
| 415 canvas->Restore(); | 417 canvas->Restore(); |
| 416 | 418 |
| 417 if (textfield_->IsEnabled() && is_cursor_visible_ && | 419 if (textfield_->IsEnabled() && is_cursor_visible_ && |
| 418 !model_->HasSelection()) { | 420 !model_->HasSelection()) { |
| 419 // Paint Cursor. Replace cursor is drawn as rectangle for now. | 421 // Paint Cursor. Replace cursor is drawn as rectangle for now. |
| 420 canvas->DrawRectInt(kCursorColor, | 422 canvas->DrawRectInt(kCursorColor, |
| 421 cursor_bounds_.x(), | 423 cursor_bounds_.x(), |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 } | 754 } |
| 753 | 755 |
| 754 void NativeTextfieldViews::TextfieldBorder::SetInsets(int top, | 756 void NativeTextfieldViews::TextfieldBorder::SetInsets(int top, |
| 755 int left, | 757 int left, |
| 756 int bottom, | 758 int bottom, |
| 757 int right) { | 759 int right) { |
| 758 insets_.Set(top, left, bottom, right); | 760 insets_.Set(top, left, bottom, right); |
| 759 } | 761 } |
| 760 | 762 |
| 761 } // namespace views | 763 } // namespace views |
| OLD | NEW |