diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-25 20:07:10 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-25 20:07:10 +0000 |
commit | 6b37608df2d2de9acf9421112166df82e3f1d61d (patch) | |
tree | e37617c6f6325647e819ebfa52c752378799e27b /content/browser/renderer_host/ui_events_helper.cc | |
parent | 3f1d2c488fe147628f61c4c752d8fbf74939d94b (diff) | |
download | chromium_src-6b37608df2d2de9acf9421112166df82e3f1d61d.zip chromium_src-6b37608df2d2de9acf9421112166df82e3f1d61d.tar.gz chromium_src-6b37608df2d2de9acf9421112166df82e3f1d61d.tar.bz2 |
touch: Make sure the touch-events created from an acked WebTouchEvents are in correct state.
This fix is specifically for cases where a second-finger press would end up
generating an erroneous press-event for the first finger as well as for the
second finger.
BUG=110231
Review URL: https://codereview.chromium.org/11266040
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164157 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host/ui_events_helper.cc')
-rw-r--r-- | content/browser/renderer_host/ui_events_helper.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/content/browser/renderer_host/ui_events_helper.cc b/content/browser/renderer_host/ui_events_helper.cc index 7e5ed80..4412b49 100644 --- a/content/browser/renderer_host/ui_events_helper.cc +++ b/content/browser/renderer_host/ui_events_helper.cc @@ -33,6 +33,26 @@ int WebModifiersToUIFlags(int modifiers) { return flags; } +ui::EventType WebTouchPointStateToEventType( + WebKit::WebTouchPoint::State state) { + switch (state) { + case WebKit::WebTouchPoint::StateReleased: + return ui::ET_TOUCH_RELEASED; + + case WebKit::WebTouchPoint::StatePressed: + return ui::ET_TOUCH_PRESSED; + + case WebKit::WebTouchPoint::StateMoved: + return ui::ET_TOUCH_MOVED; + + case WebKit::WebTouchPoint::StateCancelled: + return ui::ET_TOUCH_CANCELLED; + + default: + return ui::ET_UNKNOWN; + } +} + } // namespace namespace content { @@ -63,6 +83,8 @@ bool MakeUITouchEventsFromWebTouchEvents(const WebKit::WebTouchEvent& touch, static_cast<int64>(touch.timeStampSeconds * 1000000)); for (unsigned i = 0; i < touch.touchesLength; ++i) { const WebKit::WebTouchPoint& point = touch.touches[i]; + if (WebTouchPointStateToEventType(point.state) != type) + continue; // In aura, the touch-event needs to be in the screen coordinate, since the // touch-event is routed to RootWindow first. In Windows, on the other hand, // the touch-event is dispatched directly to the gesture-recognizer, so the |