Index: ash/wm/workspace/phantom_window_controller.cc |
diff --git a/ash/wm/workspace/phantom_window_controller.cc b/ash/wm/workspace/phantom_window_controller.cc |
index 5d756ccbd00313e4ac6e0d2c00848472b3432523..e59107d1652a034a794c955064f9faf7c1b1ba58 100644 |
--- a/ash/wm/workspace/phantom_window_controller.cc |
+++ b/ash/wm/workspace/phantom_window_controller.cc |
@@ -90,8 +90,6 @@ class WindowPainter : public views::Painter, |
// views::Painter overrides: |
virtual void Paint(gfx::Canvas* canvas, const gfx::Size& size) OVERRIDE { |
- // TODO(yusukes): Paint child windows of the |window_| correctly. Current |
- // code does not paint e.g. web content area in the window. crbug.com/141766 |
if (window_ && window_->delegate()) |
window_->delegate()->OnPaint(canvas); |
} |
@@ -114,7 +112,8 @@ PhantomWindowController::PhantomWindowController(aura::Window* window) |
: window_(window), |
phantom_below_window_(NULL), |
phantom_widget_(NULL), |
- style_(STYLE_SHADOW) { |
+ style_(STYLE_SHADOW), |
+ layer_(NULL) { |
} |
PhantomWindowController::~PhantomWindowController() { |
@@ -126,7 +125,15 @@ void PhantomWindowController::SetDestinationDisplay( |
dst_display_ = dst_display; |
} |
+void PhantomWindowController::set_layer(ui::Layer* layer) { |
+ // Cannot set a layer after the widget is initialized. |
+ DCHECK(!phantom_widget_); |
+ layer_ = layer; |
+} |
+ |
void PhantomWindowController::Show(const gfx::Rect& bounds) { |
+ if (layer_) |
+ layer_->SetVisible(true); |
if (bounds == bounds_) |
return; |
bounds_ = bounds; |
@@ -144,6 +151,8 @@ void PhantomWindowController::Show(const gfx::Rect& bounds) { |
void PhantomWindowController::SetBounds(const gfx::Rect& bounds) { |
DCHECK(IsShowing()); |
+ if (layer_) |
+ layer_->SetVisible(true); |
animation_.reset(); |
bounds_ = bounds; |
SetBoundsInternal(bounds); |
@@ -153,6 +162,8 @@ void PhantomWindowController::Hide() { |
if (phantom_widget_) |
phantom_widget_->Close(); |
phantom_widget_ = NULL; |
+ if (layer_) |
+ layer_->SetVisible(false); |
} |
bool PhantomWindowController::IsShowing() const { |
@@ -216,6 +227,19 @@ void PhantomWindowController::CreatePhantomWidget(const gfx::Rect& bounds) { |
else |
phantom_widget_->StackAbove(window_); |
phantom_widget_->Show(); |
+ |
+ if (layer_) { |
+ // When |window|'s root window and |layer_|'s original root window is not |
+ // the same (e.g. a phantom window for window dragging), most ui::Layers in |
+ // |layer_| except the web content area are not rendered at all. To work |
sky
2012/08/13 20:56:32
This seems weird. Can you talk with Antoine about
Yusuke Sato
2012/08/15 21:18:23
Done. Talked with him and added set_delegate call
|
+ // around the issue, we continue to use WindowPainter to render non-web |
+ // content part of the window. |
+ // TODO(yusukes): Find a way to resolve the issue and remove WindowPainter. |
+ aura::Window* window = phantom_widget_->GetNativeWindow(); |
+ window->layer()->Add(layer_); |
+ window->layer()->StackAtTop(layer_); |
+ } |
+ |
// Fade the window in. |
ui::Layer* layer = phantom_widget_->GetNativeWindow()->layer(); |
layer->SetOpacity(0); |