зеркало из https://github.com/electron/electron.git
fix: `requestFullscreen` from `WebContentsView` (#41966)
fix: requestFullscreen from WebContentsView
This commit is contained in:
Родитель
441dbda833
Коммит
f5fb44eaf8
|
@ -89,6 +89,9 @@ void WebContentsView::OnViewAddedToWidget(views::View* observed_view) {
|
||||||
widget->GetNativeWindowProperty(electron::kElectronNativeWindowKey));
|
widget->GetNativeWindowProperty(electron::kElectronNativeWindowKey));
|
||||||
if (!native_window)
|
if (!native_window)
|
||||||
return;
|
return;
|
||||||
|
// We don't need to call SetOwnerWindow(nullptr) in OnViewRemovedFromWidget
|
||||||
|
// because that's handled in the WebContents dtor called prior.
|
||||||
|
api_web_contents_->SetOwnerWindow(native_window);
|
||||||
native_window->AddDraggableRegionProvider(this);
|
native_window->AddDraggableRegionProvider(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,18 @@ describe('WebContentsView', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('can be fullscreened', async () => {
|
||||||
|
const w = new BaseWindow();
|
||||||
|
const v = new WebContentsView();
|
||||||
|
w.setContentView(v);
|
||||||
|
await v.webContents.loadURL('data:text/html,<div id="div">This is a simple div.</div>');
|
||||||
|
|
||||||
|
const enterFullScreen = once(w, 'enter-full-screen');
|
||||||
|
await v.webContents.executeJavaScript('document.getElementById("div").requestFullscreen()', true);
|
||||||
|
await enterFullScreen;
|
||||||
|
expect(w.isFullScreen()).to.be.true('isFullScreen');
|
||||||
|
});
|
||||||
|
|
||||||
describe('visibilityState', () => {
|
describe('visibilityState', () => {
|
||||||
it('is initially hidden', async () => {
|
it('is initially hidden', async () => {
|
||||||
const v = new WebContentsView();
|
const v = new WebContentsView();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче