Index: ash/wm/drag_window_controller.cc |
diff --git a/ash/wm/drag_window_controller.cc b/ash/wm/drag_window_controller.cc |
index fb6bc25cf677e44f7384d95fd00d60a68bc4538a..88e11ff8345fa05cffa815807b339629152e14f2 100644 |
--- a/ash/wm/drag_window_controller.cc |
+++ b/ash/wm/drag_window_controller.cc |
@@ -58,6 +58,7 @@ class DragWindowController::DragWindowDetails |
// when it becomes necessary again. |
DCHECK(!drag_window_); |
layer_owner_.reset(); |
+ delegates_.clear(); // Stop observing layers. |
oshima
2016/10/04 21:06:31
thanks for catching this. i believe this fixes the
|
return; |
} |
if (!drag_window_) |
@@ -115,6 +116,7 @@ class DragWindowController::DragWindowDetails |
void RecreateWindowLayers(aura::Window* original_window) { |
DCHECK(!layer_owner_.get()); |
+ sync_bounds_ = false; |
layer_owner_ = ::wm::RecreateLayers(original_window, this); |
// Place the layer at (0, 0) of the DragWindowController's window. |
gfx::Rect layer_bounds = layer_owner_->root()->bounds(); |
@@ -132,12 +134,14 @@ class DragWindowController::DragWindowDetails |
layer_owner_->root()->SetOpacity(1.0f); |
} |
- // aura::WindowDelegate: |
- ui::LayerDelegate* CreateDelegate(ui::Layer* foo, ui::Layer* layer) override { |
+ // wm::LayerDelegateFactory: |
+ ui::LayerDelegate* CreateDelegate(ui::Layer* new_layer, |
+ ui::Layer* layer) override { |
if (!layer || !layer->delegate()) |
return nullptr; |
wm::ForwardingLayerDelegate* new_delegate = |
- new wm::ForwardingLayerDelegate(foo, layer); |
+ new wm::ForwardingLayerDelegate(new_layer, layer, sync_bounds_); |
+ sync_bounds_ = true; |
delegates_.push_back(base::WrapUnique(new_delegate)); |
return new_delegate; |
} |
@@ -176,6 +180,7 @@ class DragWindowController::DragWindowDetails |
aura::Window* drag_window_ = nullptr; // Owned by the container. |
aura::Window* original_window_ = nullptr; |
+ bool sync_bounds_; // Used during cloning. True for all layers but the root. |
std::vector<std::unique_ptr<wm::ForwardingLayerDelegate>> delegates_; |