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

Unified Diff: ui/touch_selection/touch_selection_controller.h

Issue 2664253002: Revert "Blink handle selection handle visibility" (Closed)
Patch Set: Created 3 years, 11 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 | « ui/touch_selection/selection_event_type.h ('k') | ui/touch_selection/touch_selection_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/touch_selection/touch_selection_controller.h
diff --git a/ui/touch_selection/touch_selection_controller.h b/ui/touch_selection/touch_selection_controller.h
index 7c3541508cc432e45482a59c76a43e9ab7bf9299..e7126a3d3227ec9d29417f3bbc9ba16408908d85 100644
--- a/ui/touch_selection/touch_selection_controller.h
+++ b/ui/touch_selection/touch_selection_controller.h
@@ -85,19 +85,25 @@ class UI_TOUCH_SELECTION_EXPORT TouchSelectionController
// cease further handling of the event.
bool WillHandleTouchEvent(const MotionEvent& event);
- // To be called before forwarding a tap event.
+ // To be called before forwarding a tap event. This allows automatically
+ // showing the insertion handle from subsequent bounds changes.
// |tap_count| is tap index in a repeated sequence, i.e., 1 for the first
// tap, 2 for the second tap, etc...
- void HandleTapEvent(const gfx::PointF& location, int tap_count);
+ bool WillHandleTapEvent(const gfx::PointF& location, int tap_count);
- // To be called before forwarding a longpress event.
- void HandleLongPressEvent(base::TimeTicks event_time,
+ // To be called before forwarding a longpress event. This allows automatically
+ // showing the selection or insertion handles from subsequent bounds changes.
+ bool WillHandleLongPressEvent(base::TimeTicks event_time,
const gfx::PointF& location);
// To be called before forwarding a gesture scroll begin event to prevent
// long-press drag.
void OnScrollBeginEvent();
+ // Allow showing the selection handles from the most recent selection bounds
+ // update (if valid), or a future valid bounds update.
+ void AllowShowingFromCurrentSelection();
+
// Hide the handles and suppress bounds updates until the next explicit
// showing allowance.
void HideAndDisallowShowingAutomatically();
@@ -105,6 +111,12 @@ class UI_TOUCH_SELECTION_EXPORT TouchSelectionController
// Override the handle visibility according to |hidden|.
void SetTemporarilyHidden(bool hidden);
+ // To be called when the editability of the focused region changes.
+ void OnSelectionEditable(bool editable);
+
+ // To be called when the contents of the focused region changes.
+ void OnSelectionEmpty(bool empty);
+
// Ticks an active animation, as requested to the client by |SetNeedsAnimate|.
// Returns true if an animation is active and requires further ticking.
bool Animate(base::TimeTicks animate_time);
@@ -129,6 +141,10 @@ class UI_TOUCH_SELECTION_EXPORT TouchSelectionController
ActiveStatus active_status() const { return active_status_; }
+ bool insertion_active_or_requested() const {
+ return activate_insertion_automatically_;
+ }
+
private:
friend class TouchSelectionControllerTestApi;
@@ -154,6 +170,10 @@ class UI_TOUCH_SELECTION_EXPORT TouchSelectionController
gfx::PointF GetSelectionStart() const override;
gfx::PointF GetSelectionEnd() const override;
+ void ShowInsertionHandleAutomatically();
+ void ShowSelectionHandlesAutomatically();
+ bool WillHandleTapOrLongPress(const gfx::PointF& location);
+
void OnInsertionChanged();
void OnSelectionChanged();
@@ -163,14 +183,13 @@ class UI_TOUCH_SELECTION_EXPORT TouchSelectionController
// Returns true if selection mode was newly (re)activated.
bool ActivateSelectionIfNecessary();
void DeactivateSelection();
+ void ForceNextUpdateIfInactive();
void UpdateHandleLayoutIfNecessary();
bool WillHandleTouchEventForLongPressDrag(const MotionEvent& event);
void SetTemporarilyHiddenForLongPressDrag(bool hidden);
void RefreshHandleVisibility();
- void HideHandles();
-
gfx::Vector2dF GetStartLineOffset() const;
gfx::Vector2dF GetEndLineOffset() const;
bool GetStartVisible() const;
@@ -182,7 +201,10 @@ class UI_TOUCH_SELECTION_EXPORT TouchSelectionController
TouchSelectionControllerClient* const client_;
const Config config_;
- // TODO(amaralp): This is not necessary. Remove it.
+ // Whether to force an update on the next selection event even if the
+ // cached selection matches the new selection.
+ bool force_next_update_;
+
InputEventType response_pending_input_event_;
gfx::SelectionBound start_;
@@ -193,9 +215,14 @@ class UI_TOUCH_SELECTION_EXPORT TouchSelectionController
ActiveStatus active_status_;
std::unique_ptr<TouchHandle> insertion_handle_;
+ bool activate_insertion_automatically_;
std::unique_ptr<TouchHandle> start_selection_handle_;
std::unique_ptr<TouchHandle> end_selection_handle_;
+ bool activate_selection_automatically_;
+
+ bool selection_empty_;
+ bool selection_editable_;
bool temporarily_hidden_;
@@ -218,8 +245,6 @@ class UI_TOUCH_SELECTION_EXPORT TouchSelectionController
// Determines whether the entire touch sequence should be consumed or not.
bool consume_touch_sequence_;
- bool show_touch_handles_;
-
DISALLOW_COPY_AND_ASSIGN(TouchSelectionController);
};
« no previous file with comments | « ui/touch_selection/selection_event_type.h ('k') | ui/touch_selection/touch_selection_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698