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

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: Review comments Created 5 years, 6 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 f46a07fd761e2ee34b5dde89632cc42364e0746f..4b474c2412f9cb4e3e0ce5c22d50a29acff38192 100644
--- a/ui/touch_selection/touch_handle.h
+++ b/ui/touch_selection/touch_handle.h
@@ -24,9 +24,12 @@ class UI_TOUCH_SELECTION_EXPORT TouchHandleDrawable {
public:
virtual ~TouchHandleDrawable() {}
virtual void SetEnabled(bool enabled) = 0;
- virtual void SetOrientation(TouchHandleOrientation orientation) = 0;
+ virtual void SetLayout(const gfx::PointF& position,
+ ui::TouchHandleOrientation orientation,
+ bool mirror_vertical,
+ bool mirror_horizontal,
+ bool mirror_changed) = 0;
virtual void SetAlpha(float alpha) = 0;
- virtual void SetFocus(const gfx::PointF& position) = 0;
virtual gfx::RectF GetVisibleBounds() const = 0;
};
@@ -51,7 +54,9 @@ class UI_TOUCH_SELECTION_EXPORT TouchHandleClient {
class UI_TOUCH_SELECTION_EXPORT TouchHandle {
public:
// The drawable will be enabled but invisible until otherwise specified.
- TouchHandle(TouchHandleClient* client, TouchHandleOrientation orientation);
+ TouchHandle(TouchHandleClient* client,
+ TouchHandleOrientation orientation,
+ const gfx::RectF viewport_rect);
~TouchHandle();
// Sets whether the handle is active, allowing resource cleanup if necessary.
@@ -66,10 +71,14 @@ 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 focus points for the handles. The Handle will be positioned
+ // either |top| or |bottom| based on the mirror parameters.
// 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 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
@@ -90,10 +99,11 @@ class UI_TOUCH_SELECTION_EXPORT TouchHandle {
gfx::RectF GetVisibleBounds() const;
bool is_dragging() const { return is_dragging_; }
- const gfx::PointF& position() const { return position_; }
+ const gfx::PointF& focus_bottom() const { return focus_bottom_; }
TouchHandleOrientation orientation() const { return orientation_; }
private:
+ void UpdateLayout();
void BeginDrag();
void EndDrag();
void BeginFade();
@@ -104,7 +114,9 @@ class UI_TOUCH_SELECTION_EXPORT TouchHandle {
TouchHandleClient* const client_;
- gfx::PointF position_;
+ gfx::PointF focus_bottom_;
+ gfx::PointF focus_top_;
+ gfx::RectF viewport_rect_;
TouchHandleOrientation orientation_;
TouchHandleOrientation deferred_orientation_;
@@ -125,6 +137,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