mirror of
				https://bitbucket.org/chromiumembedded/cef
				synced 2025-06-05 21:39:12 +02:00 
			
		
		
		
	views: Fix multiple issues with hide-frame (fixes issue #3168)
This commit is contained in:
		| @@ -182,6 +182,7 @@ class CaptionlessFrameView : public views::NonClientFrameView { | |||||||
|  |  | ||||||
|   void Layout() override { |   void Layout() override { | ||||||
|     client_view_bounds_.SetRect(0, 0, width(), height()); |     client_view_bounds_.SetRect(0, 0, width(), height()); | ||||||
|  |     views::NonClientFrameView::Layout(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   gfx::Size CalculatePreferredSize() const override { |   gfx::Size CalculatePreferredSize() const override { | ||||||
|   | |||||||
| @@ -488,13 +488,7 @@ void ViewsWindow::OnWindowCreated(CefRefPtr<CefWindow> window) { | |||||||
|  |  | ||||||
|   delegate_->OnViewsWindowCreated(this); |   delegate_->OnViewsWindowCreated(this); | ||||||
|  |  | ||||||
|   CefRect bounds = delegate_->GetWindowBounds(); |   const CefRect bounds = GetInitialBounds(); | ||||||
|   if (bounds.IsEmpty()) { |  | ||||||
|     // Use the default size. |  | ||||||
|     bounds.width = 800; |  | ||||||
|     bounds.height = 600; |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   if (bounds.x == 0 && bounds.y == 0) { |   if (bounds.x == 0 && bounds.y == 0) { | ||||||
|     // Size the Window and center it. |     // Size the Window and center it. | ||||||
|     window_->CenterWindow(CefSize(bounds.width, bounds.height)); |     window_->CenterWindow(CefSize(bounds.width, bounds.height)); | ||||||
| @@ -569,6 +563,18 @@ CefRefPtr<CefWindow> ViewsWindow::GetParentWindow(CefRefPtr<CefWindow> window, | |||||||
|   return parent_window; |   return parent_window; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | CefRect ViewsWindow::GetInitialBounds(CefRefPtr<CefWindow> window) { | ||||||
|  |   CEF_REQUIRE_UI_THREAD(); | ||||||
|  |   if (frameless_) { | ||||||
|  |     // Need to provide a size for frameless windows that will be centered. | ||||||
|  |     const CefRect bounds = GetInitialBounds(); | ||||||
|  |     if (bounds.x == 0 && bounds.y == 0) { | ||||||
|  |       return bounds; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |   return CefRect(); | ||||||
|  | } | ||||||
|  |  | ||||||
| bool ViewsWindow::IsFrameless(CefRefPtr<CefWindow> window) { | bool ViewsWindow::IsFrameless(CefRefPtr<CefWindow> window) { | ||||||
|   CEF_REQUIRE_UI_THREAD(); |   CEF_REQUIRE_UI_THREAD(); | ||||||
|   return frameless_; |   return frameless_; | ||||||
| @@ -1016,4 +1022,15 @@ void ViewsWindow::OnExtensionWindowClosed() { | |||||||
|   extension_button_pressed_lock_ = nullptr; |   extension_button_pressed_lock_ = nullptr; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | CefRect ViewsWindow::GetInitialBounds() const { | ||||||
|  |   CEF_REQUIRE_UI_THREAD(); | ||||||
|  |   CefRect bounds = delegate_->GetWindowBounds(); | ||||||
|  |   if (bounds.IsEmpty()) { | ||||||
|  |     // Use the default size. | ||||||
|  |     bounds.width = 800; | ||||||
|  |     bounds.height = 600; | ||||||
|  |   } | ||||||
|  |   return bounds; | ||||||
|  | } | ||||||
|  |  | ||||||
| }  // namespace client | }  // namespace client | ||||||
|   | |||||||
| @@ -154,6 +154,7 @@ class ViewsWindow : public CefBrowserViewDelegate, | |||||||
|   CefRefPtr<CefWindow> GetParentWindow(CefRefPtr<CefWindow> window, |   CefRefPtr<CefWindow> GetParentWindow(CefRefPtr<CefWindow> window, | ||||||
|                                        bool* is_menu, |                                        bool* is_menu, | ||||||
|                                        bool* can_activate_menu) OVERRIDE; |                                        bool* can_activate_menu) OVERRIDE; | ||||||
|  |   CefRect GetInitialBounds(CefRefPtr<CefWindow> window) OVERRIDE; | ||||||
|   bool IsFrameless(CefRefPtr<CefWindow> window) OVERRIDE; |   bool IsFrameless(CefRefPtr<CefWindow> window) OVERRIDE; | ||||||
|   bool CanResize(CefRefPtr<CefWindow> window) OVERRIDE; |   bool CanResize(CefRefPtr<CefWindow> window) OVERRIDE; | ||||||
|   bool CanClose(CefRefPtr<CefWindow> window) OVERRIDE; |   bool CanClose(CefRefPtr<CefWindow> window) OVERRIDE; | ||||||
| @@ -206,6 +207,8 @@ class ViewsWindow : public CefBrowserViewDelegate, | |||||||
|                               const ImageCache::ImageSet& images); |                               const ImageCache::ImageSet& images); | ||||||
|   void OnExtensionWindowClosed(); |   void OnExtensionWindowClosed(); | ||||||
|  |  | ||||||
|  |   CefRect GetInitialBounds() const; | ||||||
|  |  | ||||||
|   Delegate* delegate_;  // Not owned by this object. |   Delegate* delegate_;  // Not owned by this object. | ||||||
|   CefRefPtr<CefBrowserView> browser_view_; |   CefRefPtr<CefBrowserView> browser_view_; | ||||||
|   bool frameless_; |   bool frameless_; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user