| 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 #include "ui/events/event.h" | 5 #include "ui/events/event.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 | 10 |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 base::TimeDelta time_stamp, | 437 base::TimeDelta time_stamp, |
| 438 int flags) | 438 int flags) |
| 439 : Event(type, time_stamp, flags), | 439 : Event(type, time_stamp, flags), |
| 440 location_(location), | 440 location_(location), |
| 441 root_location_(root_location) { | 441 root_location_(root_location) { |
| 442 } | 442 } |
| 443 | 443 |
| 444 void LocatedEvent::UpdateForRootTransform( | 444 void LocatedEvent::UpdateForRootTransform( |
| 445 const gfx::Transform& reversed_root_transform) { | 445 const gfx::Transform& reversed_root_transform) { |
| 446 // Transform has to be done at root level. | 446 // Transform has to be done at root level. |
| 447 bool locations_equal = location_ == root_location_; |
| 447 gfx::Point3F p(location_); | 448 gfx::Point3F p(location_); |
| 448 reversed_root_transform.TransformPoint(&p); | 449 reversed_root_transform.TransformPoint(&p); |
| 449 location_ = p.AsPointF(); | 450 location_ = p.AsPointF(); |
| 450 root_location_ = location_; | 451 if (locations_equal) { |
| 452 root_location_ = location_; |
| 453 LOG(ERROR) << name() << " Set to " << root_location_.ToString(); |
| 454 } else { |
| 455 p = gfx::Point3F(root_location_); |
| 456 reversed_root_transform.TransformPoint(&p); |
| 457 root_location_ = p.AsPointF(); |
| 458 LOG(ERROR) << name() << " Set to " << root_location_.ToString() |
| 459 << " instead of " << location_.ToString(); |
| 460 } |
| 451 } | 461 } |
| 452 | 462 |
| 453 //////////////////////////////////////////////////////////////////////////////// | 463 //////////////////////////////////////////////////////////////////////////////// |
| 454 // MouseEvent | 464 // MouseEvent |
| 455 | 465 |
| 456 MouseEvent::MouseEvent(const base::NativeEvent& native_event) | 466 MouseEvent::MouseEvent(const base::NativeEvent& native_event) |
| 457 : LocatedEvent(native_event), | 467 : LocatedEvent(native_event), |
| 458 changed_button_flags_(GetChangedMouseButtonFlagsFromNative(native_event)), | 468 changed_button_flags_(GetChangedMouseButtonFlagsFromNative(native_event)), |
| 459 pointer_details_(GetMousePointerDetailsFromNative(native_event)) { | 469 pointer_details_(GetMousePointerDetailsFromNative(native_event)) { |
| 460 if (type() == ET_MOUSE_PRESSED || type() == ET_MOUSE_RELEASED) | 470 if (type() == ET_MOUSE_PRESSED || type() == ET_MOUSE_RELEASED) |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 gfx::PointF(x, y), | 1224 gfx::PointF(x, y), |
| 1215 time_stamp, | 1225 time_stamp, |
| 1216 flags | EF_FROM_TOUCH), | 1226 flags | EF_FROM_TOUCH), |
| 1217 details_(details) { | 1227 details_(details) { |
| 1218 } | 1228 } |
| 1219 | 1229 |
| 1220 GestureEvent::~GestureEvent() { | 1230 GestureEvent::~GestureEvent() { |
| 1221 } | 1231 } |
| 1222 | 1232 |
| 1223 } // namespace ui | 1233 } // namespace ui |
| OLD | NEW |