Index: ash/wm/dock/docked_window_layout_manager.cc |
diff --git a/ash/wm/dock/docked_window_layout_manager.cc b/ash/wm/dock/docked_window_layout_manager.cc |
index fcbecfc00f4255e730db781b11349fae71853c1f..6538eacf5e4f040aae07747825f76424f2413b46 100644 |
--- a/ash/wm/dock/docked_window_layout_manager.cc |
+++ b/ash/wm/dock/docked_window_layout_manager.cc |
@@ -464,6 +464,13 @@ void DockedWindowLayoutManager::StartDragging(aura::Window* window) { |
if (dragged_window_->parent() != dock_container_) { |
dragged_window_->AddObserver(this); |
dragged_state->AddObserver(this); |
+ } else if (!IsAnyWindowDocked() && |
pkotwicz
2014/01/17 00:12:18
The reason that we check |DragDetails::bounds_chan
varkha
2014/01/17 01:05:28
Done.
|
+ dragged_state->drag_details() && |
+ !(dragged_state->drag_details()->bounds_change & |
+ WindowResizer::kBoundsChange_Resizes)) { |
+ // If there are no other docked windows clear alignment when a docked window |
+ // is moved. |
+ alignment_ = DOCKED_ALIGNMENT_NONE; |
} |
is_dragged_from_dock_ = window->parent() == dock_container_; |
DCHECK(!is_dragged_window_docked_); |
@@ -509,15 +516,21 @@ void DockedWindowLayoutManager::FinishDragging(DockedAction action, |
DCHECK (!is_dragged_window_docked_); |
// Stop observing a window unless it is docked container's child in which |
// case it needs to keep being observed after the drag completes. |
+ wm::WindowState* dragged_state = wm::GetWindowState(dragged_window_); |
pkotwicz
2014/01/17 00:12:18
Nit: Move initialization of |dragged_state| to lin
varkha
2014/01/17 01:05:28
Done. No need to change this since it is only used
|
if (dragged_window_->parent() != dock_container_) { |
dragged_window_->RemoveObserver(this); |
- wm::GetWindowState(dragged_window_)->RemoveObserver(this); |
+ dragged_state->RemoveObserver(this); |
if (last_active_window_ == dragged_window_) |
last_active_window_ = NULL; |
views::corewm::SetWindowShowAnimationDuration(dragged_window_, |
base::TimeDelta()); |
} else { |
+ // If this is the first window that got docked by a move - update alignment. |
pkotwicz
2014/01/17 00:12:18
Nit: No hyphen
varkha
2014/01/17 01:05:28
Done.
|
+ if (alignment_ == DOCKED_ALIGNMENT_NONE) { |
+ alignment_ = GetAlignmentOfWindow(dragged_window_); |
+ DCHECK(alignment_ != DOCKED_ALIGNMENT_NONE); |
pkotwicz
2014/01/17 00:12:18
Nit: DCHECK_NE
pkotwicz
2014/01/17 00:50:45
The DCHECK() can fail when FinishDragging() is cal
varkha
2014/01/17 01:05:28
Done. When window is destroyed while it is being d
|
+ } |
// A window is no longer dragged and is a child. |
// When a window becomes a child at drag start this is |
// the only opportunity we will have to enforce a window |
@@ -985,25 +998,9 @@ void DockedWindowLayoutManager::UpdateDockedWidth(int width) { |
void DockedWindowLayoutManager::OnDraggedWindowDocked(aura::Window* window) { |
DCHECK(!is_dragged_window_docked_); |
is_dragged_window_docked_ = true; |
- |
- // If there are no other docked windows update alignment when the window is |
- // moved. |
- if (!IsAnyWindowDocked() && |
- wm::GetWindowState(dragged_window_)->drag_details() && |
- !(wm::GetWindowState(dragged_window_)->drag_details()->bounds_change & |
- WindowResizer::kBoundsChange_Resizes)) { |
- alignment_ = DOCKED_ALIGNMENT_NONE; |
- } |
} |
void DockedWindowLayoutManager::OnDraggedWindowUndocked() { |
- // If this is the first window getting docked by moving it - update alignment. |
- if (!IsAnyWindowDocked() && |
- wm::GetWindowState(dragged_window_)->drag_details() && |
- !(wm::GetWindowState(dragged_window_)->drag_details()->bounds_change & |
- WindowResizer::kBoundsChange_Resizes)) { |
- alignment_ = GetAlignmentOfWindow(dragged_window_); |
- } |
DCHECK (is_dragged_window_docked_); |
is_dragged_window_docked_ = false; |
} |