Skip to content

Commit

Permalink
Use kUnprefixed for actual unprefixed requestFullscreen usage
Browse files Browse the repository at this point in the history
Prior to this CL, both requestFullscreen() and webkitRequestFullscreen()
would be marked as "prefixed" calls. Now, unprefixed usage is properly
registered as kUnprefixed.

Bug: 383813
Change-Id: Ie85281fc54f2a7ad6906e119a637b4e408d1e10f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4265584
Auto-Submit: Mason Freed <masonf@chromium.org>
Commit-Queue: Philip Jägenstedt <foolip@chromium.org>
Reviewed-by: Philip Jägenstedt <foolip@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1115633}
  • Loading branch information
Mason Freed authored and Chromium LUCI CQ committed Mar 10, 2023
1 parent d154eea commit efc5a58
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 19 deletions.
4 changes: 1 addition & 3 deletions third_party/blink/renderer/core/fullscreen/fullscreen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -666,11 +666,9 @@ void Fullscreen::ContextDestroyed() {

// https://fullscreen.spec.whatwg.org/#dom-element-requestfullscreen
void Fullscreen::RequestFullscreen(Element& pending) {
// TODO(foolip): Make RequestType::Unprefixed the default when the unprefixed
// API is enabled. https://crbug.com/383813
FullscreenOptions* options = FullscreenOptions::Create();
options->setNavigationUI("hide");
RequestFullscreen(pending, options, FullscreenRequestType::kPrefixed);
RequestFullscreen(pending, options, FullscreenRequestType::kUnprefixed);
}

ScriptPromise Fullscreen::RequestFullscreen(Element& pending,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ enum class FullscreenRequestType {
// No bits set, equivalent to unprefixed with no other properties
kNull = 0,

// True for Element.requestFullscreen(), false for
// False for Element.requestFullscreen(), true for
// Element.webkitRequestFullscreen()/webkitRequestFullScreen() and
// HTMLVideoElement.webkitEnterFullscreen()/webkitEnterFullScreen()
kPrefixed = 1,
Expand All @@ -42,7 +42,7 @@ enum class FullscreenRequestType {
// the status bar should stay visible.
kForXrArWithCamera = 8,

// Explicit name for "no options" for backwards compatibility and convenience
// Convenience value for "no flags".
kUnprefixed = kNull,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ void MediaControlsMediaEventListener::Attach() {
// old APIs are handled.
GetMediaElement().addEventListener(event_type_names::kWebkitfullscreenchange,
this, /*use_capture=*/false);
media_controls_->GetDocument().addEventListener(
event_type_names::kFullscreenchange, this, false);
GetMediaElement().addEventListener(event_type_names::kFullscreenchange, this,
/*use_capture=*/false);

// Picture-in-Picture events.
if (media_controls_->GetDocument().GetSettings() &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}), { once: true });

video.addEventListener('play', t.step_func(() => {
video.addEventListener('webkitfullscreenchange',
video.addEventListener('fullscreenchange',
t.step_func(testFullscreenContinuesPlayback), { once: true });

// Double-tap to go fullscreen.
Expand All @@ -37,7 +37,7 @@
assert_equals(video, document.fullscreenElement, 'video should remain in fullscreen');
assert_true(video.paused, 'video should be paused');

video.addEventListener('webkitfullscreenchange',
video.addEventListener('fullscreenchange',
t.step_func(testFullscreenKeepsPaused), { once: true });

// Prevent these taps from being double-taps with the previous single-tap.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
doubleTapAtCoordinates(coordinates[0], coordinates[1]);
}, { once: true });

video.addEventListener('webkitfullscreenchange', t.step_func(() => {
video.addEventListener('fullscreenchange', t.step_func(() => {
assert_equals(video, document.fullscreenElement);

// We are now fullscreen, update the event handler and doubletap to exit
video.addEventListener('webkitfullscreenchange',
video.addEventListener('fullscreenchange',
t.step_func_done(), { once: true });

const coordinates = videoLeftEdgeCoordinates(video);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

video.addEventListener('pause', t.done.bind(t));

video.addEventListener('fullscreenchange', t.unreached_func());
video.addEventListener('webkitfullscreenchange', t.unreached_func());

video.play();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
coordinates[0], coordinates[1], 400, t.done.bind(t));
});

video.addEventListener('fullscreenchange', t.unreached_func());
video.addEventListener('webkitfullscreenchange', t.unreached_func());

video.play();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
async_test(t => {
var video = document.querySelector('video');

video.onwebkitfullscreenchange = t.step_func_done(_ => {
video.onfullscreenchange = t.step_func_done(_ => {
checkButtonHasClass(fullscreenButton(video), 'fullscreen');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
video.width = 400;
video.src='../content/60_sec_video.webm';
document.body.appendChild(video);
video.addEventListener("fullscreenchange", t.unreached_func());
video.addEventListener("webkitfullscreenchange", t.unreached_func());

window.onload = t.step_func(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
clickAtCoordinates(...inlineFullscreenButtonCoordinates);
}), video);

video.onwebkitfullscreenchange = t.step_func(function() {
video.onwebkitfullscreenchange = null;
video.onfullscreenchange = t.step_func(function() {
video.onfullscreenchange = null;

assert_equals(document.webkitFullscreenElement, video,
assert_equals(document.fullscreenElement, video,
"Should have entered fullscreen");

assert_equals(getComputedStyle(panel).opacity, "1",
Expand All @@ -67,8 +67,8 @@
clickAtCoordinates(...fullscreenFullscreenButtonCoordinates);
}), video);

video.onwebkitfullscreenchange = t.step_func(function() {
assert_equals(document.webkitFullscreenElement, null,
video.onfullscreenchange = t.step_func(function() {
assert_equals(document.fullscreenElement, null,
"Should have exited fullscreen");

waitForHoverEffectUpdate(t.step_func(function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
assert_true(muteBtn.disabled);

// Test that the fullscreen button is actually disabled.
video.addEventListener("fullscreenchange", t.unreached_func());
video.addEventListener("webkitfullscreenchange", t.unreached_func());
singleTapOnControl(fullscreenBtn, t.step_func(() => {
// Test that the mute button is actually disabled.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ function fullscreen_test()
// wait for the fullscreenchange event
}));

v1.addEventListener("webkitfullscreenchange", t.step_func_done());
v1.addEventListener("fullscreenchange", t.step_func_done());

v2.addEventListener("webkitfullscreenchange", t.unreached_func());
v2.addEventListener("fullscreenchange", t.unreached_func());
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
var coords = elementCoordinates(overflowList.children[OverflowMenuButtons.FULLSCREEN]);
clickAtCoordinates(coords[0], coords[1]);

document.onwebkitfullscreenchange = t.step_func(() => {
document.onfullscreenchange = t.step_func(() => {
assert_equals(document.fullscreenElement, video);
// Hiding the overflow menu is triggered by layout.
runAfterLayoutAndPaint(t.step_func_done(() => {
Expand Down

0 comments on commit efc5a58

Please sign in to comment.