Commit 378501e0 authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

shelf: Renable ShelfEdgeOverlappingWindowHitTestMouse.

Failing because new hotseat window targeter was eating events that the
EasyResizeWindowTargeter was handling. Changed the hotseat window
targeter to only be active when the hotseat is extended.

Test: ash_unittests
Fixed: 1037927
Change-Id: Iff20db682d55348cc3ac090f5af90b86db268d61
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1987114
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Reviewed-by: default avatarAndrew Xu <andrewxu@chromium.org>
Reviewed-by: default avatarManu Cornet <manucornet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728774}
parent f7e31a7b
......@@ -63,11 +63,7 @@ class HotseatWindowTargeter : public aura::WindowTargeter {
bool GetHitTestRects(aura::Window* target,
gfx::Rect* hit_test_rect_mouse,
gfx::Rect* hit_test_rect_touch) const override {
// If the hotseat is not extended we can use the normal targeting as the
// hidden parts of the hotseat will not block non-shelf items from taking
// events.
if (target == hotseat_widget_->GetNativeWindow() &&
hotseat_widget_->state() == HotseatState::kExtended) {
if (target == hotseat_widget_->GetNativeWindow()) {
// Shrink the hit bounds from the size of the window to the size of the
// hotseat opaque background.
gfx::Rect hit_bounds = target->bounds();
......@@ -247,9 +243,6 @@ void HotseatWidget::Initialize(aura::Window* container, Shelf* shelf) {
scrollable_shelf_view_ = GetContentsView()->AddChildView(
std::make_unique<ScrollableShelfView>(ShelfModel::Get(), shelf));
scrollable_shelf_view_->Init();
hotseat_window_targeter_ = std::make_unique<aura::ScopedWindowTargeter>(
GetNativeWindow(), std::make_unique<HotseatWindowTargeter>(this));
} else {
// The shelf view observes the shelf model and creates icons as items are
// added to the model.
......@@ -390,6 +383,18 @@ void HotseatWidget::SetState(HotseatState state) {
return;
state_ = state;
if (!IsScrollableShelfEnabled())
return;
// If the hotseat is not extended we can use the normal targeting as the
// hidden parts of the hotseat will not block non-shelf items from taking
if (state == HotseatState::kExtended) {
hotseat_window_targeter_ = std::make_unique<aura::ScopedWindowTargeter>(
GetNativeWindow(), std::make_unique<HotseatWindowTargeter>(this));
} else {
hotseat_window_targeter_.reset();
}
}
} // namespace ash
......@@ -281,27 +281,9 @@ TEST_F(ShelfWidgetTest, HiddenShelfHitTestTouch) {
}
}
class ShelfWidgetTestWithoutHotseat : public ShelfWidgetTest {
public:
ShelfWidgetTestWithoutHotseat() = default;
~ShelfWidgetTestWithoutHotseat() override = default;
void SetUp() override {
scoped_features_.InitAndDisableFeature(chromeos::features::kShelfHotseat);
ShelfWidgetTest::SetUp();
}
private:
base::test::ScopedFeatureList scoped_features_;
DISALLOW_COPY_AND_ASSIGN(ShelfWidgetTestWithoutHotseat);
};
// Tests that the shelf lets mouse-events close to the edge fall through to the
// window underneath.
// TODO(andrewxu|mmourgos): Fix this test with hotseat feature enabled.
// crbug.com/1037927
TEST_F(ShelfWidgetTestWithoutHotseat, ShelfEdgeOverlappingWindowHitTestMouse) {
TEST_F(ShelfWidgetTest, ShelfEdgeOverlappingWindowHitTestMouse) {
UpdateDisplay("400x400");
ShelfWidget* shelf_widget = GetShelfWidget();
gfx::Rect shelf_bounds = shelf_widget->GetWindowBoundsInScreen();
......
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