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

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

Issue 2569273002: Add constructors to WebInputEvents and setters so we can work at cleaning up these public structs. (Closed)
Patch Set: Rebase Created 3 years, 11 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 return true; 48 return true;
49 } 49 }
50 50
51 void WebTouchEventTraits::ResetType(WebInputEvent::Type type, 51 void WebTouchEventTraits::ResetType(WebInputEvent::Type type,
52 double timestamp_sec, 52 double timestamp_sec,
53 WebTouchEvent* event) { 53 WebTouchEvent* event) {
54 DCHECK(WebInputEvent::isTouchEventType(type)); 54 DCHECK(WebInputEvent::isTouchEventType(type));
55 DCHECK(type != WebInputEvent::TouchScrollStarted); 55 DCHECK(type != WebInputEvent::TouchScrollStarted);
56 56
57 event->type = type; 57 event->setType(type);
58 event->dispatchType = type == WebInputEvent::TouchCancel 58 event->dispatchType = type == WebInputEvent::TouchCancel
59 ? WebInputEvent::EventNonBlocking 59 ? WebInputEvent::EventNonBlocking
60 : WebInputEvent::Blocking; 60 : WebInputEvent::Blocking;
61 event->timeStampSeconds = timestamp_sec; 61 event->setTimeStampSeconds(timestamp_sec);
62 } 62 }
63 63
64 void WebTouchEventTraits::ResetTypeAndTouchStates(WebInputEvent::Type type, 64 void WebTouchEventTraits::ResetTypeAndTouchStates(WebInputEvent::Type type,
65 double timestamp_sec, 65 double timestamp_sec,
66 WebTouchEvent* event) { 66 WebTouchEvent* event) {
67 ResetType(type, timestamp_sec, event); 67 ResetType(type, timestamp_sec, event);
68 68
69 WebTouchPoint::State newState = WebTouchPoint::StateUndefined; 69 WebTouchPoint::State newState = WebTouchPoint::StateUndefined;
70 switch (event->type) { 70 switch (event->type) {
71 case WebInputEvent::TouchStart: 71 case WebInputEvent::TouchStart:
(...skipping 10 matching lines...) Expand all
82 break; 82 break;
83 default: 83 default:
84 NOTREACHED(); 84 NOTREACHED();
85 break; 85 break;
86 } 86 }
87 for (size_t i = 0; i < event->touchesLength; ++i) 87 for (size_t i = 0; i < event->touchesLength; ++i)
88 event->touches[i].state = newState; 88 event->touches[i].state = newState;
89 } 89 }
90 90
91 } // namespace content 91 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698