diff options
author | danakj <danakj@chromium.org> | 2015-11-02 14:52:33 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-02 22:53:36 +0000 |
commit | 089746fb7612de40d86dcb5f440a45b4d8164e95 (patch) | |
tree | 43bad02895cc754b4f62edfb999de163f156b1b2 /ui/chromeos | |
parent | 2f87c9f46eb1ea6dc47a4030129a57bdaabfe210 (diff) | |
download | chromium_src-089746fb7612de40d86dcb5f440a45b4d8164e95.zip chromium_src-089746fb7612de40d86dcb5f440a45b4d8164e95.tar.gz chromium_src-089746fb7612de40d86dcb5f440a45b4d8164e95.tar.bz2 |
gfx: Make conversions from gfx::Point to PointF explicit.
R=sky@chromium.org, vmpstr
BUG=342848
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1372253002
Cr-Commit-Position: refs/heads/master@{#357460}
Diffstat (limited to 'ui/chromeos')
-rw-r--r-- | ui/chromeos/touch_exploration_controller.cc | 113 | ||||
-rw-r--r-- | ui/chromeos/touch_exploration_controller.h | 4 |
2 files changed, 74 insertions, 43 deletions
diff --git a/ui/chromeos/touch_exploration_controller.cc b/ui/chromeos/touch_exploration_controller.cc index 5661d1d..89b36ac 100644 --- a/ui/chromeos/touch_exploration_controller.cc +++ b/ui/chromeos/touch_exploration_controller.cc @@ -365,15 +365,20 @@ ui::EventRewriteStatus TouchExplorationController::InDoubleTapPending( return EVENT_REWRITE_DISCARD; scoped_ptr<ui::TouchEvent> touch_press; - touch_press.reset(new ui::TouchEvent( - ui::ET_TOUCH_PRESSED, last_touch_exploration_->location_f(), - initial_press_->touch_id(), event.time_stamp())); + touch_press.reset(new ui::TouchEvent(ui::ET_TOUCH_PRESSED, gfx::Point(), + initial_press_->touch_id(), + event.time_stamp())); + touch_press->set_location_f(last_touch_exploration_->location_f()); + touch_press->set_root_location_f(last_touch_exploration_->location_f()); DispatchEvent(touch_press.get()); - rewritten_event->reset(new ui::TouchEvent( - ui::ET_TOUCH_RELEASED, last_touch_exploration_->location_f(), - initial_press_->touch_id(), event.time_stamp())); - (*rewritten_event)->set_flags(event.flags()); + scoped_ptr<ui::TouchEvent> new_event( + new ui::TouchEvent(ui::ET_TOUCH_RELEASED, gfx::Point(), + initial_press_->touch_id(), event.time_stamp())); + new_event->set_location_f(last_touch_exploration_->location_f()); + new_event->set_root_location_f(last_touch_exploration_->location_f()); + new_event->set_flags(event.flags()); + *rewritten_event = new_event.Pass(); SET_STATE(NO_FINGERS_DOWN); return ui::EVENT_REWRITE_REWRITTEN; } @@ -391,10 +396,13 @@ ui::EventRewriteStatus TouchExplorationController::InTouchReleasePending( if (current_touch_ids_.size() != 0) return EVENT_REWRITE_DISCARD; - rewritten_event->reset(new ui::TouchEvent( - ui::ET_TOUCH_RELEASED, last_touch_exploration_->location_f(), - initial_press_->touch_id(), event.time_stamp())); - (*rewritten_event)->set_flags(event.flags()); + scoped_ptr<ui::TouchEvent> new_event( + new ui::TouchEvent(ui::ET_TOUCH_RELEASED, gfx::Point(), + initial_press_->touch_id(), event.time_stamp())); + new_event->set_location_f(last_touch_exploration_->location_f()); + new_event->set_root_location_f(last_touch_exploration_->location_f()); + new_event->set_flags(event.flags()); + *rewritten_event = new_event.Pass(); SET_STATE(NO_FINGERS_DOWN); return ui::EVENT_REWRITE_REWRITTEN; } @@ -410,10 +418,13 @@ ui::EventRewriteStatus TouchExplorationController::InTouchExploration( // Handle split-tap. initial_press_.reset(new TouchEvent(event)); tap_timer_.Stop(); - rewritten_event->reset(new ui::TouchEvent( - ui::ET_TOUCH_PRESSED, last_touch_exploration_->location_f(), - event.touch_id(), event.time_stamp())); - (*rewritten_event)->set_flags(event.flags()); + scoped_ptr<ui::TouchEvent> new_event( + new ui::TouchEvent(ui::ET_TOUCH_PRESSED, gfx::Point(), event.touch_id(), + event.time_stamp())); + new_event->set_location_f(last_touch_exploration_->location_f()); + new_event->set_root_location_f(last_touch_exploration_->location_f()); + new_event->set_flags(event.flags()); + *rewritten_event = new_event.Pass(); SET_STATE(TOUCH_EXPLORE_SECOND_PRESS); return ui::EVENT_REWRITE_REWRITTEN; } else if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) { @@ -465,9 +476,12 @@ ui::EventRewriteStatus TouchExplorationController::InCornerPassthrough( return ui::EVENT_REWRITE_DISCARD; } - rewritten_event->reset(new ui::TouchEvent( - type, event.location_f(), event.touch_id(), event.time_stamp())); - (*rewritten_event)->set_flags(event.flags()); + scoped_ptr<ui::TouchEvent> new_event(new ui::TouchEvent( + type, gfx::Point(), event.touch_id(), event.time_stamp())); + new_event->set_location_f(event.location_f()); + new_event->set_root_location_f(event.location_f()); + new_event->set_flags(event.flags()); + *rewritten_event = new_event.Pass(); if (current_touch_ids_.size() == 0) SET_STATE(NO_FINGERS_DOWN); @@ -484,11 +498,12 @@ ui::EventRewriteStatus TouchExplorationController::InOneFingerPassthrough( } return ui::EVENT_REWRITE_DISCARD; } - rewritten_event->reset( - new ui::TouchEvent(event.type(), event.location_f() - passthrough_offset_, - event.touch_id(), event.time_stamp())); - - (*rewritten_event)->set_flags(event.flags()); + scoped_ptr<ui::TouchEvent> new_event(new ui::TouchEvent( + event.type(), gfx::Point(), event.touch_id(), event.time_stamp())); + new_event->set_location_f(event.location_f() - passthrough_offset_); + new_event->set_root_location_f(event.location_f() - passthrough_offset_); + new_event->set_flags(event.flags()); + *rewritten_event = new_event.Pass(); if (current_touch_ids_.size() == 0) { SET_STATE(NO_FINGERS_DOWN); } @@ -505,10 +520,13 @@ ui::EventRewriteStatus TouchExplorationController::InTouchExploreSecondPress( // through. The user enters the wait state, Since there has already been // a press dispatched when split tap began, the touch needs to be // cancelled. - rewritten_event->reset(new ui::TouchEvent( - ui::ET_TOUCH_CANCELLED, last_touch_exploration_->location_f(), - initial_press_->touch_id(), event.time_stamp())); - (*rewritten_event)->set_flags(event.flags()); + scoped_ptr<ui::TouchEvent> new_event( + new ui::TouchEvent(ui::ET_TOUCH_CANCELLED, gfx::Point(), + initial_press_->touch_id(), event.time_stamp())); + new_event->set_location_f(last_touch_exploration_->location_f()); + new_event->set_root_location_f(last_touch_exploration_->location_f()); + new_event->set_flags(event.flags()); + *rewritten_event = new_event.Pass(); SET_STATE(WAIT_FOR_NO_FINGERS); return ui::EVENT_REWRITE_REWRITTEN; } else if (type == ui::ET_TOUCH_MOVED) { @@ -531,10 +549,13 @@ ui::EventRewriteStatus TouchExplorationController::InTouchExploreSecondPress( // cancelled, and the user enters the wait state. if ((event.location_f() - original_touch->location_f()).Length() > GetSplitTapTouchSlop()) { - rewritten_event->reset(new ui::TouchEvent( - ui::ET_TOUCH_CANCELLED, last_touch_exploration_->location_f(), - initial_press_->touch_id(), event.time_stamp())); - (*rewritten_event)->set_flags(event.flags()); + scoped_ptr<ui::TouchEvent> new_event( + new ui::TouchEvent(ui::ET_TOUCH_CANCELLED, gfx::Point(), + initial_press_->touch_id(), event.time_stamp())); + new_event->set_location_f(last_touch_exploration_->location_f()); + new_event->set_root_location_f(last_touch_exploration_->location_f()); + new_event->set_flags(event.flags()); + *rewritten_event = new_event.Pass(); SET_STATE(WAIT_FOR_NO_FINGERS); return ui::EVENT_REWRITE_REWRITTEN; } @@ -554,10 +575,13 @@ ui::EventRewriteStatus TouchExplorationController::InTouchExploreSecondPress( return EVENT_REWRITE_DISCARD; // Rewrite at location of last touch exploration. - rewritten_event->reset(new ui::TouchEvent( - ui::ET_TOUCH_RELEASED, last_touch_exploration_->location_f(), - initial_press_->touch_id(), event.time_stamp())); - (*rewritten_event)->set_flags(event.flags()); + scoped_ptr<ui::TouchEvent> new_event( + new ui::TouchEvent(ui::ET_TOUCH_RELEASED, gfx::Point(), + initial_press_->touch_id(), event.time_stamp())); + new_event->set_location_f(last_touch_exploration_->location_f()); + new_event->set_root_location_f(last_touch_exploration_->location_f()); + new_event->set_flags(event.flags()); + *rewritten_event = new_event.Pass(); SET_STATE(TOUCH_EXPLORATION); EnterTouchToMouseMode(); return ui::EVENT_REWRITE_REWRITTEN; @@ -692,9 +716,12 @@ void TouchExplorationController::OnTapTimerFired() { SET_STATE(ONE_FINGER_PASSTHROUGH); passthrough_offset_ = last_unused_finger_event_->location_f() - last_touch_exploration_->location_f(); - scoped_ptr<ui::TouchEvent> passthrough_press(new ui::TouchEvent( - ui::ET_TOUCH_PRESSED, last_touch_exploration_->location_f(), - last_unused_finger_event_->touch_id(), Now())); + scoped_ptr<ui::TouchEvent> passthrough_press( + new ui::TouchEvent(ui::ET_TOUCH_PRESSED, gfx::Point(), + last_unused_finger_event_->touch_id(), Now())); + passthrough_press->set_location_f(last_touch_exploration_->location_f()); + passthrough_press->set_root_location_f( + last_touch_exploration_->location_f()); DispatchEvent(passthrough_press.get()); return; } @@ -943,7 +970,7 @@ base::Closure TouchExplorationController::BindKeyEventWithFlags( flags); } -scoped_ptr<ui::Event> TouchExplorationController::CreateMouseMoveEvent( +scoped_ptr<ui::MouseEvent> TouchExplorationController::CreateMouseMoveEvent( const gfx::PointF& location, int flags) { // The "synthesized" flag should be set on all events that don't have a @@ -965,8 +992,12 @@ scoped_ptr<ui::Event> TouchExplorationController::CreateMouseMoveEvent( // event to the new ChromeVox background page via the automation api. flags |= ui::EF_COMMAND_DOWN; - return make_scoped_ptr(new ui::MouseEvent( - ui::ET_MOUSE_MOVED, location, location, ui::EventTimeForNow(), flags, 0)); + scoped_ptr<ui::MouseEvent> event( + new ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), + ui::EventTimeForNow(), flags, 0)); + event->set_location_f(location); + event->set_root_location_f(location); + return event; } void TouchExplorationController::EnterTouchToMouseMode() { diff --git a/ui/chromeos/touch_exploration_controller.h b/ui/chromeos/touch_exploration_controller.h index 96a7798..4872c2d 100644 --- a/ui/chromeos/touch_exploration_controller.h +++ b/ui/chromeos/touch_exploration_controller.h @@ -258,8 +258,8 @@ class UI_CHROMEOS_EXPORT TouchExplorationController // Binds DispatchKeyWithFlags to a specific key and flags. base::Closure BindKeyEventWithFlags(const ui::KeyboardCode key, int flags); - scoped_ptr<ui::Event> CreateMouseMoveEvent(const gfx::PointF& location, - int flags); + scoped_ptr<ui::MouseEvent> CreateMouseMoveEvent(const gfx::PointF& location, + int flags); void EnterTouchToMouseMode(); |