chrome: Hit-test PiP draggable regions before resize border (see #3566)

This commit is contained in:
Marshall Greenblatt 2023-11-06 15:46:43 -05:00
parent 44323082b1
commit 21e01d4889
1 changed files with 12 additions and 19 deletions

View File

@ -711,7 +711,7 @@ index 8267a265a8e10..ee08f18e96a34 100644
ContentsWebView::~ContentsWebView() {
diff --git chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.cc chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.cc
index b9b50af047993..30793a69c4942 100644
index b9b50af047993..70ece4c81ff04 100644
--- chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.cc
+++ chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.cc
@@ -573,6 +573,11 @@ PictureInPictureBrowserFrameView::PictureInPictureBrowserFrameView(
@ -726,7 +726,7 @@ index b9b50af047993..30793a69c4942 100644
}
PictureInPictureBrowserFrameView::~PictureInPictureBrowserFrameView() {
@@ -669,17 +674,20 @@ gfx::Rect PictureInPictureBrowserFrameView::GetWindowBoundsForClientBounds(
@@ -669,18 +674,42 @@ gfx::Rect PictureInPictureBrowserFrameView::GetWindowBoundsForClientBounds(
int PictureInPictureBrowserFrameView::NonClientHitTest(
const gfx::Point& point) {
@ -735,18 +735,14 @@ index b9b50af047993..30793a69c4942 100644
- GetBackToTabControlsBounds().Contains(point) ||
- GetCloseControlsBounds().Contains(point)) {
- return HTCLIENT;
- }
-
- for (size_t i = 0; i < content_setting_views_.size(); i++) {
- if (GetContentSettingViewBounds(i).Contains(point)) {
+ const bool frameless = !top_bar_container_view_->GetVisible();
+ if (!frameless) {
+ // Allow interacting with the buttons.
+ if (GetLocationIconViewBounds().Contains(point) ||
+ GetBackToTabControlsBounds().Contains(point) ||
+ GetCloseControlsBounds().Contains(point)) {
return HTCLIENT;
}
+ return HTCLIENT;
+ }
+
+ for (size_t i = 0; i < content_setting_views_.size(); i++) {
+ if (GetContentSettingViewBounds(i).Contains(point)) {
@ -755,11 +751,9 @@ index b9b50af047993..30793a69c4942 100644
+ }
}
// Allow dragging and resizing the window.
@@ -689,6 +697,27 @@ int PictureInPictureBrowserFrameView::NonClientHitTest(
if (window_component != HTNOWHERE)
return window_component;
- for (size_t i = 0; i < content_setting_views_.size(); i++) {
- if (GetContentSettingViewBounds(i).Contains(point)) {
- return HTCLIENT;
+#if BUILDFLAG(ENABLE_CEF)
+ if (frameless) {
+ // Match logic in BrowserView::ShouldDescendIntoChildForEventHandling.
@ -777,13 +771,12 @@ index b9b50af047993..30793a69c4942 100644
+ point_in_contents_web_view_coords.y())) {
+ return HTCAPTION;
+ }
+ }
+ }
}
}
+#endif // BUILDFLAG(ENABLE_CEF)
+
// Allow interacting with the web contents.
int frame_component = frame()->client_view()->NonClientHitTest(point);
if (frame_component != HTNOWHERE)
// Allow dragging and resizing the window.
int window_component = GetHTComponentForFrame(
@@ -747,7 +776,8 @@ void PictureInPictureBrowserFrameView::Layout() {
gfx::Rect content_area = GetLocalBounds();
content_area.Inset(FrameBorderInsets());