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

Unified Diff: ash/wm/dock/docked_window_layout_manager.cc

Issue 141053002: Avoids updating dock alignment when drag is cancelled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoids updating dock alignment when drag is cancelled (comments) Created 6 years, 11 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 | « no previous file | ash/wm/dock/docked_window_resizer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | ash/wm/dock/docked_window_resizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698