Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(815)

Unified Diff: ui/chromeos/touch_exploration_controller.cc

Issue 1372253002: gfx: Make conversions from gfx::Point to PointF explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pointfconvert-event: mandol_line Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/chromeos/touch_exploration_controller.h ('k') | ui/events/event.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/chromeos/touch_exploration_controller.cc
diff --git a/ui/chromeos/touch_exploration_controller.cc b/ui/chromeos/touch_exploration_controller.cc
index 5661d1d13fffe7ae9dcfc37f416d1e0ab479ba18..89b36ac487d28104cf88b520d3003d93655dc31e 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() {
« no previous file with comments | « ui/chromeos/touch_exploration_controller.h ('k') | ui/events/event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698