Changeset 203698 in webkit
- Timestamp:
- Jul 25, 2016 1:51:43 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r203696 r203698 1 2016-07-25 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Media controls should not be displayed for a video until it starts playing 4 https://bugs.webkit.org/show_bug.cgi?id=160092 5 <rdar://problem/26986673> 6 7 Reviewed by Beth Dakin. 8 9 For videos that have never played back yet, we should not show media controls. To ensure this 10 behavior, we ensure that the playback behavior restriction is set upon creating the media 11 element. This restriction is then removed when the media element begins to play. 12 13 Added two new WebKit API tests. 14 15 * html/HTMLMediaElement.cpp: 16 (WebCore::HTMLMediaElement::HTMLMediaElement): 17 1 18 2016-07-25 Jiewen Tan <jiewen_tan@apple.com> 2 19 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r203690 r203698 444 444 #endif 445 445 m_mediaSession->addBehaviorRestriction(MediaElementSession::RequireUserGestureToControlControlsManager); 446 m_mediaSession->addBehaviorRestriction(MediaElementSession::RequirePlaybackToControlControlsManager); 446 447 447 448 Settings* settings = document.settings(); -
trunk/Tools/ChangeLog
r203690 r203698 1 2016-07-25 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Media controls should not be displayed for a video until it starts playing 4 https://bugs.webkit.org/show_bug.cgi?id=160092 5 <rdar://problem/26986673> 6 7 Reviewed by Beth Dakin. 8 9 Verify that multiple videos do or don't show the media controller depending on whether videos 10 are playing. Also tweaks an existing API test (VideoControlsManagerSingleLargeVideo) that was 11 passing because we were always showing media controls for large videos with audio, even if they 12 had not played back yet. This change ensures that large videos with audio show media controls 13 only after they begin to play back, and not by virtue of being large enough for main content. 14 15 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 16 * TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm: 17 (TestWebKitAPI::TEST): 18 * TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.html: 19 * TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-with-audio-autoplay.html: Added. 20 * TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-with-audio.html: Added. 21 1 22 2016-07-25 Wenson Hsieh <wenson_hsieh@apple.com> 2 23 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r203690 r203698 57 57 2E1B7B021D41B1B9007558B4 /* large-video-hides-controls-after-seek-to-end.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2E1B7B011D41B1B3007558B4 /* large-video-hides-controls-after-seek-to-end.html */; }; 58 58 2E1DFDF11D42E1E400714A00 /* large-video-seek-to-beginning-and-play-after-ending.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2E1DFDF01D42E14400714A00 /* large-video-seek-to-beginning-and-play-after-ending.html */; }; 59 2E1DFDED1D42A51100714A00 /* large-videos-with-audio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2E1DFDEC1D42A41C00714A00 /* large-videos-with-audio.html */; }; 60 2E1DFDEF1D42A6F200714A00 /* large-videos-with-audio-autoplay.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2E1DFDEE1D42A6EB00714A00 /* large-videos-with-audio-autoplay.html */; }; 59 61 2E7765CD16C4D80A00BA2BB1 /* mainIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E7765CC16C4D80A00BA2BB1 /* mainIOS.mm */; }; 60 62 2E7765CF16C4D81100BA2BB1 /* mainMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E7765CE16C4D81100BA2BB1 /* mainMac.mm */; }; … … 505 507 2E1B7B021D41B1B9007558B4 /* large-video-hides-controls-after-seek-to-end.html in Copy Resources */, 506 508 2E1B7B001D41ABA7007558B4 /* large-video-seek-after-ending.html in Copy Resources */, 509 2E1DFDEF1D42A6F200714A00 /* large-videos-with-audio-autoplay.html in Copy Resources */, 510 2E1DFDED1D42A51100714A00 /* large-videos-with-audio.html in Copy Resources */, 507 511 5C9E59411D3EB5AC00E3C62E /* ApplicationCache.db in Copy Resources */, 508 512 5C9E59421D3EB5AC00E3C62E /* ApplicationCache.db-shm in Copy Resources */, … … 708 712 2E1B7B011D41B1B3007558B4 /* large-video-hides-controls-after-seek-to-end.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "large-video-hides-controls-after-seek-to-end.html"; sourceTree = "<group>"; }; 709 713 2E1DFDF01D42E14400714A00 /* large-video-seek-to-beginning-and-play-after-ending.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "large-video-seek-to-beginning-and-play-after-ending.html"; sourceTree = "<group>"; }; 714 2E1DFDEC1D42A41C00714A00 /* large-videos-with-audio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "large-videos-with-audio.html"; sourceTree = "<group>"; }; 715 2E1DFDEE1D42A6EB00714A00 /* large-videos-with-audio-autoplay.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "large-videos-with-audio-autoplay.html"; sourceTree = "<group>"; }; 710 716 2E7765CC16C4D80A00BA2BB1 /* mainIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = mainIOS.mm; sourceTree = "<group>"; }; 711 717 2E7765CE16C4D81100BA2BB1 /* mainMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = mainMac.mm; sourceTree = "<group>"; }; … … 1347 1353 2E1DFDF01D42E14400714A00 /* large-video-seek-to-beginning-and-play-after-ending.html */, 1348 1354 2E1B7B011D41B1B3007558B4 /* large-video-hides-controls-after-seek-to-end.html */, 1355 2E1DFDEE1D42A6EB00714A00 /* large-videos-with-audio-autoplay.html */, 1349 1356 5C9E593E1D3EB1DE00E3C62E /* ApplicationCache.db */, 1350 1357 5C9E593F1D3EB1DE00E3C62E /* ApplicationCache.db-shm */, … … 1382 1389 51714EB31CF8C761004723C4 /* WebProcessKillIDBCleanup-2.html */, 1383 1390 2E1B7AFF1D41A95F007558B4 /* large-video-seek-after-ending.html */, 1391 2E1DFDEC1D42A41C00714A00 /* large-videos-with-audio.html */, 1384 1392 ); 1385 1393 name = Resources; -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm
r203690 r203698 172 172 } 173 173 174 TEST(VideoControlsManager, VideoControlsManagerMultipleVideosWithAudio) 175 { 176 RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]); 177 configuration.get().mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone; 178 RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) configuration:configuration.get()]); 179 180 __block BOOL didShowMediaControls; 181 __block bool isDoneLoading = false; 182 183 RetainPtr<NSWindow> window = adoptNS([[NSWindow alloc] initWithContentRect:[webView frame] styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]); 184 [[window contentView] addSubview:webView.get()]; 185 RetainPtr<OnLoadMessageHandler> onloadHandler = adoptNS([[OnLoadMessageHandler alloc] initWithWKWebView:webView.get() handler:^() { 186 didShowMediaControls = [webView _hasActiveVideoForControlsManager]; 187 isDoneLoading = true; 188 }]); 189 [[configuration userContentController] addScriptMessageHandler:onloadHandler.get() name:@"onloadHandler"]; 190 191 NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"large-videos-with-audio" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]; 192 [webView loadRequest:request]; 193 194 TestWebKitAPI::Util::run(&isDoneLoading); 195 EXPECT_FALSE(didShowMediaControls); 196 } 197 198 TEST(VideoControlsManager, VideoControlsManagerMultipleVideosWithAudioAndAutoplay) 199 { 200 RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]); 201 configuration.get().mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone; 202 RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) configuration:configuration.get()]); 203 204 __block BOOL didShowMediaControls; 205 __block bool isDoneLoading = false; 206 207 RetainPtr<NSWindow> window = adoptNS([[NSWindow alloc] initWithContentRect:[webView frame] styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]); 208 [[window contentView] addSubview:webView.get()]; 209 RetainPtr<OnLoadMessageHandler> onloadHandler = adoptNS([[OnLoadMessageHandler alloc] initWithWKWebView:webView.get() handler:^() { 210 didShowMediaControls = [webView _hasActiveVideoForControlsManager]; 211 isDoneLoading = true; 212 }]); 213 [[configuration userContentController] addScriptMessageHandler:onloadHandler.get() name:@"onloadHandler"]; 214 215 NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"large-videos-with-audio-autoplay" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]; 216 [webView loadRequest:request]; 217 218 TestWebKitAPI::Util::run(&isDoneLoading); 219 EXPECT_TRUE(didShowMediaControls); 220 } 221 174 222 TEST(VideoControlsManager, VideoControlsManagerSingleSmallAutoplayingVideo) 175 223 { -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.html
r200403 r203698 13 13 function playing() { 14 14 window.clearTimeout(timeout); 15 try { 16 window.webkit.messageHandlers.playingHandler.postMessage('playing'); 17 } catch(e) { 18 window.location = 'callback:playing'; 19 } 15 setTimeout(function() { 16 try { 17 window.webkit.messageHandlers.playingHandler.postMessage('playing'); 18 } catch(e) { 19 window.location = 'callback:playing'; 20 } 21 }, 0); 20 22 } 21 23
Note: See TracChangeset
for help on using the changeset viewer.