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

Unified Diff: ui/touch_selection/touch_handle.h

Issue 481683003: Support for Adaptive Handle Orientation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 5 years, 8 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
Index: ui/touch_selection/touch_handle.h
diff --git a/ui/touch_selection/touch_handle.h b/ui/touch_selection/touch_handle.h
index 12c66d09983626db3c3f9b4a356aa80a2a9d9178..29b4ac678f7b32b58c49067a99826f171da28177 100644
--- a/ui/touch_selection/touch_handle.h
+++ b/ui/touch_selection/touch_handle.h
@@ -24,7 +24,9 @@ class UI_TOUCH_SELECTION_EXPORT TouchHandleDrawable {
public:
virtual ~TouchHandleDrawable() {}
virtual void SetEnabled(bool enabled) = 0;
- virtual void SetOrientation(TouchHandleOrientation orientation) = 0;
+ virtual void SetOrientation(TouchHandleOrientation orientation,
+ bool mirror_vertical,
+ bool mirror_horizontal) = 0;
virtual void SetAlpha(float alpha) = 0;
virtual void SetFocus(const gfx::PointF& position) = 0;
virtual gfx::RectF GetVisibleBounds() const = 0;
@@ -66,10 +68,17 @@ class UI_TOUCH_SELECTION_EXPORT TouchHandle {
// If an animation is in-progress, it will be overriden appropriately.
void SetVisible(bool visible, AnimationStyle animation_style);
- // Update the handle placement to |position|.
+ // Update the handle placement to appropriate position based on mirror params.
// Note: If a fade out animation is active or the handle is invisible, the
// handle position will not be updated until the handle regains visibility.
- void SetPosition(const gfx::PointF& position);
+ void UpdatePosition();
+
+ // Update the focus points for the handles. The Handle will be positioned
+ // either |top| or |bottom| based on the mirror parameters.
+ void SetFocus(const gfx::PointF& top, const gfx::PointF& bottom);
+
+ // Update the Viewport rect, based on which the handle decide its inversion
+ void SetViewportRect(const gfx::RectF viewport_rect);
// Update the handle visuals to |orientation|.
// Note: If the handle is being dragged, the orientation change will be
@@ -94,12 +103,16 @@ class UI_TOUCH_SELECTION_EXPORT TouchHandle {
void BeginFade();
void EndFade();
void SetAlpha(float alpha);
+ bool SetMirrorParameters();
scoped_ptr<TouchHandleDrawable> drawable_;
TouchHandleClient* const client_;
gfx::PointF position_;
+ gfx::PointF focus_bottom_;
+ gfx::PointF focus_top_;
+ gfx::RectF viewport_rect_;
TouchHandleOrientation orientation_;
TouchHandleOrientation deferred_orientation_;
@@ -120,6 +133,10 @@ class UI_TOUCH_SELECTION_EXPORT TouchHandle {
bool is_dragging_;
bool is_drag_within_tap_region_;
+ // Mirror variables determine if the handles should be inverted or not.
+ bool mirror_vertical_;
+ bool mirror_horizontal_;
+
DISALLOW_COPY_AND_ASSIGN(TouchHandle);
};

Powered by Google App Engine
This is Rietveld 408576698