Commit 54ae5a27 authored by Shimi Zhang's avatar Shimi Zhang Committed by Commit Bot

Cursor Control: Fix a check for magnifier

We should check |event.data.scroll_begin.cursor_control| flag after we
are sure this event is a GestureScrollBegin event.

Bug: 1126778
Change-Id: I99aa795d09600618fb92b5bfaad200dda3d23e21
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2533237
Commit-Queue: Shimi Zhang <ctzsm@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Reviewed-by: default avatarChangwan Ryu <changwan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826811}
parent a9657429
...@@ -1635,8 +1635,7 @@ void RenderWidgetHostViewAndroid::GestureEventAck( ...@@ -1635,8 +1635,7 @@ void RenderWidgetHostViewAndroid::GestureEventAck(
if (gesture_listener_manager_) if (gesture_listener_manager_)
gesture_listener_manager_->GestureEventAck(event, ack_result); gesture_listener_manager_->GestureEventAck(event, ack_result);
if (event.data.scroll_begin.cursor_control || swipe_to_move_cursor_activated_) HandleSwipeToMoveCursorGestureAck(event);
OnSwipeToMoveCursorGestureAck(event);
} }
void RenderWidgetHostViewAndroid::ChildDidAckGestureEvent( void RenderWidgetHostViewAndroid::ChildDidAckGestureEvent(
...@@ -2444,7 +2443,7 @@ void RenderWidgetHostViewAndroid::SetDisplayFeatureForTesting( ...@@ -2444,7 +2443,7 @@ void RenderWidgetHostViewAndroid::SetDisplayFeatureForTesting(
NOTREACHED(); NOTREACHED();
} }
void RenderWidgetHostViewAndroid::OnSwipeToMoveCursorGestureAck( void RenderWidgetHostViewAndroid::HandleSwipeToMoveCursorGestureAck(
const blink::WebGestureEvent& event) { const blink::WebGestureEvent& event) {
if (!touch_selection_controller_ || !selection_popup_controller_) { if (!touch_selection_controller_ || !selection_popup_controller_) {
swipe_to_move_cursor_activated_ = false; swipe_to_move_cursor_activated_ = false;
...@@ -2453,12 +2452,16 @@ void RenderWidgetHostViewAndroid::OnSwipeToMoveCursorGestureAck( ...@@ -2453,12 +2452,16 @@ void RenderWidgetHostViewAndroid::OnSwipeToMoveCursorGestureAck(
switch (event.GetType()) { switch (event.GetType()) {
case blink::WebInputEvent::Type::kGestureScrollBegin: { case blink::WebInputEvent::Type::kGestureScrollBegin: {
if (!event.data.scroll_begin.cursor_control)
break;
swipe_to_move_cursor_activated_ = true; swipe_to_move_cursor_activated_ = true;
touch_selection_controller_->OnSwipeToMoveCursorBegin(); touch_selection_controller_->OnSwipeToMoveCursorBegin();
OnSelectionEvent(ui::INSERTION_HANDLE_DRAG_STARTED); OnSelectionEvent(ui::INSERTION_HANDLE_DRAG_STARTED);
break; break;
} }
case blink::WebInputEvent::Type::kGestureScrollUpdate: { case blink::WebInputEvent::Type::kGestureScrollUpdate: {
if (!swipe_to_move_cursor_activated_)
break;
gfx::RectF rect = touch_selection_controller_->GetRectBetweenBounds(); gfx::RectF rect = touch_selection_controller_->GetRectBetweenBounds();
// Suppress this when the input is not focused, in which case rect will be // Suppress this when the input is not focused, in which case rect will be
// 0x0. // 0x0.
...@@ -2469,6 +2472,8 @@ void RenderWidgetHostViewAndroid::OnSwipeToMoveCursorGestureAck( ...@@ -2469,6 +2472,8 @@ void RenderWidgetHostViewAndroid::OnSwipeToMoveCursorGestureAck(
break; break;
} }
case blink::WebInputEvent::Type::kGestureScrollEnd: { case blink::WebInputEvent::Type::kGestureScrollEnd: {
if (!swipe_to_move_cursor_activated_)
break;
swipe_to_move_cursor_activated_ = false; swipe_to_move_cursor_activated_ = false;
touch_selection_controller_->OnSwipeToMoveCursorEnd(); touch_selection_controller_->OnSwipeToMoveCursorEnd();
OnSelectionEvent(ui::INSERTION_HANDLE_DRAG_STOPPED); OnSelectionEvent(ui::INSERTION_HANDLE_DRAG_STOPPED);
......
...@@ -456,7 +456,7 @@ class CONTENT_EXPORT RenderWidgetHostViewAndroid ...@@ -456,7 +456,7 @@ class CONTENT_EXPORT RenderWidgetHostViewAndroid
void OnUpdateScopedSelectionHandles(); void OnUpdateScopedSelectionHandles();
void OnSwipeToMoveCursorGestureAck(const blink::WebGestureEvent& event); void HandleSwipeToMoveCursorGestureAck(const blink::WebGestureEvent& event);
bool is_showing_; bool is_showing_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment