| 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 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1840 if (controller_) | 1840 if (controller_) |
| 1841 controller_->OnAfterCutOrCopy(ui::CLIPBOARD_TYPE_SELECTION); | 1841 controller_->OnAfterCutOrCopy(ui::CLIPBOARD_TYPE_SELECTION); |
| 1842 } | 1842 } |
| 1843 #endif | 1843 #endif |
| 1844 } | 1844 } |
| 1845 | 1845 |
| 1846 void Textfield::UpdateBackgroundColor() { | 1846 void Textfield::UpdateBackgroundColor() { |
| 1847 const SkColor color = GetBackgroundColor(); | 1847 const SkColor color = GetBackgroundColor(); |
| 1848 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { | 1848 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 1849 set_background(Background::CreateBackgroundPainter( | 1849 set_background(Background::CreateBackgroundPainter( |
| 1850 true, Painter::CreateSolidRoundRectPainter( | 1850 Painter::CreateSolidRoundRectPainter( |
| 1851 color, FocusableBorder::kCornerRadiusDp))); | 1851 color, FocusableBorder::kCornerRadiusDp))); |
| 1852 } else { | 1852 } else { |
| 1853 set_background(Background::CreateSolidBackground(color)); | 1853 set_background(Background::CreateSolidBackground(color)); |
| 1854 } | 1854 } |
| 1855 // Disable subpixel rendering when the background color is transparent | 1855 // Disable subpixel rendering when the background color is transparent |
| 1856 // because it draws incorrect colors around the glyphs in that case. | 1856 // because it draws incorrect colors around the glyphs in that case. |
| 1857 // See crbug.com/115198 | 1857 // See crbug.com/115198 |
| 1858 GetRenderText()->set_subpixel_rendering_suppressed( | 1858 GetRenderText()->set_subpixel_rendering_suppressed( |
| 1859 SkColorGetA(color) != SK_AlphaOPAQUE); | 1859 SkColorGetA(color) != SK_AlphaOPAQUE); |
| 1860 SchedulePaint(); | 1860 SchedulePaint(); |
| 1861 } | 1861 } |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2053 } | 2053 } |
| 2054 | 2054 |
| 2055 void Textfield::OnCursorBlinkTimerFired() { | 2055 void Textfield::OnCursorBlinkTimerFired() { |
| 2056 DCHECK(ShouldBlinkCursor()); | 2056 DCHECK(ShouldBlinkCursor()); |
| 2057 gfx::RenderText* render_text = GetRenderText(); | 2057 gfx::RenderText* render_text = GetRenderText(); |
| 2058 render_text->set_cursor_visible(!render_text->cursor_visible()); | 2058 render_text->set_cursor_visible(!render_text->cursor_visible()); |
| 2059 RepaintCursor(); | 2059 RepaintCursor(); |
| 2060 } | 2060 } |
| 2061 | 2061 |
| 2062 } // namespace views | 2062 } // namespace views |
| OLD | NEW |