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

Unified Diff: ash/magnifier/magnification_controller.cc

Issue 13947045: Magnifier: Move the cursor directly to the root window host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments Created 7 years, 8 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: ash/magnifier/magnification_controller.cc
diff --git a/ash/magnifier/magnification_controller.cc b/ash/magnifier/magnification_controller.cc
index ba1de9ea68cacd83ae3e818984e1502404a54538..a4c5d1c22a37871dda9be88d52794af5cd17bb38 100644
--- a/ash/magnifier/magnification_controller.cc
+++ b/ash/magnifier/magnification_controller.cc
@@ -8,6 +8,7 @@
#include "ash/shell.h"
#include "ash/shell_delegate.h"
#include "ash/system/tray/system_tray_delegate.h"
+#include "base/synchronization/waitable_event.h"
#include "ui/aura/client/cursor_client.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
@@ -18,6 +19,7 @@
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animation_observer.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/gfx/point3_f.h"
#include "ui/gfx/point_conversions.h"
#include "ui/gfx/point_f.h"
#include "ui/gfx/rect_conversions.h"
@@ -38,6 +40,14 @@ const float kScrollScaleChangeFactor = 0.05f;
// |kPanningMergin| from the edge, the view-port moves.
const int kPanningMergin = 100;
+void MoveCursorTo(aura::RootWindow* root_window,
+ const gfx::Point root_location) {
+ gfx::Point3F host_location_3f(root_location);
+ root_window->layer()->transform().TransformPoint(host_location_3f);
+ root_window->MoveCursorToHostLoation(
+ gfx::ToCeiledPoint(host_location_3f.AsPointF()));
+}
+
} // namespace
namespace ash {
@@ -67,6 +77,10 @@ class MagnificationControllerImpl : virtual public MagnificationController,
bool animate) OVERRIDE;
virtual void EnsurePointIsVisible(const gfx::Point& point,
bool animate) OVERRIDE;
+ // For test
+ virtual gfx::Point GetPointOfInterestForTesting() OVERRIDE {
+ return point_of_interest_;
+ }
private:
// ui::ImplicitAnimationObserver overrides:
@@ -358,7 +372,7 @@ void MagnificationControllerImpl::OnMouseMove(const gfx::Point& location) {
if (ret) {
// If the magnified region is moved, hides the mouse cursor and moves it.
if (x_diff != 0 || y_diff != 0)
- root_window_->MoveCursorTo(mouse);
+ MoveCursorTo(root_window_, mouse);
}
}
}
@@ -418,7 +432,7 @@ void MagnificationControllerImpl::OnImplicitAnimationsCompleted() {
return;
if (move_cursor_after_animation_) {
- root_window_->MoveCursorTo(position_after_animation_);
+ MoveCursorTo(root_window_, position_after_animation_);
move_cursor_after_animation_ = false;
aura::client::CursorClient* cursor_client =

Powered by Google App Engine
This is Rietveld 408576698