Commit d9f6557e authored by achaulk's avatar achaulk Committed by Commit bot

Revert of Fix shelf dimming on secondary display (patchset #1 id:40001 of...

Revert of Fix shelf dimming on secondary display (patchset #1 id:40001 of https://codereview.chromium.org/850833004/)

Reason for revert:
Causing crbug.com/451804 - probably using an invalid window

Original issue's description:
> Fix shelf dimming on secondary display
>
> BUG=449863
> TEST=ShelfLayoutManagerTest.DimmingBehaviorDualDisplay
>
> Committed: https://crrev.com/665d66d93fe22a50ba3623397b596a394098faef
> Cr-Commit-Position: refs/heads/master@{#312244}

TBR=skuhne@chromium.org,pkotwicz@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=449863

Review URL: https://codereview.chromium.org/883063003

Cr-Commit-Position: refs/heads/master@{#313787}
parent 3f8178ae
...@@ -1111,7 +1111,7 @@ TEST_F(ShelfLayoutManagerTest, SetAutoHideBehavior) { ...@@ -1111,7 +1111,7 @@ TEST_F(ShelfLayoutManagerTest, SetAutoHideBehavior) {
} }
// Basic assertions around the dimming of the shelf. // Basic assertions around the dimming of the shelf.
TEST_F(ShelfLayoutManagerTest, DimmingBehavior) { TEST_F(ShelfLayoutManagerTest, TestDimmingBehavior) {
// Since ShelfLayoutManager queries for mouse location, move the mouse so // Since ShelfLayoutManager queries for mouse location, move the mouse so
// it isn't over the shelf. // it isn't over the shelf.
ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
...@@ -1184,63 +1184,8 @@ TEST_F(ShelfLayoutManagerTest, DimmingBehavior) { ...@@ -1184,63 +1184,8 @@ TEST_F(ShelfLayoutManagerTest, DimmingBehavior) {
EXPECT_EQ(-1, shelf->shelf_widget()->GetDimmingAlphaForTest()); EXPECT_EQ(-1, shelf->shelf_widget()->GetDimmingAlphaForTest());
} }
// Test that dimming works correctly with multiple displays.
TEST_F(ShelfLayoutManagerTest, DimmingBehaviorDualDisplay) {
if (!SupportsMultipleDisplays())
return;
// Create two displays.
Shell* shell = Shell::GetInstance();
UpdateDisplay("0+0-200x200,+200+0-100x100");
EXPECT_EQ(2U, shell->display_manager()->GetNumDisplays());
DisplayController* display_controller = shell->display_controller();
aura::Window::Windows root_windows = display_controller->GetAllRootWindows();
EXPECT_EQ(root_windows.size(), 2U);
std::vector<ShelfWidget*> shelf_widgets;
for (auto& root_window : root_windows) {
ShelfLayoutManager* shelf =
GetRootWindowController(root_window)->GetShelfLayoutManager();
shelf_widgets.push_back(shelf->shelf_widget());
// For disabling the dimming animation to work, the animation must be
// disabled prior to creating the dimmer.
shelf_widgets.back()->DisableDimmingAnimationsForTest();
// Create a maximized window to create the dimmer.
views::Widget* widget = new views::Widget;
views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
params.context = root_window;
params.bounds = root_window->GetBoundsInScreen();
params.show_state = ui::SHOW_STATE_MAXIMIZED;
widget->Init(params);
widget->Show();
}
ui::test::EventGenerator& generator(GetEventGenerator());
generator.MoveMouseTo(root_windows[0]->GetBoundsInScreen().CenterPoint());
EXPECT_LT(0, shelf_widgets[0]->GetDimmingAlphaForTest());
EXPECT_LT(0, shelf_widgets[1]->GetDimmingAlphaForTest());
generator.MoveMouseTo(
shelf_widgets[0]->GetWindowBoundsInScreen().CenterPoint());
EXPECT_EQ(0, shelf_widgets[0]->GetDimmingAlphaForTest());
EXPECT_LT(0, shelf_widgets[1]->GetDimmingAlphaForTest());
generator.MoveMouseTo(
shelf_widgets[1]->GetWindowBoundsInScreen().CenterPoint());
EXPECT_LT(0, shelf_widgets[0]->GetDimmingAlphaForTest());
EXPECT_EQ(0, shelf_widgets[1]->GetDimmingAlphaForTest());
generator.MoveMouseTo(root_windows[1]->GetBoundsInScreen().CenterPoint());
EXPECT_LT(0, shelf_widgets[0]->GetDimmingAlphaForTest());
EXPECT_LT(0, shelf_widgets[1]->GetDimmingAlphaForTest());
}
// Assertions around the dimming of the shelf in conjunction with menus. // Assertions around the dimming of the shelf in conjunction with menus.
TEST_F(ShelfLayoutManagerTest, DimmingBehaviorWithMenus) { TEST_F(ShelfLayoutManagerTest, TestDimmingBehaviorWithMenus) {
// Since ShelfLayoutManager queries for mouse location, move the mouse so // Since ShelfLayoutManager queries for mouse location, move the mouse so
// it isn't over the shelf. // it isn't over the shelf.
ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include "ui/views/accessible_pane_view.h" #include "ui/views/accessible_pane_view.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h" #include "ui/views/widget/widget_delegate.h"
#include "ui/wm/core/coordinate_conversion.h"
#include "ui/wm/core/easy_resize_window_targeter.h" #include "ui/wm/core/easy_resize_window_targeter.h"
#include "ui/wm/public/activation_client.h" #include "ui/wm/public/activation_client.h"
...@@ -214,11 +213,7 @@ void DimmerView::DimmerEventFilter::OnMouseEvent(ui::MouseEvent* event) { ...@@ -214,11 +213,7 @@ void DimmerView::DimmerEventFilter::OnMouseEvent(ui::MouseEvent* event) {
if (event->type() != ui::ET_MOUSE_MOVED && if (event->type() != ui::ET_MOUSE_MOVED &&
event->type() != ui::ET_MOUSE_DRAGGED) event->type() != ui::ET_MOUSE_DRAGGED)
return; return;
bool inside = owner_->GetBoundsInScreen().Contains(event->root_location());
gfx::Point screen_point(event->location());
::wm::ConvertPointToScreen(static_cast<aura::Window*>(event->target()),
&screen_point);
bool inside = owner_->GetBoundsInScreen().Contains(screen_point);
if (mouse_inside_ || touch_inside_ != inside || touch_inside_) if (mouse_inside_ || touch_inside_ != inside || touch_inside_)
owner_->SetHovered(inside || touch_inside_); owner_->SetHovered(inside || touch_inside_);
mouse_inside_ = inside; mouse_inside_ = inside;
...@@ -227,12 +222,8 @@ void DimmerView::DimmerEventFilter::OnMouseEvent(ui::MouseEvent* event) { ...@@ -227,12 +222,8 @@ void DimmerView::DimmerEventFilter::OnMouseEvent(ui::MouseEvent* event) {
void DimmerView::DimmerEventFilter::OnTouchEvent(ui::TouchEvent* event) { void DimmerView::DimmerEventFilter::OnTouchEvent(ui::TouchEvent* event) {
bool touch_inside = false; bool touch_inside = false;
if (event->type() != ui::ET_TOUCH_RELEASED && if (event->type() != ui::ET_TOUCH_RELEASED &&
event->type() != ui::ET_TOUCH_CANCELLED) { event->type() != ui::ET_TOUCH_CANCELLED)
gfx::Point screen_point(event->location()); touch_inside = owner_->GetBoundsInScreen().Contains(event->root_location());
::wm::ConvertPointToScreen(static_cast<aura::Window*>(event->target()),
&screen_point);
touch_inside = owner_->GetBoundsInScreen().Contains(screen_point);
}
if (mouse_inside_ || touch_inside_ != mouse_inside_ || touch_inside) if (mouse_inside_ || touch_inside_ != mouse_inside_ || touch_inside)
owner_->SetHovered(mouse_inside_ || touch_inside); owner_->SetHovered(mouse_inside_ || touch_inside);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment