<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[203928] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/203928">203928</a></dd>
<dt>Author</dt> <dd>wenson_hsieh@apple.com</dd>
<dt>Date</dt> <dd>2016-07-29 17:11:27 -0700 (Fri, 29 Jul 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Media controls are not displayed for some autoplaying videos at certain browser dimensions
https://bugs.webkit.org/show_bug.cgi?id=160360
<rdar://problem/27179484>
Reviewed by Myles C. Maxfield.
Source/WebCore:
Previously, if a video's aspect ratio fell outside of the range [0.5, 1.8], we would
not consider it main content and would subsequently not show media controls for it.
This meant that on many websites that scale video dimensions to match the mainframe,
if the mainframe is too wide (e.g. full bounds on a widescreen display) we would not
consider the video to be main content. To fix this, we only consider aspect ratio to
be a requirement if the video does not already take up most of the space in the
mainframe.
Covered by two new TestWebKitAPI unit tests.
* html/MediaElementSession.cpp:
(WebCore::isElementLargeRelativeToMainFrame):
(WebCore::isElementLargeEnoughForMainContent):
Tools:
Adds two tests verifying that videos may be considered main content as long as they
are large enough and cover a majority of the mainframe's viewport.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/full-size-autoplaying-video-with-audio.html: Added.
* TestWebKitAPI/Tests/WebKit2Cocoa/skinny-autoplaying-video-with-audio.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlMediaElementSessioncpp">trunk/Source/WebCore/html/MediaElementSession.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaVideoControlsManagermm">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2Cocoafullsizeautoplayingvideowithaudiohtml">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/full-size-autoplaying-video-with-audio.html</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2Cocoaskinnyautoplayingvideowithaudiohtml">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/skinny-autoplaying-video-with-audio.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (203927 => 203928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-07-30 00:07:37 UTC (rev 203927)
+++ trunk/Source/WebCore/ChangeLog        2016-07-30 00:11:27 UTC (rev 203928)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2016-07-29 Wenson Hsieh <wenson_hsieh@apple.com>
+
+ Media controls are not displayed for some autoplaying videos at certain browser dimensions
+ https://bugs.webkit.org/show_bug.cgi?id=160360
+ <rdar://problem/27179484>
+
+ Reviewed by Myles C. Maxfield.
+
+ Previously, if a video's aspect ratio fell outside of the range [0.5, 1.8], we would
+ not consider it main content and would subsequently not show media controls for it.
+ This meant that on many websites that scale video dimensions to match the mainframe,
+ if the mainframe is too wide (e.g. full bounds on a widescreen display) we would not
+ consider the video to be main content. To fix this, we only consider aspect ratio to
+ be a requirement if the video does not already take up most of the space in the
+ mainframe.
+
+ Covered by two new TestWebKitAPI unit tests.
+
+ * html/MediaElementSession.cpp:
+ (WebCore::isElementLargeRelativeToMainFrame):
+ (WebCore::isElementLargeEnoughForMainContent):
+
</ins><span class="cx"> 2016-07-29 Zalan Bujtas <zalan@apple.com>
</span><span class="cx">
</span><span class="cx"> Do not set negative rate on AVSampleBufferRenderSynchronizer.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlMediaElementSessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (203927 => 203928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/MediaElementSession.cpp        2016-07-30 00:07:37 UTC (rev 203927)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp        2016-07-30 00:11:27 UTC (rev 203928)
</span><span class="lines">@@ -599,11 +599,32 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static bool isElementLargeRelativeToMainFrame(const HTMLMediaElement& element)
+{
+ static const double minimumPercentageOfMainFrameAreaForMainContent = 0.9;
+ auto* renderer = element.renderer();
+ if (!renderer)
+ return false;
+
+ auto* documentFrame = element.document().frame();
+ if (!documentFrame)
+ return false;
+
+ if (!documentFrame->mainFrame().view())
+ return false;
+
+ auto& mainFrameView = *documentFrame->mainFrame().view();
+ auto maxVisibleClientWidth = std::min(renderer->clientWidth().toInt(), mainFrameView.visibleWidth());
+ auto maxVisibleClientHeight = std::min(renderer->clientHeight().toInt(), mainFrameView.visibleHeight());
+
+ return maxVisibleClientWidth * maxVisibleClientHeight > minimumPercentageOfMainFrameAreaForMainContent * mainFrameView.visibleWidth() * mainFrameView.visibleHeight();
+}
+
</ins><span class="cx"> static bool isElementLargeEnoughForMainContent(const HTMLMediaElement& element)
</span><span class="cx"> {
</span><span class="cx"> static const double elementMainContentAreaMinimum = 400 * 300;
</span><span class="cx"> static const double maximumAspectRatio = 1.8; // Slightly larger than 16:9.
</span><del>- static const double minimumAspectRatio = .5; // Slightly smaller than 16:9.
</del><ins>+ static const double minimumAspectRatio = .5; // Slightly smaller than 9:16.
</ins><span class="cx">
</span><span class="cx"> // Elements which have not yet been laid out, or which are not yet in the DOM, cannot be main content.
</span><span class="cx"> auto* renderer = element.renderer();
</span><span class="lines">@@ -614,7 +635,14 @@
</span><span class="cx"> double height = renderer->clientHeight();
</span><span class="cx"> double area = width * height;
</span><span class="cx"> double aspectRatio = width / height;
</span><del>- return area >= elementMainContentAreaMinimum && aspectRatio >= minimumAspectRatio && aspectRatio <= maximumAspectRatio;
</del><ins>+
+ if (area < elementMainContentAreaMinimum)
+ return false;
+
+ if (aspectRatio >= minimumAspectRatio && aspectRatio <= maximumAspectRatio)
+ return true;
+
+ return isElementLargeRelativeToMainFrame(element);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void MediaElementSession::mainContentCheckTimerFired()
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (203927 => 203928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-07-30 00:07:37 UTC (rev 203927)
+++ trunk/Tools/ChangeLog        2016-07-30 00:11:27 UTC (rev 203928)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-07-29 Wenson Hsieh <wenson_hsieh@apple.com>
+
+ Media controls are not displayed for some autoplaying videos at certain browser dimensions
+ https://bugs.webkit.org/show_bug.cgi?id=160360
+ <rdar://problem/27179484>
+
+ Reviewed by Myles C. Maxfield.
+
+ Adds two tests verifying that videos may be considered main content as long as they
+ are large enough and cover a majority of the mainframe's viewport.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm:
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/WebKit2Cocoa/full-size-autoplaying-video-with-audio.html: Added.
+ * TestWebKitAPI/Tests/WebKit2Cocoa/skinny-autoplaying-video-with-audio.html: Added.
+
</ins><span class="cx"> 2016-07-29 Mark Lam <mark.lam@apple.com>
</span><span class="cx">
</span><span class="cx"> Gardening: removed unused variable.
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (203927 => 203928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-07-30 00:07:37 UTC (rev 203927)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-07-30 00:11:27 UTC (rev 203928)
</span><span class="lines">@@ -435,6 +435,8 @@
</span><span class="cx">                 CEBABD491B71687C0051210A /* should-open-external-schemes.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CEBABD481B71687C0051210A /* should-open-external-schemes.html */; };
</span><span class="cx">                 E1220DCA155B28AA0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */; };
</span><span class="cx">                 E194E1BD177E53C7009C4D4E /* StopLoadingFromDidReceiveResponse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E194E1BC177E534A009C4D4E /* StopLoadingFromDidReceiveResponse.html */; };
</span><ins>+                F4F405BC1D4C0D1C007A9707 /* full-size-autoplaying-video-with-audio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4F405BA1D4C0CF8007A9707 /* full-size-autoplaying-video-with-audio.html */; };
+                F4F405BD1D4C0D1C007A9707 /* skinny-autoplaying-video-with-audio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4F405BB1D4C0CF8007A9707 /* skinny-autoplaying-video-with-audio.html */; };
</ins><span class="cx">                 F660AA1115A5F631003A1243 /* GetInjectedBundleInitializationUserDataCallback_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F660AA0F15A5F624003A1243 /* GetInjectedBundleInitializationUserDataCallback_Bundle.cpp */; };
</span><span class="cx">                 F660AA1515A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F660AA1415A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp */; };
</span><span class="cx">                 F6B7BE9517469212008A3445 /* DidAssociateFormControls_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6B7BE92174691EF008A3445 /* DidAssociateFormControls_Bundle.cpp */; };
</span><span class="lines">@@ -504,6 +506,8 @@
</span><span class="cx">                         dstPath = TestWebKitAPI.resources;
</span><span class="cx">                         dstSubfolderSpec = 7;
</span><span class="cx">                         files = (
</span><ins>+                                F4F405BC1D4C0D1C007A9707 /* full-size-autoplaying-video-with-audio.html in Copy Resources */,
+                                F4F405BD1D4C0D1C007A9707 /* skinny-autoplaying-video-with-audio.html in Copy Resources */,
</ins><span class="cx">                                 515BE16F1D428BB100DD7C68 /* StoreBlobToBeDeleted.html in Copy Resources */,
</span><span class="cx">                                 2E1DFDF11D42E1E400714A00 /* large-video-seek-to-beginning-and-play-after-ending.html in Copy Resources */,
</span><span class="cx">                                 2E1B7B021D41B1B9007558B4 /* large-video-hides-controls-after-seek-to-end.html in Copy Resources */,
</span><span class="lines">@@ -1083,6 +1087,8 @@
</span><span class="cx">                 E4A757D3178AEA5B00B5D7A4 /* Deque.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Deque.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 E4C9ABC71B3DB1710040A987 /* RunLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunLoop.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 F3FC3EE213678B7300126A65 /* libgtest.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgtest.a; sourceTree = BUILT_PRODUCTS_DIR; };
</span><ins>+                F4F405BA1D4C0CF8007A9707 /* full-size-autoplaying-video-with-audio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "full-size-autoplaying-video-with-audio.html"; sourceTree = "<group>"; };
+                F4F405BB1D4C0CF8007A9707 /* skinny-autoplaying-video-with-audio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "skinny-autoplaying-video-with-audio.html"; sourceTree = "<group>"; };
</ins><span class="cx">                 F660AA0C15A5F061003A1243 /* GetInjectedBundleInitializationUserDataCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetInjectedBundleInitializationUserDataCallback.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 F660AA0F15A5F624003A1243 /* GetInjectedBundleInitializationUserDataCallback_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetInjectedBundleInitializationUserDataCallback_Bundle.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 F660AA1215A619C8003A1243 /* InjectedBundleInitializationUserDataCallbackWins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleInitializationUserDataCallbackWins.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -1356,6 +1362,8 @@
</span><span class="cx">                 A16F66B81C40E9E100BD4D24 /* Resources */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                F4F405BA1D4C0CF8007A9707 /* full-size-autoplaying-video-with-audio.html */,
+                                F4F405BB1D4C0CF8007A9707 /* skinny-autoplaying-video-with-audio.html */,
</ins><span class="cx">                                 2E1DFDF01D42E14400714A00 /* large-video-seek-to-beginning-and-play-after-ending.html */,
</span><span class="cx">                                 2E1B7B011D41B1B3007558B4 /* large-video-hides-controls-after-seek-to-end.html */,
</span><span class="cx">                                 2E1DFDEE1D42A6EB00714A00 /* large-videos-with-audio-autoplay.html */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaVideoControlsManagermm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm (203927 => 203928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm        2016-07-30 00:07:37 UTC (rev 203927)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm        2016-07-30 00:11:27 UTC (rev 203928)
</span><span class="lines">@@ -415,6 +415,44 @@
</span><span class="cx"> EXPECT_TRUE([webView _hasActiveVideoForControlsManager]);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+TEST(VideoControlsManager, VideoControlsManagerLongSkinnyVideoInWideMainFrame)
+{
+ RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ configuration.get().mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone;
+ RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 1600, 800) configuration:configuration.get()]);
+ RetainPtr<NSWindow> window = adoptNS([[NSWindow alloc] initWithContentRect:[webView frame] styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]);
+ [[window contentView] addSubview:webView.get()];
+
+ RetainPtr<MediaPlaybackMessageHandler> handler = adoptNS([[MediaPlaybackMessageHandler alloc] initWithWKWebView:webView.get() finalMessageString:@"playing"]);
+ [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"playingHandler"];
+ [handler setExpectedToHaveControlsManager:NO];
+
+ NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"skinny-autoplaying-video-with-audio" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+ [webView loadRequest:request];
+
+ TestWebKitAPI::Util::run(&testedControlsManagerAfterPlaying);
+ TestWebKitAPI::Util::run(&receivedScriptMessage);
+}
+
+TEST(VideoControlsManager, VideoControlsManagerFullSizeVideoInWideMainFrame)
+{
+ RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ configuration.get().mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone;
+ RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 1600, 800) configuration:configuration.get()]);
+ RetainPtr<NSWindow> window = adoptNS([[NSWindow alloc] initWithContentRect:[webView frame] styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]);
+ [[window contentView] addSubview:webView.get()];
+
+ RetainPtr<MediaPlaybackMessageHandler> handler = adoptNS([[MediaPlaybackMessageHandler alloc] initWithWKWebView:webView.get() finalMessageString:@"playing"]);
+ [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"playingHandler"];
+ [handler setExpectedToHaveControlsManager:YES];
+
+ NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"full-size-autoplaying-video-with-audio" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+ [webView loadRequest:request];
+
+ TestWebKitAPI::Util::run(&testedControlsManagerAfterPlaying);
+ TestWebKitAPI::Util::run(&receivedScriptMessage);
+}
+
</ins><span class="cx"> } // namespace TestWebKitAPI
</span><span class="cx">
</span><span class="cx"> #endif // WK_API_ENABLED && PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2Cocoafullsizeautoplayingvideowithaudiohtml"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/full-size-autoplaying-video-with-audio.html (0 => 203928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/full-size-autoplaying-video-with-audio.html         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/full-size-autoplaying-video-with-audio.html        2016-07-30 00:11:27 UTC (rev 203928)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ video {
+ width: 100vw;
+ height: 100vh;
+ }
+ </style>
+ <script>
+ function finishTest() {
+ setTimeout(function() {
+ try {
+ window.webkit.messageHandlers.playingHandler.postMessage("playing");
+ } catch(e) { }
+ }, 0);
+ }
+ </script>
+</head>
+<body>
+ <video autoplay src="video-with-audio.mp4" webkit-playsinline onplaying=finishTest()></video>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2Cocoaskinnyautoplayingvideowithaudiohtml"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/skinny-autoplaying-video-with-audio.html (0 => 203928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/skinny-autoplaying-video-with-audio.html         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/skinny-autoplaying-video-with-audio.html        2016-07-30 00:11:27 UTC (rev 203928)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ video {
+ width: 300vw;
+ height: 40vh;
+ }
+ </style>
+ <script>
+ function finishTest() {
+ setTimeout(function() {
+ try {
+ window.webkit.messageHandlers.playingHandler.postMessage("playing");
+ } catch(e) { }
+ }, 0);
+ }
+ </script>
+</head>
+<body>
+ <video autoplay src="video-with-audio.mp4" webkit-playsinline onplaying=finishTest()></video>
+</body>
+</html>
</ins></span></pre>
</div>
</div>
</body>
</html>