| 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/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 GetRenderText()->set_selection_color(GetSelectionTextColor()); | 404 GetRenderText()->set_selection_color(GetSelectionTextColor()); |
| 405 SchedulePaint(); | 405 SchedulePaint(); |
| 406 } | 406 } |
| 407 | 407 |
| 408 void Textfield::UseDefaultSelectionTextColor() { | 408 void Textfield::UseDefaultSelectionTextColor() { |
| 409 use_default_selection_text_color_ = true; | 409 use_default_selection_text_color_ = true; |
| 410 GetRenderText()->set_selection_color(GetSelectionTextColor()); | 410 GetRenderText()->set_selection_color(GetSelectionTextColor()); |
| 411 SchedulePaint(); | 411 SchedulePaint(); |
| 412 } | 412 } |
| 413 | 413 |
| 414 void Textfield::SetShadows(const gfx::ShadowValues& shadows) { | |
| 415 GetRenderText()->set_shadows(shadows); | |
| 416 SchedulePaint(); | |
| 417 } | |
| 418 | |
| 419 SkColor Textfield::GetSelectionBackgroundColor() const { | 414 SkColor Textfield::GetSelectionBackgroundColor() const { |
| 420 return use_default_selection_background_color_ ? | 415 return use_default_selection_background_color_ ? |
| 421 GetNativeTheme()->GetSystemColor( | 416 GetNativeTheme()->GetSystemColor( |
| 422 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused) : | 417 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused) : |
| 423 selection_background_color_; | 418 selection_background_color_; |
| 424 } | 419 } |
| 425 | 420 |
| 426 void Textfield::SetSelectionBackgroundColor(SkColor color) { | 421 void Textfield::SetSelectionBackgroundColor(SkColor color) { |
| 427 selection_background_color_ = color; | 422 selection_background_color_ = color; |
| 428 use_default_selection_background_color_ = false; | 423 use_default_selection_background_color_ = false; |
| (...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2058 } | 2053 } |
| 2059 | 2054 |
| 2060 void Textfield::OnCursorBlinkTimerFired() { | 2055 void Textfield::OnCursorBlinkTimerFired() { |
| 2061 DCHECK(ShouldBlinkCursor()); | 2056 DCHECK(ShouldBlinkCursor()); |
| 2062 gfx::RenderText* render_text = GetRenderText(); | 2057 gfx::RenderText* render_text = GetRenderText(); |
| 2063 render_text->set_cursor_visible(!render_text->cursor_visible()); | 2058 render_text->set_cursor_visible(!render_text->cursor_visible()); |
| 2064 RepaintCursor(); | 2059 RepaintCursor(); |
| 2065 } | 2060 } |
| 2066 | 2061 |
| 2067 } // namespace views | 2062 } // namespace views |
| OLD | NEW |