OLD | NEW |
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 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 is_cursor_visible_ = !is_cursor_visible_; | 1104 is_cursor_visible_ = !is_cursor_visible_; |
1105 RepaintCursor(); | 1105 RepaintCursor(); |
1106 base::MessageLoop::current()->PostDelayedTask( | 1106 base::MessageLoop::current()->PostDelayedTask( |
1107 FROM_HERE, | 1107 FROM_HERE, |
1108 base::Bind(&NativeTextfieldViews::UpdateCursor, | 1108 base::Bind(&NativeTextfieldViews::UpdateCursor, |
1109 cursor_timer_.GetWeakPtr()), | 1109 cursor_timer_.GetWeakPtr()), |
1110 base::TimeDelta::FromMilliseconds(kCursorBlinkCycleMs / 2)); | 1110 base::TimeDelta::FromMilliseconds(kCursorBlinkCycleMs / 2)); |
1111 } | 1111 } |
1112 | 1112 |
1113 void NativeTextfieldViews::RepaintCursor() { | 1113 void NativeTextfieldViews::RepaintCursor() { |
1114 gfx::Rect r(GetCaretBounds()); | 1114 gfx::Rect r(GetRenderText()->GetUpdatedCursorBounds()); |
1115 r.Inset(-1, -1, -1, -1); | 1115 r.Inset(-1, -1, -1, -1); |
1116 SchedulePaintInRect(r); | 1116 SchedulePaintInRect(r); |
1117 } | 1117 } |
1118 | 1118 |
1119 void NativeTextfieldViews::PaintTextAndCursor(gfx::Canvas* canvas) { | 1119 void NativeTextfieldViews::PaintTextAndCursor(gfx::Canvas* canvas) { |
1120 TRACE_EVENT0("views", "NativeTextfieldViews::PaintTextAndCursor"); | 1120 TRACE_EVENT0("views", "NativeTextfieldViews::PaintTextAndCursor"); |
1121 canvas->Save(); | 1121 canvas->Save(); |
1122 GetRenderText()->set_cursor_visible(!is_drop_cursor_visible_ && | 1122 GetRenderText()->set_cursor_visible(!is_drop_cursor_visible_ && |
1123 is_cursor_visible_ && !model_->HasSelection()); | 1123 is_cursor_visible_ && !model_->HasSelection()); |
1124 // Draw the text, cursor, and selection. | 1124 // Draw the text, cursor, and selection. |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 | 1457 |
1458 void NativeTextfieldViews::PlatformGestureEventHandling( | 1458 void NativeTextfieldViews::PlatformGestureEventHandling( |
1459 const ui::GestureEvent* event) { | 1459 const ui::GestureEvent* event) { |
1460 #if defined(OS_WIN) && defined(USE_AURA) | 1460 #if defined(OS_WIN) && defined(USE_AURA) |
1461 if (event->type() == ui::ET_GESTURE_TAP_DOWN && !textfield_->read_only()) | 1461 if (event->type() == ui::ET_GESTURE_TAP_DOWN && !textfield_->read_only()) |
1462 base::win::DisplayVirtualKeyboard(); | 1462 base::win::DisplayVirtualKeyboard(); |
1463 #endif | 1463 #endif |
1464 } | 1464 } |
1465 | 1465 |
1466 } // namespace views | 1466 } // namespace views |
OLD | NEW |