Media controls should not be displayed for a video until it starts playing
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Jul 2016 20:51:43 +0000 (20:51 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Jul 2016 20:51:43 +0000 (20:51 +0000)
commit1f7da1acc818c15c6d91860799541db46a4fcc72
treec6eaa411c3cefa7fb777895d6150d708d09c12bc
parent2066956fb11ee3cfeeaee90292645bd84bd5bfe0
Media controls should not be displayed for a video until it starts playing
https://bugs.webkit.org/show_bug.cgi?id=160092
<rdar://problem/26986673>

Reviewed by Beth Dakin.

Source/WebCore:

For videos that have never played back yet, we should not show media controls. To ensure this
behavior, we ensure that the playback behavior restriction is set upon creating the media
element. This restriction is then removed when the media element begins to play.

Added two new WebKit API tests.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):

Tools:

Verify that multiple videos do or don't show the media controller depending on whether videos
are playing. Also tweaks an existing API test (VideoControlsManagerSingleLargeVideo) that was
passing because we were always showing media controls for large videos with audio, even if they
had not played back yet. This change ensures that large videos with audio show media controls
only after they begin to play back, and not by virtue of being large enough for main content.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.html:
* TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-with-audio-autoplay.html: Added.
* TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-with-audio.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203698 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.html
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-with-audio-autoplay.html [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-with-audio.html [new file with mode: 0644]