| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef UI_EVENTS_EVENT_H_ | 5 #ifndef UI_EVENTS_EVENT_H_ |
| 6 #define UI_EVENTS_EVENT_H_ | 6 #define UI_EVENTS_EVENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 } | 361 } |
| 362 | 362 |
| 363 // Transform the locations using |inverted_root_transform|. | 363 // Transform the locations using |inverted_root_transform|. |
| 364 // This is applied to both |location_| and |root_location_|. | 364 // This is applied to both |location_| and |root_location_|. |
| 365 virtual void UpdateForRootTransform( | 365 virtual void UpdateForRootTransform( |
| 366 const gfx::Transform& inverted_root_transform); | 366 const gfx::Transform& inverted_root_transform); |
| 367 | 367 |
| 368 template <class T> void ConvertLocationToTarget(T* source, T* target) { | 368 template <class T> void ConvertLocationToTarget(T* source, T* target) { |
| 369 if (!target || target == source) | 369 if (!target || target == source) |
| 370 return; | 370 return; |
| 371 gfx::Point offset = gfx::ToFlooredPoint(location_); | 371 T::ConvertPointToTargetF(source, target, &location_); |
| 372 T::ConvertPointToTarget(source, target, &offset); | |
| 373 gfx::Vector2d diff = gfx::ToFlooredPoint(location_) - offset; | |
| 374 location_= location_ - diff; | |
| 375 } | 372 } |
| 376 | 373 |
| 377 protected: | 374 protected: |
| 378 friend class LocatedEventTestApi; | 375 friend class LocatedEventTestApi; |
| 379 | 376 |
| 380 explicit LocatedEvent(const base::NativeEvent& native_event); | 377 explicit LocatedEvent(const base::NativeEvent& native_event); |
| 381 | 378 |
| 382 // Create a new LocatedEvent which is identical to the provided model. | 379 // Create a new LocatedEvent which is identical to the provided model. |
| 383 // If source / target windows are provided, the model location will be | 380 // If source / target windows are provided, the model location will be |
| 384 // converted from |source| coordinate system to |target| coordinate system. | 381 // converted from |source| coordinate system to |target| coordinate system. |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 // dispatched. This field gets a non-zero value only for gestures that are | 1035 // dispatched. This field gets a non-zero value only for gestures that are |
| 1039 // released through TouchDispositionGestureFilter::SendGesture. The gesture | 1036 // released through TouchDispositionGestureFilter::SendGesture. The gesture |
| 1040 // events that aren't fired directly in response to processing a touch-event | 1037 // events that aren't fired directly in response to processing a touch-event |
| 1041 // (e.g. timer fired ones), this id is zero. See crbug.com/618738. | 1038 // (e.g. timer fired ones), this id is zero. See crbug.com/618738. |
| 1042 uint32_t unique_touch_event_id_; | 1039 uint32_t unique_touch_event_id_; |
| 1043 }; | 1040 }; |
| 1044 | 1041 |
| 1045 } // namespace ui | 1042 } // namespace ui |
| 1046 | 1043 |
| 1047 #endif // UI_EVENTS_EVENT_H_ | 1044 #endif // UI_EVENTS_EVENT_H_ |
| OLD | NEW |