fix: html fullscreen when window not fullscreenable (#37348)
This commit is contained in:
parent
868676aa5c
commit
32c60b29bb
3 changed files with 46 additions and 7 deletions
|
@ -1307,7 +1307,10 @@ Profile* WebContents::GetProfile() {
|
|||
}
|
||||
|
||||
bool WebContents::IsFullscreen() const {
|
||||
return owner_window_ && owner_window_->IsFullscreen();
|
||||
if (!owner_window())
|
||||
return false;
|
||||
|
||||
return owner_window()->IsFullscreen() || is_html_fullscreen();
|
||||
}
|
||||
|
||||
void WebContents::EnterFullscreen(const GURL& url,
|
||||
|
@ -1353,7 +1356,7 @@ void WebContents::OnEnterFullscreenModeForTab(
|
|||
content::RenderFrameHost* requesting_frame,
|
||||
const blink::mojom::FullscreenOptions& options,
|
||||
bool allowed) {
|
||||
if (!allowed || !owner_window_)
|
||||
if (!allowed || !owner_window())
|
||||
return;
|
||||
|
||||
auto* source = content::WebContents::FromRenderFrameHost(requesting_frame);
|
||||
|
@ -1377,7 +1380,7 @@ void WebContents::OnEnterFullscreenModeForTab(
|
|||
}
|
||||
|
||||
void WebContents::ExitFullscreenModeForTab(content::WebContents* source) {
|
||||
if (!owner_window_)
|
||||
if (!owner_window())
|
||||
return;
|
||||
|
||||
// This needs to be called before we exit fullscreen on the native window,
|
||||
|
@ -3657,14 +3660,14 @@ void WebContents::EnumerateDirectory(
|
|||
bool WebContents::IsFullscreenForTabOrPending(
|
||||
const content::WebContents* source) {
|
||||
if (!owner_window())
|
||||
return html_fullscreen_;
|
||||
return is_html_fullscreen();
|
||||
|
||||
bool in_transition = owner_window()->fullscreen_transition_state() !=
|
||||
NativeWindow::FullScreenTransitionState::NONE;
|
||||
bool is_html_transition = owner_window()->fullscreen_transition_type() ==
|
||||
NativeWindow::FullScreenTransitionType::HTML;
|
||||
|
||||
return html_fullscreen_ || (in_transition && is_html_transition);
|
||||
return is_html_fullscreen() || (in_transition && is_html_transition);
|
||||
}
|
||||
|
||||
bool WebContents::TakeFocus(content::WebContents* source, bool reverse) {
|
||||
|
@ -3954,7 +3957,7 @@ void WebContents::OnDevToolsSearchCompleted(
|
|||
|
||||
void WebContents::SetHtmlApiFullscreen(bool enter_fullscreen) {
|
||||
// Window is already in fullscreen mode, save the state.
|
||||
if (enter_fullscreen && owner_window_->IsFullscreen()) {
|
||||
if (enter_fullscreen && owner_window()->IsFullscreen()) {
|
||||
native_fullscreen_ = true;
|
||||
UpdateHtmlApiFullscreen(true);
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue