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

Side by Side Diff: content/browser/renderer_host/input/motion_event_web.cc

Issue 755403006: Added experimental Touch.tilt, Touch.tiltDirection support for Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 // MSVC++ requires this to be set before any other includes to get M_PI. 5 // MSVC++ requires this to be set before any other includes to get M_PI.
6 #define _USE_MATH_DEFINES 6 #define _USE_MATH_DEFINES
7 7
8 #include "content/browser/renderer_host/input/motion_event_web.h" 8 #include "content/browser/renderer_host/input/motion_event_web.h"
9 9
10 #include <cmath> 10 #include <cmath>
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 > event_.touches[pointer_index].radiusY) { 130 > event_.touches[pointer_index].radiusY) {
131 // The case radiusX == radiusY is omitted from here on purpose: for circles, 131 // The case radiusX == radiusY is omitted from here on purpose: for circles,
132 // we want to pass the angle (which could be any value in such cases but 132 // we want to pass the angle (which could be any value in such cases but
133 // always seem to be set to zero) unchanged. 133 // always seem to be set to zero) unchanged.
134 rotation_angle_rad -= (float) M_PI_2; 134 rotation_angle_rad -= (float) M_PI_2;
135 } 135 }
136 136
137 return rotation_angle_rad; 137 return rotation_angle_rad;
138 } 138 }
139 139
140 float MotionEventWeb::GetTilt(size_t pointer_index) const {
141 return 0.f;
142 }
143
140 float MotionEventWeb::GetPressure(size_t pointer_index) const { 144 float MotionEventWeb::GetPressure(size_t pointer_index) const {
141 return 0.f; 145 return 0.f;
142 } 146 }
143 147
144 base::TimeTicks MotionEventWeb::GetEventTime() const { 148 base::TimeTicks MotionEventWeb::GetEventTime() const {
145 return base::TimeTicks() + 149 return base::TimeTicks() +
146 base::TimeDelta::FromMicroseconds(event_.timeStampSeconds * 150 base::TimeDelta::FromMicroseconds(event_.timeStampSeconds *
147 base::Time::kMicrosecondsPerSecond); 151 base::Time::kMicrosecondsPerSecond);
148 } 152 }
149 153
150 ui::MotionEvent::ToolType MotionEventWeb::GetToolType( 154 ui::MotionEvent::ToolType MotionEventWeb::GetToolType(
151 size_t pointer_index) const { 155 size_t pointer_index) const {
152 // TODO(jdduke): Plumb tool type from the platform event, crbug.com/404128. 156 // TODO(jdduke): Plumb tool type from the platform event, crbug.com/404128.
153 DCHECK_LT(pointer_index, GetPointerCount()); 157 DCHECK_LT(pointer_index, GetPointerCount());
154 return TOOL_TYPE_UNKNOWN; 158 return TOOL_TYPE_UNKNOWN;
155 } 159 }
156 160
157 int MotionEventWeb::GetButtonState() const { 161 int MotionEventWeb::GetButtonState() const {
158 return 0; 162 return 0;
159 } 163 }
160 164
161 int MotionEventWeb::GetFlags() const { 165 int MotionEventWeb::GetFlags() const {
162 return WebEventModifiersToEventFlags(event_.modifiers); 166 return WebEventModifiersToEventFlags(event_.modifiers);
163 } 167 }
164 168
165 } // namespace content 169 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698