Commit 71f63e24 authored by Francois Doray's avatar Francois Doray Committed by Commit Bot

Set aura::Window transparency in SurfaceTreeHost::UpdateHostWindowBounds().

SurfaceTreeHost::UpdateHostWindowBounds() used to call
ui::Layer::SetFillsBoundsOpaquely() directly. With this CL, the method
is called through aura::Window::SetTransparent(). This is equivalent,
except that the |transparent_| bit of the aura::Window, on which
aura::WindowOcclusionTracker depends, is also updated.

This CL also adds a ScopedPauseOcclusionTracking instance to ensure
that occlusion isn't recomputed multiple times during a call to
SurfaceTreeHost::UpdateHostWindowBounds().

Bug: 668690
Change-Id: I4f6181d4e247f2a54d96569b3379964c9253246a
Reviewed-on: https://chromium-review.googlesource.com/970746Reviewed-by: default avatarDavid Reveman <reveman@chromium.org>
Commit-Queue: François Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544362}
parent 02d3c5b9
......@@ -19,6 +19,7 @@
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/aura/window_occlusion_tracker.h"
#include "ui/aura/window_targeter.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/cursor/cursor.h"
......@@ -105,6 +106,11 @@ void SurfaceTreeHost::SetRootSurface(Surface* root_surface) {
if (root_surface == root_surface_)
return;
// This method applies multiple changes to the window tree. Use
// ScopedPauseOcclusionTracking to ensure that occlusion isn't recomputed
// before all changes have been applied.
aura::WindowOcclusionTracker::ScopedPauseOcclusionTracking pause_occlusion;
if (root_surface_) {
root_surface_->window()->Hide();
host_window_->RemoveChild(root_surface_->window());
......@@ -320,12 +326,18 @@ void SurfaceTreeHost::SubmitCompositorFrame() {
// SurfaceTreeHost, private:
void SurfaceTreeHost::UpdateHostWindowBounds() {
// This method applies multiple changes to the window tree. Use
// ScopedPauseOcclusionTracking to ensure that occlusion isn't recomputed
// before all changes have been applied.
aura::WindowOcclusionTracker::ScopedPauseOcclusionTracking pause_occlusion;
gfx::Rect bounds = root_surface_->surface_hierarchy_content_bounds();
host_window_->SetBounds(
gfx::Rect(host_window_->bounds().origin(), bounds.size()));
host_window_->layer()->SetFillsBoundsOpaquely(
const bool fills_bounds_opaquely =
bounds.size() == root_surface_->content_size() &&
root_surface_->FillsBoundsOpaquely());
root_surface_->FillsBoundsOpaquely();
host_window_->SetTransparent(!fills_bounds_opaquely);
root_surface_origin_ = gfx::Point() - bounds.OffsetFromOrigin();
root_surface_->window()->SetBounds(gfx::Rect(
......
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