Fix Picture-in-Picture window resize

This CL makes sure min and max sizes of the Picture-in-Picture window
adhere to the aspect ratio of the video before applying resize
algorithm. This wasn't the case before which may cause some unexpected
issue.

Bug: 924938
Change-Id: Id785ce863051b1694451497424d0e94b16cda8f9
Reviewed-on: https://chromium-review.googlesource.com/c/1445511
Auto-Submit: François Beaufort <beaufort.francois@gmail.com>
Reviewed-by: Mounir Lamouri <mlamouri@chromium.org>
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
Cr-Original-Commit-Position: refs/heads/master@{#627546}(cherry picked from commit 13df529ae56f4319392e222acb1359c8341e643a)
Reviewed-on: https://chromium-review.googlesource.com/c/1448325
Reviewed-by: François Beaufort <beaufort.francois@gmail.com>
Cr-Commit-Position: refs/branch-heads/3683@{#105}
Cr-Branched-From: e51029943e0a38dd794b73caaf6373d5496ae783-refs/heads/master@{#625896}
diff --git a/chrome/browser/ui/views/overlay/overlay_window_views.cc b/chrome/browser/ui/views/overlay/overlay_window_views.cc
index 5c8fa5e..4cf13f6 100644
--- a/chrome/browser/ui/views/overlay/overlay_window_views.cc
+++ b/chrome/browser/ui/views/overlay/overlay_window_views.cc
@@ -296,9 +296,13 @@
     }
 
     // Update the window size to adhere to the aspect ratio.
+    gfx::Size min_size = min_size_;
+    gfx::Size max_size = max_size_;
+    views::WindowResizeUtils::SizeMinMaxToAspectRatio(aspect_ratio, &min_size,
+                                                      &max_size);
     gfx::Rect window_rect(GetBounds().origin(), window_size);
     views::WindowResizeUtils::SizeRectToAspectRatio(
-        hit_test, aspect_ratio, min_size_, max_size_, &window_rect);
+        hit_test, aspect_ratio, min_size, max_size, &window_rect);
     window_size.SetSize(window_rect.width(), window_rect.height());
 
     UpdateLayerBoundsWithLetterboxing(window_size);