Commit 51258edc authored by Jun Mukai's avatar Jun Mukai Committed by Commit Bot

Allow notifying injected event which turns out invalid

Some tab-dragging test cases never finishes on SingleProcessMash,
and it turns out that WindowEventDispatcher thinks some
TOUCH_RELEASED events can be invalid; it won't generate any
gestures and does not do anything. In that case, OnEvent()
won't be called and any other methods are not called, therefore
InjectedEventHandler couldn't notify it's done.

This CL adds a new method to WindowEventDispatcherObserver to
catch such cases and allow handling it's done.

BUG=890071
TEST=see the filter update

Change-Id: I6dcda9af52e5cbd4013b8d228bda2e9b1f14bdd6
Reviewed-on: https://chromium-review.googlesource.com/c/1316767
Commit-Queue: Jun Mukai <mukai@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605531}
parent d41d5fef
...@@ -98,6 +98,15 @@ void InjectedEventHandler::OnWindowEventDispatcherDispatchedHeldEvents( ...@@ -98,6 +98,15 @@ void InjectedEventHandler::OnWindowEventDispatcherDispatchedHeldEvents(
NotifyCallback(); NotifyCallback();
} }
void InjectedEventHandler::OnWindowEventDispatcherIgnoredEvent(
aura::WindowEventDispatcher* dispatcher) {
// The event turns out to be invalid, no event processing happens anymore.
// It's okay to notify the callback.
DCHECK(!event_id_);
if (dispatcher->host() == window_tree_host_)
NotifyCallback();
}
void InjectedEventHandler::OnWindowDestroying(aura::Window* window) { void InjectedEventHandler::OnWindowDestroying(aura::Window* window) {
// This is called when the WindowTreeHost has been destroyed. Assume we won't // This is called when the WindowTreeHost has been destroyed. Assume we won't
// be getting an ack from the client. // be getting an ack from the client.
......
...@@ -91,6 +91,8 @@ class COMPONENT_EXPORT(WINDOW_SERVICE) InjectedEventHandler ...@@ -91,6 +91,8 @@ class COMPONENT_EXPORT(WINDOW_SERVICE) InjectedEventHandler
aura::WindowEventDispatcher* dispatcher) override; aura::WindowEventDispatcher* dispatcher) override;
void OnWindowEventDispatcherDispatchedHeldEvents( void OnWindowEventDispatcherDispatchedHeldEvents(
aura::WindowEventDispatcher* dispatcher) override; aura::WindowEventDispatcher* dispatcher) override;
void OnWindowEventDispatcherIgnoredEvent(
aura::WindowEventDispatcher* dispatcher) override;
// aura::WindowObserver: // aura::WindowObserver:
void OnWindowDestroying(aura::Window* window) override; void OnWindowDestroying(aura::Window* window) override;
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
-TabDragging/DetachToBrowserTabDragControllerTest.DragWithMaskedWindows/0 -TabDragging/DetachToBrowserTabDragControllerTest.DragWithMaskedWindows/0
-TabDragging/DetachToBrowserTabDragControllerTest.DragWithMaskedWindows/1 -TabDragging/DetachToBrowserTabDragControllerTest.DragWithMaskedWindows/1
-TabDragging/DetachToBrowserTabDragControllerTestTouch.PressSecondFingerWhileDetached/0 -TabDragging/DetachToBrowserTabDragControllerTestTouch.PressSecondFingerWhileDetached/0
-TabDragging/DetachToBrowserTabDragControllerTestTouch.SecondFingerPressTest/0
# This test is flaky. https://crbug.com/897879 # This test is flaky. https://crbug.com/897879
-ExtensionApiTest.DisplayModeWindowIsInFullscreen -ExtensionApiTest.DisplayModeWindowIsInFullscreen
...@@ -1076,6 +1076,8 @@ DispatchDetails WindowEventDispatcher::PreDispatchTouchEvent( ...@@ -1076,6 +1076,8 @@ DispatchDetails WindowEventDispatcher::PreDispatchTouchEvent(
// The event is invalid - ignore it. // The event is invalid - ignore it.
event->StopPropagation(); event->StopPropagation();
event->DisableSynchronousHandling(); event->DisableSynchronousHandling();
for (auto& observer : env_->window_event_dispatcher_observers())
observer.OnWindowEventDispatcherIgnoredEvent(this);
return DispatchDetails(); return DispatchDetails();
} }
......
...@@ -37,6 +37,12 @@ class AURA_EXPORT WindowEventDispatcherObserver { ...@@ -37,6 +37,12 @@ class AURA_EXPORT WindowEventDispatcherObserver {
virtual void OnWindowEventDispatcherDispatchedHeldEvents( virtual void OnWindowEventDispatcherDispatchedHeldEvents(
WindowEventDispatcher* dispatcher) {} WindowEventDispatcher* dispatcher) {}
// Called when the WindowEventDispatcher doesn't dispatch the event because
// it's not appropriate at this time. For example a TouchEvent may be ignored
// at certain points in a gesture.
virtual void OnWindowEventDispatcherIgnoredEvent(
WindowEventDispatcher* dispatcher) {}
protected: protected:
virtual ~WindowEventDispatcherObserver() {} virtual ~WindowEventDispatcherObserver() {}
}; };
......
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