mirror of
				https://bitbucket.org/chromiumembedded/cef
				synced 2025-06-05 21:39:12 +02:00 
			
		
		
		
	chrome: Hit-test PiP draggable regions before resize border (see #3566)
This commit is contained in:
		| @@ -711,7 +711,7 @@ index 8267a265a8e10..ee08f18e96a34 100644 | |||||||
|   |   | ||||||
|  ContentsWebView::~ContentsWebView() { |  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 | 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 | ||||||
| +++ 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( | @@ -573,6 +573,11 @@ PictureInPictureBrowserFrameView::PictureInPictureBrowserFrameView( | ||||||
| @@ -726,7 +726,7 @@ index b9b50af047993..30793a69c4942 100644 | |||||||
|  } |  } | ||||||
|   |   | ||||||
|  PictureInPictureBrowserFrameView::~PictureInPictureBrowserFrameView() { |  PictureInPictureBrowserFrameView::~PictureInPictureBrowserFrameView() { | ||||||
| @@ -669,17 +674,20 @@ gfx::Rect PictureInPictureBrowserFrameView::GetWindowBoundsForClientBounds( | @@ -669,18 +674,42 @@ gfx::Rect PictureInPictureBrowserFrameView::GetWindowBoundsForClientBounds( | ||||||
|   |   | ||||||
|  int PictureInPictureBrowserFrameView::NonClientHitTest( |  int PictureInPictureBrowserFrameView::NonClientHitTest( | ||||||
|      const gfx::Point& point) { |      const gfx::Point& point) { | ||||||
| @@ -735,18 +735,14 @@ index b9b50af047993..30793a69c4942 100644 | |||||||
| -      GetBackToTabControlsBounds().Contains(point) || | -      GetBackToTabControlsBounds().Contains(point) || | ||||||
| -      GetCloseControlsBounds().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)) { |  | ||||||
| +  const bool frameless = !top_bar_container_view_->GetVisible(); | +  const bool frameless = !top_bar_container_view_->GetVisible(); | ||||||
| +  if (!frameless) { | +  if (!frameless) { | ||||||
| +    // Allow interacting with the buttons. | +    // Allow interacting with the buttons. | ||||||
| +    if (GetLocationIconViewBounds().Contains(point) || | +    if (GetLocationIconViewBounds().Contains(point) || | ||||||
| +        GetBackToTabControlsBounds().Contains(point) || | +        GetBackToTabControlsBounds().Contains(point) || | ||||||
| +        GetCloseControlsBounds().Contains(point)) { | +        GetCloseControlsBounds().Contains(point)) { | ||||||
|        return HTCLIENT; | +      return HTCLIENT; | ||||||
|      } | +    } | ||||||
| + | + | ||||||
| +    for (size_t i = 0; i < content_setting_views_.size(); i++) { | +    for (size_t i = 0; i < content_setting_views_.size(); i++) { | ||||||
| +      if (GetContentSettingViewBounds(i).Contains(point)) { | +      if (GetContentSettingViewBounds(i).Contains(point)) { | ||||||
| @@ -755,11 +751,9 @@ index b9b50af047993..30793a69c4942 100644 | |||||||
| +    } | +    } | ||||||
|    } |    } | ||||||
|   |   | ||||||
|    // Allow dragging and resizing the window. | -  for (size_t i = 0; i < content_setting_views_.size(); i++) { | ||||||
| @@ -689,6 +697,27 @@ int PictureInPictureBrowserFrameView::NonClientHitTest( | -    if (GetContentSettingViewBounds(i).Contains(point)) { | ||||||
|    if (window_component != HTNOWHERE) | -      return HTCLIENT; | ||||||
|      return window_component; |  | ||||||
|   |  | ||||||
| +#if BUILDFLAG(ENABLE_CEF) | +#if BUILDFLAG(ENABLE_CEF) | ||||||
| +  if (frameless) { | +  if (frameless) { | ||||||
| +    // Match logic in BrowserView::ShouldDescendIntoChildForEventHandling. | +    // Match logic in BrowserView::ShouldDescendIntoChildForEventHandling. | ||||||
| @@ -777,13 +771,12 @@ index b9b50af047993..30793a69c4942 100644 | |||||||
| +              point_in_contents_web_view_coords.y())) { | +              point_in_contents_web_view_coords.y())) { | ||||||
| +        return HTCAPTION; | +        return HTCAPTION; | ||||||
| +      } | +      } | ||||||
| +    } |      } | ||||||
| +  } |    } | ||||||
| +#endif  // BUILDFLAG(ENABLE_CEF) | +#endif  // BUILDFLAG(ENABLE_CEF) | ||||||
| + |   | ||||||
|    // Allow interacting with the web contents. |    // Allow dragging and resizing the window. | ||||||
|    int frame_component = frame()->client_view()->NonClientHitTest(point); |    int window_component = GetHTComponentForFrame( | ||||||
|    if (frame_component != HTNOWHERE) |  | ||||||
| @@ -747,7 +776,8 @@ void PictureInPictureBrowserFrameView::Layout() { | @@ -747,7 +776,8 @@ void PictureInPictureBrowserFrameView::Layout() { | ||||||
|    gfx::Rect content_area = GetLocalBounds(); |    gfx::Rect content_area = GetLocalBounds(); | ||||||
|    content_area.Inset(FrameBorderInsets()); |    content_area.Inset(FrameBorderInsets()); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user