Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/views/controls/textfield/textfield.h" | 5 #include "ui/views/controls/textfield/textfield.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 378 } | 378 } |
| 379 | 379 |
| 380 bool Textfield::HasSelection() const { | 380 bool Textfield::HasSelection() const { |
| 381 return !GetSelectedRange().is_empty(); | 381 return !GetSelectedRange().is_empty(); |
| 382 } | 382 } |
| 383 | 383 |
| 384 SkColor Textfield::GetTextColor() const { | 384 SkColor Textfield::GetTextColor() const { |
| 385 if (!use_default_text_color_) | 385 if (!use_default_text_color_) |
| 386 return text_color_; | 386 return text_color_; |
| 387 | 387 |
| 388 return GetNativeTheme()->GetSystemColor(read_only() || !enabled() ? | 388 int style = |
| 389 ui::NativeTheme::kColorId_TextfieldReadOnlyColor : | 389 read_only() || !enabled() ? style::STYLE_DISABLED : style::STYLE_PRIMARY; |
|
Peter Kasting
2017/06/29 20:24:57
Nit: Please put parens around the condition before
tapted
2017/06/30 05:53:43
Done.
| |
| 390 ui::NativeTheme::kColorId_TextfieldDefaultColor); | 390 return style::GetColor(style::CONTEXT_TEXTFIELD, style, GetNativeTheme()); |
| 391 } | 391 } |
| 392 | 392 |
| 393 void Textfield::SetTextColor(SkColor color) { | 393 void Textfield::SetTextColor(SkColor color) { |
| 394 text_color_ = color; | 394 text_color_ = color; |
| 395 use_default_text_color_ = false; | 395 use_default_text_color_ = false; |
| 396 SetColor(color); | 396 SetColor(color); |
| 397 } | 397 } |
| 398 | 398 |
| 399 void Textfield::UseDefaultTextColor() { | 399 void Textfield::UseDefaultTextColor() { |
| 400 use_default_text_color_ = true; | 400 use_default_text_color_ = true; |
| (...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2120 cursor_blink_timer_.Stop(); | 2120 cursor_blink_timer_.Stop(); |
| 2121 } | 2121 } |
| 2122 | 2122 |
| 2123 void Textfield::OnCursorBlinkTimerFired() { | 2123 void Textfield::OnCursorBlinkTimerFired() { |
| 2124 DCHECK(ShouldBlinkCursor()); | 2124 DCHECK(ShouldBlinkCursor()); |
| 2125 cursor_view_.SetVisible(!cursor_view_.visible()); | 2125 cursor_view_.SetVisible(!cursor_view_.visible()); |
| 2126 UpdateCursorViewPosition(); | 2126 UpdateCursorViewPosition(); |
| 2127 } | 2127 } |
| 2128 | 2128 |
| 2129 } // namespace views | 2129 } // namespace views |
| OLD | NEW |