Placeholder does not show the first time going into picture-in-picture on video witho...
authoradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Aug 2016 22:48:58 +0000 (22:48 +0000)
committeradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Aug 2016 22:48:58 +0000 (22:48 +0000)
commit81f1cc400ba537a51b135e83ecbdc1f0cb650fc6
treed9d9570bbb83c4f103ea78fa38ae53384230ce8d
parentdb34cf5f6b1de3ce782a6ffba1008c4ed8c7eeea
Placeholder does not show the first time going into picture-in-picture on video without controls
https://bugs.webkit.org/show_bug.cgi?id=160868

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/controls/pip-placeholder-without-video-controls.html

If the media controls script is not injected by the time webkitpresentationmodechanged
event fires, the script that updates the stylesheet to show the placeholder won't execute.

To fix this, doing one of the following would work:
- Ensure the shadow dom for the video is set up when we schedule the
webkitpresentationmodechanged event.
- Make sure the styles are set up correctly to show the placeholder if needed
when the Controller object (in mediaControlsApple.js) is created.

Doing both here following what we did for the wireless playback status.

* Modules/mediacontrols/mediaControlsApple.js:
(Controller):
Call updatePictureInPicturePlaceholder() so it updates the styles to show the
placeholder if needed.
(Controller.prototype.updatePictureInPicturePlaceholder):
Extract the logic that updates the placeholder into a separate method so it can
be called when we initialize Controller.
(Controller.prototype.handlePresentationModeChange):
Call updatePictureInPicturePlaceholder().
* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS.prototype.updatePictureInPicturePlaceholder):
Renamed from handlePresentationModeChange().
(ControllerIOS.prototype.handlePresentationModeChange): Deleted.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::enterFullscreen):
Call configureMediaControls() which ensures the shadow root gets added if needed.

LayoutTests:

Test that a video without controls attribute does show after going into picture-in-picture.

* TestExpectations:
* media/controls/pip-placeholder-without-video-controls-expected.txt: Added.
* media/controls/pip-placeholder-without-video-controls.html: Added.
* platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204534 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/media/controls/pip-placeholder-without-video-controls-expected.txt [new file with mode: 0644]
LayoutTests/media/controls/pip-placeholder-without-video-controls.html [new file with mode: 0644]
LayoutTests/platform/mac-wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediacontrols/mediaControlsApple.js
Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js
Source/WebCore/html/HTMLMediaElement.cpp