| OLD | NEW |
| 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 18 matching lines...) Expand all Loading... |
| 29 static_cast<const ui::LocatedEvent*>(native_event); | 29 static_cast<const ui::LocatedEvent*>(native_event); |
| 30 DCHECK(e->IsMouseEvent() || e->IsTouchEvent() || e->IsGestureEvent() || | 30 DCHECK(e->IsMouseEvent() || e->IsTouchEvent() || e->IsGestureEvent() || |
| 31 e->IsScrollEvent()); | 31 e->IsScrollEvent()); |
| 32 return e->location(); | 32 return e->location(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) { | 35 gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) { |
| 36 return EventSystemLocationFromNative(native_event); | 36 return EventSystemLocationFromNative(native_event); |
| 37 } | 37 } |
| 38 | 38 |
| 39 gfx::PointF EventLocationFromNativeF(const base::NativeEvent& native_event) { |
| 40 const ui::LocatedEvent* e = |
| 41 static_cast<const ui::LocatedEvent*>(native_event); |
| 42 DCHECK(e->IsMouseEvent() || e->IsTouchEvent() || e->IsGestureEvent() || |
| 43 e->IsScrollEvent()); |
| 44 return e->location_f(); |
| 45 } |
| 46 |
| 39 int GetChangedMouseButtonFlagsFromNative( | 47 int GetChangedMouseButtonFlagsFromNative( |
| 40 const base::NativeEvent& native_event) { | 48 const base::NativeEvent& native_event) { |
| 41 const ui::MouseEvent* event = | 49 const ui::MouseEvent* event = |
| 42 static_cast<const ui::MouseEvent*>(native_event); | 50 static_cast<const ui::MouseEvent*>(native_event); |
| 43 DCHECK(event->IsMouseEvent() || event->IsScrollEvent()); | 51 DCHECK(event->IsMouseEvent() || event->IsScrollEvent()); |
| 44 return event->changed_button_flags(); | 52 return event->changed_button_flags(); |
| 45 } | 53 } |
| 46 | 54 |
| 47 PointerDetails GetMousePointerDetailsFromNative( | 55 PointerDetails GetMousePointerDetailsFromNative( |
| 48 const base::NativeEvent& native_event) { | 56 const base::NativeEvent& native_event) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 *vx_ordinal = event->x_offset_ordinal(); | 160 *vx_ordinal = event->x_offset_ordinal(); |
| 153 if (vy_ordinal) | 161 if (vy_ordinal) |
| 154 *vy_ordinal = event->y_offset_ordinal(); | 162 *vy_ordinal = event->y_offset_ordinal(); |
| 155 if (is_cancel) | 163 if (is_cancel) |
| 156 *is_cancel = event->type() == ET_SCROLL_FLING_CANCEL; | 164 *is_cancel = event->type() == ET_SCROLL_FLING_CANCEL; |
| 157 | 165 |
| 158 return true; | 166 return true; |
| 159 } | 167 } |
| 160 | 168 |
| 161 } // namespace ui | 169 } // namespace ui |
| OLD | NEW |