Repository navigation
feat: replace BrowserView with WebContentsView - #35658
Merged
Merged
Conversation
…es to webcontentsview
nornagon
force-pushed
the
replace-browserview
branch
from
September 15, 2022 18:45
da434ce to
b1c7457
Compare
samuelmaddock
left a comment
Member
There was a problem hiding this comment.
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.
Contributor
Author
|
My main comment on #32890 is that |
Member
|
@panther7, |
This was referenced May 6, 2024
2 of 3 tasks
3 tasks done
3 tasks done
VerteDinde
pushed a commit
that referenced
this pull request
Aug 6, 2024
* 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
trop Bot
added a commit
that referenced
this pull request
Aug 6, 2024
Reference: #35658 Co-authored-by: Piotr Płaczek <[email protected]>
VerteDinde
pushed a commit
that referenced
this pull request
Aug 6, 2024
* 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]>
3 tasks done
3 tasks done
2 of 3 tasks
TheCommieAxolotl
pushed a commit
to TheCommieAxolotl/electron
that referenced
this pull request
Nov 2, 2025
chore: remove unused reference to api::BrowserView Unused since electron#35658 / 15c6014
nilayarya
pushed a commit
to nilayarya/electron
that referenced
this pull request
Nov 21, 2025
chore: remove unused reference to api::BrowserView Unused since electron#35658 / 15c6014
nilayarya
added a commit
to nilayarya/electron
that referenced
this pull request
Nov 21, 2025
chore: remove unused reference to api::BrowserView Unused since electron#35658 / 15c6014
nilayarya
added a commit
to nilayarya/electron
that referenced
this pull request
Nov 21, 2025
chore: remove unused reference to api::BrowserView Unused since electron#35658 / 15c6014
3 of 4 tasks
Merged
3 tasks
7 tasks done
pedro-b-rosa
added a commit
to pedro-b-rosa/electron
that referenced
this pull request
May 21, 2026
- Remove redundant v8::TryCatch in JSLayoutManager. gin's V8FunctionInvoker
already absorbs JS exceptions thrown from calculateProposedLayout: it
returns a default-constructed ProposedLayout and leaves the exception
pending on the isolate, which Node surfaces via uncaughtException on the
next reentry. The previous TryCatch+ReThrow added no observable behavior
vs. simply not catching.
- Reject unknown layout type values explicitly (e.g. setLayout({type:'fluss'}))
instead of silently falling through to FlexLayout. An *absent* type still
configures FlexLayout for back-compat with the legacy PR electron#35658 shape.
- Make getMainAxisAlignment and getCrossAxisAlignment symmetric across
BoxLayout and FlexLayout via an AlignmentToString helper.
- Document the SetLayoutFlex cache invariant on last_min/max_flex_rule_.
- Add 6 tests: unknown-type rejection, legacy no-type shape, setLayout(null)
on a JS layout manager, setBoxFlex(child, 0), and flex variants of both
alignment getters.
Co-authored-by: João Miguel Ribeiro da Silva <[email protected]>
pedro-b-rosa
added a commit
to pedro-b-rosa/electron
that referenced
this pull request
May 23, 2026
- Remove redundant v8::TryCatch in JSLayoutManager. gin's V8FunctionInvoker
already absorbs JS exceptions thrown from calculateProposedLayout: it
returns a default-constructed ProposedLayout and leaves the exception
pending on the isolate, which Node surfaces via uncaughtException on the
next reentry. The previous TryCatch+ReThrow added no observable behavior
vs. simply not catching.
- Reject unknown layout type values explicitly (e.g. setLayout({type:'fluss'}))
instead of silently falling through to FlexLayout. An *absent* type still
configures FlexLayout for back-compat with the legacy PR electron#35658 shape.
- Make getMainAxisAlignment and getCrossAxisAlignment symmetric across
BoxLayout and FlexLayout via an AlignmentToString helper.
- Document the SetLayoutFlex cache invariant on last_min/max_flex_rule_.
- Add 6 tests: unknown-type rejection, legacy no-type shape, setLayout(null)
on a JS layout manager, setBoxFlex(child, 0), and flex variants of both
alignment getters.
Co-authored-by: João Miguel Ribeiro da Silva <[email protected]>
pedro-b-rosa
added a commit
to pedro-b-rosa/electron
that referenced
this pull request
May 24, 2026
- Remove redundant v8::TryCatch in JSLayoutManager. gin's
V8FunctionInvoker already absorbs JS exceptions thrown from
calculateProposedLayout: it returns a default-constructed
ProposedLayout and leaves the exception pending on the
isolate, which Node surfaces via uncaughtException on the
next reentry. The previous TryCatch+ReThrow added no
observable behavior vs. simply not catching.
- Reject unknown layout type values explicitly (e.g.
setLayout({type:'fluss'})) instead of silently falling
through to FlexLayout. An *absent* type still configures
FlexLayout for back-compat with the legacy PR electron#35658 shape.
- Make getMainAxisAlignment and getCrossAxisAlignment
symmetric across BoxLayout and FlexLayout via an
AlignmentToString helper.
- Document the SetLayoutFlex cache invariant on
last_min/max_flex_rule_.
- Add 6 tests: unknown-type rejection, legacy no-type shape,
setLayout(null) on a JS layout manager, setBoxFlex(child,
0), and flex variants of both alignment getters.
Co-authored-by: João Miguel Ribeiro da Silva <[email protected]>
pedro-b-rosa
added a commit
to pedro-b-rosa/electron
that referenced
this pull request
May 24, 2026
- Remove redundant v8::TryCatch in JSLayoutManager. gin's
V8FunctionInvoker already absorbs JS exceptions thrown from
calculateProposedLayout: it returns a default-constructed
ProposedLayout and leaves the exception pending on the
isolate, which Node surfaces via uncaughtException on the
next reentry. The previous TryCatch+ReThrow added no
observable behavior vs. simply not catching.
- Reject unknown layout type values explicitly (e.g.
setLayout({type:'fluss'})) instead of silently falling
through to FlexLayout. An *absent* type still configures
FlexLayout for back-compat with the legacy PR electron#35658 shape.
- Make getMainAxisAlignment and getCrossAxisAlignment
symmetric across BoxLayout and FlexLayout via an
AlignmentToString helper.
- Document the SetLayoutFlex cache invariant on
last_min/max_flex_rule_.
- Add 6 tests: unknown-type rejection, legacy no-type shape,
setLayout(null) on a JS layout manager, setBoxFlex(child,
0), and flex variants of both alignment getters.
Co-authored-by: João Silva <[email protected]>
5 tasks done
pedro-b-rosa
added a commit
to pedro-b-rosa/electron
that referenced
this pull request
May 26, 2026
- Remove redundant v8::TryCatch in JSLayoutManager. gin's
V8FunctionInvoker already absorbs JS exceptions thrown from
calculateProposedLayout: it returns a default-constructed
ProposedLayout and leaves the exception pending on the
isolate, which Node surfaces via uncaughtException on the
next reentry. The previous TryCatch+ReThrow added no
observable behavior vs. simply not catching.
- Reject unknown layout type values explicitly (e.g.
setLayout({type:'fluss'})) instead of silently falling
through to FlexLayout. An *absent* type still configures
FlexLayout for back-compat with the legacy PR electron#35658 shape.
- Make getMainAxisAlignment and getCrossAxisAlignment
symmetric across BoxLayout and FlexLayout via an
AlignmentToString helper.
- Document the SetLayoutFlex cache invariant on
last_min/max_flex_rule_.
- Add 6 tests: unknown-type rejection, legacy no-type shape,
setLayout(null) on a JS layout manager, setBoxFlex(child,
0), and flex variants of both alignment getters.
Co-authored-by: João Silva <[email protected]>
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.