Commit d42d4b2b authored by jonross's avatar jonross Committed by Commit bot

Revert of Have Notifications appear over docked windows (patchset #4 id:60001...

Revert of Have Notifications appear over docked windows (patchset #4 id:60001 of https://codereview.chromium.org/1121893004/)

Reason for revert:
varkha@ noticed that this change will cause the virtual keyboard to obscure the notifications. Which I confirmed on my local branch.

Reverting before the regression is released.

I'll work on a followup change that also accounts for the keyboard region.

Original issue's description:
> Have Notifications appear over docked windows
>
> Update AshPopupAlignmentDelegate calculations of its work area.
>
> When windows are docked this reduces the work area for windows.
> AshPopupAlignmentDelegate uses the work area to determine the positioning of
> notifications. Update this calculation to include the docked region.
>
> TEST=AshPopupAlignmentDelegateTest.DockedWindow
> BUG=284574
>
> Committed: https://crrev.com/5b4e72c6ad0924d64d5eb9a10e063bc9334e95b2
> Cr-Commit-Position: refs/heads/master@{#329486}

TBR=oshima@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=284574

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

Cr-Commit-Position: refs/heads/master@{#329508}
parent 7a1ba5ff
......@@ -859,9 +859,6 @@ void ShelfLayoutManager::CalculateTargetBounds(
gfx::Rect(0, 0,
shelf_width - status_size.width(),
target_bounds->shelf_bounds_in_root.height()));
non_shelf_bounds_ = available_bounds;
non_shelf_bounds_.Subtract(target_bounds->shelf_bounds_in_root);
}
void ShelfLayoutManager::UpdateTargetBoundsForGesture(
......
......@@ -121,9 +121,6 @@ class ASH_EXPORT ShelfLayoutManager
// Returns the docked area bounds.
const gfx::Rect& dock_bounds() const { return dock_bounds_; }
// Returns the bounds within the root window not occupied by the shelf.
const gfx::Rect& non_shelf_bounds() const { return non_shelf_bounds_; }
// Stops any animations and sets the bounds of the shelf and status
// widgets.
void LayoutShelf();
......@@ -402,9 +399,6 @@ class ASH_EXPORT ShelfLayoutManager
// The bounds of the dock.
gfx::Rect dock_bounds_;
// The bounds within the root window not occupied by the shelf.
gfx::Rect non_shelf_bounds_;
// The show hide animation duration override or 0 for default.
int duration_override_in_ms_;
......
......@@ -55,7 +55,7 @@ void AshPopupAlignmentDelegate::StartObserving(gfx::Screen* screen,
screen->AddObserver(this);
Shell::GetInstance()->AddShellObserver(this);
if (system_tray_height_ > 0)
UpdateWorkArea();
UpdateWorkArea(display, shelf_->auto_hide_state());
}
void AshPopupAlignmentDelegate::SetSystemTrayHeight(int height) {
......@@ -134,19 +134,39 @@ gfx::Display AshPopupAlignmentDelegate::GetCurrentDisplay() const {
shelf_->shelf_widget()->GetNativeView());
}
void AshPopupAlignmentDelegate::UpdateWorkArea() {
work_area_ = shelf_->non_shelf_bounds();
void AshPopupAlignmentDelegate::UpdateWorkArea(const gfx::Display& display,
ShelfAutoHideState new_state) {
work_area_ = display.work_area();
if (Shell::GetInstance()->display_manager()->IsInUnifiedMode()) {
gfx::Rect bounds = ScreenUtil::GetShelfDisplayBoundsInScreen(
shelf_->shelf_widget()->GetNativeView());
work_area_.Intersect(bounds);
}
int width = 0;
if (shelf_ && (shelf_->visibility_state() == SHELF_AUTO_HIDE) &&
new_state == SHELF_AUTO_HIDE_SHOWN) {
// Since the work_area is already reduced by kAutoHideSize, the inset width
// should be just the difference.
width = kShelfSize - ShelfLayoutManager::kAutoHideSize;
}
work_area_.Inset(shelf_->SelectValueForShelfAlignment(
gfx::Insets(0, 0, width, 0),
gfx::Insets(0, width, 0, 0),
gfx::Insets(0, 0, 0, width),
gfx::Insets(width, 0, 0, 0)));
DoUpdateIfPossible();
}
void AshPopupAlignmentDelegate::OnDisplayWorkAreaInsetsChanged() {
UpdateShelf();
UpdateWorkArea();
UpdateWorkArea(GetCurrentDisplay(), shelf_->auto_hide_state());
}
void AshPopupAlignmentDelegate::OnAutoHideStateChanged(
ShelfAutoHideState new_state) {
UpdateWorkArea();
UpdateWorkArea(GetCurrentDisplay(), new_state);
}
void AshPopupAlignmentDelegate::OnDisplayAdded(
......@@ -162,7 +182,7 @@ void AshPopupAlignmentDelegate::OnDisplayMetricsChanged(
uint32_t metrics) {
UpdateShelf();
if (shelf_ && GetCurrentDisplay().id() == display.id())
UpdateWorkArea();
UpdateWorkArea(display, shelf_->auto_hide_state());
}
} // namespace ash
......@@ -70,7 +70,8 @@ class ASH_EXPORT AshPopupAlignmentDelegate
gfx::Display GetCurrentDisplay() const;
// Compute the new work area.
void UpdateWorkArea();
void UpdateWorkArea(const gfx::Display& display,
ShelfAutoHideState new_state);
// Overridden from ShellObserver:
void OnDisplayWorkAreaInsetsChanged() override;
......
......@@ -170,19 +170,6 @@ TEST_F(AshPopupAlignmentDelegateTest, DockedWindow) {
kShellWindowId_DockedContainer);
docked_container->AddChild(window.get());
// Left-side dock should not affect popup alignment
EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine());
EXPECT_FALSE(alignment_delegate()->IsTopDown());
EXPECT_FALSE(alignment_delegate()->IsFromLeft());
// Force dock to right-side
Shell::GetInstance()->SetShelfAlignment(SHELF_ALIGNMENT_LEFT,
Shell::GetPrimaryRootWindow());
Shell::GetInstance()->SetShelfAlignment(SHELF_ALIGNMENT_BOTTOM,
Shell::GetPrimaryRootWindow());
// Right-side dock should not affect popup alignment
EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine());
EXPECT_FALSE(alignment_delegate()->IsTopDown());
......
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