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

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 (test) 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') | ash/wm/dock/docked_window_resizer_unittest.cc » ('J')
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..c8433539119cbd95dba43feec7cfb477023e0596 100644
--- a/ash/wm/dock/docked_window_layout_manager.cc
+++ b/ash/wm/dock/docked_window_layout_manager.cc
@@ -458,6 +458,16 @@ void DockedWindowLayoutManager::StartDragging(aura::Window* window) {
DCHECK(!dragged_window_);
dragged_window_ = window;
DCHECK(!IsPopupOrTransient(window));
+
+ // If there are no other docked windows clear alignment when a docked window
+ // is moved.
+ if (dragged_window_->parent() == dock_container_ &&
+ !IsAnyWindowDocked() &&
+ wm::GetWindowState(dragged_window_)->drag_details() &&
+ !(wm::GetWindowState(dragged_window_)->drag_details()->bounds_change &
+ WindowResizer::kBoundsChange_Resizes)) {
+ alignment_ = DOCKED_ALIGNMENT_NONE;
+ }
// Start observing a window unless it is docked container's child in which
// case it is already observed.
wm::WindowState* dragged_state = wm::GetWindowState(dragged_window_);
@@ -507,6 +517,15 @@ void DockedWindowLayoutManager::FinishDragging(DockedAction action,
if (is_dragged_window_docked_)
OnDraggedWindowUndocked();
DCHECK (!is_dragged_window_docked_);
+
+ // If this is the first window getting docked by moving it - update alignment.
+ if (dragged_window_->parent() == dock_container_ &&
+ !IsAnyWindowDocked() &&
+ wm::GetWindowState(dragged_window_)->drag_details() &&
+ !(wm::GetWindowState(dragged_window_)->drag_details()->bounds_change &
+ WindowResizer::kBoundsChange_Resizes)) {
pkotwicz 2014/01/16 21:43:27 I wonder whether it is possible to have a new func
varkha 2014/01/16 23:34:14 I will try to use the "closest to edge" logic when
+ alignment_ = GetAlignmentOfWindow(dragged_window_);
+ }
// Stop observing a window unless it is docked container's child in which
// case it needs to keep being observed after the drag completes.
if (dragged_window_->parent() != dock_container_) {
@@ -985,25 +1004,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') | ash/wm/dock/docked_window_resizer_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698