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/wm/workspace/workspace_window_resizer.h" | 5 #include "ash/wm/workspace/workspace_window_resizer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 !ShouldAllowMouseWarp()) { | 700 !ShouldAllowMouseWarp()) { |
701 return; | 701 return; |
702 } | 702 } |
703 | 703 |
704 // It's available. Show a phantom window on the display if needed. | 704 // It's available. Show a phantom window on the display if needed. |
705 aura::RootWindow* another_root = | 705 aura::RootWindow* another_root = |
706 GetAnotherRootWindow(window()->GetRootWindow()); | 706 GetAnotherRootWindow(window()->GetRootWindow()); |
707 const gfx::Rect root_bounds_in_screen(another_root->GetBoundsInScreen()); | 707 const gfx::Rect root_bounds_in_screen(another_root->GetBoundsInScreen()); |
708 const gfx::Rect bounds_in_screen = | 708 const gfx::Rect bounds_in_screen = |
709 ScreenAsh::ConvertRectToScreen(window()->parent(), bounds); | 709 ScreenAsh::ConvertRectToScreen(window()->parent(), bounds); |
710 gfx::Rect bounds_in_another_root = root_bounds_in_screen; | 710 gfx::Rect bounds_in_another_root = |
711 bounds_in_another_root.Intersect(bounds_in_screen); | 711 gfx::IntersectRects(root_bounds_in_screen, bounds_in_screen); |
712 | 712 |
713 const float fraction_in_another_window = | 713 const float fraction_in_another_window = |
714 (bounds_in_another_root.width() * bounds_in_another_root.height()) / | 714 (bounds_in_another_root.width() * bounds_in_another_root.height()) / |
715 static_cast<float>(bounds.width() * bounds.height()); | 715 static_cast<float>(bounds.width() * bounds.height()); |
716 const float phantom_opacity = | 716 const float phantom_opacity = |
717 !in_original_root ? 1 : (kMaxOpacity * fraction_in_another_window); | 717 !in_original_root ? 1 : (kMaxOpacity * fraction_in_another_window); |
718 const float window_opacity = | 718 const float window_opacity = |
719 in_original_root ? 1 : (kMaxOpacity * (1 - fraction_in_another_window)); | 719 in_original_root ? 1 : (kMaxOpacity * (1 - fraction_in_another_window)); |
720 | 720 |
721 if (fraction_in_another_window > 0) { | 721 if (fraction_in_another_window > 0) { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 gfx::Rect layer_bounds = layer_->bounds(); | 828 gfx::Rect layer_bounds = layer_->bounds(); |
829 layer_bounds.set_origin(gfx::Point(0, 0)); | 829 layer_bounds.set_origin(gfx::Point(0, 0)); |
830 layer_->SetBounds(layer_bounds); | 830 layer_->SetBounds(layer_bounds); |
831 layer_->SetVisible(false); | 831 layer_->SetVisible(false); |
832 // Detach it from the current container. | 832 // Detach it from the current container. |
833 layer_->parent()->Remove(layer_); | 833 layer_->parent()->Remove(layer_); |
834 } | 834 } |
835 | 835 |
836 } // namespace internal | 836 } // namespace internal |
837 } // namespace ash | 837 } // namespace ash |
OLD | NEW |