| Index: ui/views/controls/textfield/textfield.h
|
| diff --git a/ui/views/controls/textfield/textfield.h b/ui/views/controls/textfield/textfield.h
|
| index 1a28b12433f14585c7479c71f13c942e3e8595f9..35e64b4504c0fd304bf79f85eaf08ae514ee2293 100644
|
| --- a/ui/views/controls/textfield/textfield.h
|
| +++ b/ui/views/controls/textfield/textfield.h
|
| @@ -29,6 +29,7 @@
|
| #include "ui/views/context_menu_controller.h"
|
| #include "ui/views/controls/textfield/textfield_model.h"
|
| #include "ui/views/drag_controller.h"
|
| +#include "ui/views/selection_controller.h"
|
| #include "ui/views/view.h"
|
| #include "ui/views/word_lookup_client.h"
|
|
|
| @@ -44,6 +45,7 @@ class VIEWS_EXPORT Textfield : public View,
|
| public ContextMenuController,
|
| public DragController,
|
| public WordLookupClient,
|
| + public SelectionController::Delegate,
|
| public ui::TouchEditable,
|
| public ui::TextInputClient {
|
| public:
|
| @@ -206,9 +208,6 @@ class VIEWS_EXPORT Textfield : public View,
|
| // Set the accessible name of the text field.
|
| void SetAccessibleName(const base::string16& name);
|
|
|
| - // Returns whether there is a drag operation originating from the textfield.
|
| - bool HasTextBeingDragged();
|
| -
|
| // View overrides:
|
| gfx::Insets GetInsets() const override;
|
| int GetBaseline() const override;
|
| @@ -266,6 +265,9 @@ class VIEWS_EXPORT Textfield : public View,
|
| gfx::DecoratedText* decorated_word,
|
| gfx::Point* baseline_point) override;
|
|
|
| + // SelectionController::Delegate overrides:
|
| + bool HasTextBeingDragged() const override;
|
| +
|
| // ui::TouchEditable overrides:
|
| void SelectRect(const gfx::Point& start, const gfx::Point& end) override;
|
| void MoveCaretTo(const gfx::Point& point) override;
|
| @@ -323,7 +325,7 @@ class VIEWS_EXPORT Textfield : public View,
|
| // Returns the TextfieldModel's text/cursor/selection rendering model.
|
| gfx::RenderText* GetRenderText() const;
|
|
|
| - gfx::Point last_click_location() const { return last_click_location_; }
|
| + gfx::Point GetLastClickLocation() const;
|
|
|
| // Get the text from the selection clipboard.
|
| virtual base::string16 GetSelectionClipboardText() const;
|
| @@ -341,6 +343,20 @@ class VIEWS_EXPORT Textfield : public View,
|
| bool OnKeyPressed(const ui::KeyEvent& event) final;
|
| bool OnKeyReleased(const ui::KeyEvent& event) final;
|
|
|
| + // SelectionController::Delegate overrides:
|
| + gfx::RenderText* GetRenderTextForSelection() override;
|
| + bool IsReadOnly() const override;
|
| + void SetTextBeingDragged(bool value) override;
|
| + int GetViewHeight() const override;
|
| + int GetViewWidth() const override;
|
| + int GetDragSelectionDelay() const override;
|
| + void OnBeforeMouseAction() override;
|
| + void OnAfterMouseAction(bool text_changed, bool selection_changed) override;
|
| + void OnBeforeSelectionUpdated() override;
|
| + void OnAfterSelectionUpdated() override;
|
| + void PasteSelectionClipboard(const ui::MouseEvent& event) override;
|
| + void UpdateSelectionClipboard() override;
|
| +
|
| // Handles a request to change the value of this text field from software
|
| // using an accessibility API (typically automation software, screen readers
|
| // don't normally use this). Sets the value and clears the selection.
|
| @@ -349,7 +365,9 @@ class VIEWS_EXPORT Textfield : public View,
|
| // Updates the painted background color.
|
| void UpdateBackgroundColor();
|
|
|
| - // Does necessary updates when the text and/or cursor position changes.
|
| + // Does necessary updates when the text and/or cursor position changes. NO-OP
|
| + // if |performing_mouse_action_| is true to ensure updates are only made when
|
| + // the mouse action completes i.e. on the call to OnAfterMouseAction.
|
| void UpdateAfterChange(bool text_changed, bool cursor_changed);
|
|
|
| // A callback function to periodically update the cursor state.
|
| @@ -363,9 +381,6 @@ class VIEWS_EXPORT Textfield : public View,
|
| // Helper function to call MoveCursorTo on the TextfieldModel.
|
| void MoveCursorTo(const gfx::Point& point, bool select);
|
|
|
| - // Helper function to update the selection on a mouse drag.
|
| - void SelectThroughLastDragLocation();
|
| -
|
| // Convenience method to notify the InputMethod and TouchSelectionController.
|
| void OnCaretBoundsChanged();
|
|
|
| @@ -388,9 +403,6 @@ class VIEWS_EXPORT Textfield : public View,
|
| // Utility function to prepare the context menu.
|
| void UpdateContextMenu();
|
|
|
| - // Tracks the mouse clicks for single/double/triple clicks.
|
| - void TrackMouseClicks(const ui::MouseEvent& event);
|
| -
|
| // Returns true if the current text input type allows access by the IME.
|
| bool ImeEditingAllowed() const;
|
|
|
| @@ -400,13 +412,6 @@ class VIEWS_EXPORT Textfield : public View,
|
|
|
| void CreateTouchSelectionControllerAndNotifyIt();
|
|
|
| - // Updates the selection clipboard to any non-empty text selection for a non-
|
| - // password textfield.
|
| - void UpdateSelectionClipboard() const;
|
| -
|
| - // Pastes the selection clipboard for the specified mouse event.
|
| - void PasteSelectionClipboard(const ui::MouseEvent& event);
|
| -
|
| // Called when editing a textfield fails because the textfield is readonly.
|
| void OnEditFailed();
|
|
|
| @@ -480,6 +485,10 @@ class VIEWS_EXPORT Textfield : public View,
|
| // has been called, but OnAfterUserAction() has not yet been called.
|
| bool performing_user_action_;
|
|
|
| + // Tracks whether a mouse action is being performed i.e. OnBeforeMouseAction()
|
| + // has been called, but OnAfterMouseAction() has not yet been called.
|
| + bool performing_mouse_action_;
|
| +
|
| // True if InputMethod::CancelComposition() should not be called.
|
| bool skip_input_method_cancel_composition_;
|
|
|
| @@ -493,19 +502,11 @@ class VIEWS_EXPORT Textfield : public View,
|
| // Is the user potentially dragging and dropping from this view?
|
| bool initiating_drag_;
|
|
|
| - // A timer and point used to modify the selection when dragging.
|
| - base::RepeatingTimer drag_selection_timer_;
|
| - gfx::Point last_drag_location_;
|
| -
|
| - // State variables used to track double and triple clicks.
|
| - size_t aggregated_clicks_;
|
| - base::TimeTicks last_click_time_;
|
| - gfx::Point last_click_location_;
|
| - gfx::Range double_click_word_;
|
| -
|
| std::unique_ptr<ui::TouchEditingControllerDeprecated>
|
| touch_selection_controller_;
|
|
|
| + std::unique_ptr<SelectionController> selection_controller_;
|
| +
|
| // Used to track touch drag starting location and offset to enable touch
|
| // scrolling.
|
| gfx::Point drag_start_location_;
|
|
|