Commit 88e14121 authored by François Beaufort's avatar François Beaufort Committed by Commit Bot

Add Auto Picture-in-Picture Origin Trial

Intent to Experiment: https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/eFZ3h_A3VTY

Bug: 917303
Change-Id: I96e19600bad93f53b2014bacea6aa49c9d74a269
Reviewed-on: https://chromium-review.googlesource.com/c/1426703Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
Reviewed-by: default avatarIan Clelland <iclelland@chromium.org>
Reviewed-by: default avatarMounir Lamouri <mlamouri@chromium.org>
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
Cr-Commit-Position: refs/heads/master@{#626971}
parent 84f37f06
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
#include "third_party/blink/renderer/core/layout/layout_image.h" #include "third_party/blink/renderer/core/layout/layout_image.h"
#include "third_party/blink/renderer/core/layout/layout_video.h" #include "third_party/blink/renderer/core/layout/layout_video.h"
#include "third_party/blink/renderer/core/layout/layout_view.h" #include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/origin_trials/origin_trials.h"
#include "third_party/blink/renderer/platform/graphics/canvas_resource_provider.h" #include "third_party/blink/renderer/platform/graphics/canvas_resource_provider.h"
#include "third_party/blink/renderer/platform/graphics/gpu/extensions_3d_util.h" #include "third_party/blink/renderer/platform/graphics/gpu/extensions_3d_util.h"
#include "third_party/blink/renderer/platform/graphics/graphics_context.h" #include "third_party/blink/renderer/platform/graphics/graphics_context.h"
...@@ -238,7 +239,8 @@ void HTMLVideoElement::ParseAttribute( ...@@ -238,7 +239,8 @@ void HTMLVideoElement::ParseAttribute(
GetLayoutObject()->IsVideo()) GetLayoutObject()->IsVideo())
ToLayoutVideo(GetLayoutObject())->IntrinsicSizeChanged(); ToLayoutVideo(GetLayoutObject())->IntrinsicSizeChanged();
} else if (params.name == kAutopictureinpictureAttr && } else if (params.name == kAutopictureinpictureAttr &&
RuntimeEnabledFeatures::AutoPictureInPictureEnabled()) { origin_trials::AutoPictureInPictureEnabled(
GetExecutionContext())) {
if (!params.new_value.IsNull()) { if (!params.new_value.IsNull()) {
PictureInPictureController::From(GetDocument()) PictureInPictureController::From(GetDocument())
.AddToAutoPictureInPictureElementsList(this); .AddToAutoPictureInPictureElementsList(this);
......
...@@ -4,17 +4,16 @@ ...@@ -4,17 +4,16 @@
// https://wicg.github.io/picture-in-picture/#htmlvideoelement-extensions // https://wicg.github.io/picture-in-picture/#htmlvideoelement-extensions
[ [
ImplementedAs=HTMLVideoElementPictureInPicture, ImplementedAs=HTMLVideoElementPictureInPicture
RuntimeEnabled=PictureInPictureAPI
] ]
partial interface HTMLVideoElement { partial interface HTMLVideoElement {
[CallWith=ScriptState, Measure, NewObject] Promise<PictureInPictureWindow> requestPictureInPicture(); [RuntimeEnabled=PictureInPictureAPI, CallWith=ScriptState, Measure, NewObject] Promise<PictureInPictureWindow> requestPictureInPicture();
[RuntimeEnabled=PictureInPictureControl] void setPictureInPictureControls(sequence<PictureInPictureControl> pipControls); [RuntimeEnabled=PictureInPictureControl] void setPictureInPictureControls(sequence<PictureInPictureControl> pipControls);
attribute EventHandler onenterpictureinpicture; [RuntimeEnabled=PictureInPictureAPI] attribute EventHandler onenterpictureinpicture;
attribute EventHandler onleavepictureinpicture; [RuntimeEnabled=PictureInPictureAPI] attribute EventHandler onleavepictureinpicture;
[RuntimeEnabled=PictureInPictureControl] attribute EventHandler onpictureinpicturecontrolclick; [RuntimeEnabled=PictureInPictureControl] attribute EventHandler onpictureinpicturecontrolclick;
[RuntimeEnabled=AutoPictureInPicture, CEReactions, Measure, Reflect] attribute boolean autoPictureInPicture; [OriginTrialEnabled=AutoPictureInPicture, CEReactions, Measure, Reflect] attribute boolean autoPictureInPicture;
[CEReactions, Measure, Reflect] attribute boolean disablePictureInPicture; [RuntimeEnabled=PictureInPictureAPI, CEReactions, Measure, Reflect] attribute boolean disablePictureInPicture;
}; };
...@@ -113,6 +113,8 @@ ...@@ -113,6 +113,8 @@
}, },
{ {
name: "AutoPictureInPicture", name: "AutoPictureInPicture",
depends_on: ["PictureInPictureAPI"],
origin_trial_feature_name: "AutoPictureInPicture",
status: "experimental", status: "experimental",
}, },
{ {
......
<!DOCTYPE html>
<meta charset="utf-8">
<!-- Generate token with the command:
generate_token.py http://127.0.0.1:8000 AutoPictureInPicture --expire-timestamp=2000000000
-->
<meta http-equiv="origin-trial" content="At8TdACNKoUe/s/mrfCk9A0o+kksPEeI53NWPTEwQImY6MLC+HWuO53CYt/IQju7VzodQhlGFdRWJ3AuA6AxGg8AAABceyJvcmlnaW4iOiAiaHR0cDovLzEyNy4wLjAuMTo4MDAwIiwgImZlYXR1cmUiOiAiQXV0b1BpY3R1cmVJblBpY3R1cmUiLCAiZXhwaXJ5IjogMjAwMDAwMDAwMH0=" />
<title>Auto Picture-in-Picture - properties exposed by origin trial</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/origin-trials-helper.js"></script>
<script>
test(t => {
OriginTrialsHelper.check_properties(this,
{ 'HTMLVideoElement': ['autoPictureInPicture'] });
}, 'Auto Picture-in-Picture properties in Origin-Trial enabled document.');
</script>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment