| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/common/accessibility_delegate.h" | 5 #include "ash/common/accessibility_delegate.h" |
| 6 #include "ash/common/wm/window_state.h" | 6 #include "ash/common/wm/window_state.h" |
| 7 #include "ash/common/wm/wm_event.h" | 7 #include "ash/common/wm/wm_event.h" |
| 8 #include "ash/common/wm_shell.h" | 8 #include "ash/common/wm_shell.h" |
| 9 #include "ash/common/wm_window.h" | 9 #include "ash/common/wm_window.h" |
| 10 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 shell_surface->SetRectangularSurfaceShadow(gfx::Rect()); | 614 shell_surface->SetRectangularSurfaceShadow(gfx::Rect()); |
| 615 surface->Commit(); | 615 surface->Commit(); |
| 616 | 616 |
| 617 EXPECT_EQ(wm::ShadowElevation::NONE, GetShadowElevation(window)); | 617 EXPECT_EQ(wm::ShadowElevation::NONE, GetShadowElevation(window)); |
| 618 EXPECT_FALSE(shadow->layer()->visible()); | 618 EXPECT_FALSE(shadow->layer()->visible()); |
| 619 | 619 |
| 620 // 6) This should enable non surface shadow again. | 620 // 6) This should enable non surface shadow again. |
| 621 shell_surface->SetRectangularSurfaceShadow(gfx::Rect(10, 10, 100, 100)); | 621 shell_surface->SetRectangularSurfaceShadow(gfx::Rect(10, 10, 100, 100)); |
| 622 surface->Commit(); | 622 surface->Commit(); |
| 623 | 623 |
| 624 EXPECT_EQ(wm::ShadowElevation::MEDIUM, GetShadowElevation(window)); | 624 EXPECT_EQ(wm::ShadowElevation::DEFAULT, GetShadowElevation(window)); |
| 625 EXPECT_TRUE(shadow->layer()->visible()); | 625 EXPECT_TRUE(shadow->layer()->visible()); |
| 626 | 626 |
| 627 // For surface shadow, the underlay is placed at the bottom of shell surfaces. | 627 // For surface shadow, the underlay is placed at the bottom of shell surfaces. |
| 628 EXPECT_EQ(surface->window(), shell_surface->shadow_underlay()->parent()); | 628 EXPECT_EQ(surface->window(), shell_surface->shadow_underlay()->parent()); |
| 629 EXPECT_EQ(window, shell_surface->shadow_overlay()->parent()); | 629 EXPECT_EQ(window, shell_surface->shadow_overlay()->parent()); |
| 630 | 630 |
| 631 EXPECT_EQ(*surface->window()->children().begin(), | 631 EXPECT_EQ(*surface->window()->children().begin(), |
| 632 shell_surface->shadow_underlay()); | 632 shell_surface->shadow_underlay()); |
| 633 } | 633 } |
| 634 | 634 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 shell_surface->SetRectangularShadowEnabled(false); | 691 shell_surface->SetRectangularShadowEnabled(false); |
| 692 surface->Commit(); | 692 surface->Commit(); |
| 693 | 693 |
| 694 EXPECT_EQ(wm::ShadowElevation::NONE, GetShadowElevation(window)); | 694 EXPECT_EQ(wm::ShadowElevation::NONE, GetShadowElevation(window)); |
| 695 EXPECT_FALSE(shadow->layer()->visible()); | 695 EXPECT_FALSE(shadow->layer()->visible()); |
| 696 | 696 |
| 697 // 6) This should enable non surface shadow. | 697 // 6) This should enable non surface shadow. |
| 698 shell_surface->SetRectangularShadowEnabled(true); | 698 shell_surface->SetRectangularShadowEnabled(true); |
| 699 surface->Commit(); | 699 surface->Commit(); |
| 700 | 700 |
| 701 EXPECT_EQ(wm::ShadowElevation::MEDIUM, GetShadowElevation(window)); | 701 EXPECT_EQ(wm::ShadowElevation::DEFAULT, GetShadowElevation(window)); |
| 702 EXPECT_TRUE(shadow->layer()->visible()); | 702 EXPECT_TRUE(shadow->layer()->visible()); |
| 703 | 703 |
| 704 // For no surface shadow, both of underlay and overlay should be stacked | 704 // For no surface shadow, both of underlay and overlay should be stacked |
| 705 // below the surface window. | 705 // below the surface window. |
| 706 EXPECT_EQ(window, shell_surface->shadow_underlay()->parent()); | 706 EXPECT_EQ(window, shell_surface->shadow_underlay()->parent()); |
| 707 EXPECT_EQ(window, shell_surface->shadow_overlay()->parent()); | 707 EXPECT_EQ(window, shell_surface->shadow_overlay()->parent()); |
| 708 | 708 |
| 709 // Shadow overlay should be stacked just above the shadow underlay. | 709 // Shadow overlay should be stacked just above the shadow underlay. |
| 710 auto underlay_it = | 710 auto underlay_it = |
| 711 std::find(window->children().begin(), window->children().end(), | 711 std::find(window->children().begin(), window->children().end(), |
| (...skipping 25 matching lines...) Expand all Loading... |
| 737 // Expected shadow position/bounds in parent coordinates. | 737 // Expected shadow position/bounds in parent coordinates. |
| 738 const gfx::Point expected_shadow_origin(-10, -10); | 738 const gfx::Point expected_shadow_origin(-10, -10); |
| 739 const gfx::Rect expected_shadow_bounds(expected_shadow_origin, content_size); | 739 const gfx::Rect expected_shadow_bounds(expected_shadow_origin, content_size); |
| 740 | 740 |
| 741 views::Widget* widget = shell_surface->GetWidget(); | 741 views::Widget* widget = shell_surface->GetWidget(); |
| 742 aura::Window* window = widget->GetNativeWindow(); | 742 aura::Window* window = widget->GetNativeWindow(); |
| 743 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window); | 743 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window); |
| 744 | 744 |
| 745 shell_surface->SetRectangularSurfaceShadow(shadow_bounds); | 745 shell_surface->SetRectangularSurfaceShadow(shadow_bounds); |
| 746 surface->Commit(); | 746 surface->Commit(); |
| 747 EXPECT_EQ(wm::ShadowElevation::MEDIUM, GetShadowElevation(window)); | 747 EXPECT_EQ(wm::ShadowElevation::DEFAULT, GetShadowElevation(window)); |
| 748 | 748 |
| 749 // Shadow overlay bounds. | 749 // Shadow overlay bounds. |
| 750 EXPECT_TRUE(shadow->layer()->visible()); | 750 EXPECT_TRUE(shadow->layer()->visible()); |
| 751 // Origin must be in sync. | 751 // Origin must be in sync. |
| 752 EXPECT_EQ(expected_shadow_origin, | 752 EXPECT_EQ(expected_shadow_origin, |
| 753 shadow->layer()->parent()->bounds().origin()); | 753 shadow->layer()->parent()->bounds().origin()); |
| 754 | 754 |
| 755 const gfx::Rect work_area = | 755 const gfx::Rect work_area = |
| 756 display::Screen::GetScreen()->GetPrimaryDisplay().work_area(); | 756 display::Screen::GetScreen()->GetPrimaryDisplay().work_area(); |
| 757 // Maximizing window hides the shadow. | 757 // Maximizing window hides the shadow. |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 shell_surface->surface_for_testing()->window()->bounds().size()); | 1056 shell_surface->surface_for_testing()->window()->bounds().size()); |
| 1057 | 1057 |
| 1058 ash::wm::WMEvent minimize_event(ash::wm::WM_EVENT_MINIMIZE); | 1058 ash::wm::WMEvent minimize_event(ash::wm::WM_EVENT_MINIMIZE); |
| 1059 ash::WmWindow* window = | 1059 ash::WmWindow* window = |
| 1060 ash::WmWindow::Get(shell_surface->GetWidget()->GetNativeWindow()); | 1060 ash::WmWindow::Get(shell_surface->GetWidget()->GetNativeWindow()); |
| 1061 window->GetWindowState()->OnWMEvent(&minimize_event); | 1061 window->GetWindowState()->OnWMEvent(&minimize_event); |
| 1062 } | 1062 } |
| 1063 | 1063 |
| 1064 } // namespace | 1064 } // namespace |
| 1065 } // namespace exo | 1065 } // namespace exo |
| OLD | NEW |