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 #include "content/browser/renderer_host/input/motion_event_web.h" | 5 #include "content/browser/renderer_host/input/motion_event_web.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 using blink::WebInputEvent; | 9 using blink::WebInputEvent; |
10 using blink::WebTouchEvent; | 10 using blink::WebTouchEvent; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 return event_.touches[pointer_index].position.y; | 92 return event_.touches[pointer_index].position.y; |
93 } | 93 } |
94 | 94 |
95 float MotionEventWeb::GetTouchMajor(size_t pointer_index) const { | 95 float MotionEventWeb::GetTouchMajor(size_t pointer_index) const { |
96 DCHECK_LT(pointer_index, GetPointerCount()); | 96 DCHECK_LT(pointer_index, GetPointerCount()); |
97 // TODO(jdduke): We should be a bit more careful about axes here. | 97 // TODO(jdduke): We should be a bit more careful about axes here. |
98 return 2.f * std::max(event_.touches[pointer_index].radiusX, | 98 return 2.f * std::max(event_.touches[pointer_index].radiusX, |
99 event_.touches[pointer_index].radiusY); | 99 event_.touches[pointer_index].radiusY); |
100 } | 100 } |
101 | 101 |
| 102 float MotionEventWeb::GetPressure(size_t pointer_index) const { |
| 103 return 0.f; |
| 104 } |
| 105 |
102 base::TimeTicks MotionEventWeb::GetEventTime() const { | 106 base::TimeTicks MotionEventWeb::GetEventTime() const { |
103 return base::TimeTicks() + | 107 return base::TimeTicks() + |
104 base::TimeDelta::FromMicroseconds(event_.timeStampSeconds * | 108 base::TimeDelta::FromMicroseconds(event_.timeStampSeconds * |
105 base::Time::kMicrosecondsPerSecond); | 109 base::Time::kMicrosecondsPerSecond); |
106 } | 110 } |
107 | 111 |
108 size_t MotionEventWeb::GetHistorySize() const { return 0; } | 112 size_t MotionEventWeb::GetHistorySize() const { return 0; } |
109 | 113 |
110 base::TimeTicks MotionEventWeb::GetHistoricalEventTime( | 114 base::TimeTicks MotionEventWeb::GetHistoricalEventTime( |
111 size_t historical_index) const { | 115 size_t historical_index) const { |
(...skipping 27 matching lines...) Expand all Loading... |
139 WebTouchEvent cancel_event(event_); | 143 WebTouchEvent cancel_event(event_); |
140 | 144 |
141 cancel_event.type = WebInputEvent::TouchCancel; | 145 cancel_event.type = WebInputEvent::TouchCancel; |
142 for (size_t i = 0; i < cancel_event.touchesLength; ++i) | 146 for (size_t i = 0; i < cancel_event.touchesLength; ++i) |
143 cancel_event.touches[i].state = WebTouchPoint::StateCancelled; | 147 cancel_event.touches[i].state = WebTouchPoint::StateCancelled; |
144 | 148 |
145 return scoped_ptr<MotionEvent>(new MotionEventWeb(cancel_event)); | 149 return scoped_ptr<MotionEvent>(new MotionEventWeb(cancel_event)); |
146 } | 150 } |
147 | 151 |
148 } // namespace content | 152 } // namespace content |
OLD | NEW |