fix: fallback to FullSizeContentView for frameless window on mac (#13600)
When using `views::Widget` to create window, Chromium will automatically use a `BridgedContentView` as content view, which however does not support draggable regions inside it. By fallback to `FullSizeContentView` we can work around this problem, with the price of losing the ability to use `views::View` APIs. Since we don't expect users to use the new `View` APIs in `BrowserWindow` anyway, it should not be a problem. This change does not affect users of `TopLevelWindow`, and for users of `BrowserWindow` there is nothing to lose. In the long term we should look into how to make draggable regions work with `BridgedContentView`. The related Chromium code is still being changed rapidly, we can wait until Chromium migrated its `NativeAppWindowCocoa` class to use `views::Widget`.
This commit is contained in:
parent
f6ae438005
commit
85526c7f21
5 changed files with 123 additions and 55 deletions
|
@ -128,6 +128,9 @@ class NativeWindowMac : public NativeWindow {
|
|||
gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds) const override;
|
||||
gfx::Rect WindowBoundsToContentBounds(const gfx::Rect& bounds) const override;
|
||||
|
||||
// Use a custom content view instead of Chromium's BridgedContentView.
|
||||
void OverrideNSWindowContentView();
|
||||
|
||||
// Set the attribute of NSWindow while work around a bug of zoom button.
|
||||
void SetStyleMask(bool on, NSUInteger flag);
|
||||
void SetCollectionBehavior(bool on, NSUInteger flag);
|
||||
|
@ -152,6 +155,9 @@ class NativeWindowMac : public NativeWindow {
|
|||
views::View* GetContentsView() override;
|
||||
|
||||
private:
|
||||
// Add custom layers to the content view.
|
||||
void AddContentViewLayers();
|
||||
|
||||
void InternalSetParentWindow(NativeWindow* parent, bool attach);
|
||||
void ShowWindowButton(NSWindowButton button);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue