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

Unified Diff: ash/magnifier/magnification_controller.cc

Issue 2572413002: Ash magnifier: Check whether the caret bounds were actually moved or not. (Closed)
Patch Set: Created 4 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/magnifier/magnification_controller.cc
diff --git a/ash/magnifier/magnification_controller.cc b/ash/magnifier/magnification_controller.cc
index cbd04b3d03cc9046e8eedbfc47c6c19899ea8984..6825d19966d947d428f28ff9aa0bf39d33f03f87 100644
--- a/ash/magnifier/magnification_controller.cc
+++ b/ash/magnifier/magnification_controller.cc
@@ -812,9 +812,17 @@ void MagnificationControllerImpl::OnCaretBoundsChanged(
if (caret_bounds.width() == 0 && caret_bounds.height() == 0)
return;
- caret_point_ = caret_bounds.CenterPoint();
+ gfx::Point new_caret_point = caret_bounds.CenterPoint();
// |caret_point_| in |root_window_| coordinates.
- ::wm::ConvertPointFromScreen(root_window_, &caret_point_);
+ ::wm::ConvertPointFromScreen(root_window_, &new_caret_point);
+
+ // When the caret point was not actually changed, nothing should happen.
+ // OnCaretBoundsChanged could be fired on every event that may change the
+ // caret bounds, in particular a window creation/movement, that may not result
+ // in an actual movement.
+ if (new_caret_point == caret_point_)
+ return;
+ caret_point_ = new_caret_point;
// If the feature for centering the text input focus is disabled, the
// magnifier window will be moved to follow the focus with a panning margin.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698