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

Unified Diff: components/exo/shell_surface.cc

Issue 2237983002: Allow updating arc widget bounds in maximize/fullscreen state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use black background Created 4 years, 4 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 | « components/exo/shell_surface.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/shell_surface.cc
diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc
index 10efe727153569f65763e70a2f63d143f92155cd..b348179c7e1f586c5c8e6709e567c453da2e9306 100644
--- a/components/exo/shell_surface.cc
+++ b/components/exo/shell_surface.cc
@@ -1212,10 +1212,26 @@ void ShellSurface::UpdateShadow() {
if (!widget_)
return;
aura::Window* window = widget_->GetNativeWindow();
+ ash::wm::WindowState* window_state = ash::wm::GetWindowState(window);
+ if (widget_->IsFullscreen() &&
+ window_state->allow_set_bounds_in_maximized()) {
+ if (window->layer()->transform().IsIdentity()) {
+ wm::SetShadowType(window, wm::SHADOW_TYPE_NONE);
+ gfx::Point origin;
+ origin -= window->bounds().origin().OffsetFromOrigin();
+ gfx::Rect bounds(origin, window->parent()->bounds().size());
+ ShowShadowUnderlay(bounds, 1.0f);
+ } else if (shadow_underlay_) {
+ shadow_underlay_->Hide();
+ }
+ return;
+ }
+
if (shadow_content_bounds_.IsEmpty()) {
wm::SetShadowType(window, wm::SHADOW_TYPE_NONE);
if (shadow_underlay_)
shadow_underlay_->Hide();
+
} else {
wm::SetShadowType(window, wm::SHADOW_TYPE_RECTANGULAR);
@@ -1227,30 +1243,12 @@ void ShellSurface::UpdateShadow() {
gfx::Rect shadow_bounds(shadow_origin, shadow_content_bounds_.size());
// Always create and show the underlay, even in maximized/fullscreen.
- if (!shadow_underlay_) {
- shadow_underlay_ = new aura::Window(nullptr);
- DCHECK(shadow_underlay_->owned_by_parent());
- shadow_underlay_->set_ignore_events(true);
- // Ensure the background area inside the shadow is solid black.
- // Clients that provide translucent contents should not be using
- // rectangular shadows as this method requires opaque contents to
- // cast a shadow that represent it correctly.
- shadow_underlay_->Init(ui::LAYER_SOLID_COLOR);
- shadow_underlay_->layer()->SetColor(SK_ColorBLACK);
- DCHECK(shadow_underlay_->layer()->fills_bounds_opaquely());
- window->AddChild(shadow_underlay_);
- window->StackChildAtBottom(shadow_underlay_);
- }
- shadow_underlay_->layer()->SetOpacity(
- rectangular_shadow_background_opacity_);
- shadow_underlay_->SetBounds(shadow_bounds);
- shadow_underlay_->Show();
+ ShowShadowUnderlay(shadow_bounds, rectangular_shadow_background_opacity_);
wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window);
// Maximized/Fullscreen window does not create a shadow.
if (!shadow)
return;
-
if (!shadow_overlay_) {
shadow_overlay_ = new aura::Window(nullptr);
DCHECK(shadow_overlay_->owned_by_parent());
@@ -1265,4 +1263,25 @@ void ShellSurface::UpdateShadow() {
}
}
+void ShellSurface::ShowShadowUnderlay(const gfx::Rect& bounds, float opacity) {
+ if (!shadow_underlay_) {
+ aura::Window* window = widget_->GetNativeWindow();
+ shadow_underlay_ = new aura::Window(nullptr);
+ DCHECK(shadow_underlay_->owned_by_parent());
+ shadow_underlay_->set_ignore_events(true);
+ // Ensure the background area inside the shadow is solid black.
+ // Clients that provide translucent contents should not be using
+ // rectangular shadows as this method requires opaque contents to
+ // cast a shadow that represent it correctly.
+ shadow_underlay_->Init(ui::LAYER_SOLID_COLOR);
+ shadow_underlay_->layer()->SetColor(SK_ColorBLACK);
+ DCHECK(shadow_underlay_->layer()->fills_bounds_opaquely());
+ window->AddChild(shadow_underlay_);
+ window->StackChildAtBottom(shadow_underlay_);
+ }
+ shadow_underlay_->layer()->SetOpacity(opacity);
+ shadow_underlay_->SetBounds(bounds);
+ shadow_underlay_->Show();
+}
+
} // namespace exo
« no previous file with comments | « components/exo/shell_surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698