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

Issue 404213003: [WIP] Allow scroll events to permanently change the default gesture handler in RootView (Closed)

Created:
6 years, 5 months ago by tdanderson
Modified:
6 years, 4 months ago
Reviewers:
sadrul, tdresser, sky
CC:
chromium-reviews, tfarina, ben+views_chromium.org, tdanderson+views_chromium.org
Project:
chromium
Visibility:
Public.

Description

[WIP] Allow scroll events to permanently change the default gesture handler in RootView (This CL is for discussion only, pending agreement I will split this up into smaller CLs.) If a view has been established as the default gesture handler in RootView (the |gesture_handler_| member) but it does not handle scroll events, then these events will be sent to the closest ancestor of |gesture_handler_| that does handle scroll events. Currently, if any non-scroll gestures occur after the scroll events but before the ui::ET_GESTURE_END, these will be dispatched to the original |gesture_handler_|, and not to the View that received the scroll events. In this CL I propose the following change: If non-scroll gestures occur after a scroll gesture but before the ui::ET_GESTURE_END event (e.g., pinch), then these events should be dispatched to the same View to which the scrolls were dispatched. In other words, when the default gesture handler in RootView is changed in response to a scroll gesture, we never change it back to its original value. Reasons for making this change: * The state maintained by RootView becomes simpler. Instead of needing to store separate |gesture_handler_| and |scroll_gesture_handler_| members, we will only need to store a single |gesture_handler_| member. * A side effect of the above is that the in-progress removal of RootView::DispatchGestureEvent() becomes simpler. * The behavior is arguably more correct; if I am currently scrolling a menu then I would expect a pinch gesture to be dispatched to the menu itself, not to the menu item I targeted on tap down. With this change it will be possible to be in an undesirable situation where the View that received the ui::ET_GESTURE_BEGIN could be different from the one that received the ui::ET_GESTURE_END. To eliminate this problem: * Ignore (do not dispatch) ui::ET_GESTURE_BEGIN to any View. View subclasses which currently handle GESTURE_BEGIN events should instead handle a more specific event type such as ui::ET_GESTURE_TAP_DOWN. All such cases can be seen in this CL. * Ignore (do not dispatch) ui::ET_GESTURE_END to any View, but still clear the |gesture_handler_| member upon seeing this event type. View subclasses which currently handle GESTURE_END events should instead handle a more specific event type such as ui::ET_GESTURE_TAP_DOWN, ui::ET_GESTURE_SCROLL_END, etc. All such cases can be seen in this CL. Added bonus: for each gesture sequence (GESTURE_BEGIN, ..., GESTURE_END) we will have to perform exactly two fewer dispatches and at most two fewer event-targeting operations. BUG=bugs to be filed for each smaller CL TEST=TabDragControllerTest.DragWithGesture, MenuButtonTest.ActivateNonDropDownOnGestureTap, RootViewTest.ContextMenuFromLongPress, WidgetTestInteractive.ResetCaptureOnGestureEnd, WidgetTest.EventHandlersOnRootView, WidgetTest.GestureBeginAndEndEvents, WidgetTest.ScrollGestureEventDispatch (*) (*) replaces ViewTest.ScrollGestureEvent

Patch Set 1 #

Patch Set 2 : WIP #

Patch Set 3 : added and changed some more tests #

Patch Set 4 : compile error #

Patch Set 5 : change to test name #

Patch Set 6 : for initial feedback #

Patch Set 7 : friend test #

Total comments: 18
Unified diffs Side-by-side diffs Delta from patch set Stats (+369 lines, -358 lines) Patch
M ash/frame/caption_buttons/frame_size_button.cc View 1 1 chunk +1 line, -2 lines 5 comments Download
M chrome/browser/ui/views/tabs/tab.h View 1 2 3 4 5 6 3 chunks +8 lines, -4 lines 0 comments Download
M chrome/browser/ui/views/tabs/tab.cc View 1 2 3 4 5 4 chunks +5 lines, -4 lines 6 comments Download
M chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc View 1 2 3 2 chunks +37 lines, -7 lines 0 comments Download
M chrome/browser/ui/views/tabs/tab_strip.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/tabs/tab_strip.cc View 1 3 chunks +4 lines, -9 lines 0 comments Download
M ui/app_list/views/app_list_item_view.cc View 1 1 chunk +0 lines, -1 line 0 comments Download
M ui/views/controls/button/custom_button.cc View 1 2 3 4 5 2 chunks +4 lines, -8 lines 5 comments Download
M ui/views/controls/button/menu_button_unittest.cc View 1 1 chunk +2 lines, -2 lines 0 comments Download
M ui/views/controls/scrollbar/base_scroll_bar.cc View 1 2 3 4 5 6 1 chunk +2 lines, -6 lines 0 comments Download
M ui/views/controls/scrollbar/overlay_scroll_bar.cc View 1 1 chunk +0 lines, -1 line 0 comments Download
M ui/views/controls/slider.cc View 1 2 chunks +9 lines, -2 lines 2 comments Download
M ui/views/view_unittest.cc View 1 7 chunks +0 lines, -190 lines 0 comments Download
M ui/views/widget/root_view.h View 1 chunk +1 line, -5 lines 0 comments Download
M ui/views/widget/root_view.cc View 1 10 chunks +46 lines, -55 lines 0 comments Download
M ui/views/widget/root_view_unittest.cc View 1 2 chunks +1 line, -9 lines 0 comments Download
M ui/views/widget/widget_interactive_uitest.cc View 1 2 3 4 5 6 3 chunks +10 lines, -8 lines 0 comments Download
M ui/views/widget/widget_unittest.cc View 1 2 3 4 5 6 8 chunks +238 lines, -44 lines 0 comments Download

