Commit 2a257c79 authored by Kazuki Takise's avatar Kazuki Takise Committed by Commit Bot

Don't fling PIP window during resize

We don't want to apply ComputeFlungPosition() for PIP resize.

send a wrong bounds at the end of resize anymore.

Bug: b/142105182
Test: Resized a PIP window very quickly and confirmed Chrome didn't
Change-Id: Ie1d6b1288f4ff16175ee013edbc5dd2e3660f863
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1849750Reviewed-by: default avatarEliot Courtney <edcourtney@chromium.org>
Reviewed-by: default avatarStefan Kuhne <skuhne@chromium.org>
Commit-Queue: Kazuki Takise <takise@chromium.org>
Auto-Submit: Kazuki Takise <takise@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706785}
parent f6b822ff
...@@ -252,7 +252,8 @@ void PipWindowResizer::Drag(const gfx::Point& location_in_parent, ...@@ -252,7 +252,8 @@ void PipWindowResizer::Drag(const gfx::Point& location_in_parent,
} }
void PipWindowResizer::CompleteDrag() { void PipWindowResizer::CompleteDrag() {
if (details().bounds_change & kBoundsChange_Resizes) { const bool is_resize = details().bounds_change & kBoundsChange_Resizes;
if (is_resize) {
CollectFreeResizeAreaMetric(kAshPipFreeResizeFinishAreaHistogramName, CollectFreeResizeAreaMetric(kAshPipFreeResizeFinishAreaHistogramName,
GetTarget()); GetTarget());
} else { } else {
...@@ -283,7 +284,7 @@ void PipWindowResizer::CompleteDrag() { ...@@ -283,7 +284,7 @@ void PipWindowResizer::CompleteDrag() {
} else { } else {
// Animate the PIP window to its resting position. // Animate the PIP window to its resting position.
gfx::Rect bounds; gfx::Rect bounds;
if (fling_amount > kPipMovementFlingThresholdSquared) { if (!is_resize && fling_amount > kPipMovementFlingThresholdSquared) {
bounds = ComputeFlungPosition(); bounds = ComputeFlungPosition();
} else { } else {
bounds = GetTarget()->GetBoundsInScreen(); bounds = GetTarget()->GetBoundsInScreen();
......
...@@ -255,6 +255,17 @@ TEST_P(PipWindowResizerTest, PipWindowCanBeResizedInTabletMode) { ...@@ -255,6 +255,17 @@ TEST_P(PipWindowResizerTest, PipWindowCanBeResizedInTabletMode) {
EXPECT_EQ(gfx::Rect(200, 200, 100, 110), test_state()->last_bounds()); EXPECT_EQ(gfx::Rect(200, 200, 100, 110), test_state()->last_bounds());
} }
TEST_P(PipWindowResizerTest, ResizingPipWindowDoesNotTriggerFling) {
PreparePipWindow(gfx::Rect(8, 8, 100, 100));
std::unique_ptr<PipWindowResizer> resizer(CreateResizerForTest(HTBOTTOM));
ASSERT_TRUE(resizer.get());
Fling(std::move(resizer), 0.f, 4000.f);
// Ensure that the PIP window isn't flung to the bottom edge during resize.
EXPECT_EQ(gfx::Point(8, 8), test_state()->last_bounds().origin());
}
TEST_P(PipWindowResizerTest, PipWindowCanBeSwipeDismissed) { TEST_P(PipWindowResizerTest, PipWindowCanBeSwipeDismissed) {
PreparePipWindow(gfx::Rect(8, 8, 100, 100)); PreparePipWindow(gfx::Rect(8, 8, 100, 100));
std::unique_ptr<PipWindowResizer> resizer(CreateResizerForTest(HTCAPTION)); std::unique_ptr<PipWindowResizer> resizer(CreateResizerForTest(HTCAPTION));
......
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