<!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>[197898] 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/197898">197898</a></dd>
<dt>Author</dt> <dd>jer.noble@apple.com</dd>
<dt>Date</dt> <dd>2016-03-09 16:22:12 -0800 (Wed, 09 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add heuristic for &quot;main content&quot; videos which override user gesture requirements
https://bugs.webkit.org/show_bug.cgi?id=155224

Reviewed by Eric Carlson.

Source/WebCore:

Tests: media/video-main-content-allow-then-deny.html
       media/video-main-content-allow.html
       media/video-main-content-deny-display-none.html
       media/video-main-content-deny-not-in-dom.html
       media/video-main-content-deny-not-visible.html
       media/video-main-content-deny-obscured.html
       media/video-main-content-deny-too-small.html

Add a new behavior &quot;restriction&quot; to MediaElementSession that allows media elements
to optionally overriding their own user gesture requirements if the session determines
that the media element is the page's &quot;main content&quot;.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::didAttachRenderers):
(WebCore::HTMLMediaElement::updateShouldPlay):
* html/HTMLMediaElement.h:
* html/MediaElementSession.cpp:
(WebCore::restrictionName):
(WebCore::MediaElementSession::MediaElementSession):
(WebCore::MediaElementSession::addBehaviorRestriction):
(WebCore::MediaElementSession::playbackPermitted):
(WebCore::MediaElementSession::dataLoadingPermitted):
(WebCore::isMainContent):
(WebCore::MediaElementSession::mainContentCheckTimerFired):
(WebCore::MediaElementSession::updateIsMainContent):
* html/MediaElementSession.h:
* testing/Internals.cpp:
(WebCore::Internals::setMediaElementRestrictions):

LayoutTests:

* media/video-main-content-allow-expected.txt: Added.
* media/video-main-content-allow-then-deny-expected.txt: Added.
* media/video-main-content-allow-then-deny.html: Added.
* media/video-main-content-allow.html: Added.
* media/video-main-content-deny-display-none-expected.txt: Added.
* media/video-main-content-deny-display-none.html: Added.
* media/video-main-content-deny-not-in-dom-expected.txt: Added.
* media/video-main-content-deny-not-in-dom.html: Added.
* media/video-main-content-deny-not-visible-expected.txt: Added.
* media/video-main-content-deny-not-visible.html: Added.
* media/video-main-content-deny-obscured-expected.txt: Added.
* media/video-main-content-deny-obscured.html: Added.
* media/video-main-content-deny-too-small-expected.txt: Added.
* media/video-main-content-deny-too-small.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementcpp">trunk/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementh">trunk/Source/WebCore/html/HTMLMediaElement.h</a></li>
<li><a href="#trunkSourceWebCorehtmlMediaElementSessioncpp">trunk/Source/WebCore/html/MediaElementSession.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlMediaElementSessionh">trunk/Source/WebCore/html/MediaElementSession.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsmediavideomaincontentallowexpectedtxt">trunk/LayoutTests/media/video-main-content-allow-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediavideomaincontentallowthendenyexpectedtxt">trunk/LayoutTests/media/video-main-content-allow-then-deny-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediavideomaincontentallowthendenyhtml">trunk/LayoutTests/media/video-main-content-allow-then-deny.html</a></li>
<li><a href="#trunkLayoutTestsmediavideomaincontentallowhtml">trunk/LayoutTests/media/video-main-content-allow.html</a></li>
<li><a href="#trunkLayoutTestsmediavideomaincontentdenydisplaynoneexpectedtxt">trunk/LayoutTests/media/video-main-content-deny-display-none-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediavideomaincontentdenydisplaynonehtml">trunk/LayoutTests/media/video-main-content-deny-display-none.html</a></li>
<li><a href="#trunkLayoutTestsmediavideomaincontentdenynotindomexpectedtxt">trunk/LayoutTests/media/video-main-content-deny-not-in-dom-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediavideomaincontentdenynotindomhtml">trunk/LayoutTests/media/video-main-content-deny-not-in-dom.html</a></li>
<li><a href="#trunkLayoutTestsmediavideomaincontentdenynotvisibleexpectedtxt">trunk/LayoutTests/media/video-main-content-deny-not-visible-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediavideomaincontentdenynotvisiblehtml">trunk/LayoutTests/media/video-main-content-deny-not-visible.html</a></li>
<li><a href="#trunkLayoutTestsmediavideomaincontentdenyobscuredexpectedtxt">trunk/LayoutTests/media/video-main-content-deny-obscured-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediavideomaincontentdenyobscuredhtml">trunk/LayoutTests/media/video-main-content-deny-obscured.html</a></li>
<li><a href="#trunkLayoutTestsmediavideomaincontentdenytoosmallexpectedtxt">trunk/LayoutTests/media/video-main-content-deny-too-small-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediavideomaincontentdenytoosmallhtml">trunk/LayoutTests/media/video-main-content-deny-too-small.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (197897 => 197898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-03-10 00:14:07 UTC (rev 197897)
+++ trunk/LayoutTests/ChangeLog        2016-03-10 00:22:12 UTC (rev 197898)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2016-03-09  Jer Noble  &lt;jer.noble@apple.com&gt;
+
+        Add heuristic for &quot;main content&quot; videos which override user gesture requirements
+        https://bugs.webkit.org/show_bug.cgi?id=155224
+
+        Reviewed by Eric Carlson.
+
+        * media/video-main-content-allow-expected.txt: Added.
+        * media/video-main-content-allow-then-deny-expected.txt: Added.
+        * media/video-main-content-allow-then-deny.html: Added.
+        * media/video-main-content-allow.html: Added.
+        * media/video-main-content-deny-display-none-expected.txt: Added.
+        * media/video-main-content-deny-display-none.html: Added.
+        * media/video-main-content-deny-not-in-dom-expected.txt: Added.
+        * media/video-main-content-deny-not-in-dom.html: Added.
+        * media/video-main-content-deny-not-visible-expected.txt: Added.
+        * media/video-main-content-deny-not-visible.html: Added.
+        * media/video-main-content-deny-obscured-expected.txt: Added.
+        * media/video-main-content-deny-obscured.html: Added.
+        * media/video-main-content-deny-too-small-expected.txt: Added.
+        * media/video-main-content-deny-too-small.html: Added.
+
</ins><span class="cx"> 2016-03-09  Ryan Haddad  &lt;ryanhaddad@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Skipping js/regress/getter-richards-try-catch.html on ios-simulator debug
</span></span></pre></div>
<a id="trunkLayoutTestsmediavideomaincontentallowexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-main-content-allow-expected.txt (0 => 197898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-main-content-allow-expected.txt                                (rev 0)
+++ trunk/LayoutTests/media/video-main-content-allow-expected.txt        2016-03-10 00:22:12 UTC (rev 197898)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+RUN(internals.setMediaElementRestrictions(video, &quot;RequireUserGestureForRateChange,OverrideUserGestureRequirementForMainContent&quot;))
+EVENT(canplaythrough)
+EVENT(playing)
+END OF TEST
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediavideomaincontentallowthendenyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-main-content-allow-then-deny-expected.txt (0 => 197898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-main-content-allow-then-deny-expected.txt                                (rev 0)
+++ trunk/LayoutTests/media/video-main-content-allow-then-deny-expected.txt        2016-03-10 00:22:12 UTC (rev 197898)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+RUN(internals.setMediaElementRestrictions(video, &quot;RequireUserGestureForRateChange,OverrideUserGestureRequirementForMainContent&quot;))
+EVENT(canplaythrough)
+EVENT(playing)
+RUN(video.style.visibility = &quot;hidden&quot;)
+EVENT(pause)
+END OF TEST
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediavideomaincontentallowthendenyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-main-content-allow-then-deny.html (0 => 197898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-main-content-allow-then-deny.html                                (rev 0)
+++ trunk/LayoutTests/media/video-main-content-allow-then-deny.html        2016-03-10 00:22:12 UTC (rev 197898)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;title&gt;video-main-content-allow&lt;/title&gt;
+    &lt;script src=&quot;video-test.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;media-file.js&quot;&gt;&lt;/script&gt;
+    &lt;script&gt;
+    function go() {
+        video = document.createElement('video');
+        run('internals.setMediaElementRestrictions(video, &quot;RequireUserGestureForRateChange,OverrideUserGestureRequirementForMainContent&quot;)');
+        document.body.appendChild(video);
+
+        video.src = findMediaFile('video', 'content/test');
+        waitForEvent('canplaythrough', canPlayThrough);
+    }
+
+    function canPlayThrough() {
+        video.play();
+        waitForEvent('playing', playing);
+    }
+
+    function playing() {
+        run('video.style.visibility = &quot;hidden&quot;');
+        waitForEventAndEnd('pause');
+        failTestIn(500);
+    }
+    &lt;/script&gt;
+    &lt;style&gt;
+    video {
+        width: 600px;
+        height: 400px;
+    }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;go()&quot;&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsmediavideomaincontentallowhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-main-content-allow.html (0 => 197898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-main-content-allow.html                                (rev 0)
+++ trunk/LayoutTests/media/video-main-content-allow.html        2016-03-10 00:22:12 UTC (rev 197898)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;title&gt;video-main-content-allow&lt;/title&gt;
+    &lt;script src=&quot;video-test.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;media-file.js&quot;&gt;&lt;/script&gt;
+    &lt;script&gt;
+    function go() {
+        video = document.createElement('video');
+        run('internals.setMediaElementRestrictions(video, &quot;RequireUserGestureForRateChange,OverrideUserGestureRequirementForMainContent&quot;)');
+        document.body.appendChild(video);
+
+        video.src = findMediaFile('video', 'content/test');
+        waitForEvent('canplaythrough', canPlayThrough);
+    }
+
+    function canPlayThrough() {
+        video.play();
+        waitForEventAndEnd('playing');
+        failTestIn(100);
+    }
+    &lt;/script&gt;
+    &lt;style&gt;
+    video {
+        width: 600px;
+        height: 400px;
+    }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;go()&quot;&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsmediavideomaincontentdenydisplaynoneexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-main-content-deny-display-none-expected.txt (0 => 197898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-main-content-deny-display-none-expected.txt                                (rev 0)
+++ trunk/LayoutTests/media/video-main-content-deny-display-none-expected.txt        2016-03-10 00:22:12 UTC (rev 197898)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+RUN(internals.setMediaElementRestrictions(video, &quot;RequireUserGestureForRateChange,OverrideUserGestureRequirementForMainContent&quot;))
+EVENT(canplaythrough)
+Did not begin playing OK
+END OF TEST
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediavideomaincontentdenydisplaynonehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-main-content-deny-display-none.html (0 => 197898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-main-content-deny-display-none.html                                (rev 0)
+++ trunk/LayoutTests/media/video-main-content-deny-display-none.html        2016-03-10 00:22:12 UTC (rev 197898)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;title&gt;video-main-content-allow&lt;/title&gt;
+    &lt;script src=&quot;video-test.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;media-file.js&quot;&gt;&lt;/script&gt;
+    &lt;script&gt;
+    function go() {
+        video = document.createElement('video');
+        run('internals.setMediaElementRestrictions(video, &quot;RequireUserGestureForRateChange,OverrideUserGestureRequirementForMainContent&quot;)');
+        document.body.appendChild(video);
+
+        video.src = findMediaFile('video', 'content/test');
+        waitForEvent('canplaythrough', canPlayThrough);
+    }
+
+    function canPlayThrough() {
+        video.play();
+        waitForEventAndFail('playing');
+        setTimeout(didNotBeginPlaying, 100);
+    }
+
+    function didNotBeginPlaying() {
+        logResult(true, 'Did not begin playing');
+        endTest();
+    }
+    &lt;/script&gt;
+    &lt;style&gt;
+    video {
+        width: 600px;
+        height: 400px;
+        display: none;
+    }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;go()&quot;&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsmediavideomaincontentdenynotindomexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-main-content-deny-not-in-dom-expected.txt (0 => 197898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-main-content-deny-not-in-dom-expected.txt                                (rev 0)
+++ trunk/LayoutTests/media/video-main-content-deny-not-in-dom-expected.txt        2016-03-10 00:22:12 UTC (rev 197898)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+RUN(internals.setMediaElementRestrictions(video, &quot;RequireUserGestureForRateChange,OverrideUserGestureRequirementForMainContent&quot;))
+EVENT(canplaythrough)
+Did not begin playing OK
+END OF TEST
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediavideomaincontentdenynotindomhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-main-content-deny-not-in-dom.html (0 => 197898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-main-content-deny-not-in-dom.html                                (rev 0)
+++ trunk/LayoutTests/media/video-main-content-deny-not-in-dom.html        2016-03-10 00:22:12 UTC (rev 197898)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;title&gt;video-main-content-allow&lt;/title&gt;
+    &lt;script src=&quot;video-test.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;media-file.js&quot;&gt;&lt;/script&gt;
+    &lt;script&gt;
+    function go() {
+        mediaElement = video = document.createElement('video');
+        // video.customProperty = 'custom';
+        run('internals.setMediaElementRestrictions(video, &quot;RequireUserGestureForRateChange,OverrideUserGestureRequirementForMainContent&quot;)');
+
+        video.src = findMediaFile('video', 'content/test');
+        waitForEvent('canplaythrough', canPlayThrough);
+    }
+
+    function canPlayThrough() {
+        video.play();
+        waitForEventAndFail('playing');
+        setTimeout(didNotBeginPlaying, 100);
+    }
+
+    function didNotBeginPlaying() {
+        logResult(true, 'Did not begin playing');
+        endTest();
+    }
+    &lt;/script&gt;
+    &lt;style&gt;
+    video {
+        width: 600px;
+        height: 400px;
+    }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;go()&quot;&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsmediavideomaincontentdenynotvisibleexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-main-content-deny-not-visible-expected.txt (0 => 197898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-main-content-deny-not-visible-expected.txt                                (rev 0)
+++ trunk/LayoutTests/media/video-main-content-deny-not-visible-expected.txt        2016-03-10 00:22:12 UTC (rev 197898)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+RUN(internals.setMediaElementRestrictions(video, &quot;RequireUserGestureForRateChange,OverrideUserGestureRequirementForMainContent&quot;))
+EVENT(canplaythrough)
+Did not begin playing OK
+END OF TEST
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediavideomaincontentdenynotvisiblehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-main-content-deny-not-visible.html (0 => 197898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-main-content-deny-not-visible.html                                (rev 0)
+++ trunk/LayoutTests/media/video-main-content-deny-not-visible.html        2016-03-10 00:22:12 UTC (rev 197898)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;title&gt;video-main-content-allow&lt;/title&gt;
+    &lt;script src=&quot;video-test.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;media-file.js&quot;&gt;&lt;/script&gt;
+    &lt;script&gt;
+    function go() {
+        video = document.createElement('video');
+        run('internals.setMediaElementRestrictions(video, &quot;RequireUserGestureForRateChange,OverrideUserGestureRequirementForMainContent&quot;)');
+        document.body.appendChild(video);
+
+        video.src = findMediaFile('video', 'content/test');
+        waitForEvent('canplaythrough', canPlayThrough);
+    }
+
+    function canPlayThrough() {
+        video.play();
+        waitForEventAndFail('playing');
+        setTimeout(didNotBeginPlaying, 100);
+    }
+
+    function didNotBeginPlaying() {
+        logResult(true, 'Did not begin playing');
+        endTest();
+    }
+    &lt;/script&gt;
+    &lt;style&gt;
+    video {
+        width: 600px;
+        height: 400px;
+        visibility: hidden;
+    }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;go()&quot;&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsmediavideomaincontentdenyobscuredexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-main-content-deny-obscured-expected.txt (0 => 197898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-main-content-deny-obscured-expected.txt                                (rev 0)
+++ trunk/LayoutTests/media/video-main-content-deny-obscured-expected.txt        2016-03-10 00:22:12 UTC (rev 197898)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+
+RUN(internals.setMediaElementRestrictions(video, &quot;RequireUserGestureForRateChange,OverrideUserGestureRequirementForMainContent&quot;))
+EVENT(canplaythrough)
+Did not begin playing OK
+END OF TEST
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediavideomaincontentdenyobscuredhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-main-content-deny-obscured.html (0 => 197898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-main-content-deny-obscured.html                                (rev 0)
+++ trunk/LayoutTests/media/video-main-content-deny-obscured.html        2016-03-10 00:22:12 UTC (rev 197898)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;title&gt;video-main-content-allow&lt;/title&gt;
+    &lt;script src=&quot;video-test.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;media-file.js&quot;&gt;&lt;/script&gt;
+    &lt;script&gt;
+    function go() {
+        video = document.createElement('video');
+        run('internals.setMediaElementRestrictions(video, &quot;RequireUserGestureForRateChange,OverrideUserGestureRequirementForMainContent&quot;)');
+        document.body.insertBefore(video, document.body.firstChild);
+
+        video.src = findMediaFile('video', 'content/test');
+        waitForEvent('canplaythrough', canPlayThrough);
+    }
+
+    function canPlayThrough() {
+        video.play();
+        waitForEventAndFail('playing');
+        setTimeout(didNotBeginPlaying, 100);
+    }
+
+    function didNotBeginPlaying() {
+        logResult(true, 'Did not begin playing');
+        endTest();
+    }
+    &lt;/script&gt;
+    &lt;style&gt;
+    video {
+        width: 600px;
+        height: 400px;
+    }
+    .block {
+        position: absolute;
+        top: 0px;
+        width: 600px;
+        height: 400px;
+        background-color: red;
+        z-index: 1;
+    }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;go()&quot;&gt;
+    &lt;div class=&quot;block&quot;&gt;&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsmediavideomaincontentdenytoosmallexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-main-content-deny-too-small-expected.txt (0 => 197898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-main-content-deny-too-small-expected.txt                                (rev 0)
+++ trunk/LayoutTests/media/video-main-content-deny-too-small-expected.txt        2016-03-10 00:22:12 UTC (rev 197898)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+RUN(internals.setMediaElementRestrictions(video, &quot;RequireUserGestureForRateChange,OverrideUserGestureRequirementForMainContent&quot;))
+EVENT(canplaythrough)
+Did not begin playing OK
+END OF TEST
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediavideomaincontentdenytoosmallhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-main-content-deny-too-small.html (0 => 197898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-main-content-deny-too-small.html                                (rev 0)
+++ trunk/LayoutTests/media/video-main-content-deny-too-small.html        2016-03-10 00:22:12 UTC (rev 197898)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;title&gt;video-main-content-allow&lt;/title&gt;
+    &lt;script src=&quot;video-test.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;media-file.js&quot;&gt;&lt;/script&gt;
+    &lt;script&gt;
+    function go() {
+        video = document.createElement('video');
+        run('internals.setMediaElementRestrictions(video, &quot;RequireUserGestureForRateChange,OverrideUserGestureRequirementForMainContent&quot;)');
+        document.body.appendChild(video);
+
+        video.src = findMediaFile('video', 'content/test');
+        waitForEvent('canplaythrough', canPlayThrough);
+    }
+
+    function canPlayThrough() {
+        video.play();
+        waitForEventAndFail('playing');
+        setTimeout(didNotBeginPlaying, 100);
+    }
+
+    function didNotBeginPlaying() {
+        logResult(true, 'Did not begin playing');
+        endTest();
+    }
+    &lt;/script&gt;
+    &lt;style&gt;
+    video {
+        width: 200px;
+        height: 100px;
+    }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;go()&quot;&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (197897 => 197898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-10 00:14:07 UTC (rev 197897)
+++ trunk/Source/WebCore/ChangeLog        2016-03-10 00:22:12 UTC (rev 197898)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2016-03-09  Jer Noble  &lt;jer.noble@apple.com&gt;
+
+        Add heuristic for &quot;main content&quot; videos which override user gesture requirements
+        https://bugs.webkit.org/show_bug.cgi?id=155224
+
+        Reviewed by Eric Carlson.
+
+        Tests: media/video-main-content-allow-then-deny.html
+               media/video-main-content-allow.html
+               media/video-main-content-deny-display-none.html
+               media/video-main-content-deny-not-in-dom.html
+               media/video-main-content-deny-not-visible.html
+               media/video-main-content-deny-obscured.html
+               media/video-main-content-deny-too-small.html
+
+        Add a new behavior &quot;restriction&quot; to MediaElementSession that allows media elements
+        to optionally overriding their own user gesture requirements if the session determines
+        that the media element is the page's &quot;main content&quot;.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::didAttachRenderers):
+        (WebCore::HTMLMediaElement::updateShouldPlay):
+        * html/HTMLMediaElement.h:
+        * html/MediaElementSession.cpp:
+        (WebCore::restrictionName):
+        (WebCore::MediaElementSession::MediaElementSession):
+        (WebCore::MediaElementSession::addBehaviorRestriction):
+        (WebCore::MediaElementSession::playbackPermitted):
+        (WebCore::MediaElementSession::dataLoadingPermitted):
+        (WebCore::isMainContent):
+        (WebCore::MediaElementSession::mainContentCheckTimerFired):
+        (WebCore::MediaElementSession::updateIsMainContent):
+        * html/MediaElementSession.h:
+        * testing/Internals.cpp:
+        (WebCore::Internals::setMediaElementRestrictions):
+
</ins><span class="cx"> 2016-03-09  Konstantin Tokarev  &lt;annulen@yandex.ru&gt;
</span><span class="cx"> 
</span><span class="cx">         Added missing #if(SOUP) after r197591.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (197897 => 197898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp        2016-03-10 00:14:07 UTC (rev 197897)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp        2016-03-10 00:22:12 UTC (rev 197898)
</span><span class="lines">@@ -794,7 +794,8 @@
</span><span class="cx"> {
</span><span class="cx">     if (RenderElement* renderer = this-&gt;renderer()) {
</span><span class="cx">         renderer-&gt;updateFromElement();
</span><del>-        if (m_mediaSession-&gt;hasBehaviorRestriction(MediaElementSession::InvisibleAutoplayNotPermitted))
</del><ins>+        if (m_mediaSession-&gt;hasBehaviorRestriction(MediaElementSession::InvisibleAutoplayNotPermitted)
+            || m_mediaSession-&gt;hasBehaviorRestriction(MediaElementSession::OverrideUserGestureRequirementForMainContent))
</ins><span class="cx">             renderer-&gt;registerForVisibleInViewportCallback();
</span><span class="cx">     }
</span><span class="cx">     updateShouldAutoplay();
</span><span class="lines">@@ -6816,6 +6817,14 @@
</span><span class="cx">         m_mediaSession-&gt;beginInterruption(PlatformMediaSession::InvisibleAutoplay);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void HTMLMediaElement::updateShouldPlay()
+{
+    if (isPlaying() &amp;&amp; !m_mediaSession-&gt;playbackPermitted(*this))
+        pauseInternal();
+    else if (elementCanTransitionFromAutoplayToPlay(*this))
+        play();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (197897 => 197898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.h        2016-03-10 00:14:07 UTC (rev 197897)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h        2016-03-10 00:22:12 UTC (rev 197898)
</span><span class="lines">@@ -452,6 +452,7 @@
</span><span class="cx">     void visibilityDidChange();
</span><span class="cx"> 
</span><span class="cx">     void allowsMediaDocumentInlinePlaybackChanged();
</span><ins>+    void updateShouldPlay();
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     HTMLMediaElement(const QualifiedName&amp;, Document&amp;, bool);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlMediaElementSessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (197897 => 197898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/MediaElementSession.cpp        2016-03-10 00:14:07 UTC (rev 197897)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp        2016-03-10 00:22:12 UTC (rev 197898)
</span><span class="lines">@@ -38,9 +38,12 @@
</span><span class="cx"> #include &quot;HTMLMediaElementEnums.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;HTMLVideoElement.h&quot;
</span><ins>+#include &quot;HitTestResult.h&quot;
</ins><span class="cx"> #include &quot;Logging.h&quot;
</span><ins>+#include &quot;MainFrame.h&quot;
</ins><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;PlatformMediaSessionManager.h&quot;
</span><ins>+#include &quot;RenderView.h&quot;
</ins><span class="cx"> #include &quot;ScriptController.h&quot;
</span><span class="cx"> #include &quot;SourceBuffer.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -51,6 +54,12 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+static const int elementMainContentMinimumWidth = 400;
+static const int elementMainContentMinimumHeight = 300;
+static const double elementMainContentCheckInterval = .250;
+
+static bool isMainContent(const HTMLMediaElement&amp;);
+
</ins><span class="cx"> #if !LOG_DISABLED
</span><span class="cx"> static String restrictionName(MediaElementSession::BehaviorRestrictions restriction)
</span><span class="cx"> {
</span><span class="lines">@@ -75,6 +84,7 @@
</span><span class="cx"> #endif
</span><span class="cx">     CASE(RequireUserGestureForAudioRateChange);
</span><span class="cx">     CASE(InvisibleAutoplayNotPermitted);
</span><ins>+    CASE(OverrideUserGestureRequirementForMainContent);
</ins><span class="cx"> 
</span><span class="cx">     return restrictionBuilder.toString();
</span><span class="cx"> }
</span><span class="lines">@@ -87,12 +97,14 @@
</span><span class="cx">     return document.isMediaDocument() &amp;&amp; !document.ownerElement() &amp;&amp; page &amp;&amp; page-&gt;allowsMediaDocumentInlinePlayback();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-MediaElementSession::MediaElementSession(PlatformMediaSessionClient&amp; client)
-    : PlatformMediaSession(client)
</del><ins>+MediaElementSession::MediaElementSession(HTMLMediaElement&amp; element)
+    : PlatformMediaSession(element)
+    , m_element(element)
</ins><span class="cx">     , m_restrictions(NoRestrictions)
</span><span class="cx"> #if ENABLE(WIRELESS_PLAYBACK_TARGET)
</span><span class="cx">     , m_targetAvailabilityChangedTimer(*this, &amp;MediaElementSession::targetAvailabilityChangedTimerFired)
</span><span class="cx"> #endif
</span><ins>+    , m_mainContentCheckTimer(*this, &amp;MediaElementSession::mainContentCheckTimerFired)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -118,6 +130,9 @@
</span><span class="cx"> {
</span><span class="cx">     LOG(Media, &quot;MediaElementSession::addBehaviorRestriction - adding %s&quot;, restrictionName(restriction).utf8().data());
</span><span class="cx">     m_restrictions |= restriction;
</span><ins>+
+    if (restriction &amp; OverrideUserGestureRequirementForMainContent)
+        m_mainContentCheckTimer.startRepeating(elementMainContentCheckInterval);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MediaElementSession::removeBehaviorRestriction(BehaviorRestrictions restriction)
</span><span class="lines">@@ -131,6 +146,9 @@
</span><span class="cx">     if (pageExplicitlyAllowsElementToAutoplayInline(element))
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><ins>+    if (m_restrictions &amp; OverrideUserGestureRequirementForMainContent &amp;&amp; updateIsMainContent())
+        return true;
+
</ins><span class="cx">     if (m_restrictions &amp; RequireUserGestureForRateChange &amp;&amp; !ScriptController::processingUserGestureForMedia()) {
</span><span class="cx">         LOG(Media, &quot;MediaElementSession::playbackPermitted - returning FALSE&quot;);
</span><span class="cx">         return false;
</span><span class="lines">@@ -146,6 +164,9 @@
</span><span class="cx"> 
</span><span class="cx"> bool MediaElementSession::dataLoadingPermitted(const HTMLMediaElement&amp;) const
</span><span class="cx"> {
</span><ins>+    if (m_restrictions &amp; OverrideUserGestureRequirementForMainContent &amp;&amp; updateIsMainContent())
+        return true;
+
</ins><span class="cx">     if (m_restrictions &amp; RequireUserGestureForLoad &amp;&amp; !ScriptController::processingUserGestureForMedia()) {
</span><span class="cx">         LOG(Media, &quot;MediaElementSession::dataLoadingPermitted - returning FALSE&quot;);
</span><span class="cx">         return false;
</span><span class="lines">@@ -448,6 +469,69 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+static bool isMainContent(const HTMLMediaElement&amp; element)
+{
+    if (!element.hasAudio() || !element.hasVideo())
+        return false;
+
+    // Elements which have not yet been laid out, or which are not yet in the DOM, cannot be main content.
+    RenderBox* renderer = downcast&lt;RenderBox&gt;(element.renderer());
+    if (!renderer)
+        return false;
+
+    if (renderer-&gt;clientWidth() &lt; elementMainContentMinimumWidth
+        || renderer-&gt;clientHeight() &lt; elementMainContentMinimumHeight)
+        return false;
+
+    // Elements which are hidden by style, or have been scrolled out of view, cannot be main content.
+    if (renderer-&gt;style().visibility() != VISIBLE
+        || renderer-&gt;visibleInViewportState() != RenderElement::VisibleInViewport)
+        return false;
+
+    // Main content elements must be in the main frame.
+    Document&amp; document = element.document();
+    if (!document.frame() || !document.frame()-&gt;isMainFrame())
+        return false;
+
+    MainFrame&amp; mainFrame = document.frame()-&gt;mainFrame();
+    if (!mainFrame.view() || !mainFrame.view()-&gt;renderView())
+        return false;
+
+    RenderView&amp; mainRenderView = *mainFrame.view()-&gt;renderView();
+
+    // Hit test the area of the main frame where the element appears, to determine if the element is being obscured.
+    IntRect rectRelativeToView = element.clientRect();
+    ScrollPosition scrollPosition = mainFrame.view()-&gt;documentScrollPositionRelativeToViewOrigin();
+    IntRect rectRelativeToTopDocument(rectRelativeToView.location() + scrollPosition, rectRelativeToView.size());
+    HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::AllowChildFrameContent | HitTestRequest::IgnoreClipping | HitTestRequest::DisallowShadowContent);
+    HitTestResult result(rectRelativeToTopDocument.center());
+
+    // Elements which are obscured by other elements cannot be main content.
+    mainRenderView.hitTest(request, result);
+    Element* hitElement = result.innerElement();
+    if (hitElement != &amp;element)
+        return false;
+
+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void MediaElementSession::mainContentCheckTimerFired()
+{
+    if (!hasBehaviorRestriction(OverrideUserGestureRequirementForMainContent))
+        return;
+
+    bool wasMainContent = m_isMainContent;
+    m_isMainContent = isMainContent(m_element);
+
+    if (m_isMainContent != wasMainContent)
+        m_element.updateShouldPlay();
+}
+
+bool MediaElementSession::updateIsMainContent() const
+{
+    return m_isMainContent = isMainContent(m_element);
+}
+
+}
+
</ins><span class="cx"> #endif // ENABLE(VIDEO)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlMediaElementSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/MediaElementSession.h (197897 => 197898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/MediaElementSession.h        2016-03-10 00:14:07 UTC (rev 197897)
+++ trunk/Source/WebCore/html/MediaElementSession.h        2016-03-10 00:22:12 UTC (rev 197898)
</span><span class="lines">@@ -41,7 +41,7 @@
</span><span class="cx"> class MediaElementSession final : public PlatformMediaSession {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    explicit MediaElementSession(PlatformMediaSessionClient&amp;);
</del><ins>+    explicit MediaElementSession(HTMLMediaElement&amp;);
</ins><span class="cx">     virtual ~MediaElementSession() { }
</span><span class="cx"> 
</span><span class="cx">     void registerWithDocument(Document&amp;);
</span><span class="lines">@@ -92,6 +92,7 @@
</span><span class="cx">         MetadataPreloadingNotPermitted = 1 &lt;&lt; 9,
</span><span class="cx">         AutoPreloadingNotPermitted = 1 &lt;&lt; 10,
</span><span class="cx">         InvisibleAutoplayNotPermitted = 1 &lt;&lt; 11,
</span><ins>+        OverrideUserGestureRequirementForMainContent = 1 &lt;&lt; 12
</ins><span class="cx">     };
</span><span class="cx">     typedef unsigned BehaviorRestrictions;
</span><span class="cx"> 
</span><span class="lines">@@ -118,7 +119,10 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     bool requiresPlaybackTargetRouteMonitoring() const override;
</span><span class="cx"> #endif
</span><ins>+    bool updateIsMainContent() const;
+    void mainContentCheckTimerFired();
</ins><span class="cx"> 
</span><ins>+    HTMLMediaElement&amp; m_element;
</ins><span class="cx">     BehaviorRestrictions m_restrictions;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WIRELESS_PLAYBACK_TARGET)
</span><span class="lines">@@ -130,6 +134,9 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     bool m_hasPlaybackTargetAvailabilityListeners { false };
</span><span class="cx"> #endif
</span><ins>+
+    mutable bool m_isMainContent { false };
+    Timer m_mainContentCheckTimer;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (197897 => 197898)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2016-03-10 00:14:07 UTC (rev 197897)
+++ trunk/Source/WebCore/testing/Internals.cpp        2016-03-10 00:22:12 UTC (rev 197898)
</span><span class="lines">@@ -3090,6 +3090,8 @@
</span><span class="cx">             restrictions |= MediaElementSession::AutoPreloadingNotPermitted;
</span><span class="cx">         if (equalLettersIgnoringASCIICase(restrictionString, &quot;invisibleautoplaynotpermitted&quot;))
</span><span class="cx">             restrictions |= MediaElementSession::InvisibleAutoplayNotPermitted;
</span><ins>+        if (equalLettersIgnoringASCIICase(restrictionString, &quot;overrideusergesturerequirementformaincontent&quot;))
+            restrictions |= MediaElementSession::OverrideUserGestureRequirementForMainContent;
</ins><span class="cx">     }
</span><span class="cx">     element-&gt;mediaSession().addBehaviorRestriction(restrictions);
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>