| OLD | NEW |
| 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 Loading... |
| 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 std::numeric_limits<float>::quiet_NaN(); |
| 142 } |
| 143 |
| 144 float MotionEventWeb::GetTiltDirection(size_t pointer_index) const { |
| 145 return std::numeric_limits<float>::quiet_NaN(); |
| 146 } |
| 147 |
| 140 float MotionEventWeb::GetPressure(size_t pointer_index) const { | 148 float MotionEventWeb::GetPressure(size_t pointer_index) const { |
| 141 return 0.f; | 149 return 0.f; |
| 142 } | 150 } |
| 143 | 151 |
| 144 base::TimeTicks MotionEventWeb::GetEventTime() const { | 152 base::TimeTicks MotionEventWeb::GetEventTime() const { |
| 145 return base::TimeTicks() + | 153 return base::TimeTicks() + |
| 146 base::TimeDelta::FromMicroseconds(event_.timeStampSeconds * | 154 base::TimeDelta::FromMicroseconds(event_.timeStampSeconds * |
| 147 base::Time::kMicrosecondsPerSecond); | 155 base::Time::kMicrosecondsPerSecond); |
| 148 } | 156 } |
| 149 | 157 |
| 150 ui::MotionEvent::ToolType MotionEventWeb::GetToolType( | 158 ui::MotionEvent::ToolType MotionEventWeb::GetToolType( |
| 151 size_t pointer_index) const { | 159 size_t pointer_index) const { |
| 152 // TODO(jdduke): Plumb tool type from the platform event, crbug.com/404128. | 160 // TODO(jdduke): Plumb tool type from the platform event, crbug.com/404128. |
| 153 DCHECK_LT(pointer_index, GetPointerCount()); | 161 DCHECK_LT(pointer_index, GetPointerCount()); |
| 154 return TOOL_TYPE_UNKNOWN; | 162 return TOOL_TYPE_UNKNOWN; |
| 155 } | 163 } |
| 156 | 164 |
| 157 int MotionEventWeb::GetButtonState() const { | 165 int MotionEventWeb::GetButtonState() const { |
| 158 return 0; | 166 return 0; |
| 159 } | 167 } |
| 160 | 168 |
| 161 int MotionEventWeb::GetFlags() const { | 169 int MotionEventWeb::GetFlags() const { |
| 162 return WebEventModifiersToEventFlags(event_.modifiers); | 170 return WebEventModifiersToEventFlags(event_.modifiers); |
| 163 } | 171 } |
| 164 | 172 |
| 165 } // namespace content | 173 } // namespace content |
| OLD | NEW |