-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Window Placement: Prototype Fullscreen Capability Delegation - Part 2
This completes the prototype started in https://crrev.com/c/3575071 Support Fullscreen Capability Delegation when a flag is enabled: --enable-blink-features=CapabilityDelegationFullscreenRequest Frames can delegate via messaging another frame on activation: - w.postMessage(m, { targetOrigin: o, delegate: "fullscreen" }); Another frame can use the delegated capability on message receipt: - window.onmessage = () => { e.requestFullscreen(); } Activate a browser-side FullscreenRequestToken in: - RFHI::PostMessageEvent for RemoteFrameHost's RouteMessageEvent - new ReceivedDelegatedCapability for LocalFrameHost local messages Focus windows that had delegation to request fullscreen, so: - user can press [Esc] to exit fullscreen - another focused window doesn't z-order above/below fullscreen Add automated tests supporting feature flag and local/remote usage (cherry picked from commit dbf43d9) Bug: 1293083 Test: automated; Fullscreen Capability Delegation WAI with flag enabled Change-Id: Ie46e627cd8df033016f16afbfda4075da81517b2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3642842 Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Charlie Reis <creis@chromium.org> Reviewed-by: Mustaq Ahmed <mustaq@chromium.org> Commit-Queue: Mike Wasserman <msw@chromium.org> Cr-Original-Commit-Position: refs/heads/main@{#1005525} Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3658340 Auto-Submit: Mike Wasserman <msw@chromium.org> Commit-Queue: Charlie Reis <creis@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Cr-Commit-Position: refs/branch-heads/5060@{#187} Cr-Branched-From: b83393d-refs/heads/main@{#1002911}
- Loading branch information
Mike Wasserman
authored and
Chromium LUCI CQ
committed
May 23, 2022
1 parent
208206b
commit e14a425
Showing
12 changed files
with
241 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
chrome/test/data/capability_delegation/fullscreen_request_delegation_initiator.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<!-- | ||
Copyright 2022 The Chromium Authors. All rights reserved. | ||
Use of this source code is governed by a BSD-style license that can be | ||
found in the LICENSE file. | ||
--> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>Fullscreen request delegation initiator</title> | ||
</head> | ||
<script> | ||
// https://wicg.github.io/capability-delegation/spec.html | ||
async function delegateCapability(target, origin, capability) { | ||
const promise = new Promise(resolve => { | ||
window.addEventListener("message", e => resolve(e.data), /*once=*/true); | ||
}); | ||
target.postMessage("", { targetOrigin: origin, delegate: capability }); | ||
return promise; | ||
} | ||
</script> | ||
</html> |
23 changes: 23 additions & 0 deletions
23
chrome/test/data/capability_delegation/fullscreen_request_delegation_receiver.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<!-- | ||
Copyright 2022 The Chromium Authors. All rights reserved. | ||
Use of this source code is governed by a BSD-style license that can be | ||
found in the LICENSE file. | ||
--> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>Fullscreen request delegation receiver</title> | ||
</head> | ||
<script> | ||
// https://wicg.github.io/capability-delegation/spec.html | ||
async function requestFullscreenAndReport(event) { | ||
document.documentElement.requestFullscreen().finally(() => { | ||
event.source.postMessage(!!document.fullscreenElement, "*"); | ||
}); | ||
} | ||
|
||
window.addEventListener("message", requestFullscreenAndReport); | ||
</script> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters