summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-24 02:15:53 +0000
committerpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-24 02:15:53 +0000
commitb9d8ac34b8097248a16a0df7456176276c3547d0 (patch)
tree3033dd0b60a5e7a57469afc9749a2202febc53b0 /ui
parentcec3dc4cbab2fbe94089a5177ee4191d6cf6e7ac (diff)
downloadchromium_src-b9d8ac34b8097248a16a0df7456176276c3547d0.zip
chromium_src-b9d8ac34b8097248a16a0df7456176276c3547d0.tar.gz
chromium_src-b9d8ac34b8097248a16a0df7456176276c3547d0.tar.bz2
In High DPI mode we set transform which includes a scale factor.
Fix gesture events and touch events to scale delta and touch radius information as well Review URL: http://codereview.chromium.org/10175002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133604 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/aura/event.cc9
-rw-r--r--ui/aura/event.h13
2 files changed, 18 insertions, 4 deletions
diff --git a/ui/aura/event.cc b/ui/aura/event.cc
index 3fd6ab3..8192e55 100644
--- a/ui/aura/event.cc
+++ b/ui/aura/event.cc
@@ -13,6 +13,7 @@
#include "ui/aura/window.h"
#include "ui/base/keycodes/keyboard_code_conversion.h"
#include "ui/gfx/point3.h"
+#include "ui/gfx/interpolated_transform.h"
#include "ui/gfx/transform.h"
#if defined(OS_MACOSX)
@@ -280,6 +281,14 @@ TouchEvent::TouchEvent(ui::EventType type,
TouchEvent::~TouchEvent() {
}
+void TouchEvent::UpdateForRootTransform(const ui::Transform& root_transform) {
+ LocatedEvent::UpdateForRootTransform(root_transform);
+ gfx::Point3f scale;
+ ui::InterpolatedTransform::FactorTRS(root_transform, NULL, NULL, &scale);
+ radius_x_ *= scale.x();
+ radius_y_ *= scale.y();
+}
+
ui::EventType TouchEvent::GetEventType() const {
return type();
}
diff --git a/ui/aura/event.h b/ui/aura/event.h
index eb6f6f2..da27885 100644
--- a/ui/aura/event.h
+++ b/ui/aura/event.h
@@ -112,8 +112,9 @@ class AURA_EXPORT LocatedEvent : public Event {
gfx::Point location() const { return location_; }
gfx::Point root_location() const { return root_location_; }
- // Applies the |root_transform| to both |location_| and |root_location_|.
- void UpdateForRootTransform(const ui::Transform& root_transform);
+ // Applies |root_transform| to the event.
+ // This is applied to both |location_| and |root_location_|.
+ virtual void UpdateForRootTransform(const ui::Transform& root_transform);
protected:
explicit LocatedEvent(const base::NativeEvent& native_event);
@@ -204,6 +205,10 @@ class AURA_EXPORT TouchEvent : public LocatedEvent,
float rotation_angle() const { return rotation_angle_; }
float force() const { return force_; }
+ // Overridden from LocatedEvent.
+ virtual void UpdateForRootTransform(
+ const ui::Transform& root_transform) OVERRIDE;
+
// Overridden from ui::TouchEvent.
virtual ui::EventType GetEventType() const OVERRIDE;
virtual gfx::Point GetLocation() const OVERRIDE;
@@ -218,10 +223,10 @@ class AURA_EXPORT TouchEvent : public LocatedEvent,
const int touch_id_;
// Radius of the X (major) axis of the touch ellipse. 1.0 if unknown.
- const float radius_x_;
+ float radius_x_;
// Radius of the Y (minor) axis of the touch ellipse. 1.0 if unknown.
- const float radius_y_;
+ float radius_y_;
// Angle of the major axis away from the X axis. Default 0.0.
const float rotation_angle_;