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

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

Issue 14846029: Pass caret bound to SchedulePaintInRect in local coordinate (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 7 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
« 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 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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