Commit 48ac7e2a authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

splitview: Fix failing DCHECK in OnWindowActivated.

This failed previously because when SnapWindow is called after ToggleOverview,
it ends the overview start animations, which then activates the hidden
overview textfield. This causes OnWindowActivated to be called before
SnapWindow has finished, so IsSplitViewModeActive() still returns false.

Test: tested with DCHECKS enabled
Bug: 906707
Change-Id: Ic7b99eb8642f8bf1cd1badaa6fa6c981127987a7
Reviewed-on: https://chromium-review.googlesource.com/c/1342807
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609408}
parent 3248501c
......@@ -236,6 +236,8 @@ class ASH_EXPORT WindowSelector : public display::DisplayObserver,
return split_view_drag_indicators_.get();
}
views::Widget* text_filter_widget() { return text_filter_widget_.get(); }
int text_filter_bottom() const { return text_filter_bottom_; }
EnterExitOverviewType enter_exit_overview_type() const {
......
......@@ -697,7 +697,15 @@ void SplitViewController::OnPostWindowStateTypeChange(
void SplitViewController::OnWindowActivated(ActivationReason reason,
aura::Window* gained_active,
aura::Window* lost_active) {
DCHECK(IsSplitViewModeActive());
// This may be called while SnapWindow is still underway because SnapWindow
// will end the overview start animations which will cause the overview text
// filter to be activated.
aura::Window* text_filter_widget =
GetWindowSelector()
? GetWindowSelector()->text_filter_widget()->GetNativeWindow()
: nullptr;
DCHECK(IsSplitViewModeActive() ||
(text_filter_widget && text_filter_widget == gained_active));
// If |gained_active| was activated as a side effect of a window disposition
// change, do nothing. For example, when a snapped window is closed, another
......
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