Skip to content

Commit

Permalink
Skip requestFullscreen checks on current fullscreen element
Browse files Browse the repository at this point in the history
This will allow an already fullscreen element to switch displays
(with window-placement permission) without requiring an additional
user activation.  This is similar to how moveTo behaves.

Filed here: whatwg/fullscreen#193

Bug: 1218483
Change-Id: Ia793eccb7e3f25492690c703025f7e975b597ccf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2970683
Reviewed-by: Mustaq Ahmed <[email protected]>
Commit-Queue: enne <[email protected]>
Cr-Commit-Position: refs/heads/master@{#897516}
NOKEYCHECK=True
GitOrigin-RevId: c17358d64ea9ee12cce4d136ac41dc7b1b90421c
  • Loading branch information
quisquous authored and copybara-github committed Jun 30, 2021
1 parent 1f84b9c commit 8b18894
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions blink/renderer/core/fullscreen/fullscreen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ bool AllowedToUseFullscreen(const Document& document,
mojom::blink::PermissionsPolicyFeature::kFullscreen, report_on_failure);
}

bool AllowedToRequestFullscreen(Document& document) {
bool AllowedToRequestFullscreen(Document& document, Element& element) {
// WebXR DOM Overlay integration, cf.
// https://immersive-web.github.io/dom-overlays/
//
Expand Down Expand Up @@ -308,6 +308,12 @@ bool AllowedToRequestFullscreen(Document& document) {
return false;
}

// If the element is already fullscreen, then it is allowed to repeat a
// request to fullscreen (possibly on another display) without requiring
// user activation.
if (element == Fullscreen::FullscreenElementFrom(document))
return true;

// An algorithm is allowed to request fullscreen if one of the following is
// true:

Expand Down Expand Up @@ -390,7 +396,7 @@ bool RequestFullscreenConditionsMet(Element& pending, Document& document) {
return false;

// This algorithm is allowed to request fullscreen.
if (!AllowedToRequestFullscreen(document))
if (!AllowedToRequestFullscreen(document, pending))
return false;

return true;
Expand Down

0 comments on commit 8b18894

Please sign in to comment.