[Modern Media Controls] Toggle playback when clicking on the video on macOS
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Feb 2017 21:40:37 +0000 (21:40 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Feb 2017 21:40:37 +0000 (21:40 +0000)
commitbd593524dd5e4c7f9d2724a5fac501e92fbf2070
tree5fdf79aabc5f2f8ac4cc4e3edb8d82d4d678f93a
parentea94ac11b6f21614f5ffd9adc38df9a69d9bc4aa
[Modern Media Controls] Toggle playback when clicking on the video on macOS
https://bugs.webkit.org/show_bug.cgi?id=168515
<rdar://problem/30577441>

Reviewed by Dean Jackson.

Source/WebCore:

Listen to click events on the macOS media controls. Detect any clicks that were on the
background instead of the controls widgets themselves, and tell the delegate (MediaController)
about them.

Tests: media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause.html
       media/modern-media-controls/media-controller/media-controller-click-on-video-background-to-dismiss-tracks-panel-should-not-toggle-playback.html
       media/modern-media-controls/media-controller/media-controller-click-on-video-controls-should-not-pause.html

* Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
(MacOSFullscreenMediaControls.prototype._handleMousedown):
* Modules/modern-media-controls/controls/macos-inline-media-controls.js:
(MacOSInlineMediaControls.prototype.handleEvent):
* Modules/modern-media-controls/controls/macos-media-controls.js:
(MacOSMediaControls.prototype.handleEvent):
(MacOSMediaControls):
* Modules/modern-media-controls/media/media-controller.js:
(MediaController.prototype.togglePlayback):
(MediaController.prototype.macOSControlsBackgroundWasClicked):
(MediaController.prototype._updateControlsIfNeeded):
* Modules/modern-media-controls/media/playback-support.js:
(PlaybackSupport.prototype.buttonWasPressed):

LayoutTests:

* media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause-expected.txt: Added.
* media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause.html: Added.
* media/modern-media-controls/media-controller/media-controller-click-on-video-background-to-dismiss-tracks-panel-should-not-toggle-playback-expected.txt: Added.
* media/modern-media-controls/media-controller/media-controller-click-on-video-background-to-dismiss-tracks-panel-should-not-toggle-playback.html: Added.
* media/modern-media-controls/media-controller/media-controller-click-on-video-controls-should-not-pause-expected.txt: Added.
* media/modern-media-controls/media-controller/media-controller-click-on-video-controls-should-not-pause.html: Added.
* media/modern-media-controls/media-documents/click-on-video-should-not-pause-expected.txt:
* media/modern-media-controls/media-documents/click-on-video-should-not-pause.html:
* platform/ios-simulator/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212573 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
LayoutTests/ChangeLog
LayoutTests/media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause-expected.txt [new file with mode: 0644]
LayoutTests/media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause.html [new file with mode: 0644]
LayoutTests/media/modern-media-controls/media-controller/media-controller-click-on-video-background-to-dismiss-tracks-panel-should-not-toggle-playback-expected.txt [new file with mode: 0644]
LayoutTests/media/modern-media-controls/media-controller/media-controller-click-on-video-background-to-dismiss-tracks-panel-should-not-toggle-playback.html [new file with mode: 0644]
LayoutTests/media/modern-media-controls/media-controller/media-controller-click-on-video-controls-should-not-pause-expected.txt [new file with mode: 0644]
LayoutTests/media/modern-media-controls/media-controller/media-controller-click-on-video-controls-should-not-pause.html [new file with mode: 0644]
LayoutTests/media/modern-media-controls/media-documents/click-on-video-should-not-pause-expected.txt
LayoutTests/media/modern-media-controls/media-documents/click-on-video-should-not-pause.html
LayoutTests/platform/ios-simulator/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js
Source/WebCore/Modules/modern-media-controls/controls/macos-inline-media-controls.js
Source/WebCore/Modules/modern-media-controls/controls/macos-media-controls.js
Source/WebCore/Modules/modern-media-controls/media/media-controller.js
Source/WebCore/Modules/modern-media-controls/media/playback-support.js