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

Side by Side Diff: ui/events/events_default.cc

Issue 2193153002: MacViews: Send Mac scrollWheel NSEvents as ui::ET_SCROLL (ui::ScrollEvent). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20160728-MacViews-ScrollLayers
Patch Set: NSDictionary subscripting Created 4 years, 2 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
« no previous file with comments | « ui/events/event_utils.cc ('k') | ui/events/events_stub.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "ui/events/event.h" 5 #include "ui/events/event.h"
6 #include "ui/events/event_constants.h" 6 #include "ui/events/event_constants.h"
7 #include "ui/events/event_utils.h" 7 #include "ui/events/event_utils.h"
8 8
9 namespace ui { 9 namespace ui {
10 10
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 static_cast<const ui::TouchEvent*>(native_event); 107 static_cast<const ui::TouchEvent*>(native_event);
108 DCHECK(event->IsTouchEvent()); 108 DCHECK(event->IsTouchEvent());
109 return event->rotation_angle(); 109 return event->rotation_angle();
110 } 110 }
111 111
112 bool GetScrollOffsets(const base::NativeEvent& native_event, 112 bool GetScrollOffsets(const base::NativeEvent& native_event,
113 float* x_offset, 113 float* x_offset,
114 float* y_offset, 114 float* y_offset,
115 float* x_offset_ordinal, 115 float* x_offset_ordinal,
116 float* y_offset_ordinal, 116 float* y_offset_ordinal,
117 int* finger_count) { 117 int* finger_count,
118 EventMomentumPhase* momentum_phase) {
118 const ui::ScrollEvent* event = 119 const ui::ScrollEvent* event =
119 static_cast<const ui::ScrollEvent*>(native_event); 120 static_cast<const ui::ScrollEvent*>(native_event);
120 DCHECK(event->IsScrollEvent()); 121 DCHECK(event->IsScrollEvent());
121 if (x_offset) 122 if (x_offset)
122 *x_offset = event->x_offset(); 123 *x_offset = event->x_offset();
123 if (y_offset) 124 if (y_offset)
124 *y_offset = event->y_offset(); 125 *y_offset = event->y_offset();
125 if (x_offset_ordinal) 126 if (x_offset_ordinal)
126 *x_offset_ordinal = event->x_offset_ordinal(); 127 *x_offset_ordinal = event->x_offset_ordinal();
127 if (y_offset_ordinal) 128 if (y_offset_ordinal)
128 *y_offset_ordinal = event->y_offset_ordinal(); 129 *y_offset_ordinal = event->y_offset_ordinal();
129 if (finger_count) 130 if (finger_count)
130 *finger_count = event->finger_count(); 131 *finger_count = event->finger_count();
132 if (momentum_phase)
133 *momentum_phase = event->momentum_phase();
131 134
132 return true; 135 return true;
133 } 136 }
134 137
135 bool GetFlingData(const base::NativeEvent& native_event, 138 bool GetFlingData(const base::NativeEvent& native_event,
136 float* vx, 139 float* vx,
137 float* vy, 140 float* vy,
138 float* vx_ordinal, 141 float* vx_ordinal,
139 float* vy_ordinal, 142 float* vy_ordinal,
140 bool* is_cancel) { 143 bool* is_cancel) {
141 const ui::ScrollEvent* event = 144 const ui::ScrollEvent* event =
142 static_cast<const ui::ScrollEvent*>(native_event); 145 static_cast<const ui::ScrollEvent*>(native_event);
143 DCHECK(event->IsScrollEvent()); 146 DCHECK(event->IsScrollEvent());
144 if (vx) 147 if (vx)
145 *vx = event->x_offset(); 148 *vx = event->x_offset();
146 if (vy) 149 if (vy)
147 *vy = event->y_offset(); 150 *vy = event->y_offset();
148 if (vx_ordinal) 151 if (vx_ordinal)
149 *vx_ordinal = event->x_offset_ordinal(); 152 *vx_ordinal = event->x_offset_ordinal();
150 if (vy_ordinal) 153 if (vy_ordinal)
151 *vy_ordinal = event->y_offset_ordinal(); 154 *vy_ordinal = event->y_offset_ordinal();
152 if (is_cancel) 155 if (is_cancel)
153 *is_cancel = event->type() == ET_SCROLL_FLING_CANCEL; 156 *is_cancel = event->type() == ET_SCROLL_FLING_CANCEL;
154 157
155 return true; 158 return true;
156 } 159 }
157 160
158 } // namespace ui 161 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/event_utils.cc ('k') | ui/events/events_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698