Commit 625e4a99 authored by varkha's avatar varkha Committed by Commit bot

[ash-md] Fixes a bug with setting window shape to mask header in overview

The bug was introduced in the last patch set of
https://codereview.chromium.org/2129213003/.
1. Open an app window with insets (hidden header) and a few other windows.
2. Enter overview
3. While in overview close a few windows so that all windows grow.
4. Close overview by clicking the window with active shape (app frame).

The first active window has its header and some client area content
masked.

BUG=624431
TBR=tdanderson@chromium.org

Review-Url: https://codereview.chromium.org/2148703002
Cr-Commit-Position: refs/heads/master@{#405189}
parent 00be2555
...@@ -248,6 +248,7 @@ base::Closure ScopedTransformOverviewWindow::OverviewContentMask:: ...@@ -248,6 +248,7 @@ base::Closure ScopedTransformOverviewWindow::OverviewContentMask::
ScopedTransformOverviewWindow::ScopedTransformOverviewWindow(WmWindow* window) ScopedTransformOverviewWindow::ScopedTransformOverviewWindow(WmWindow* window)
: window_(window), : window_(window),
determined_original_window_shape_(false),
minimized_(window->GetShowState() == ui::SHOW_STATE_MINIMIZED), minimized_(window->GetShowState() == ui::SHOW_STATE_MINIMIZED),
ignored_by_shelf_(window->GetWindowState()->ignored_by_shelf()), ignored_by_shelf_(window->GetWindowState()->ignored_by_shelf()),
overview_started_(false), overview_started_(false),
...@@ -416,9 +417,12 @@ void ScopedTransformOverviewWindow::SetTransform( ...@@ -416,9 +417,12 @@ void ScopedTransformOverviewWindow::SetTransform(
mask_->set_radius(radius); mask_->set_radius(radius);
window()->GetLayer()->SchedulePaint(bounds); window()->GetLayer()->SchedulePaint(bounds);
SkRegion* window_shape = window()->GetLayer()->alpha_shape(); if (!determined_original_window_shape_) {
if (!original_window_shape_ && window_shape) determined_original_window_shape_ = true;
original_window_shape_.reset(new SkRegion(*window_shape)); SkRegion* window_shape = window()->GetLayer()->alpha_shape();
if (!original_window_shape_ && window_shape)
original_window_shape_.reset(new SkRegion(*window_shape));
}
const int inset = const int inset =
window()->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET); window()->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET);
if (inset > 0) { if (inset > 0) {
......
...@@ -140,6 +140,10 @@ class ASH_EXPORT ScopedTransformOverviewWindow { ...@@ -140,6 +140,10 @@ class ASH_EXPORT ScopedTransformOverviewWindow {
// Original window shape, if it was set on a window. // Original window shape, if it was set on a window.
std::unique_ptr<SkRegion> original_window_shape_; std::unique_ptr<SkRegion> original_window_shape_;
// True after the |original_window_shape_| has been set or after it has
// been determined that window shape was not originally set on the |window_|.
bool determined_original_window_shape_;
// If true, the window was minimized and should be restored if the window // If true, the window was minimized and should be restored if the window
// was not selected. // was not selected.
bool minimized_; bool minimized_;
......
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