https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 736f2bef4c6150b8584798121663db838b573320 authored by Emilio Cobos Álvarez on 04 April 2018, 18:00:47 UTC
Fix the logic to do layout stuff after reassigning a slot.
Tip revision: 736f2be
picture-in-picture-helpers.js
function callWithTrustedClick(callback) {
  return new Promise(resolve => {
    let button = document.createElement('button');
    button.textContent = 'click to continue test';
    button.style.display = 'block';
    button.style.fontSize = '20px';
    button.style.padding = '10px';
    button.onclick = () => {
      document.body.removeChild(button);
      resolve(callback());
    };
    document.body.appendChild(button);
    test_driver.click(button);
  });
}

// Calls requestPictureInPicture() in a context that's 'allowed to request PiP'.
function requestPictureInPictureWithTrustedClick(videoElement) {
  return callWithTrustedClick(
      () => videoElement.requestPictureInPicture());
}
back to top