| 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "ash/accelerators/accelerator_controller.h" | 10 #include "ash/accelerators/accelerator_controller.h" |
| (...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 | 763 |
| 764 void MagnificationControllerImpl::MoveMagnifierWindowFollowRect( | 764 void MagnificationControllerImpl::MoveMagnifierWindowFollowRect( |
| 765 const gfx::Rect& rect) { | 765 const gfx::Rect& rect) { |
| 766 DCHECK(root_window_); | 766 DCHECK(root_window_); |
| 767 bool should_pan = false; | 767 bool should_pan = false; |
| 768 | 768 |
| 769 const gfx::Rect viewport_rect = GetViewportRect(); | 769 const gfx::Rect viewport_rect = GetViewportRect(); |
| 770 const int left = viewport_rect.x(); | 770 const int left = viewport_rect.x(); |
| 771 const int right = viewport_rect.right(); | 771 const int right = viewport_rect.right(); |
| 772 const gfx::Point rect_center = rect.CenterPoint(); | 772 const gfx::Point rect_center = rect.CenterPoint(); |
| 773 const gfx::Point window_center = viewport_rect.CenterPoint(); | |
| 774 | 773 |
| 775 int x = left; | 774 int x = left; |
| 776 if (rect.x() < left || right < rect.right()) { | 775 if (rect.x() < left || right < rect.right()) { |
| 777 // Panning horizontally. | 776 // Panning horizontally. |
| 778 x = rect_center.x() - viewport_rect.width() / 2; | 777 x = rect_center.x() - viewport_rect.width() / 2; |
| 779 should_pan = true; | 778 should_pan = true; |
| 780 } | 779 } |
| 781 | 780 |
| 782 const int top = viewport_rect.y(); | 781 const int top = viewport_rect.y(); |
| 783 const int bottom = viewport_rect.bottom(); | 782 const int bottom = viewport_rect.bottom(); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 | 854 |
| 856 //////////////////////////////////////////////////////////////////////////////// | 855 //////////////////////////////////////////////////////////////////////////////// |
| 857 // MagnificationController: | 856 // MagnificationController: |
| 858 | 857 |
| 859 // static | 858 // static |
| 860 MagnificationController* MagnificationController::CreateInstance() { | 859 MagnificationController* MagnificationController::CreateInstance() { |
| 861 return new MagnificationControllerImpl(); | 860 return new MagnificationControllerImpl(); |
| 862 } | 861 } |
| 863 | 862 |
| 864 } // namespace ash | 863 } // namespace ash |
| OLD | NEW |