Messages

Total messages: 12 (0 generated)
tdanderson
Sadrul, Scott, and Tim, can you please have a look and share any high-level comments ...
6 years, 5 months ago (2014-07-24 18:07:21 UTC) #1
tdresser
Just gave this an extremely high level skim. I'm in favor of the changes. There ...
6 years, 5 months ago (2014-07-24 18:17:23 UTC) #2
sadrul
https://codereview.chromium.org/404213003/diff/120001/ash/frame/caption_buttons/frame_size_button.cc File ash/frame/caption_buttons/frame_size_button.cc (left): https://codereview.chromium.org/404213003/diff/120001/ash/frame/caption_buttons/frame_size_button.cc#oldcode124 ash/frame/caption_buttons/frame_size_button.cc:124: event->type() == ui::ET_GESTURE_END) { On 2014/07/24 18:17:22, tdresser wrote: ...
6 years, 5 months ago (2014-07-24 19:12:13 UTC) #3
tdresser
https://codereview.chromium.org/404213003/diff/120001/ash/frame/caption_buttons/frame_size_button.cc File ash/frame/caption_buttons/frame_size_button.cc (left): https://codereview.chromium.org/404213003/diff/120001/ash/frame/caption_buttons/frame_size_button.cc#oldcode124 ash/frame/caption_buttons/frame_size_button.cc:124: event->type() == ui::ET_GESTURE_END) { On 2014/07/24 19:12:13, sadrul wrote: ...
6 years, 5 months ago (2014-07-24 19:16:44 UTC) #4
sadrul
https://codereview.chromium.org/404213003/diff/120001/ash/frame/caption_buttons/frame_size_button.cc File ash/frame/caption_buttons/frame_size_button.cc (left): https://codereview.chromium.org/404213003/diff/120001/ash/frame/caption_buttons/frame_size_button.cc#oldcode124 ash/frame/caption_buttons/frame_size_button.cc:124: event->type() == ui::ET_GESTURE_END) { On 2014/07/24 19:16:44, tdresser wrote: ...
6 years, 5 months ago (2014-07-24 19:21:35 UTC) #5
sky
I'm ok with this, but Sadrul likely has a better feel for the impact of ...
6 years, 5 months ago (2014-07-24 22:13:52 UTC) #6
tdanderson
Please see some replies below: https://codereview.chromium.org/404213003/diff/120001/ash/frame/caption_buttons/frame_size_button.cc File ash/frame/caption_buttons/frame_size_button.cc (left): https://codereview.chromium.org/404213003/diff/120001/ash/frame/caption_buttons/frame_size_button.cc#oldcode124 ash/frame/caption_buttons/frame_size_button.cc:124: event->type() == ui::ET_GESTURE_END) { ...
6 years, 5 months ago (2014-07-25 17:16:11 UTC) #7
tdresser
https://codereview.chromium.org/404213003/diff/120001/ui/views/controls/button/custom_button.cc File ui/views/controls/button/custom_button.cc (right): https://codereview.chromium.org/404213003/diff/120001/ui/views/controls/button/custom_button.cc#newcode233 ui/views/controls/button/custom_button.cc:233: SetState(STATE_NORMAL); On 2014/07/25 17:16:10, tdanderson wrote: > On 2014/07/24 ...
6 years, 5 months ago (2014-07-25 17:24:20 UTC) #8
tdanderson
https://codereview.chromium.org/404213003/diff/120001/ui/views/controls/button/custom_button.cc File ui/views/controls/button/custom_button.cc (right): https://codereview.chromium.org/404213003/diff/120001/ui/views/controls/button/custom_button.cc#newcode233 ui/views/controls/button/custom_button.cc:233: SetState(STATE_NORMAL); On 2014/07/25 17:24:20, tdresser wrote: > On 2014/07/25 ...
6 years, 5 months ago (2014-07-25 17:49:20 UTC) #9
tdanderson
I've started splitting this up into smaller patches, (tracked at crbug.com/397564). https://codereview.chromium.org/404213003/diff/120001/ui/views/controls/button/custom_button.cc File ui/views/controls/button/custom_button.cc (right): ...
6 years, 5 months ago (2014-07-25 18:53:02 UTC) #10
sadrul
The overall approach in this CL looks good. Each individual View that currently processes GESTURE_END ...
6 years, 5 months ago (2014-07-25 20:08:22 UTC) #11
tdanderson
6 years, 4 months ago (2014-08-01 19:23:34 UTC) #12
On 2014/07/25 20:08:22, sadrul wrote:
> The overall approach in this CL looks good. Each individual View that
currently
> processes GESTURE_END will have to be tested carefully to make sure we don't
> cause regressions.

All of this has now landed in pieces (tracked by crbug.com/397821 and its
blockers).
Closing this WIP codereview.

Powered by Google App Engine
This is Rietveld 408576698