diff options
-rw-r--r-- | content/browser/renderer_host/web_input_event_aurax11.cc | 5 | ||||
-rw-r--r-- | ui/aura/event.cc | 10 | ||||
-rw-r--r-- | ui/aura/event.h | 4 | ||||
-rw-r--r-- | ui/base/x/events_x.cc | 4 |
4 files changed, 13 insertions, 10 deletions
diff --git a/content/browser/renderer_host/web_input_event_aurax11.cc b/content/browser/renderer_host/web_input_event_aurax11.cc index 8b20ea2..905a52e 100644 --- a/content/browser/renderer_host/web_input_event_aurax11.cc +++ b/content/browser/renderer_host/web_input_event_aurax11.cc @@ -410,8 +410,9 @@ WebKit::WebTouchPoint* UpdateWebTouchEventFromAuraEvent( if (!point) return NULL; - point->radiusX = event->radius_x(); - point->radiusY = event->radius_y(); + // The spec requires the radii values to be positive (and 1 when unknown). + point->radiusX = std::max(1.f, event->radius_x()); + point->radiusY = std::max(1.f, event->radius_y()); point->rotationAngle = event->rotation_angle(); point->force = event->force(); diff --git a/ui/aura/event.cc b/ui/aura/event.cc index 0d9f590..a4c990c 100644 --- a/ui/aura/event.cc +++ b/ui/aura/event.cc @@ -271,8 +271,8 @@ TouchEvent::TouchEvent(ui::EventType type, base::TimeDelta time_stamp) : LocatedEvent(type, location, location, 0), touch_id_(touch_id), - radius_x_(1.0f), - radius_y_(1.0f), + radius_x_(0.0f), + radius_y_(0.0f), rotation_angle_(0.0f), force_(0.0f) { set_time_stamp(time_stamp); @@ -285,8 +285,10 @@ 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(); + if (scale.x()) + radius_x_ /= scale.x(); + if (scale.y()) + radius_y_ /= scale.y(); } ui::EventType TouchEvent::GetEventType() const { diff --git a/ui/aura/event.h b/ui/aura/event.h index e9cc7e8..c3fa722 100644 --- a/ui/aura/event.h +++ b/ui/aura/event.h @@ -230,10 +230,10 @@ class AURA_EXPORT TouchEvent : public LocatedEvent, // for each separable additional touch that the hardware can detect. const int touch_id_; - // Radius of the X (major) axis of the touch ellipse. 1.0 if unknown. + // Radius of the X (major) axis of the touch ellipse. 0.0 if unknown. float radius_x_; - // Radius of the Y (minor) axis of the touch ellipse. 1.0 if unknown. + // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. float radius_y_; // Angle of the major axis away from the X axis. Default 0.0. diff --git a/ui/base/x/events_x.cc b/ui/base/x/events_x.cc index 47cb746..4d822e4 100644 --- a/ui/base/x/events_x.cc +++ b/ui/base/x/events_x.cc @@ -834,12 +834,12 @@ int GetTouchId(const base::NativeEvent& xev) { float GetTouchRadiusX(const base::NativeEvent& native_event) { return GetTouchParamFromXEvent(native_event, - ui::TouchFactory::TP_TOUCH_MAJOR, 2.0) / 2.0; + ui::TouchFactory::TP_TOUCH_MAJOR, 0.0) / 2.0; } float GetTouchRadiusY(const base::NativeEvent& native_event) { return GetTouchParamFromXEvent(native_event, - ui::TouchFactory::TP_TOUCH_MINOR, 2.0) / 2.0; + ui::TouchFactory::TP_TOUCH_MINOR, 0.0) / 2.0; } float GetTouchAngle(const base::NativeEvent& native_event) { |