[Modern Media Controls] Media Controller: click-to-start support
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Oct 2016 19:04:35 +0000 (19:04 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Oct 2016 19:04:35 +0000 (19:04 +0000)
commitc107dbffc6f07b1ba3ccca92d85beb51d808d860
tree6a6f237baa1bcc59659cfd3391370ea4adfab445
parentdeb4195b627e752f6f9e852f9a7f193a100edf03
[Modern Media Controls] Media Controller: click-to-start support
https://bugs.webkit.org/show_bug.cgi?id=163659
<rdar://problem/28845656>

Patch by Antoine Quint <graouts@apple.com> on 2016-10-19
Reviewed by Dean Jackson.

Source/WebCore:

We introduce the MediaControllerSupport class which will allow a number of media controller
features to be implemented by subclasses each devoted to implementing a specific subset of
media controller features. With this bug, we add the correct behavior for click-to-start,
only showing the start button under the right circumstances.

A MediaController object indicates which media control to attach click event listeners to
through the `control` property, and a list of media events it should register on the media
element through the `mediaEvents` property. Then, as the user interacts with the specified
control and the media, the Button delegation method `buttonWasClicked()` and the `syncControl()`
methods are called to allow for the media state to be correctly set and represented in the
media controls. Custom event handling for the specified events can also be achieved by
subclassing the `handleEvent()` method.

Tests: media/modern-media-controls/start-support/start-support-audio.html
       media/modern-media-controls/start-support/start-support-autoplay.html
       media/modern-media-controls/start-support/start-support-click-to-start.html
       media/modern-media-controls/start-support/start-support-error.html
       media/modern-media-controls/start-support/start-support-fullscreen.html
       media/modern-media-controls/start-support/start-support-manual-play.html
       media/modern-media-controls/start-support/start-support-no-source.html

* Modules/modern-media-controls/media/media-controller-support.js: Added.
(MediaControllerSupport):
(MediaControllerSupport.prototype.get control):
(MediaControllerSupport.prototype.get mediaEvents):
(MediaControllerSupport.prototype.buttonWasClicked):
(MediaControllerSupport.prototype.handleEvent):
(MediaControllerSupport.prototype.syncControl):
* Modules/modern-media-controls/media/media-controller.js:
(MediaController):
(MediaController.prototype.buttonWasClicked): Deleted.
* Modules/modern-media-controls/media/start-support.js: Added.
(StartSupport.prototype.get control):
(StartSupport.prototype.get mediaEvents):
(StartSupport.prototype.buttonWasClicked):
(StartSupport.prototype.handleEvent):
(StartSupport.prototype.syncControl):
(StartSupport.prototype._shouldShowStartButton):
(StartSupport):

LayoutTests:

New test coverage for the StartSupport class.

* media/modern-media-controls/media-controller/media-controller-constructor.html:
* media/modern-media-controls/media-controller/media-controller-resize.html:
* media/modern-media-controls/start-support/start-support-audio-expected.txt: Added.
* media/modern-media-controls/start-support/start-support-audio.html: Added.
* media/modern-media-controls/start-support/start-support-autoplay-expected.txt: Added.
* media/modern-media-controls/start-support/start-support-autoplay.html: Added.
* media/modern-media-controls/start-support/start-support-click-to-start-expected.txt: Renamed from LayoutTests/media/modern-media-controls/media-controller/media-controller-click-to-start-expected.txt.
* media/modern-media-controls/start-support/start-support-click-to-start.html: Renamed from LayoutTests/media/modern-media-controls/media-controller/media-controller-click-to-start.html.
* media/modern-media-controls/start-support/start-support-error-expected.txt: Added.
* media/modern-media-controls/start-support/start-support-error.html: Added.
* media/modern-media-controls/start-support/start-support-fullscreen-expected.txt: Added.
* media/modern-media-controls/start-support/start-support-fullscreen.html: Added.
* media/modern-media-controls/start-support/start-support-manual-play-expected.txt: Added.
* media/modern-media-controls/start-support/start-support-manual-play.html: Added.
* media/modern-media-controls/start-support/start-support-no-source-expected.txt: Added.
* media/modern-media-controls/start-support/start-support-no-source.html: Added.
* platform/ios-simulator/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207554 268f45cc-cd09-0410-ab3c-d52691b4dbfc
22 files changed:
LayoutTests/ChangeLog
LayoutTests/media/modern-media-controls/media-controller/media-controller-constructor.html
LayoutTests/media/modern-media-controls/media-controller/media-controller-resize.html
LayoutTests/media/modern-media-controls/start-support/start-support-audio-expected.txt [new file with mode: 0644]
LayoutTests/media/modern-media-controls/start-support/start-support-audio.html [new file with mode: 0644]
LayoutTests/media/modern-media-controls/start-support/start-support-autoplay-expected.txt [new file with mode: 0644]
LayoutTests/media/modern-media-controls/start-support/start-support-autoplay.html [moved from LayoutTests/media/modern-media-controls/media-controller/media-controller-click-to-start.html with 92% similarity]
LayoutTests/media/modern-media-controls/start-support/start-support-click-to-start-expected.txt [moved from LayoutTests/media/modern-media-controls/media-controller/media-controller-click-to-start-expected.txt with 100% similarity]
LayoutTests/media/modern-media-controls/start-support/start-support-click-to-start.html [new file with mode: 0644]
LayoutTests/media/modern-media-controls/start-support/start-support-error-expected.txt [new file with mode: 0644]
LayoutTests/media/modern-media-controls/start-support/start-support-error.html [new file with mode: 0644]
LayoutTests/media/modern-media-controls/start-support/start-support-fullscreen-expected.txt [new file with mode: 0644]
LayoutTests/media/modern-media-controls/start-support/start-support-fullscreen.html [new file with mode: 0644]
LayoutTests/media/modern-media-controls/start-support/start-support-manual-play-expected.txt [new file with mode: 0644]
LayoutTests/media/modern-media-controls/start-support/start-support-manual-play.html [new file with mode: 0644]
LayoutTests/media/modern-media-controls/start-support/start-support-no-source-expected.txt [new file with mode: 0644]
LayoutTests/media/modern-media-controls/start-support/start-support-no-source.html [new file with mode: 0644]
LayoutTests/platform/ios-simulator/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/Modules/modern-media-controls/media/media-controller-support.js [new file with mode: 0644]
Source/WebCore/Modules/modern-media-controls/media/media-controller.js
Source/WebCore/Modules/modern-media-controls/media/start-support.js [new file with mode: 0644]