Index: chrome/browser/ui/panels/panel_drag_controller.cc |
diff --git a/chrome/browser/ui/panels/panel_drag_controller.cc b/chrome/browser/ui/panels/panel_drag_controller.cc |
index d45798cce8e5a4cf007c26972547ea0cedfef38d..0e19fdd3641071a42a49c4af5846fd2f0638ab96 100644 |
--- a/chrome/browser/ui/panels/panel_drag_controller.cc |
+++ b/chrome/browser/ui/panels/panel_drag_controller.cc |
@@ -446,16 +446,6 @@ bool PanelDragController::TryUnstackFromTop(const gfx::Point& target_position) { |
return false; |
} |
- // Move the panel (and all the panels below if in a stack) to the new |
- // position. |
- for (StackedPanelCollection::Panels::const_iterator iter = |
- dragging_stack->panels().begin(); |
- iter != dragging_stack->panels().end(); ++iter) { |
- if (!(*iter)->in_preview_mode()) |
- break; |
- (*iter)->MoveByInstantly(delta); |
- } |
- |
int num_panels_in_stack = dragging_stack->num_panels(); |
DCHECK_GE(num_panels_in_stack, 2); |
@@ -472,6 +462,7 @@ bool PanelDragController::TryUnstackFromTop(const gfx::Point& target_position) { |
MovePanelAndBelowToCollection(dragging_panel_, |
detached_collection, |
PanelCollection::KNOWN_POSITION); |
+ dragging_panel_->MoveByInstantly(delta); |
return true; |
} |
@@ -480,8 +471,9 @@ bool PanelDragController::TryUnstackFromTop(const gfx::Point& target_position) { |
// If only one panel (top panel) needs to unstack, move it out of the stack. |
if (num_panels_to_unstack == 1) { |
panel_manager_->MovePanelToCollection(dragging_panel_, |
- panel_manager_->detached_collection(), |
+ detached_collection, |
PanelCollection::KNOWN_POSITION); |
+ dragging_panel_->MoveByInstantly(delta); |
return true; |
} |
@@ -489,8 +481,9 @@ bool PanelDragController::TryUnstackFromTop(const gfx::Point& target_position) { |
// bottom panel out of the stack. |
if (num_panels_in_stack - num_panels_to_unstack == 1) { |
panel_manager_->MovePanelToCollection(dragging_stack->bottom_panel(), |
- panel_manager_->detached_collection(), |
+ detached_collection, |
PanelCollection::KNOWN_POSITION); |
+ dragging_panel_->stack()->MoveAllDraggingPanelsInstantly(delta); |
return true; |
} |
@@ -513,6 +506,7 @@ bool PanelDragController::TryUnstackFromTop(const gfx::Point& target_position) { |
new_stack, |
PanelCollection::KNOWN_POSITION); |
} |
+ dragging_panel_->stack()->MoveAllDraggingPanelsInstantly(delta); |
return true; |
} |
@@ -546,13 +540,7 @@ bool PanelDragController::TryUnstackFromBottom( |
return false; |
} |
- // Move the panel (and all the panels below if in a stack) to the new |
- // position. |
gfx::Vector2d delta = target_position - dragging_panel_->GetBounds().origin(); |
- if (dragging_stack) |
- dragging_stack->MoveAllDraggingPanelsInstantly(delta); |
- else |
- dragging_panel_->MoveByInstantly(delta); |
// If there're only 2 panels in the stack, both panels should move out the |
// stack and the stack should be removed. |
@@ -562,6 +550,7 @@ bool PanelDragController::TryUnstackFromBottom( |
MovePanelAndBelowToCollection(dragging_stack->top_panel(), |
detached_collection, |
PanelCollection::KNOWN_POSITION); |
+ dragging_panel_->MoveByInstantly(delta); |
return true; |
} |
@@ -573,6 +562,7 @@ bool PanelDragController::TryUnstackFromBottom( |
panel_manager_->MovePanelToCollection(dragging_panel_, |
detached_collection, |
PanelCollection::KNOWN_POSITION); |
+ dragging_panel_->MoveByInstantly(delta); |
return true; |
} |
@@ -583,6 +573,7 @@ bool PanelDragController::TryUnstackFromBottom( |
panel_manager_->MovePanelToCollection(dragging_stack->top_panel(), |
detached_collection, |
PanelCollection::KNOWN_POSITION); |
+ dragging_panel_->stack()->MoveAllDraggingPanelsInstantly(delta); |
return true; |
} |
@@ -595,6 +586,7 @@ bool PanelDragController::TryUnstackFromBottom( |
MovePanelAndBelowToCollection(dragging_panel_, |
new_stack, |
PanelCollection::KNOWN_POSITION); |
+ dragging_panel_->stack()->MoveAllDraggingPanelsInstantly(delta); |
return true; |
} |