| 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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 void LocatedEvent::UpdateForRootTransform( | 494 void LocatedEvent::UpdateForRootTransform( |
| 495 const gfx::Transform& reversed_root_transform) { | 495 const gfx::Transform& reversed_root_transform) { |
| 496 // Transform has to be done at root level. | 496 // Transform has to be done at root level. |
| 497 gfx::Point3F p(location_); | 497 gfx::Point3F p(location_); |
| 498 reversed_root_transform.TransformPoint(&p); | 498 reversed_root_transform.TransformPoint(&p); |
| 499 location_ = p.AsPointF(); | 499 location_ = p.AsPointF(); |
| 500 root_location_ = location_; | 500 root_location_ = location_; |
| 501 } | 501 } |
| 502 | 502 |
| 503 //////////////////////////////////////////////////////////////////////////////// | 503 //////////////////////////////////////////////////////////////////////////////// |
| 504 // PointerDetails |
| 505 |
| 506 PointerDetails::PointerDetails() {} |
| 507 |
| 508 PointerDetails::PointerDetails(EventPointerType pointer_type) |
| 509 : pointer_type(pointer_type), |
| 510 force(std::numeric_limits<float>::quiet_NaN()) {} |
| 511 |
| 512 PointerDetails::PointerDetails(EventPointerType pointer_type, |
| 513 float radius_x, |
| 514 float radius_y, |
| 515 float force, |
| 516 float tilt_x, |
| 517 float tilt_y, |
| 518 float tangential_pressure, |
| 519 int twist, |
| 520 uint32_t id) |
| 521 : pointer_type(pointer_type), |
| 522 // If we aren't provided with a radius on one axis, use the |
| 523 // information from the other axis. |
| 524 radius_x(radius_x > 0 ? radius_x : radius_y), |
| 525 radius_y(radius_y > 0 ? radius_y : radius_x), |
| 526 force(force), |
| 527 tilt_x(tilt_x), |
| 528 tilt_y(tilt_y), |
| 529 tangential_pressure(tangential_pressure), |
| 530 twist(twist), |
| 531 id(id) {} |
| 532 |
| 533 PointerDetails::PointerDetails(EventPointerType pointer_type, |
| 534 const gfx::Vector2d& offset) |
| 535 : pointer_type(pointer_type), |
| 536 force(std::numeric_limits<float>::quiet_NaN()), |
| 537 offset(offset) {} |
| 538 |
| 539 PointerDetails::PointerDetails(const PointerDetails& other) = default; |
| 540 |
| 541 //////////////////////////////////////////////////////////////////////////////// |
| 504 // MouseEvent | 542 // MouseEvent |
| 505 | 543 |
| 506 MouseEvent::MouseEvent(const base::NativeEvent& native_event) | 544 MouseEvent::MouseEvent(const base::NativeEvent& native_event) |
| 507 : LocatedEvent(native_event), | 545 : LocatedEvent(native_event), |
| 508 changed_button_flags_(GetChangedMouseButtonFlagsFromNative(native_event)), | 546 changed_button_flags_(GetChangedMouseButtonFlagsFromNative(native_event)), |
| 509 pointer_details_(GetMousePointerDetailsFromNative(native_event)) { | 547 pointer_details_(GetMousePointerDetailsFromNative(native_event)) { |
| 510 latency()->AddLatencyNumberWithTimestamp( | 548 latency()->AddLatencyNumberWithTimestamp( |
| 511 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, 0, | 549 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, 0, |
| 512 base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), 1); | 550 base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), 1); |
| 513 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 551 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
| (...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1390 flags | EF_FROM_TOUCH), | 1428 flags | EF_FROM_TOUCH), |
| 1391 details_(details), | 1429 details_(details), |
| 1392 unique_touch_event_id_(unique_touch_event_id) { | 1430 unique_touch_event_id_(unique_touch_event_id) { |
| 1393 latency()->set_source_event_type(ui::SourceEventType::TOUCH); | 1431 latency()->set_source_event_type(ui::SourceEventType::TOUCH); |
| 1394 } | 1432 } |
| 1395 | 1433 |
| 1396 GestureEvent::~GestureEvent() { | 1434 GestureEvent::~GestureEvent() { |
| 1397 } | 1435 } |
| 1398 | 1436 |
| 1399 } // namespace ui | 1437 } // namespace ui |
| OLD | NEW |