Chromium Code Reviews| Index: content/shell/renderer/test_runner/event_sender.cc |
| diff --git a/content/shell/renderer/test_runner/event_sender.cc b/content/shell/renderer/test_runner/event_sender.cc |
| index 8706b8643211bf3ce4311ce42c76519ff9a006de..af34006039f16fc6827b26be08961013afd41bd8 100644 |
| --- a/content/shell/renderer/test_runner/event_sender.cc |
| +++ b/content/shell/renderer/test_runner/event_sender.cc |
| @@ -381,8 +381,12 @@ class EventSenderBindings : public gin::Wrappable<EventSenderBindings> { |
| void SetPageScaleFactorLimits(gin::Arguments* args); |
| void ClearTouchPoints(); |
| void ReleaseTouchPoint(unsigned index); |
| - void UpdateTouchPoint(unsigned index, double x, double y); |
| + void UpdateTouchPoint(unsigned index, float x, float y); |
| void CancelTouchPoint(unsigned index); |
| + void SetTouchPointTilt(unsigned index, |
| + float tils, |
| + float tiltDirection, |
| + bool set_state_moved); |
| void SetTouchModifier(const std::string& key_name, bool set_mask); |
| void SetTouchCancelable(bool cancelable); |
| void DumpFilenameBeingDragged(); |
| @@ -518,6 +522,7 @@ EventSenderBindings::GetObjectTemplateBuilder(v8::Isolate* isolate) { |
| .SetMethod("releaseTouchPoint", &EventSenderBindings::ReleaseTouchPoint) |
| .SetMethod("updateTouchPoint", &EventSenderBindings::UpdateTouchPoint) |
| .SetMethod("cancelTouchPoint", &EventSenderBindings::CancelTouchPoint) |
| + .SetMethod("setTouchPointTilt", &EventSenderBindings::SetTouchPointTilt) |
| .SetMethod("setTouchModifier", &EventSenderBindings::SetTouchModifier) |
| .SetMethod("setTouchCancelable", &EventSenderBindings::SetTouchCancelable) |
| .SetMethod("dumpFilenameBeingDragged", |
| @@ -697,9 +702,9 @@ void EventSenderBindings::ReleaseTouchPoint(unsigned index) { |
| sender_->ReleaseTouchPoint(index); |
| } |
| -void EventSenderBindings::UpdateTouchPoint(unsigned index, double x, double y) { |
| +void EventSenderBindings::UpdateTouchPoint(unsigned index, float x, float y) { |
| if (sender_) |
| - sender_->UpdateTouchPoint(index, static_cast<float>(x), static_cast<float>(y)); |
| + sender_->UpdateTouchPoint(index, x, y); |
| } |
| void EventSenderBindings::CancelTouchPoint(unsigned index) { |
| @@ -707,6 +712,14 @@ void EventSenderBindings::CancelTouchPoint(unsigned index) { |
| sender_->CancelTouchPoint(index); |
| } |
| +void EventSenderBindings::SetTouchPointTilt(unsigned index, |
| + float tilt, |
| + float tiltDirection, |
| + bool set_state_moved) { |
| + if (sender_) |
| + sender_->SetTouchPointTilt(index, tilt, tiltDirection, set_state_moved); |
| +} |
| + |
| void EventSenderBindings::SetTouchModifier(const std::string& key_name, |
| bool set_mask) { |
| if (sender_) |
| @@ -1611,6 +1624,22 @@ void EventSender::CancelTouchPoint(unsigned index) { |
| touch_point->state = WebTouchPoint::StateCancelled; |
| } |
| +void EventSender::SetTouchPointTilt(unsigned index, |
| + float tilt, |
| + float tiltDirection, |
| + bool set_state_moved) { |
| + if (index >= touch_points_.size()) { |
| + ThrowTouchPointError(); |
| + return; |
| + } |
| + |
| + WebTouchPoint* touch_point = &touch_points_[index]; |
| + touch_point->tilt = tilt; |
| + touch_point->tiltDirection = tiltDirection; |
| + if (set_state_moved) |
| + touch_point->state = WebTouchPoint::StateMoved; |
| +} |
| + |
| void EventSender::SetTouchModifier(const std::string& key_name, |
| bool set_mask) { |
| int mask = 0; |
| @@ -1789,6 +1818,20 @@ void EventSender::AddTouchPoint(gin::Arguments* args) { |
| touch_point.radiusY = static_cast<float>(radius_y); |
| } |
| + if (!args->PeekNext().IsEmpty()) { |
|
Rick Byers
2015/03/17 14:40:35
you can remove this chunk now, right?
d.pikalov
2015/03/17 16:15:07
Done. I'll remove chunk for radius in CL 990183003
|
| + if (!args->GetNext(&touch_point.tilt)) { |
| + args->ThrowError(); |
| + return; |
| + } |
| + } |
| + |
| + if (!args->PeekNext().IsEmpty()) { |
| + if (!args->GetNext(&touch_point.tiltDirection)) { |
| + args->ThrowError(); |
| + return; |
| + } |
| + } |
| + |
| int lowest_id = 0; |
| for (size_t i = 0; i < touch_points_.size(); i++) { |
| if (touch_points_[i].id == lowest_id) |