-
Notifications
You must be signed in to change notification settings - Fork 16.9k
feat: replace BrowserView with WebContentsView #35658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…es to webcontentsview
da434ce to
b1c7457
Compare
samuelmaddock
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm very much in favor of the direction these changes are taking the view-related classes. Cool to see classes move directly into JS. 👍👍
Do you happen to know whether the View class is at all compatible with the design of BaseView in #32890? Would be great if these two proposals could build off of each other.
|
My main comment on #32890 is that |
|
I' ve reported issue for WebContentsView visibility on macOS: #41276 |
|
Why didn't I see any related documentation? |
|
In changelog:
But, |
|
@panther7, |
* docs: deprecate `BrowserView` Reference: #35658 * docs: deprecate `webContents.goToIndex(index)` Reference: https://github.com/electron/electron/pull/41752/files#diff-18ed6a5b5a9084c976509502962b7f05989a8bd13a2ba3dc02868056938c03b6R1165-R1167 * docs: deprecate some protocol methods Reference: https://github.com/electron/electron/pull/36674/files#diff-74861ecada868821b139e79f244ea32b840a93f60de572d585117a0ff8d165c8R380
Reference: #35658 Co-authored-by: Piotr Płaczek <[email protected]>
* docs: deprecate `BrowserView` Reference: #35658 Co-authored-by: Piotr Płaczek <[email protected]> * docs: deprecate `webContents.goToIndex(index)` Reference: https://github.com/electron/electron/pull/41752/files#diff-18ed6a5b5a9084c976509502962b7f05989a8bd13a2ba3dc02868056938c03b6R1165-R1167 Co-authored-by: Piotr Płaczek <[email protected]> * docs: deprecate some protocol methods Reference: https://github.com/electron/electron/pull/36674/files#diff-74861ecada868821b139e79f244ea32b840a93f60de572d585117a0ff8d165c8R380 Co-authored-by: Piotr Płaczek <[email protected]> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Piotr Płaczek <[email protected]>
chore: remove unused reference to api::BrowserView Unused since electron#35658 / 15c6014
chore: remove unused reference to api::BrowserView Unused since electron#35658 / 15c6014
chore: remove unused reference to api::BrowserView Unused since electron#35658 / 15c6014
chore: remove unused reference to api::BrowserView Unused since electron#35658 / 15c6014
Description of Change
Replaces the experimental BrowserView API with a new WebContentsView API.
BaseWindow, whichBrowserWindowextends.the
BrowserWindowdocs. Ideally we could deduplicate this, but forusability and consistency (avoiding "where did all the BrowserWindow
methods go???" type questions), we should probably change the docs site to
account for that change, e.g. to have the duplication of docs for inherited
methods happen at render time.
BaseWindowread-write property,contentView.ViewandWebContentsView.WebContentsViewis the replacement for the oldBrowserViewclass. Wealso expose and document the
Viewclass, because that is the typeof
BaseWindow.contentView, to whichWebContentsViews are added.Viewproperties and methods.removeChildView(),children,setBounds(),getBounds(),setBackgroundColor(),setVisible().BrowserViewAPI and updates all references to it to point toWebContentsViewinstead.WebContentsView.BrowserViewAPI, whichunder the hood delegates to the new
WebContentsViewAPI.BrowserView-specific draggable region handling. This will bereplaced with refactor: use views NonClientHitTest for draggable regions on mac #35603, but may need some more holes poked to enable draggable
regions to work correctly on all platforms in
WebContentsViews.setAutoResizeto behave consistently on all platforms. (The behavior on macOS has been changed to match the behavior on Windows.)Still TODO:
This is done, I ported the autoresizing logic from C++ to JS.BrowserViewhad options for auto-sizing. This isn't yet possible with thecurrently exposed APIs of
WebContentsView/View, but it should bedoable!
There is some code about compositor recycling for BrowserViews that I glazedI tested this using the example from fix: Disable new fade animation for BrowserViews #14911 and it seems like things are okay (no flickering)!over and removed in this PR. I'm not really sure how to test "is this still
working properly", but it deserves investigation.
Test that background colors are working properly.as far as I can tell, they are.Test that onbeforeunload works properly inWebContentsView.Draggable regions are broken inWebContentsView. I think this should be fixed with chore: Move draggable regions implementation from NativeBrowserView into InspectableWebContentsView #35007, so I'm going to say that doesn't block this PR from landing.Checklist
npm testpassesRelease Notes
Notes: Added
WebContentsViewandBaseWindow, replacing the now-deprecatedBrowserViewAPIs.