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

Unified Diff: ash/wm/window_util.cc

Issue 10837211: Draw web content area correctly on a phantom window for window dragging (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove WindowPainter Created 8 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 | « ash/wm/window_util.h ('k') | ash/wm/workspace/phantom_window_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/window_util.cc
diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc
index 0b71f068d51ab604660ca1153b99605585f1563f..070015156c7116ddf09b021e3b827ed8d1c10330 100644
--- a/ash/wm/window_util.cc
+++ b/ash/wm/window_util.cc
@@ -4,6 +4,8 @@
#include "ash/wm/window_util.h"
+#include <vector>
+
#include "ash/shell.h"
#include "ash/wm/activation_controller.h"
#include "ash/wm/window_properties.h"
@@ -12,6 +14,7 @@
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/base/ui_base_types.h"
+#include "ui/compositor/layer.h"
#include "ui/gfx/display.h"
#include "ui/gfx/screen.h"
@@ -99,5 +102,35 @@ void CenterWindow(aura::Window* window) {
window->SetBounds(center);
}
+ui::Layer* RecreateWindowLayers(aura::Window* window) {
+ const gfx::Rect bounds = window->bounds();
+ ui::Layer* old_layer = window->RecreateLayer();
+ DCHECK(old_layer);
+ // Resize the window to the new size, which will force a layout and paint.
+ window->SetBounds(bounds);
+ for (aura::Window::Windows::const_iterator it = window->children().begin();
+ it != window->children().end();
+ ++it) {
+ aura::Window* child = *it;
+ const gfx::Rect child_bounds = child->bounds();
+ ui::Layer* old_child_layer = RecreateWindowLayers(child);
+ // Maintain the hierarchy of the detached layers.
+ old_layer->Add(old_child_layer);
+ child->SetBounds(child_bounds); // Resize the child window too.
+ }
+ return old_layer;
+}
+
+void DeepDeleteLayers(ui::Layer* layer) {
+ std::vector<ui::Layer*> children = layer->children();
+ for (std::vector<ui::Layer*>::const_iterator it = children.begin();
+ it != children.end();
+ ++it) {
+ ui::Layer* child = *it;
+ DeepDeleteLayers(child);
+ }
+ delete layer;
+}
+
} // namespace wm
} // namespace ash
« no previous file with comments | « ash/wm/window_util.h ('k') | ash/wm/workspace/phantom_window_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698