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

Unified Diff: ui/aura/test/event_generator.cc

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix step one more time Created 8 years, 2 months 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
Index: ui/aura/test/event_generator.cc
diff --git a/ui/aura/test/event_generator.cc b/ui/aura/test/event_generator.cc
index a2eb897daad5d2853beaaa66c9ad3e9699591ca8..3c6e607289b950282f8d7befcd09a66d9cd0f5f5 100644
--- a/ui/aura/test/event_generator.cc
+++ b/ui/aura/test/event_generator.cc
@@ -7,6 +7,7 @@
#include "base/memory/scoped_ptr.h"
#include "ui/aura/root_window.h"
#include "ui/base/events/event.h"
+#include "ui/gfx/vector2d_conversions.h"
#if defined(USE_X11)
#include <X11/Xlib.h>
@@ -126,10 +127,11 @@ void EventGenerator::MoveMouseTo(const gfx::Point& point, int count) {
DCHECK_GT(count, 0);
const ui::EventType event_type = (flags_ & ui::EF_LEFT_MOUSE_BUTTON) ?
ui::ET_MOUSE_DRAGGED : ui::ET_MOUSE_MOVED;
- const gfx::Point diff = point.Subtract(current_location_);
+ gfx::Vector2dF diff = point - current_location_;
for (int i = 1; i <= count; i++) {
- const gfx::Point move_point = current_location_.Add(
- gfx::Point(diff.x() / count * i, diff.y() / count * i));
+ gfx::Vector2dF step = diff;
+ step.Scale(static_cast<float>(i) / count);
+ gfx::Point move_point = current_location_ + gfx::ToFlooredVector2d(step);
Peter Kasting 2012/10/31 01:04:41 How come you ignored three points of my proposed c
danakj 2012/10/31 16:55:46 Oh, I didn't see that, assumed your lack of static
Peter Kasting 2012/10/31 17:13:41 We're already introducing a behavior change becaus
ui::MouseEvent mouseev(event_type, move_point, move_point, flags_);
Dispatch(mouseev);
}

Powered by Google App Engine
This is Rietveld 408576698