Skip to content
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

fix: HTML fullscreen request for sub frames #18775

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions atom/browser/api/atom_api_web_contents.cc
Expand Up @@ -837,6 +837,10 @@ void WebContents::OnInterfaceRequestFromFrame(
registry_.TryBindInterface(interface_name, interface_pipe, render_frame_host);
}

void WebContents::DidAcquireFullscreen(content::RenderFrameHost* rfh) {
set_fullscreen_frame(rfh);
}

void WebContents::DocumentLoadedInFrame(
content::RenderFrameHost* render_frame_host) {
if (!render_frame_host->GetParent())
Expand Down
1 change: 1 addition & 0 deletions atom/browser/api/atom_api_web_contents.h
Expand Up @@ -455,6 +455,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
content::RenderFrameHost* render_frame_host,
const std::string& interface_name,
mojo::ScopedMessagePipeHandle* interface_pipe) override;
void DidAcquireFullscreen(content::RenderFrameHost* rfh) override;

// InspectableWebContentsDelegate:
void DevToolsReloadPage() override;
Expand Down
6 changes: 4 additions & 2 deletions atom/browser/common_web_contents_delegate.cc
Expand Up @@ -328,9 +328,12 @@ void CommonWebContentsDelegate::EnterFullscreenModeForTab(
const blink::WebFullscreenOptions& options) {
if (!owner_window_)
return;
if (IsFullscreenForTabOrPending(source)) {
DCHECK_EQ(fullscreen_frame_, source->GetFocusedFrame());
return;
}
SetHtmlApiFullscreen(true);
owner_window_->NotifyWindowEnterHtmlFullScreen();
source->GetRenderViewHost()->GetWidget()->SynchronizeVisualProperties();
}

void CommonWebContentsDelegate::ExitFullscreenModeForTab(
Expand All @@ -339,7 +342,6 @@ void CommonWebContentsDelegate::ExitFullscreenModeForTab(
return;
SetHtmlApiFullscreen(false);
owner_window_->NotifyWindowLeaveHtmlFullScreen();
source->GetRenderViewHost()->GetWidget()->SynchronizeVisualProperties();
}

bool CommonWebContentsDelegate::IsFullscreenForTabOrPending(
Expand Down
7 changes: 7 additions & 0 deletions atom/browser/common_web_contents_delegate.h
Expand Up @@ -68,6 +68,10 @@ class CommonWebContentsDelegate : public content::WebContentsDelegate,

bool is_html_fullscreen() const { return html_fullscreen_; }

void set_fullscreen_frame(content::RenderFrameHost* rfh) {
fullscreen_frame_ = rfh;
}

protected:
#if BUILDFLAG(ENABLE_OSR)
virtual OffScreenWebContentsView* GetOffScreenWebContentsView() const;
Expand Down Expand Up @@ -203,6 +207,9 @@ class CommonWebContentsDelegate : public content::WebContentsDelegate,

scoped_refptr<base::SequencedTaskRunner> file_task_runner_;

// Stores the frame thats currently in fullscreen, nullptr if there is none.
content::RenderFrameHost* fullscreen_frame_ = nullptr;

base::WeakPtrFactory<CommonWebContentsDelegate> weak_factory_;

DISALLOW_COPY_AND_ASSIGN(CommonWebContentsDelegate);
Expand Down