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

Side by Side Diff: ash/magnifier/magnification_controller.cc

Issue 1564973002: Don't center screen magnification on empty focus rectangle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit test Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | ash/magnifier/magnification_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | ash/magnifier/magnification_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698