Commit 36e34964 authored by Xiaoqian Dai's avatar Xiaoqian Dai Committed by Commit Bot

overview gesture: the dragged window can't exceed the top of the display.

Bug: 997885
Change-Id: I1e7df1158e2d1751339c54e0758b4d2d45172f5b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1888396Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Xiaoqian Dai <xdai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710812}
parent bb471bc6
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "ui/compositor/layer_animation_observer.h" #include "ui/compositor/layer_animation_observer.h"
#include "ui/compositor/scoped_layer_animation_settings.h" #include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/display/screen.h" #include "ui/display/screen.h"
#include "ui/gfx/transform_util.h"
#include "ui/wm/core/coordinate_conversion.h" #include "ui/wm/core/coordinate_conversion.h"
namespace ash { namespace ash {
...@@ -452,6 +453,22 @@ void DragWindowFromShelfController::UpdateDraggedWindow( ...@@ -452,6 +453,22 @@ void DragWindowFromShelfController::UpdateDraggedWindow(
(initial_location_in_screen_.y() - bounds.y()) * scale); (initial_location_in_screen_.y() - bounds.y()) * scale);
transform.Scale(scale, scale); transform.Scale(scale, scale);
// The dragged window cannot exceed the top of the display. So calculate the
// expected transformed bounds and then adjust the transform if needed.
gfx::RectF transformed_bounds(window_->bounds());
gfx::Transform new_tranform = TransformAboutPivot(
gfx::ToRoundedPoint(transformed_bounds.origin()), transform);
new_tranform.TransformRect(&transformed_bounds);
::wm::TranslateRectToScreen(window_->parent(), &transformed_bounds);
const gfx::Rect display_bounds =
display::Screen::GetScreen()
->GetDisplayNearestPoint(location_in_screen)
.bounds();
if (transformed_bounds.y() < display_bounds.y()) {
transform.Translate(0,
(display_bounds.y() - transformed_bounds.y()) / scale);
}
SetTransform(window_, transform); SetTransform(window_, transform);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment