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/base/events/event.h" | 5 #include "ui/base/events/event.h" |
6 | 6 |
7 #if defined(USE_X11) | 7 #if defined(USE_X11) |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 CHECK(IsScrollEvent()); | 672 CHECK(IsScrollEvent()); |
673 } | 673 } |
674 | 674 |
675 void ScrollEvent::Scale(const float factor) { | 675 void ScrollEvent::Scale(const float factor) { |
676 x_offset_ *= factor; | 676 x_offset_ *= factor; |
677 y_offset_ *= factor; | 677 y_offset_ *= factor; |
678 x_offset_ordinal_ *= factor; | 678 x_offset_ordinal_ *= factor; |
679 y_offset_ordinal_ *= factor; | 679 y_offset_ordinal_ *= factor; |
680 } | 680 } |
681 | 681 |
| 682 void ScrollEvent::UpdateForRootTransform(const gfx::Transform& root_transform) { |
| 683 LocatedEvent::UpdateForRootTransform(root_transform); |
| 684 gfx::DecomposedTransform decomp; |
| 685 bool success = gfx::DecomposeTransform(&decomp, root_transform); |
| 686 DCHECK(success); |
| 687 if (decomp.scale[0]) |
| 688 x_offset_ordinal_ /= decomp.scale[0]; |
| 689 if (decomp.scale[1]) |
| 690 y_offset_ordinal_ /= decomp.scale[1]; |
| 691 } |
| 692 |
682 //////////////////////////////////////////////////////////////////////////////// | 693 //////////////////////////////////////////////////////////////////////////////// |
683 // GestureEvent | 694 // GestureEvent |
684 | 695 |
685 GestureEvent::GestureEvent(EventType type, | 696 GestureEvent::GestureEvent(EventType type, |
686 int x, | 697 int x, |
687 int y, | 698 int y, |
688 int flags, | 699 int flags, |
689 base::TimeDelta time_stamp, | 700 base::TimeDelta time_stamp, |
690 const GestureEventDetails& details, | 701 const GestureEventDetails& details, |
691 unsigned int touch_ids_bitfield) | 702 unsigned int touch_ids_bitfield) |
(...skipping 12 matching lines...) Expand all Loading... |
704 int GestureEvent::GetLowestTouchId() const { | 715 int GestureEvent::GetLowestTouchId() const { |
705 if (touch_ids_bitfield_ == 0) | 716 if (touch_ids_bitfield_ == 0) |
706 return -1; | 717 return -1; |
707 int i = -1; | 718 int i = -1; |
708 // Find the index of the least significant 1 bit | 719 // Find the index of the least significant 1 bit |
709 while (!(1 << ++i & touch_ids_bitfield_)); | 720 while (!(1 << ++i & touch_ids_bitfield_)); |
710 return i; | 721 return i; |
711 } | 722 } |
712 | 723 |
713 } // namespace ui | 724 } // namespace ui |
OLD | NEW |