diff options
author | rbyers@chromium.org <rbyers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-24 21:05:30 +0000 |
---|---|---|
committer | rbyers@chromium.org <rbyers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-24 21:05:30 +0000 |
commit | ace1cd5043cedb0676240c74e69a8faf7e6d9a49 (patch) | |
tree | 823dbbbfd11d88a977880d10d567e56a334d03c4 /content/browser/renderer_host/input/touch_event_queue.cc | |
parent | 3301058a73caf3d4322993e65ee91fcec75b046a (diff) | |
download | chromium_src-ace1cd5043cedb0676240c74e69a8faf7e6d9a49.zip chromium_src-ace1cd5043cedb0676240c74e69a8faf7e6d9a49.tar.gz chromium_src-ace1cd5043cedb0676240c74e69a8faf7e6d9a49.tar.bz2 |
Mark touchcancel events as uncancelable
The touch events spec says that all touch events are cancelable except for
touchcancel, and this is exposed to JS via the cancelable property.
Previously we were marking all touch events as cancelable, but as of
https://src.chromium.org/viewvc/blink?revision=172329&view=revision the
decision is up to the browser (since only it can decide if it will wait for
an ACK). This change ensures all touchcancel events are marked as
uncancelable, and all other touch events remain cancelable.
There are a lot of different places that create WebTouchEvents, and we
don't want some central location (like the InputRouter) to be modifying
these events. So I've added a WebTouchEventTraits::ResetType function to
reset properties of a WebTouchEvent, applying appropriate default policy
like cancelable state.
Then we can DCHECK at the central location that an a event is cancelable
if and only if we intend to wait for it's ACK.
I've updated a handful of unit tests to verify that the cancelable bit
is set correctly in various scenarios.
This also extends EventSender to allow the cancelable bit to be set so that
we can add a blink LayoutTest, and removes an unused
SyntheticWebTouchEventBuilder.
BUG=365681
Review URL: https://codereview.chromium.org/247433003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265991 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host/input/touch_event_queue.cc')
-rw-r--r-- | content/browser/renderer_host/input/touch_event_queue.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/content/browser/renderer_host/input/touch_event_queue.cc b/content/browser/renderer_host/input/touch_event_queue.cc index 8662f4a..4f4aa7b 100644 --- a/content/browser/renderer_host/input/touch_event_queue.cc +++ b/content/browser/renderer_host/input/touch_event_queue.cc @@ -9,7 +9,7 @@ #include "base/debug/trace_event.h" #include "base/stl_util.h" #include "content/browser/renderer_host/input/timeout_monitor.h" -#include "content/browser/renderer_host/input/web_touch_event_traits.h" +#include "content/common/input/web_touch_event_traits.h" #include "content/public/common/content_switches.h" #include "ui/gfx/geometry/point_f.h" @@ -31,9 +31,11 @@ typedef std::vector<TouchEventWithLatencyInfo> WebTouchEventWithLatencyList; TouchEventWithLatencyInfo ObtainCancelEventForTouchEvent( const TouchEventWithLatencyInfo& event_to_cancel) { TouchEventWithLatencyInfo event = event_to_cancel; - event.event.type = WebInputEvent::TouchCancel; - for (size_t i = 0; i < event.event.touchesLength; i++) - event.event.touches[i].state = WebTouchPoint::StateCancelled; + WebTouchEventTraits::ResetTypeAndTouchStates( + WebInputEvent::TouchCancel, + // TODO(rbyers): Shouldn't we use a fresh timestamp? + event.event.timeStampSeconds, + &event.event); return event; } |