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

Side by Side 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, 2 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 | ui/views/controls/textfield/textfield.cc » ('j') | 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) 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 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_
6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 // password textfield. 392 // password textfield.
393 void UpdateSelectionClipboard() const; 393 void UpdateSelectionClipboard() const;
394 394
395 // Pastes the selection clipboard for the specified mouse event. 395 // Pastes the selection clipboard for the specified mouse event.
396 void PasteSelectionClipboard(const ui::MouseEvent& event); 396 void PasteSelectionClipboard(const ui::MouseEvent& event);
397 397
398 // Called whenever a keypress is unhandled for any reason, including failing 398 // Called whenever a keypress is unhandled for any reason, including failing
399 // to insert text into a readonly text field. 399 // to insert text into a readonly text field.
400 void OnKeypressUnhandled(); 400 void OnKeypressUnhandled();
401 401
402 // Returns true if an insertion cursor should be visible (a vertical bar,
403 // placed at the point new text will be inserted).
404 bool ShouldShowCursor() const;
405
406 // Returns true if an insertion cursor should be visible and blinking.
407 bool ShouldBlinkCursor() const;
408
409 // Starts and stops blinking the cursor, respectively. These are both
410 // idempotent if the cursor is already blinking/not blinking.
411 void StartBlinkingCursor();
412 void StopBlinkingCursor();
413
414 // Callback for the cursor blink timer. Called every
415 // Textfield::GetCaretBlinkMs().
416 void OnCursorBlinkTimerFired();
417
402 // The text model. 418 // The text model.
403 std::unique_ptr<TextfieldModel> model_; 419 std::unique_ptr<TextfieldModel> model_;
404 420
405 // This is the current listener for events from this Textfield. 421 // This is the current listener for events from this Textfield.
406 TextfieldController* controller_; 422 TextfieldController* controller_;
407 423
408 // An edit command to execute on the next key event. When set to a valid 424 // An edit command to execute on the next key event. When set to a valid
409 // value, the key event is still passed to |controller_|, but otherwise 425 // value, the key event is still passed to |controller_|, but otherwise
410 // ignored in favor of the edit command. Set via 426 // ignored in favor of the edit command. Set via
411 // SetTextEditCommandForNextKeyEvent() during dispatch of that key event (see 427 // SetTextEditCommandForNextKeyEvent() during dispatch of that key event (see
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 // The timer to reveal the last typed password character. 465 // The timer to reveal the last typed password character.
450 base::OneShotTimer password_reveal_timer_; 466 base::OneShotTimer password_reveal_timer_;
451 467
452 // Tracks whether a user action is being performed; i.e. OnBeforeUserAction() 468 // Tracks whether a user action is being performed; i.e. OnBeforeUserAction()
453 // has been called, but OnAfterUserAction() has not yet been called. 469 // has been called, but OnAfterUserAction() has not yet been called.
454 bool performing_user_action_; 470 bool performing_user_action_;
455 471
456 // True if InputMethod::CancelComposition() should not be called. 472 // True if InputMethod::CancelComposition() should not be called.
457 bool skip_input_method_cancel_composition_; 473 bool skip_input_method_cancel_composition_;
458 474
459 // The text editing cursor repaint timer and visibility. 475 // Insertion cursor repaint timer and visibility.
460 base::RepeatingTimer cursor_repaint_timer_; 476 base::RepeatingTimer cursor_blink_timer_;
461 bool cursor_visible_;
462 477
463 // The drop cursor is a visual cue for where dragged text will be dropped. 478 // The drop cursor is a visual cue for where dragged text will be dropped.
464 bool drop_cursor_visible_; 479 bool drop_cursor_visible_;
465 gfx::SelectionModel drop_cursor_position_; 480 gfx::SelectionModel drop_cursor_position_;
466 481
467 // Is the user potentially dragging and dropping from this view? 482 // Is the user potentially dragging and dropping from this view?
468 bool initiating_drag_; 483 bool initiating_drag_;
469 484
470 // A timer and point used to modify the selection when dragging. 485 // A timer and point used to modify the selection when dragging.
471 base::RepeatingTimer drag_selection_timer_; 486 base::RepeatingTimer drag_selection_timer_;
(...skipping 23 matching lines...) Expand all
495 510
496 // Used to bind callback functions to this object. 511 // Used to bind callback functions to this object.
497 base::WeakPtrFactory<Textfield> weak_ptr_factory_; 512 base::WeakPtrFactory<Textfield> weak_ptr_factory_;
498 513
499 DISALLOW_COPY_AND_ASSIGN(Textfield); 514 DISALLOW_COPY_AND_ASSIGN(Textfield);
500 }; 515 };
501 516
502 } // namespace views 517 } // namespace views
503 518
504 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ 519 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_
OLDNEW
« 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