feat: API for creating/manipulating the views hierarchy #32890
feat: API for creating/manipulating the views hierarchy #32890daniel-koc wants to merge 5 commits intoelectron:mainfrom
Conversation
|
💖 Thanks for opening this pull request! 💖 We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of commit messages with semantic prefixes:
Things that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
53f0b0e to
225a325
Compare
225a325 to
c75a112
Compare
c75a112 to
6305cea
Compare
|
Hi @daniel-koc, thanks for the PR! I think this proposal should go through the API WG's RFC process. There isn't really consensus on how we should approach exposing Views. This is the second attempt at it (you can see part of the first one here), and I think we would benefit by going through a more rigorous design process this time around. Once you have a spec document, we can meet with the API WG to discuss and move the proposal forward. Let me know if you have any questions! |
|
Hey @nornagon! There's an RFC up here - let us know if there's additional information or other tradeoffs you're interested in! |
|
Marking this as |
|
Hi, It is very nice to see that you're constantly improving Electron, making it more flexible and comfortable to use :) It seems that Chromium views hierarchy (Z order I think - used for input and composition) is maintained using the simple list order - the last in the views list has the highest top Z order. So, is it possible to add a similar method somewhere in this new WebContentsView components? Thank you in advance and keep the good work! |
|
@daniel-koc The Views API has changed substantially since this PR was proposed. I wanted to check in to see if there's still interest in pursuing aspects of the proposed changes in this PR. The API working group can continue to review if so. |
|
Thank you for your contribution to Electron! We've noticed there hasn't been any activity on the pull request in some time, and there have been many changes to the codebase since it was opened. As a result, your pull request may no longer be applicable or could conflict with more recent updates. To keep pull requests relevant for maintainers, we'll be closing this one for now. However, if you believe it's still relevant or if there was a mistake, feel free to request us to reopen it or provide a follow-up comment. If you'd like to continue with your contribution, please update your branch with the latest changes from main and resolve any conflicts. |
Closes #32751
Motivation
Bring native ScrollView component into Electron to provide flexible way of showing mutliple BrowserViews in one window in a performant way. Please see the issue #32751 for more details.
The challenges we addressed in this PR
beforeunloadeventsImplementation
For clarity of the review, we organized the code by several commits and is best reviewed commit-by-commit:
18cf919e7 - The implementation of
BaseViewwhich is the base class for all views.base-view.mdapi::BaseViewNativeView(Cocoa for Mac, Chromium views for Windows/Linux).132a9992d - The few additional functions for BaseWindow/BrowserWindow API.
addChildViewremoveChildViewsetContentBaseViewbeforeunloadevents for views hierarchy / updating draggable regions and few more.0c13af938 - The implementation of ContainerView which allows building the hierarchy of views.
container-view.mdapi::ContainerViewNativeContainer.2cc9ed017 - Implementation of ScrollView
scroll-view.mdapi::ScrollViewNativeScroll.53f0b0e72 - The wrapper for BrowserView and some additional changes for BrowserView (window/view owner).
API
An example code will look the following