Bug 1436442 [wpt PR 9387] - [Picture-in-Picture] Add Shadow DOM support for pictureInPictureElement, a=testonly
authorFrançois Beaufort <beaufort.francois@gmail.com>
Mon, 26 Mar 2018 11:19:35 +0000
changeset 410870 b4350afa07ca23d6e0d69396c067407d4c560469
parent 410869 6d076a35699865845aba814c14973d11f02127e7
child 410871 a28c69d8cd5fe11111530bb2657c5d90b82c29f6
push id101593
push userjames@hoppipolla.co.uk
push dateSat, 31 Mar 2018 22:09:06 +0000
treeherdermozilla-inbound@feb3750f2fac [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1436442, 656517, 806249, 897513, 535747
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1436442 [wpt PR 9387] - [Picture-in-Picture] Add Shadow DOM support for pictureInPictureElement, a=testonly Automatic update from web-platform-tests[Picture-in-Picture] Add Shadow DOM support for pictureInPictureElement Until now, pictureInPictureElement was supported only in Document. This CL makes it compliant with the spec by adding Shadow DOM support to pictureInPictureElement. Note that I wish I could have used a partial interface DocumentOrShadowRoot but partial interface for mix-in IDL are not supported at that time (crbug.com/656517). Bug: 806249, 656517 Change-Id: I5f9666ea9c52ded9a6d07a238fc7756371b7550e Reviewed-on: https://chromium-review.googlesource.com/897513 Commit-Queue: Mounir Lamouri <mlamouri@chromium.org> Reviewed-by: apacible <apacible@chromium.org> Reviewed-by: Hayato Ito <hayato@chromium.org> Reviewed-by: Mounir Lamouri <mlamouri@chromium.org> Reviewed-by: Kentaro Hara <haraken@chromium.org> Cr-Commit-Position: refs/heads/master@{#535747} wpt-commits: 92d49351bff2af43398743e7581d60b5bcaf0af5 wpt-pr: 9387 wpt-commits: 92d49351bff2af43398743e7581d60b5bcaf0af5 wpt-pr: 9387
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/picture-in-picture/shadow-dom.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -345938,16 +345938,24 @@
    "picture-in-picture/request-picture-in-picture.html": [
     [
      "/picture-in-picture/request-picture-in-picture.html",
      {
       "testdriver": true
      }
     ]
    ],
+   "picture-in-picture/shadow-dom.html": [
+    [
+     "/picture-in-picture/shadow-dom.html",
+     {
+      "testdriver": true
+     }
+    ]
+   ],
    "pointerevents/extension/idlharness.html": [
     [
      "/pointerevents/extension/idlharness.html",
      {}
     ]
    ],
    "pointerevents/extension/pointerevent_constructor.html": [
     [
@@ -574225,16 +574233,20 @@
   "picture-in-picture/request-picture-in-picture.html": [
    "3359d5a1a2c605847122da6ae3eab19e2751cdeb",
    "testharness"
   ],
   "picture-in-picture/resources/picture-in-picture-helpers.js": [
    "84462753efc9803a053e3675b850654c0e57ca93",
    "support"
   ],
+  "picture-in-picture/shadow-dom.html": [
+   "d93f73abe52d38c26503c743fc64e440b8f779de",
+   "testharness"
+  ],
   "pointerevents/OWNERS": [
    "e76cae8532b1259fa8665b515468d0b25b0a9bb3",
    "support"
   ],
   "pointerevents/README.md": [
    "91a8bd86357b0d96ba3ab8f08f88c28436de484c",
    "support"
   ],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/picture-in-picture/shadow-dom.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<title>Test for pictureInPictureElement adjustment for Shadow DOM</title>
+<script src='/resources/testharness.js'></script>
+<script src='/resources/testharnessreport.js'></script>
+<script src="/resources/testdriver.js"></script>
+<script src="/resources/testdriver-vendor.js"></script>
+<script src="resources/picture-in-picture-helpers.js"></script>
+<script src='../shadow-dom/resources/shadow-dom.js'></script>
+<body>
+<div id='host'>
+  <template data-mode='open' id='root'>
+    <slot></slot>
+  </template>
+  <div id='host2'>
+    <template data-mode='open' id='root2'>
+      <div id='host3'>
+        <template data-mode='open' id='root3'>
+          <video id='video'></video>
+          <div id='host4'>
+            <template data-mode='open' id='root4'>
+              <div></div>
+            </template>
+          </div>
+        </template>
+      </div>
+      <div id='host5'>
+        <template data-mode='open' id='root5'>
+          <div></div>
+        </template>
+      </div>
+    </template>
+  </div>
+</div>
+</body>
+<script>
+promise_test(t => {
+  const ids = createTestTree(host);
+  document.body.appendChild(ids.host);
+
+  assert_equals(document.pictureInPictureElement, null);
+  assert_equals(ids.root.pictureInPictureElement, null);
+  assert_equals(ids.root2.pictureInPictureElement, null);
+  assert_equals(ids.root3.pictureInPictureElement, null);
+  assert_equals(ids.root4.pictureInPictureElement, null);
+  assert_equals(ids.root5.pictureInPictureElement, null);
+
+  return requestPictureInPictureWithTrustedClick(ids.video)
+  .then(() => {
+    assert_equals(document.pictureInPictureElement, ids.host2);
+    assert_equals(ids.root.pictureInPictureElement, null);
+    assert_equals(ids.root2.pictureInPictureElement, ids.host3);
+    assert_equals(ids.root3.pictureInPictureElement, ids.video);
+    assert_equals(ids.root4.pictureInPictureElement, null);
+    assert_equals(ids.root5.pictureInPictureElement, null);
+  })
+});
+</script>
\ No newline at end of file