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

Unified Diff: ui/views/controls/textfield/textfield.h

Issue 2322303002: Textfield: suppress cursor repaints when there's a selection (Closed)
Patch Set: remove spurious DCHECK Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/views/controls/textfield/textfield.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/textfield/textfield.h
diff --git a/ui/views/controls/textfield/textfield.h b/ui/views/controls/textfield/textfield.h
index 8b39ecba133bc4d1be1b6e66660fda71a3504252..c6dd5c11eaa2def01c015a62a224062858bb2549 100644
--- a/ui/views/controls/textfield/textfield.h
+++ b/ui/views/controls/textfield/textfield.h
@@ -399,6 +399,22 @@ class VIEWS_EXPORT Textfield : public View,
// to insert text into a readonly text field.
void OnKeypressUnhandled();
+ // Returns true if an insertion cursor should be visible (a vertical bar,
+ // placed at the point new text will be inserted).
+ bool ShouldShowCursor() const;
+
+ // Returns true if an insertion cursor should be visible and blinking.
+ bool ShouldBlinkCursor() const;
+
+ // Starts and stops blinking the cursor, respectively. These are both
+ // idempotent if the cursor is already blinking/not blinking.
+ void StartBlinkingCursor();
+ void StopBlinkingCursor();
+
+ // Callback for the cursor blink timer. Called every
+ // Textfield::GetCaretBlinkMs().
+ void OnCursorBlinkTimerFired();
+
// The text model.
std::unique_ptr<TextfieldModel> model_;
@@ -456,9 +472,8 @@ class VIEWS_EXPORT Textfield : public View,
// True if InputMethod::CancelComposition() should not be called.
bool skip_input_method_cancel_composition_;
- // The text editing cursor repaint timer and visibility.
- base::RepeatingTimer cursor_repaint_timer_;
- bool cursor_visible_;
+ // Insertion cursor repaint timer and visibility.
+ base::RepeatingTimer cursor_blink_timer_;
// The drop cursor is a visual cue for where dragged text will be dropped.
bool drop_cursor_visible_;
« no previous file with comments | « no previous file | ui/views/controls/textfield/textfield.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698