Commit 1425beb3 authored by Weidong Guo's avatar Weidong Guo Committed by Commit Bot

cros: Fix crash showing fullscreen app list in mash

Reason for crash:
DesktopNativeWidgetAura::InitNativeWidget binds current widget with the
root window's kDesktopNativeWidgetAuraKey for desktop build. But the
DCHECK in DesktopScreenPositionClient::SetBounds() expects current
widget's root window's kDesktopNativeWidgetAuraKey is not set or is not
set to the current widget.

Changes:
Set bounds widget's native view in parent window's coordinates instead
of screen coordinates to avoid calling Window::SetBoundsInScreen()
which triggers DesktopScreenPositionClient::SetBounds().

BUG=757573

Change-Id: Id627572256fd315ae4609d347a7999cecb2ee0f1
Reviewed-on: https://chromium-review.googlesource.com/627385
Commit-Queue: Weidong Guo <weidongg@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#496538}
parent 2567bc98
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include "ui/views/layout/fill_layout.h" #include "ui/views/layout/fill_layout.h"
#include "ui/views/views_delegate.h" #include "ui/views/views_delegate.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
#include "ui/wm/core/coordinate_conversion.h"
#include "ui/wm/core/shadow_types.h" #include "ui/wm/core/shadow_types.h"
using wallpaper::ColorProfileType; using wallpaper::ColorProfileType;
...@@ -524,11 +525,15 @@ void AppListView::InitializeFullscreen(gfx::NativeView parent, ...@@ -524,11 +525,15 @@ void AppListView::InitializeFullscreen(gfx::NativeView parent,
fullscreen_widget_->GetNativeWindow()->SetEventTargeter( fullscreen_widget_->GetNativeWindow()->SetEventTargeter(
base::MakeUnique<AppListEventTargeter>()); base::MakeUnique<AppListEventTargeter>());
// Set bounds directly in screen coordinates to avoid screen position // Set native view's bounds directly to avoid screen position controller
// controller setting bounds in the display where the widget has the largest // setting bounds in the display where the widget has the largest
// intersection. // intersection. Also, we should not set native view's bounds in screen
fullscreen_widget_->GetNativeView()->SetBoundsInScreen( // coordinates as it causes crash in DesktopScreenPositionClient::SetBounds()
app_list_overlay_view_bounds, GetDisplayNearestView()); // when '--mash' flag is enabled for desktop build (See crbug.com/757573).
gfx::NativeView native_view = fullscreen_widget_->GetNativeView();
::wm::ConvertRectFromScreen(native_view->parent(),
&app_list_overlay_view_bounds);
native_view->SetBounds(app_list_overlay_view_bounds);
overlay_view_ = new AppListOverlayView(0 /* no corners */); overlay_view_ = new AppListOverlayView(0 /* no corners */);
...@@ -1213,8 +1218,9 @@ void AppListView::UpdateYPositionAndOpacity(int y_position_in_screen, ...@@ -1213,8 +1218,9 @@ void AppListView::UpdateYPositionAndOpacity(int y_position_in_screen,
app_list_y_position_in_screen_ = app_list_y_position_in_screen_ =
std::max(y_position_in_screen, GetDisplayNearestView().bounds().y()); std::max(y_position_in_screen, GetDisplayNearestView().bounds().y());
new_widget_bounds.set_y(app_list_y_position_in_screen_); new_widget_bounds.set_y(app_list_y_position_in_screen_);
fullscreen_widget_->GetNativeView()->SetBoundsInScreen( gfx::NativeView native_view = fullscreen_widget_->GetNativeView();
new_widget_bounds, GetDisplayNearestView()); ::wm::ConvertRectFromScreen(native_view->parent(), &new_widget_bounds);
native_view->SetBounds(new_widget_bounds);
} }
DraggingLayout(); DraggingLayout();
......
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