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

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

Issue 17517005: Match the NativeTextfieldViews cursor color to the text color. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | « no previous file | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/views/controls/textfield/native_textfield_views.h" 5 #include "ui/views/controls/textfield/native_textfield_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #if defined(USE_AURA) 47 #if defined(USE_AURA)
48 #include "ui/base/cursor/cursor.h" 48 #include "ui/base/cursor/cursor.h"
49 #endif 49 #endif
50 50
51 #if defined(OS_WIN) && defined(USE_AURA) 51 #if defined(OS_WIN) && defined(USE_AURA)
52 #include "base/win/win_util.h" 52 #include "base/win/win_util.h"
53 #endif 53 #endif
54 54
55 namespace { 55 namespace {
56 56
57 // Default "system" color for text cursor.
58 const SkColor kDefaultCursorColor = SK_ColorBLACK;
59
60 void ConvertRectToScreen(const views::View* src, gfx::Rect* r) { 57 void ConvertRectToScreen(const views::View* src, gfx::Rect* r) {
61 DCHECK(src); 58 DCHECK(src);
62 59
63 gfx::Point new_origin = r->origin(); 60 gfx::Point new_origin = r->origin();
64 views::View::ConvertPointToScreen(src, &new_origin); 61 views::View::ConvertPointToScreen(src, &new_origin);
65 r->set_origin(new_origin); 62 r->set_origin(new_origin);
66 } 63 }
67 64
68 } // namespace 65 } // namespace
69 66
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 1117
1121 string16 NativeTextfieldViews::GetTextForDisplay(const string16& text) { 1118 string16 NativeTextfieldViews::GetTextForDisplay(const string16& text) {
1122 return textfield_->style() & Textfield::STYLE_LOWERCASE ? 1119 return textfield_->style() & Textfield::STYLE_LOWERCASE ?
1123 base::i18n::ToLower(text) : text; 1120 base::i18n::ToLower(text) : text;
1124 } 1121 }
1125 1122
1126 void NativeTextfieldViews::UpdateColorsFromTheme(const ui::NativeTheme* theme) { 1123 void NativeTextfieldViews::UpdateColorsFromTheme(const ui::NativeTheme* theme) {
1127 UpdateTextColor(); 1124 UpdateTextColor();
1128 UpdateBackgroundColor(); 1125 UpdateBackgroundColor();
1129 gfx::RenderText* render_text = GetRenderText(); 1126 gfx::RenderText* render_text = GetRenderText();
1130 render_text->set_cursor_color(kDefaultCursorColor); 1127 render_text->set_cursor_color(textfield_->GetTextColor());
1131 render_text->set_selection_color(theme->GetSystemColor( 1128 render_text->set_selection_color(theme->GetSystemColor(
1132 ui::NativeTheme::kColorId_TextfieldSelectionColor)); 1129 ui::NativeTheme::kColorId_TextfieldSelectionColor));
1133 render_text->set_selection_background_focused_color(theme->GetSystemColor( 1130 render_text->set_selection_background_focused_color(theme->GetSystemColor(
1134 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused)); 1131 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused));
1135 render_text->set_selection_background_unfocused_color(theme->GetSystemColor( 1132 render_text->set_selection_background_unfocused_color(theme->GetSystemColor(
1136 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundUnfocused)); 1133 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundUnfocused));
1137 } 1134 }
1138 1135
1139 void NativeTextfieldViews::UpdateCursor() { 1136 void NativeTextfieldViews::UpdateCursor() {
1140 is_cursor_visible_ = !is_cursor_visible_; 1137 is_cursor_visible_ = !is_cursor_visible_;
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 if (index != -1) { 1505 if (index != -1) {
1509 obscured_reveal_timer_.Start( 1506 obscured_reveal_timer_.Start(
1510 FROM_HERE, 1507 FROM_HERE,
1511 duration, 1508 duration,
1512 base::Bind(&NativeTextfieldViews::RevealObscuredChar, 1509 base::Bind(&NativeTextfieldViews::RevealObscuredChar,
1513 base::Unretained(this), -1, base::TimeDelta())); 1510 base::Unretained(this), -1, base::TimeDelta()));
1514 } 1511 }
1515 } 1512 }
1516 1513
1517 } // namespace views 1514 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698