Chromium Code Reviews| Index: ash/wm/workspace/workspace_window_resizer.cc |
| diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc |
| index 4b8c0aaf7e9366f91aa1fd1bf6f8d88f9429b0c9..aaa69c7bfd24116ec932bf7ea2b71c25d988f744 100644 |
| --- a/ash/wm/workspace/workspace_window_resizer.cc |
| +++ b/ash/wm/workspace/workspace_window_resizer.cc |
| @@ -422,8 +422,7 @@ void WorkspaceWindowResizer::CompleteDrag(int event_flags) { |
| initial_bounds : |
| details_.restore_bounds); |
| } |
| - window()->SetBounds(snap_sizer_->target_bounds()); |
| - return; |
| + snap_sizer_->Snap(); |
| } |
| } |
| @@ -855,9 +854,6 @@ void WorkspaceWindowResizer::UpdateSnapPhantomWindow(const gfx::Point& location, |
| if (!did_move_or_resize_ || details_.window_component != HTCAPTION) |
| return; |
| - if (!wm::CanSnapWindow(window())) |
| - return; |
| - |
| if (window()->type() == aura::client::WINDOW_TYPE_PANEL && |
| window()->GetProperty(kPanelAttachedKey)) { |
| return; |
| @@ -865,25 +861,26 @@ void WorkspaceWindowResizer::UpdateSnapPhantomWindow(const gfx::Point& location, |
| SnapType last_type = snap_type_; |
| snap_type_ = GetSnapType(location); |
| - if (snap_type_ == SNAP_NONE || snap_type_ != last_type) { |
| + using internal::SnapSizer; |
| + SnapSizer::Edge edge = (snap_type_ == SNAP_LEFT_EDGE) ? |
| + SnapSizer::LEFT_EDGE : SnapSizer::RIGHT_EDGE; |
| + if (snap_type_ == SNAP_NONE || |
| + !SnapSizer::CanSnapWindow(window(), edge)) { |
| + snap_type_ = SNAP_NONE; |
| snap_phantom_window_controller_.reset(); |
| snap_sizer_.reset(); |
| - if (snap_type_ == SNAP_NONE) |
| - return; |
| - } |
| - if (!snap_sizer_) { |
| - SnapSizer::Edge edge = (snap_type_ == SNAP_LEFT_EDGE) ? |
| - SnapSizer::LEFT_EDGE : SnapSizer::RIGHT_EDGE; |
| - snap_sizer_.reset(new SnapSizer(window(), |
| - location, |
| - edge, |
| - internal::SnapSizer::OTHER_INPUT)); |
| - } else { |
| - snap_sizer_->Update(location); |
| + return; |
| } |
| - if (!snap_phantom_window_controller_) { |
| + |
| + if (snap_type_ != last_type || |
|
varkha
2013/08/30 17:13:25
Will the animations be smoother if we don't re-cre
pkotwicz
2013/08/30 21:10:57
I believe that you always transition through SNAP_
|
| + !snap_sizer_ || |
| + !snap_phantom_window_controller_) { |
| + snap_sizer_.reset( |
| + new SnapSizer(window(), location, edge, SnapSizer::STEP_YES)); |
| snap_phantom_window_controller_.reset( |
| new PhantomWindowController(window())); |
| + } else { |
| + snap_sizer_->Update(location); |
| } |
| snap_phantom_window_controller_->Show(ScreenAsh::ConvertRectToScreen( |
| window()->parent(), snap_sizer_->target_bounds())); |