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