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

Side by Side Diff: content/common/input/web_touch_event_traits.h

Issue 247433003: Mark touchcancel events as uncancelable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up and add tests Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_COMMON_INPUT_WEB_TOUCH_EVENT_TRAITS_H_
6 #define CONTENT_COMMON_INPUT_WEB_TOUCH_EVENT_TRAITS_H_
7
8 #include "base/basictypes.h"
9 #include "content/common/input/scoped_web_input_event.h"
10 #include "third_party/WebKit/public/web/WebInputEvent.h"
11
12 namespace content {
13
14 // Utility class for performing operations on and with WebTouchEvents.
15 class CONTENT_EXPORT WebTouchEventTraits {
16 public:
17
18 // Returns whether all touches in the event have the specified state.
19 static bool AllTouchPointsHaveState(
20 const blink::WebTouchEvent& event,
21 blink::WebTouchPoint::State state);
22
23 // Returns whether this event represents a transition from no active
24 // touches to some active touches (the start of a new "touch sequence").
25 static bool IsTouchSequenceStart(const blink::WebTouchEvent& event);
26
27 // Sets the type of |event| to |type|, resetting any other type-specific
28 // properties and updating the timestamp and touches as requested.
29 // This is particularly useful, for example, in sending a touchcancel
30 // for all active touches.
31 enum ResetTouchesMode {
32 // Don't modify the Touches at all.
33 IGNORE_TOUCHES_STATE,
34 // Reset the state of every active Touch to match the event type.
35 RESET_TOUCHES_STATE
36 };
37 static void ResetType(blink::WebTouchEvent* event,
jdduke (slow) 2014/04/23 21:55:47 I'd much prefer two methods here, |ResetType| and
Rick Byers 2014/04/23 23:15:35 Done.
38 blink::WebInputEvent::Type type,
39 double timestamp_sec,
40 ResetTouchesMode);
41 };
42
43 } // namespace content
44
45 #endif // CONTENT_COMMON_INPUT_WEB_TOUCH_EVENT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698