| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/magnifier/magnification_controller.h" | 5 #include "ash/magnifier/magnification_controller.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/accelerators/accelerator_controller.h" | 9 #include "ash/accelerators/accelerator_controller.h" |
| 10 #include "ash/accessibility_delegate.h" | 10 #include "ash/accessibility_delegate.h" |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 return gfx::ToEnclosingRect(GetWindowRectDIP(scale_)); | 428 return gfx::ToEnclosingRect(GetWindowRectDIP(scale_)); |
| 429 } | 429 } |
| 430 | 430 |
| 431 void MagnificationControllerImpl::HandleFocusedNodeChanged( | 431 void MagnificationControllerImpl::HandleFocusedNodeChanged( |
| 432 bool is_editable_node, | 432 bool is_editable_node, |
| 433 const gfx::Rect& node_bounds_in_screen) { | 433 const gfx::Rect& node_bounds_in_screen) { |
| 434 // The editable node is handled by OnCaretBoundsChanged. | 434 // The editable node is handled by OnCaretBoundsChanged. |
| 435 if (is_editable_node) | 435 if (is_editable_node) |
| 436 return; | 436 return; |
| 437 | 437 |
| 438 // Nothing to recenter on. |
| 439 if (node_bounds_in_screen.IsEmpty()) |
| 440 return; |
| 441 |
| 438 gfx::Rect node_bounds_in_root = | 442 gfx::Rect node_bounds_in_root = |
| 439 ScreenUtil::ConvertRectFromScreen(root_window_, node_bounds_in_screen); | 443 ScreenUtil::ConvertRectFromScreen(root_window_, node_bounds_in_screen); |
| 440 if (GetViewportRect().Contains(node_bounds_in_root)) | 444 if (GetViewportRect().Contains(node_bounds_in_root)) |
| 441 return; | 445 return; |
| 442 | 446 |
| 443 MoveMagnifierWindowFollowRect(node_bounds_in_root); | 447 MoveMagnifierWindowFollowRect(node_bounds_in_root); |
| 444 } | 448 } |
| 445 | 449 |
| 446 void MagnificationControllerImpl::SwitchTargetRootWindow( | 450 void MagnificationControllerImpl::SwitchTargetRootWindow( |
| 447 aura::Window* new_root_window, | 451 aura::Window* new_root_window, |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 | 853 |
| 850 //////////////////////////////////////////////////////////////////////////////// | 854 //////////////////////////////////////////////////////////////////////////////// |
| 851 // MagnificationController: | 855 // MagnificationController: |
| 852 | 856 |
| 853 // static | 857 // static |
| 854 MagnificationController* MagnificationController::CreateInstance() { | 858 MagnificationController* MagnificationController::CreateInstance() { |
| 855 return new MagnificationControllerImpl(); | 859 return new MagnificationControllerImpl(); |
| 856 } | 860 } |
| 857 | 861 |
| 858 } // namespace ash | 862 } // namespace ash |
| OLD | NEW |