Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1947)

Unified Diff: ash/common/wm/overview/scoped_transform_overview_window.cc

Issue 2329433003: Revert of [ash-md] Fades overview header in and out (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/wm/overview/scoped_transform_overview_window.h ('k') | ash/common/wm/overview/window_grid.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/wm/overview/scoped_transform_overview_window.cc
diff --git a/ash/common/wm/overview/scoped_transform_overview_window.cc b/ash/common/wm/overview/scoped_transform_overview_window.cc
index 50a980ce4021bf7c8190ef4865db2f8eac90ed62..2c1b83e03db1ceca913f50dbcaf4c28b796baa39 100644
--- a/ash/common/wm/overview/scoped_transform_overview_window.cc
+++ b/ash/common/wm/overview/scoped_transform_overview_window.cc
@@ -271,8 +271,7 @@
BeginScopedAnimation(OverviewAnimationType::OVERVIEW_ANIMATION_RESTORE_WINDOW,
&animation_settings_list);
SetTransform(window()->GetRootWindow(), original_transform_,
- false /* use_mask */);
- set_overview_transform(original_transform_);
+ false /* use_mask */, false /* use_shape */, 0);
std::unique_ptr<ScopedOverviewAnimationSettings> animation_settings =
CreateScopedOverviewAnimationSettings(
@@ -297,8 +296,19 @@
window_->GetWindowState()->set_ignored_by_shelf(ignored_by_shelf_);
SetOpacity(original_opacity_);
- if (ash::MaterialDesignController::IsOverviewMaterial())
- ShowHeaderAndResetShape();
+ if (ash::MaterialDesignController::IsOverviewMaterial()) {
+ ui::Layer* layer = window()->GetLayer();
+ layer->SetMaskLayer(nullptr);
+ mask_.reset();
+
+ if (original_window_shape_) {
+ layer->SetAlphaShape(
+ base::MakeUnique<SkRegion>(*original_window_shape_.get()));
+ } else {
+ layer->SetAlphaShape(nullptr);
+ }
+ window()->SetMasksToBounds(false);
+ }
}
void ScopedTransformOverviewWindow::BeginScopedAnimation(
@@ -335,9 +345,6 @@
gfx::Rect ScopedTransformOverviewWindow::GetTransformedBounds(
bool hide_header) const {
- if (window_->GetWindowState()->IsMinimized())
- return window_->GetMinimizeAnimationTargetBoundsInScreen();
-
const bool material = ash::MaterialDesignController::IsOverviewMaterial();
const int top_inset = hide_header ? GetTopInset() : 0;
gfx::Rect bounds;
@@ -368,18 +375,6 @@
ToEnclosingRect(window_bounds)));
}
return bounds;
-}
-
-SkColor ScopedTransformOverviewWindow::GetTopColor() const {
- for (auto* window : GetTransientTreeIterator(window_)) {
- // If there are regular windows in the transient ancestor tree, all those
- // windows are shown in the same overview item and the header is not masked.
- if (window != window_ && (window->GetType() == ui::wm::WINDOW_TYPE_NORMAL ||
- window->GetType() == ui::wm::WINDOW_TYPE_PANEL)) {
- return SK_ColorTRANSPARENT;
- }
- }
- return window_->GetColorProperty(WmWindowProperty::TOP_VIEW_COLOR);
}
int ScopedTransformOverviewWindow::GetTopInset() const {
@@ -471,7 +466,9 @@
void ScopedTransformOverviewWindow::SetTransform(
WmWindow* root_window,
const gfx::Transform& transform,
- bool use_mask) {
+ bool use_mask,
+ bool use_shape,
+ float radius) {
DCHECK(overview_started_);
if (ash::MaterialDesignController::IsOverviewMaterial() &&
@@ -486,6 +483,26 @@
SkRegion* window_shape = window()->GetLayer()->alpha_shape();
if (!original_window_shape_ && window_shape)
original_window_shape_.reset(new SkRegion(*window_shape));
+ }
+ gfx::Rect bounds(GetTargetBoundsInScreen().size());
+ const int inset = (use_mask || use_shape) ? GetTopInset() : 0;
+ if (mask_) {
+ // Mask layer is used both to hide the window header and to use rounded
+ // corners. Its layout needs to be update when setting a transform.
+ mask_->layer()->SetBounds(bounds);
+ mask_->set_inset(inset);
+ mask_->set_radius(radius);
+ window()->GetLayer()->SchedulePaint(bounds);
+ } else if (inset > 0) {
+ // Alpha shape is only used to to hide the window header and only when
+ // not using a mask layer.
+ bounds.Inset(0, inset, 0, 0);
+ SkRegion* region = new SkRegion;
+ region->setRect(RectToSkIRect(bounds));
+ if (original_window_shape_)
+ region->op(*original_window_shape_, SkRegion::kIntersect_Op);
+ window()->GetLayer()->SetAlphaShape(base::WrapUnique(region));
+ window()->SetMasksToBounds(true);
}
}
@@ -509,45 +526,6 @@
}
}
-void ScopedTransformOverviewWindow::HideHeaderAndSetShape(bool use_mask,
- bool use_shape,
- int radius) {
- gfx::Rect bounds(GetTargetBoundsInScreen().size());
- const int inset = (use_mask || use_shape) ? GetTopInset() : 0;
- if (mask_) {
- // Mask layer is used both to hide the window header and to use rounded
- // corners. Its layout needs to be updated when setting a transform.
- mask_->layer()->SetBounds(bounds);
- mask_->set_inset(inset);
- mask_->set_radius(radius);
- window()->GetLayer()->SchedulePaint(bounds);
- } else if (inset > 0) {
- // Alpha shape is only used to hide the window header and only when not
- // using a mask layer.
- bounds.Inset(0, inset, 0, 0);
- std::unique_ptr<SkRegion> region(new SkRegion);
- region->setRect(RectToSkIRect(bounds));
- if (original_window_shape_)
- region->op(*original_window_shape_, SkRegion::kIntersect_Op);
- window()->GetLayer()->SetAlphaShape(std::move(region));
- window()->SetMasksToBounds(true);
- }
-}
-
-void ScopedTransformOverviewWindow::ShowHeaderAndResetShape() {
- ui::Layer* layer = window()->GetLayer();
- layer->SetMaskLayer(nullptr);
- mask_.reset();
-
- if (original_window_shape_) {
- layer->SetAlphaShape(
- base::MakeUnique<SkRegion>(*original_window_shape_.get()));
- } else {
- layer->SetAlphaShape(nullptr);
- }
- window()->SetMasksToBounds(false);
-}
-
void ScopedTransformOverviewWindow::Close() {
if (immediate_close_for_tests ||
!ash::MaterialDesignController::IsOverviewMaterial()) {
« no previous file with comments | « ash/common/wm/overview/scoped_transform_overview_window.h ('k') | ash/common/wm/overview/window_grid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698