8000 GitHub Β· Where software is built
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[Bug]: Adding a View to a WebContentsView will not display itΒ #43255
Open
@liliang1112

Description

@liliang1112

Preflight Checklist

Electron Version

31.3.1

What operating system(s) are you using?

Windows

Operating System Version

Windows 11 22631.3958

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

const win = new BaseWindow({ width: 800, height: 400 });
win.maximize();

const view1 = new WebContentsView();
win.contentView.addChildView(view1);
view1.setBackgroundColor('red');
view1.webContents.loadURL('https://electronjs.org');
view1.setBounds({ x: 0, y: 0, width: 1000, height: 1000 });

const view2 = new WebContentsView();
win.contentView.addChildView(view2);
view2.webContents.loadURL('https://github.com/electron/electron');
view2.setBounds({ x: 450, y: 450, width: 500, height: 1200 });

const view3 = new WebContentsView();
view1.addChildView(view3);
view3.webContents.loadURL('https://baidu.com');
view3.setBounds({ x: 50, y: 50, width: 1200, height: 500 });

view3 can be displayed normally in the parent view1

Actual Behavior

const win = new BaseWindow({ width: 800, height: 400 });
win.maximize();

const view1 = new WebContentsView();
win.contentView.addChildView(view1);
view1.setBackgroundColor('red');
view1.webContents.loadURL('https://electronjs.org');
view1.setBounds({ x: 0, y: 0, width: 1000, height: 1000 });

const view2 = new WebContentsView();
win.contentView.addChildView(view2);
view2.webContents.loadURL('https://github.com/electron/electron');
view2.setBounds({ x: 450, y: 450, width: 500, height: 1200 });

const view3 = new WebContentsView();
view1.addChildView(view3);
view3.webContents.loadURL('https://baidu.com');
view3.setBounds({ x: 50, y: 50, width: 1200, height: 500 });

In the above code, view3 is not displayed

Testcase Gist URL

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0