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

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

Issue 1888163003: Articulate the cancel behavior in the WebTouchEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests Created 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/input/web_touch_event_traits.h" 5 #include "content/common/input/web_touch_event_traits.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 return false; 45 return false;
46 } 46 }
47 return true; 47 return true;
48 } 48 }
49 49
50 void WebTouchEventTraits::ResetType(WebInputEvent::Type type, 50 void WebTouchEventTraits::ResetType(WebInputEvent::Type type,
51 double timestamp_sec, 51 double timestamp_sec,
52 WebTouchEvent* event) { 52 WebTouchEvent* event) {
53 DCHECK(WebInputEvent::isTouchEventType(type)); 53 DCHECK(WebInputEvent::isTouchEventType(type));
54 event->type = type; 54 event->type = type;
55 event->cancelable = (type != WebInputEvent::TouchCancel); 55 event->dispatchType = type == WebInputEvent::TouchCancel
56 ? WebInputEvent::EventNonBlocking
57 : WebInputEvent::Blocking;
56 event->timeStampSeconds = timestamp_sec; 58 event->timeStampSeconds = timestamp_sec;
57 } 59 }
58 60
59 void WebTouchEventTraits::ResetTypeAndTouchStates(WebInputEvent::Type type, 61 void WebTouchEventTraits::ResetTypeAndTouchStates(WebInputEvent::Type type,
60 double timestamp_sec, 62 double timestamp_sec,
61 WebTouchEvent* event) { 63 WebTouchEvent* event) {
62 ResetType(type, timestamp_sec, event); 64 ResetType(type, timestamp_sec, event);
63 65
64 WebTouchPoint::State newState = WebTouchPoint::StateUndefined; 66 WebTouchPoint::State newState = WebTouchPoint::StateUndefined;
65 switch (event->type) { 67 switch (event->type) {
(...skipping 11 matching lines...) Expand all
77 break; 79 break;
78 default: 80 default:
79 NOTREACHED(); 81 NOTREACHED();
80 break; 82 break;
81 } 83 }
82 for (size_t i = 0; i < event->touchesLength; ++i) 84 for (size_t i = 0; i < event->touchesLength; ++i)
83 event->touches[i].state = newState; 85 event->touches[i].state = newState;
84 } 86 }
85 87
86 } // namespace content 88 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698