<!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>[211100] branches/safari-603-branch</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/211100">211100</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2017-01-24 13:22:36 -0800 (Tue, 24 Jan 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/211007">r211007</a>. rdar://problem/28620919</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari603branchLayoutTestsChangeLog">branches/safari-603-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari603branchSourceWebCoreChangeLog">branches/safari-603-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari603branchSourceWebCoreModulesgamepadGamepadManagercpp">branches/safari-603-branch/Source/WebCore/Modules/gamepad/GamepadManager.cpp</a></li>
<li><a href="#branchessafari603branchSourceWebCoreModulesgamepadGamepadManagerh">branches/safari-603-branch/Source/WebCore/Modules/gamepad/GamepadManager.h</a></li>
<li><a href="#branchessafari603branchSourceWebCoreplatformgamepadGamepadProvidercpp">branches/safari-603-branch/Source/WebCore/platform/gamepad/GamepadProvider.cpp</a></li>
<li><a href="#branchessafari603branchSourceWebCoreplatformgamepadGamepadProviderh">branches/safari-603-branch/Source/WebCore/platform/gamepad/GamepadProvider.h</a></li>
<li><a href="#branchessafari603branchSourceWebCoreplatformgamepadGamepadProviderClienth">branches/safari-603-branch/Source/WebCore/platform/gamepad/GamepadProviderClient.h</a></li>
<li><a href="#branchessafari603branchSourceWebCoreplatformgamepadcocoaGameControllerGamepadh">branches/safari-603-branch/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.h</a></li>
<li><a href="#branchessafari603branchSourceWebCoreplatformgamepadcocoaGameControllerGamepadmm">branches/safari-603-branch/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.mm</a></li>
<li><a href="#branchessafari603branchSourceWebCoreplatformgamepadcocoaGameControllerGamepadProviderh">branches/safari-603-branch/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.h</a></li>
<li><a href="#branchessafari603branchSourceWebCoreplatformgamepadcocoaGameControllerGamepadProvidermm">branches/safari-603-branch/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm</a></li>
<li><a href="#branchessafari603branchSourceWebCoreplatformgamepadmacHIDGamepadcpp">branches/safari-603-branch/Source/WebCore/platform/gamepad/mac/HIDGamepad.cpp</a></li>
<li><a href="#branchessafari603branchSourceWebCoreplatformgamepadmacHIDGamepadh">branches/safari-603-branch/Source/WebCore/platform/gamepad/mac/HIDGamepad.h</a></li>
<li><a href="#branchessafari603branchSourceWebCoreplatformgamepadmacHIDGamepadProvidercpp">branches/safari-603-branch/Source/WebCore/platform/gamepad/mac/HIDGamepadProvider.cpp</a></li>
<li><a href="#branchessafari603branchSourceWebCoreplatformgamepadmacHIDGamepadProviderh">branches/safari-603-branch/Source/WebCore/platform/gamepad/mac/HIDGamepadProvider.h</a></li>
<li><a href="#branchessafari603branchSourceWebCoretestingMockGamepadProvidercpp">branches/safari-603-branch/Source/WebCore/testing/MockGamepadProvider.cpp</a></li>
<li><a href="#branchessafari603branchSourceWebCoretestingMockGamepadProviderh">branches/safari-603-branch/Source/WebCore/testing/MockGamepadProvider.h</a></li>
<li><a href="#branchessafari603branchSourceWebKit2ChangeLog">branches/safari-603-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari603branchSourceWebKit2UIProcessGamepadUIGamepadProvidercpp">branches/safari-603-branch/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.cpp</a></li>
<li><a href="#branchessafari603branchSourceWebKit2UIProcessGamepadUIGamepadProviderh">branches/safari-603-branch/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h</a></li>
<li><a href="#branchessafari603branchSourceWebKit2UIProcessWebPageProxycpp">branches/safari-603-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#branchessafari603branchSourceWebKit2UIProcessWebPageProxyh">branches/safari-603-branch/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#branchessafari603branchSourceWebKit2WebProcessGamepadWebGamepadProvidercpp">branches/safari-603-branch/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.cpp</a></li>
<li><a href="#branchessafari603branchSourceWebKit2WebProcessGamepadWebGamepadProviderh">branches/safari-603-branch/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h</a></li>
<li><a href="#branchessafari603branchSourceWebKit2WebProcessWebPageWebPagecpp">branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#branchessafari603branchSourceWebKit2WebProcessWebPageWebPageh">branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#branchessafari603branchSourceWebKit2WebProcessWebPageWebPagemessagesin">branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari603branchLayoutTestsgamepadgamepadvisibility1expectedtxt">branches/safari-603-branch/LayoutTests/gamepad/gamepad-visibility-1-expected.txt</a></li>
<li><a href="#branchessafari603branchLayoutTestsgamepadgamepadvisibility1html">branches/safari-603-branch/LayoutTests/gamepad/gamepad-visibility-1.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari603branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/LayoutTests/ChangeLog (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/ChangeLog        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/LayoutTests/ChangeLog        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2017-01-24  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r211007. rdar://problem/28620919
+
+    2017-01-20  Brady Eidson  &lt;beidson@apple.com&gt;
+
+            Require a button press on a gamepad for them to be exposed to the DOM.
+            &lt;rdar://problem/28620919&gt; and https://bugs.webkit.org/show_bug.cgi?id=167272
+
+            Reviewed by Alex Christensen.
+
+            * gamepad/gamepad-visibility-1-expected.txt: Added.
+            * gamepad/gamepad-visibility-1.html: Added.
+
</ins><span class="cx"> 2017-01-20  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r210951. rdar://problem/29562247
</span></span></pre></div>
<a id="branchessafari603branchLayoutTestsgamepadgamepadvisibility1expectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-603-branch/LayoutTests/gamepad/gamepad-visibility-1-expected.txt (0 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/gamepad/gamepad-visibility-1-expected.txt                                (rev 0)
+++ branches/safari-603-branch/LayoutTests/gamepad/gamepad-visibility-1-expected.txt        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+No connect event seen in 20 run loop spins. Yay.
+
</ins></span></pre></div>
<a id="branchessafari603branchLayoutTestsgamepadgamepadvisibility1html"></a>
<div class="addfile"><h4>Added: branches/safari-603-branch/LayoutTests/gamepad/gamepad-visibility-1.html (0 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/gamepad/gamepad-visibility-1.html                                (rev 0)
+++ branches/safari-603-branch/LayoutTests/gamepad/gamepad-visibility-1.html        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+&lt;head&gt;
+&lt;script&gt;
+
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+function log(msg)
+{
+    document.getElementById(&quot;logger&quot;).innerHTML += msg + &quot;&lt;br&gt;&quot;;
+}
+
+function finishTest()
+{
+    if (testRunner)
+        testRunner.notifyDone();
+}
+
+var timeoutCount = 0;
+
+function spinABit()
+{
+    if (timeoutCount == 20) {
+        log(&quot;No connect event seen in 20 run loop spins. Yay.&quot;);
+        finishTest();
+    }
+
+    ++timeoutCount;
+    setTimeout(spinABit, 0);
+}
+
+function handleGamepadConnect()
+{
+    log(&quot;Connect event seen! Should NOT have been seen&quot;);
+    finishTest();
+}
+
+function runTest() {
+    addEventListener(&quot;gamepadconnected&quot;, handleGamepadConnect);
+
+    // Connecting the gamepad and changing axis values should *not* make it visible.
+    // Only button presses should expose it.
+    testRunner.setMockGamepadDetails(0, &quot;Test Joystick&quot;, 2, 2);
+    testRunner.connectMockGamepad(0);
+    testRunner.setMockGamepadAxisValue(0, 0, 0.7);
+    testRunner.setMockGamepadAxisValue(0, 1, -1.0);
+
+    setTimeout(spinABit, 0);
+}
+
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest();&quot;&gt;
+&lt;div id=&quot;logger&quot;&gt;&lt;/div&gt;
+&lt;/body&gt;
</ins></span></pre></div>
<a id="branchessafari603branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/ChangeLog (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/ChangeLog        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebCore/ChangeLog        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -1,3 +1,52 @@
</span><ins>+2017-01-24  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r211007. rdar://problem/28620919
+
+    2017-01-20  Brady Eidson  &lt;beidson@apple.com&gt;
+
+            Require a button press on a gamepad for them to be exposed to the DOM.
+            &lt;rdar://problem/28620919&gt; and https://bugs.webkit.org/show_bug.cgi?id=167272
+
+            Reviewed by Alex Christensen.
+
+            Test: gamepad/gamepad-visibility-1.html
+
+            * Modules/gamepad/GamepadManager.cpp:
+            (WebCore::GamepadManager::platformGamepadInputActivity):
+            * Modules/gamepad/GamepadManager.h:
+
+            * platform/gamepad/GamepadProvider.cpp:
+            (WebCore::GamepadProvider::dispatchPlatformGamepadInputActivity):
+            * platform/gamepad/GamepadProvider.h:
+            (WebCore::GamepadProvider::~GamepadProvider): Deleted.
+            (WebCore::GamepadProvider::isMockGamepadProvider): Deleted.
+
+            * platform/gamepad/GamepadProviderClient.h:
+
+            * platform/gamepad/cocoa/GameControllerGamepad.h:
+            * platform/gamepad/cocoa/GameControllerGamepad.mm:
+            (WebCore::GameControllerGamepad::setupAsExtendedGamepad):
+            (WebCore::GameControllerGamepad::setupAsGamepad):
+
+            * platform/gamepad/cocoa/GameControllerGamepadProvider.h:
+            * platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
+            (WebCore::GameControllerGamepadProvider::gamepadHadInput):
+            (WebCore::GameControllerGamepadProvider::inputNotificationTimerFired):
+
+            * platform/gamepad/mac/HIDGamepad.cpp:
+            (WebCore::HIDGamepad::valueChanged):
+            * platform/gamepad/mac/HIDGamepad.h:
+
+            * platform/gamepad/mac/HIDGamepadProvider.cpp:
+            (WebCore::HIDGamepadProvider::valuesChanged):
+            (WebCore::HIDGamepadProvider::inputNotificationTimerFired):
+            * platform/gamepad/mac/HIDGamepadProvider.h:
+
+            * testing/MockGamepadProvider.cpp:
+            (WebCore::MockGamepadProvider::setMockGamepadButtonValue):
+            (WebCore::MockGamepadProvider::gamepadInputActivity):
+            * testing/MockGamepadProvider.h:
+
</ins><span class="cx"> 2017-01-20  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r210951. rdar://problem/29562247
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoreModulesgamepadGamepadManagercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/Modules/gamepad/GamepadManager.cpp (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/Modules/gamepad/GamepadManager.cpp        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebCore/Modules/gamepad/GamepadManager.cpp        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -115,8 +115,11 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void GamepadManager::platformGamepadInputActivity()
</del><ins>+void GamepadManager::platformGamepadInputActivity(bool shouldMakeGamepadVisible)
</ins><span class="cx"> {
</span><ins>+    if (!shouldMakeGamepadVisible)
+        return;
+
</ins><span class="cx">     if (m_gamepadBlindNavigators.isEmpty() &amp;&amp; m_gamepadBlindDOMWindows.isEmpty())
</span><span class="cx">         return;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoreModulesgamepadGamepadManagerh"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/Modules/gamepad/GamepadManager.h (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/Modules/gamepad/GamepadManager.h        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebCore/Modules/gamepad/GamepadManager.h        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx"> 
</span><span class="cx">     void platformGamepadConnected(PlatformGamepad&amp;) final;
</span><span class="cx">     void platformGamepadDisconnected(PlatformGamepad&amp;) final;
</span><del>-    void platformGamepadInputActivity() final;
</del><ins>+    void platformGamepadInputActivity(bool shouldMakeGamepadVisible) final;
</ins><span class="cx"> 
</span><span class="cx">     void registerNavigator(NavigatorGamepad*);
</span><span class="cx">     void unregisterNavigator(NavigatorGamepad*);
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoreplatformgamepadGamepadProvidercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/platform/gamepad/GamepadProvider.cpp (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/platform/gamepad/GamepadProvider.cpp        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebCore/platform/gamepad/GamepadProvider.cpp        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #if ENABLE(GAMEPAD)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;EmptyGamepadProvider.h&quot;
</span><ins>+#include &quot;GamepadProviderClient.h&quot;
</ins><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -49,6 +50,14 @@
</span><span class="cx">     sharedProvider = &amp;newProvider;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void GamepadProvider::dispatchPlatformGamepadInputActivity()
+{
+    for (auto&amp; client : m_clients)
+        client-&gt;platformGamepadInputActivity(m_shouldMakeGamepadsVisible);
+
+    m_shouldMakeGamepadsVisible = false;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(GAMEPAD)
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoreplatformgamepadGamepadProviderh"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/platform/gamepad/GamepadProvider.h (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/platform/gamepad/GamepadProvider.h        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebCore/platform/gamepad/GamepadProvider.h        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(GAMEPAD)
</span><span class="cx"> 
</span><ins>+#include &lt;wtf/HashSet.h&gt;
</ins><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -34,7 +35,7 @@
</span><span class="cx"> class GamepadProviderClient;
</span><span class="cx"> class PlatformGamepad;
</span><span class="cx"> 
</span><del>-class GamepadProvider {
</del><ins>+class WEBCORE_EXPORT GamepadProvider {
</ins><span class="cx"> public:
</span><span class="cx">     virtual ~GamepadProvider() { }
</span><span class="cx"> 
</span><span class="lines">@@ -46,6 +47,13 @@
</span><span class="cx">     virtual const Vector&lt;PlatformGamepad*&gt;&amp; platformGamepads() = 0;
</span><span class="cx">     virtual bool isMockGamepadProvider() const { return false; }
</span><span class="cx"> 
</span><ins>+protected:
+    void dispatchPlatformGamepadInputActivity();
+    void setShouldMakeGamepadsVisibile() { m_shouldMakeGamepadsVisible = true; }
+    HashSet&lt;GamepadProviderClient*&gt; m_clients;
+
+private:
+    bool m_shouldMakeGamepadsVisible { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoreplatformgamepadGamepadProviderClienth"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/platform/gamepad/GamepadProviderClient.h (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/platform/gamepad/GamepadProviderClient.h        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebCore/platform/gamepad/GamepadProviderClient.h        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx">     virtual void setInitialConnectedGamepads(const Vector&lt;PlatformGamepad*&gt;&amp;) { }
</span><span class="cx">     virtual void platformGamepadConnected(PlatformGamepad&amp;) = 0;
</span><span class="cx">     virtual void platformGamepadDisconnected(PlatformGamepad&amp;) = 0;
</span><del>-    virtual void platformGamepadInputActivity() = 0;
</del><ins>+    virtual void platformGamepadInputActivity(bool shouldMakeGamepadVisible) = 0;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoreplatformgamepadcocoaGameControllerGamepadh"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.h (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.h        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.h        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -58,6 +58,8 @@
</span><span class="cx"> 
</span><span class="cx">     RetainPtr&lt;GCGamepad&gt; m_gamepad;
</span><span class="cx">     RetainPtr&lt;GCExtendedGamepad&gt; m_extendedGamepad;
</span><ins>+
+    bool m_hadButtonPresses { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoreplatformgamepadcocoaGameControllerGamepadmm"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.mm (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.mm        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.mm        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -59,7 +59,8 @@
</span><span class="cx"> 
</span><span class="cx">     m_extendedGamepad.get().valueChangedHandler = ^(GCExtendedGamepad *, GCControllerElement *) {
</span><span class="cx">         m_lastUpdateTime = monotonicallyIncreasingTime();
</span><del>-        GameControllerGamepadProvider::singleton().gamepadHadInput(*this);
</del><ins>+        GameControllerGamepadProvider::singleton().gamepadHadInput(*this, m_hadButtonPresses);
+        m_hadButtonPresses = false;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     m_buttonValues.resize(8);
</span><span class="lines">@@ -80,29 +81,45 @@
</span><span class="cx">     m_axisValues[4] = m_extendedGamepad.get().dpad.xAxis.value;
</span><span class="cx">     m_axisValues[5] = m_extendedGamepad.get().dpad.yAxis.value;
</span><span class="cx"> 
</span><del>-    m_extendedGamepad.get().buttonA.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
</del><ins>+    m_extendedGamepad.get().buttonA.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL pressed) {
</ins><span class="cx">         m_buttonValues[0] = value;
</span><ins>+        if (pressed)
+            m_hadButtonPresses = true;
</ins><span class="cx">     };
</span><del>-    m_extendedGamepad.get().buttonB.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
</del><ins>+    m_extendedGamepad.get().buttonB.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL pressed) {
</ins><span class="cx">         m_buttonValues[1] = value;
</span><ins>+        if (pressed)
+            m_hadButtonPresses = true;
</ins><span class="cx">     };
</span><del>-    m_extendedGamepad.get().buttonX.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
</del><ins>+    m_extendedGamepad.get().buttonX.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL pressed) {
</ins><span class="cx">         m_buttonValues[2] = value;
</span><ins>+        if (pressed)
+            m_hadButtonPresses = true;
</ins><span class="cx">     };
</span><del>-    m_extendedGamepad.get().buttonY.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
</del><ins>+    m_extendedGamepad.get().buttonY.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL pressed) {
</ins><span class="cx">         m_buttonValues[3] = value;
</span><ins>+        if (pressed)
+            m_hadButtonPresses = true;
</ins><span class="cx">     };
</span><del>-    m_extendedGamepad.get().leftShoulder.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
</del><ins>+    m_extendedGamepad.get().leftShoulder.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL pressed) {
</ins><span class="cx">         m_buttonValues[4] = value;
</span><ins>+        if (pressed)
+            m_hadButtonPresses = true;
</ins><span class="cx">     };
</span><del>-    m_extendedGamepad.get().rightShoulder.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
</del><ins>+    m_extendedGamepad.get().rightShoulder.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL pressed) {
</ins><span class="cx">         m_buttonValues[5] = value;
</span><ins>+        if (pressed)
+            m_hadButtonPresses = true;
</ins><span class="cx">     };
</span><del>-    m_extendedGamepad.get().leftTrigger.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
</del><ins>+    m_extendedGamepad.get().leftTrigger.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL pressed) {
</ins><span class="cx">         m_buttonValues[6] = value;
</span><ins>+        if (pressed)
+            m_hadButtonPresses = true;
</ins><span class="cx">     };
</span><del>-    m_extendedGamepad.get().rightTrigger.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
</del><ins>+    m_extendedGamepad.get().rightTrigger.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL pressed) {
</ins><span class="cx">         m_buttonValues[7] = value;
</span><ins>+        if (pressed)
+            m_hadButtonPresses = true;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     m_extendedGamepad.get().leftThumbstick.xAxis.valueChangedHandler = ^(GCControllerAxisInput *, float value) {
</span><span class="lines">@@ -133,7 +150,8 @@
</span><span class="cx"> 
</span><span class="cx">     m_gamepad.get().valueChangedHandler = ^(GCGamepad *, GCControllerElement *) {
</span><span class="cx">         m_lastUpdateTime = monotonicallyIncreasingTime();
</span><del>-        GameControllerGamepadProvider::singleton().gamepadHadInput(*this);
</del><ins>+        GameControllerGamepadProvider::singleton().gamepadHadInput(*this, m_hadButtonPresses);
+        m_hadButtonPresses = false;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     m_buttonValues.resize(6);
</span><span class="lines">@@ -148,23 +166,35 @@
</span><span class="cx">     m_axisValues[0] = m_extendedGamepad.get().dpad.xAxis.value;
</span><span class="cx">     m_axisValues[1] = m_extendedGamepad.get().dpad.yAxis.value;
</span><span class="cx"> 
</span><del>-    m_extendedGamepad.get().buttonA.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
</del><ins>+    m_extendedGamepad.get().buttonA.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL pressed) {
</ins><span class="cx">         m_buttonValues[0] = value;
</span><ins>+        if (pressed)
+            m_hadButtonPresses = true;
</ins><span class="cx">     };
</span><del>-    m_extendedGamepad.get().buttonB.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
</del><ins>+    m_extendedGamepad.get().buttonB.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL pressed) {
</ins><span class="cx">         m_buttonValues[1] = value;
</span><ins>+        if (pressed)
+            m_hadButtonPresses = true;
</ins><span class="cx">     };
</span><del>-    m_extendedGamepad.get().buttonX.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
</del><ins>+    m_extendedGamepad.get().buttonX.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL pressed) {
</ins><span class="cx">         m_buttonValues[2] = value;
</span><ins>+        if (pressed)
+            m_hadButtonPresses = true;
</ins><span class="cx">     };
</span><del>-    m_extendedGamepad.get().buttonY.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
</del><ins>+    m_extendedGamepad.get().buttonY.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL pressed) {
</ins><span class="cx">         m_buttonValues[3] = value;
</span><ins>+        if (pressed)
+            m_hadButtonPresses = true;
</ins><span class="cx">     };
</span><del>-    m_extendedGamepad.get().leftShoulder.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
</del><ins>+    m_extendedGamepad.get().leftShoulder.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL pressed) {
</ins><span class="cx">         m_buttonValues[4] = value;
</span><ins>+        if (pressed)
+            m_hadButtonPresses = true;
</ins><span class="cx">     };
</span><del>-    m_extendedGamepad.get().rightShoulder.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
</del><ins>+    m_extendedGamepad.get().rightShoulder.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL pressed) {
</ins><span class="cx">         m_buttonValues[5] = value;
</span><ins>+        if (pressed)
+            m_hadButtonPresses = true;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     m_extendedGamepad.get().leftThumbstick.xAxis.valueChangedHandler = ^(GCControllerAxisInput *, float value) {
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoreplatformgamepadcocoaGameControllerGamepadProviderh"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.h (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.h        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.h        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -29,7 +29,6 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;GamepadProvider.h&quot;
</span><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><del>-#include &lt;wtf/HashSet.h&gt;
</del><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><span class="cx"> #include &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/RunLoop.h&gt;
</span><span class="lines">@@ -55,7 +54,7 @@
</span><span class="cx">     WEBCORE_EXPORT void stopMonitoringInput();
</span><span class="cx">     WEBCORE_EXPORT void startMonitoringInput();
</span><span class="cx"> 
</span><del>-    void gamepadHadInput(GameControllerGamepad&amp;);
</del><ins>+    void gamepadHadInput(GameControllerGamepad&amp;, bool hadButtonPresses);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     GameControllerGamepadProvider();
</span><span class="lines">@@ -74,8 +73,6 @@
</span><span class="cx"> 
</span><span class="cx">     void makeInvisibileGamepadsVisible();
</span><span class="cx"> 
</span><del>-    HashSet&lt;GamepadProviderClient*&gt; m_clients;
-
</del><span class="cx">     HashMap&lt;GCController *, std::unique_ptr&lt;GameControllerGamepad&gt;&gt; m_gamepadMap;
</span><span class="cx">     Vector&lt;PlatformGamepad*&gt; m_gamepadVector;
</span><span class="cx">     HashSet&lt;PlatformGamepad*&gt; m_invisibleGamepads;
</span><span class="lines">@@ -84,6 +81,7 @@
</span><span class="cx">     RetainPtr&lt;NSObject&gt; m_disconnectObserver;
</span><span class="cx"> 
</span><span class="cx">     RunLoop::Timer&lt;GameControllerGamepadProvider&gt; m_inputNotificationTimer;
</span><ins>+    bool m_shouldMakeInvisibileGamepadsVisible { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoreplatformgamepadcocoaGameControllerGamepadProvidermm"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -141,10 +141,13 @@
</span><span class="cx">     return index;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void GameControllerGamepadProvider::gamepadHadInput(GameControllerGamepad&amp;)
</del><ins>+void GameControllerGamepadProvider::gamepadHadInput(GameControllerGamepad&amp;, bool hadButtonPresses)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_inputNotificationTimer.isActive())
</span><span class="cx">         m_inputNotificationTimer.startOneShot(InputNotificationDelay);
</span><ins>+
+    if (hadButtonPresses)
+        m_shouldMakeInvisibileGamepadsVisible = true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void GameControllerGamepadProvider::makeInvisibileGamepadsVisible()
</span><span class="lines">@@ -159,10 +162,14 @@
</span><span class="cx"> 
</span><span class="cx"> void GameControllerGamepadProvider::inputNotificationTimerFired()
</span><span class="cx"> {
</span><del>-    makeInvisibileGamepadsVisible();
</del><ins>+    if (m_shouldMakeInvisibileGamepadsVisible) {
+        setShouldMakeGamepadsVisibile();
+        makeInvisibileGamepadsVisible();
+    }
</ins><span class="cx"> 
</span><del>-    for (auto&amp; client : m_clients)
-        client-&gt;platformGamepadInputActivity();
</del><ins>+    m_shouldMakeInvisibileGamepadsVisible = false;
+
+    dispatchPlatformGamepadInputActivity();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoreplatformgamepadmacHIDGamepadcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/platform/gamepad/mac/HIDGamepad.cpp (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/platform/gamepad/mac/HIDGamepad.cpp        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebCore/platform/gamepad/mac/HIDGamepad.cpp        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -158,7 +158,7 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void HIDGamepad::valueChanged(IOHIDValueRef value)
</del><ins>+HIDInputType HIDGamepad::valueChanged(IOHIDValueRef value)
</ins><span class="cx"> {
</span><span class="cx">     IOHIDElementCookie cookie = IOHIDElementGetCookie(IOHIDValueGetElement(value));
</span><span class="cx">     HIDGamepadElement* element = m_elementMap.get(cookie);
</span><span class="lines">@@ -165,7 +165,7 @@
</span><span class="cx"> 
</span><span class="cx">     // This might be an element we don't currently handle as input so we can skip it.
</span><span class="cx">     if (!element)
</span><del>-        return;
</del><ins>+        return HIDInputType::NotAButtonPress;
</ins><span class="cx"> 
</span><span class="cx">     element-&gt;rawValue = IOHIDValueGetScaledValue(value, kIOHIDValueScaleTypePhysical);
</span><span class="cx"> 
</span><span class="lines">@@ -183,6 +183,8 @@
</span><span class="cx">         ASSERT_NOT_REACHED();
</span><span class="cx"> 
</span><span class="cx">     m_lastUpdateTime = monotonicallyIncreasingTime();
</span><ins>+
+    return element-&gt;isButton() ? HIDInputType::ButtonPress : HIDInputType::NotAButtonPress;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoreplatformgamepadmacHIDGamepadh"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/platform/gamepad/mac/HIDGamepad.h (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/platform/gamepad/mac/HIDGamepad.h        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebCore/platform/gamepad/mac/HIDGamepad.h        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -91,6 +91,11 @@
</span><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+enum class HIDInputType {
+    ButtonPress,
+    NotAButtonPress,
+};
+
</ins><span class="cx"> class HIDGamepad : public PlatformGamepad {
</span><span class="cx"> public:
</span><span class="cx">     HIDGamepad(IOHIDDeviceRef, unsigned index);
</span><span class="lines">@@ -97,7 +102,7 @@
</span><span class="cx"> 
</span><span class="cx">     IOHIDDeviceRef hidDevice() const { return m_hidDevice.get(); }
</span><span class="cx"> 
</span><del>-    void valueChanged(IOHIDValueRef);
</del><ins>+    HIDInputType valueChanged(IOHIDValueRef);
</ins><span class="cx"> 
</span><span class="cx">     const Vector&lt;double&gt;&amp; axisValues() const final { return m_axisValues; }
</span><span class="cx">     const Vector&lt;double&gt;&amp; buttonValues() const final { return m_buttonValues; }
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoreplatformgamepadmacHIDGamepadProvidercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/platform/gamepad/mac/HIDGamepadProvider.cpp (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/platform/gamepad/mac/HIDGamepadProvider.cpp        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebCore/platform/gamepad/mac/HIDGamepadProvider.cpp        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -237,7 +237,8 @@
</span><span class="cx">     if (!gamepad)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    gamepad-&gt;valueChanged(value);
</del><ins>+    if (gamepad-&gt;valueChanged(value) == HIDInputType::ButtonPress)
+        setShouldMakeGamepadsVisibile();
</ins><span class="cx"> 
</span><span class="cx">     // This isActive check is necessary as we want to delay input notifications from the time of the first input,
</span><span class="cx">     // and not push the notification out on every subsequent input.
</span><span class="lines">@@ -250,8 +251,7 @@
</span><span class="cx">     if (!m_shouldDispatchCallbacks)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    for (auto&amp; client : m_clients)
-        client-&gt;platformGamepadInputActivity();
</del><ins>+    dispatchPlatformGamepadInputActivity();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;HIDGamepad&gt; HIDGamepadProvider::removeGamepadForDevice(IOHIDDeviceRef device)
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoreplatformgamepadmacHIDGamepadProviderh"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/platform/gamepad/mac/HIDGamepadProvider.h (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/platform/gamepad/mac/HIDGamepadProvider.h        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebCore/platform/gamepad/mac/HIDGamepadProvider.h        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -33,7 +33,6 @@
</span><span class="cx"> #include &lt;IOKit/hid/IOHIDManager.h&gt;
</span><span class="cx"> #include &lt;wtf/Deque.h&gt;
</span><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><del>-#include &lt;wtf/HashSet.h&gt;
</del><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><span class="cx"> #include &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -76,7 +75,6 @@
</span><span class="cx"> 
</span><span class="cx">     RetainPtr&lt;IOHIDManagerRef&gt; m_manager;
</span><span class="cx"> 
</span><del>-    HashSet&lt;GamepadProviderClient*&gt; m_clients;
</del><span class="cx">     bool m_shouldDispatchCallbacks;
</span><span class="cx"> 
</span><span class="cx">     Timer m_connectionDelayTimer;
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoretestingMockGamepadProvidercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/testing/MockGamepadProvider.cpp (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/testing/MockGamepadProvider.cpp        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebCore/testing/MockGamepadProvider.cpp        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -132,6 +132,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     m_mockGamepadVector[index]-&gt;setButtonValue(buttonIndex, value);
</span><ins>+    setShouldMakeGamepadsVisibile();
</ins><span class="cx">     gamepadInputActivity();
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -143,8 +144,7 @@
</span><span class="cx"> 
</span><span class="cx">     m_shouldScheduleActivityCallback = false;
</span><span class="cx">     callOnMainThread([this]() {
</span><del>-        for (auto&amp; client : m_clients)
-            client-&gt;platformGamepadInputActivity();
</del><ins>+        dispatchPlatformGamepadInputActivity();
</ins><span class="cx"> 
</span><span class="cx">         m_shouldScheduleActivityCallback = true;
</span><span class="cx">     });
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoretestingMockGamepadProviderh"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/testing/MockGamepadProvider.h (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/testing/MockGamepadProvider.h        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebCore/testing/MockGamepadProvider.h        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -29,7 +29,6 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;GamepadProvider.h&quot;
</span><span class="cx"> #include &quot;MockGamepad.h&quot;
</span><del>-#include &lt;wtf/HashSet.h&gt;
</del><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -62,8 +61,6 @@
</span><span class="cx">     Vector&lt;PlatformGamepad*&gt; m_connectedGamepadVector;
</span><span class="cx">     Vector&lt;std::unique_ptr&lt;MockGamepad&gt;&gt; m_mockGamepadVector;
</span><span class="cx"> 
</span><del>-    HashSet&lt;GamepadProviderClient*&gt; m_clients;
-
</del><span class="cx">     bool m_shouldScheduleActivityCallback { true };
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari603branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit2/ChangeLog (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit2/ChangeLog        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebKit2/ChangeLog        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -1,5 +1,34 @@
</span><span class="cx"> 2017-01-24  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r211007. rdar://problem/28620919
+
+    2017-01-20  Brady Eidson  &lt;beidson@apple.com&gt;
+
+            Require a button press on a gamepad for them to be exposed to the DOM.
+            &lt;rdar://problem/28620919&gt; and https://bugs.webkit.org/show_bug.cgi?id=167272
+
+            Reviewed by Alex Christensen.
+
+            * UIProcess/Gamepad/UIGamepadProvider.cpp:
+            (WebKit::UIGamepadProvider::gamepadSyncTimerFired):
+            (WebKit::UIGamepadProvider::platformGamepadInputActivity):
+            * UIProcess/Gamepad/UIGamepadProvider.h:
+
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::gamepadActivity):
+            * UIProcess/WebPageProxy.h:
+
+            * WebProcess/Gamepad/WebGamepadProvider.cpp:
+            (WebKit::WebGamepadProvider::gamepadActivity):
+            * WebProcess/Gamepad/WebGamepadProvider.h:
+
+            * WebProcess/WebPage/WebPage.cpp:
+            (WebKit::WebPage::gamepadActivity):
+            * WebProcess/WebPage/WebPage.h:
+            * WebProcess/WebPage/WebPage.messages.in:
+
+2017-01-24  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
</ins><span class="cx">         Merge r210603. rdar://problem/29839194
</span><span class="cx"> 
</span><span class="cx">     2017-01-11  Anders Carlsson  &lt;andersca@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari603branchSourceWebKit2UIProcessGamepadUIGamepadProvidercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.cpp (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.cpp        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.cpp        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -65,7 +65,8 @@
</span><span class="cx">     if (!webPageProxy || !m_processPoolsUsingGamepads.contains(&amp;webPageProxy-&gt;process().processPool()))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    webPageProxy-&gt;gamepadActivity(snapshotGamepads());
</del><ins>+    webPageProxy-&gt;gamepadActivity(snapshotGamepads(), m_shouldMakeGamepadsVisibleOnSync);
+    m_shouldMakeGamepadsVisibleOnSync = false;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void UIGamepadProvider::scheduleGamepadStateSync()
</span><span class="lines">@@ -126,7 +127,7 @@
</span><span class="cx">         pool-&gt;gamepadDisconnected(*disconnectedGamepad);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void UIGamepadProvider::platformGamepadInputActivity()
</del><ins>+void UIGamepadProvider::platformGamepadInputActivity(bool shouldMakeGamepadsVisible)
</ins><span class="cx"> {
</span><span class="cx">     auto platformGamepads = GamepadProvider::singleton().platformGamepads();
</span><span class="cx">     ASSERT(platformGamepads.size() == m_gamepads.size());
</span><span class="lines">@@ -141,6 +142,9 @@
</span><span class="cx">         m_gamepads[i]-&gt;updateFromPlatformGamepad(*platformGamepads[i]);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (shouldMakeGamepadsVisible)
+        m_shouldMakeGamepadsVisibleOnSync = true;
+
</ins><span class="cx">     scheduleGamepadStateSync();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari603branchSourceWebKit2UIProcessGamepadUIGamepadProviderh"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx">     void setInitialConnectedGamepads(const Vector&lt;WebCore::PlatformGamepad*&gt;&amp;) final;
</span><span class="cx">     void platformGamepadConnected(WebCore::PlatformGamepad&amp;) final;
</span><span class="cx">     void platformGamepadDisconnected(WebCore::PlatformGamepad&amp;) final;
</span><del>-    void platformGamepadInputActivity() final;
</del><ins>+    void platformGamepadInputActivity(bool shouldMakeGamepadsVisible) final;
</ins><span class="cx"> 
</span><span class="cx">     void scheduleGamepadStateSync();
</span><span class="cx">     void gamepadSyncTimerFired();
</span><span class="lines">@@ -87,6 +87,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool m_isMonitoringGamepads { false };
</span><span class="cx">     bool m_hasInitialGamepads { false };
</span><ins>+    bool m_shouldMakeGamepadsVisibleOnSync { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari603branchSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -5594,9 +5594,9 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(GAMEPAD)
</span><span class="cx"> 
</span><del>-void WebPageProxy::gamepadActivity(const Vector&lt;GamepadData&gt;&amp; gamepadDatas)
</del><ins>+void WebPageProxy::gamepadActivity(const Vector&lt;GamepadData&gt;&amp; gamepadDatas, bool shouldMakeGamepadsVisible)
</ins><span class="cx"> {
</span><del>-    m_process-&gt;send(Messages::WebPage::GamepadActivity(gamepadDatas), m_pageID);
</del><ins>+    m_process-&gt;send(Messages::WebPage::GamepadActivity(gamepadDatas, shouldMakeGamepadsVisible), m_pageID);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="branchessafari603branchSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit2/UIProcess/WebPageProxy.h (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit2/UIProcess/WebPageProxy.h        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebKit2/UIProcess/WebPageProxy.h        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -1175,7 +1175,7 @@
</span><span class="cx">     void canAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t frameID, const WebCore::ProtectionSpace&amp;);
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(GAMEPAD)
</span><del>-    void gamepadActivity(const Vector&lt;GamepadData&gt;&amp;);
</del><ins>+    void gamepadActivity(const Vector&lt;GamepadData&gt;&amp;, bool shouldMakeGamepadsVisible);
</ins><span class="cx"> #endif
</span><span class="cx">         
</span><span class="cx">     WeakPtr&lt;WebPageProxy&gt; createWeakPtr() const { return m_weakPtrFactory.createWeakPtr(); }
</span></span></pre></div>
<a id="branchessafari603branchSourceWebKit2WebProcessGamepadWebGamepadProvidercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.cpp (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.cpp        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.cpp        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -95,7 +95,7 @@
</span><span class="cx">         client-&gt;platformGamepadDisconnected(*disconnectedGamepad);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebGamepadProvider::gamepadActivity(const Vector&lt;GamepadData&gt;&amp; gamepadDatas)
</del><ins>+void WebGamepadProvider::gamepadActivity(const Vector&lt;GamepadData&gt;&amp; gamepadDatas, bool shouldMakeGamepadsVisible)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(m_gamepads.size() == gamepadDatas.size());
</span><span class="cx"> 
</span><span class="lines">@@ -105,7 +105,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     for (auto* client : m_clients)
</span><del>-        client-&gt;platformGamepadInputActivity();
</del><ins>+        client-&gt;platformGamepadInputActivity(shouldMakeGamepadsVisible);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebGamepadProvider::startMonitoringGamepads(GamepadProviderClient&amp; client)
</span></span></pre></div>
<a id="branchessafari603branchSourceWebKit2WebProcessGamepadWebGamepadProviderh"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx"> 
</span><span class="cx">     void gamepadConnected(const GamepadData&amp;);
</span><span class="cx">     void gamepadDisconnected(unsigned index);
</span><del>-    void gamepadActivity(const Vector&lt;GamepadData&gt;&amp;);
</del><ins>+    void gamepadActivity(const Vector&lt;GamepadData&gt;&amp;, bool shouldMakeGamepadsVisible);
</ins><span class="cx"> 
</span><span class="cx">     void setInitialGamepads(const Vector&lt;GamepadData&gt;&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari603branchSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -5690,9 +5690,9 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(GAMEPAD)
</span><span class="cx"> 
</span><del>-void WebPage::gamepadActivity(const Vector&lt;GamepadData&gt;&amp; gamepadDatas)
</del><ins>+void WebPage::gamepadActivity(const Vector&lt;GamepadData&gt;&amp; gamepadDatas, bool shouldMakeGamepadsVisible)
</ins><span class="cx"> {
</span><del>-    WebGamepadProvider::singleton().gamepadActivity(gamepadDatas);
</del><ins>+    WebGamepadProvider::singleton().gamepadActivity(gamepadDatas, shouldMakeGamepadsVisible);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="branchessafari603branchSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -964,7 +964,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(GAMEPAD)
</span><del>-    void gamepadActivity(const Vector&lt;GamepadData&gt;&amp;);
</del><ins>+    void gamepadActivity(const Vector&lt;GamepadData&gt;&amp;, bool shouldMakeGamepadsVisible);
</ins><span class="cx"> #endif
</span><span class="cx">     
</span><span class="cx"> #if ENABLE(POINTER_LOCK)
</span></span></pre></div>
<a id="branchessafari603branchSourceWebKit2WebProcessWebPageWebPagemessagesin"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (211099 => 211100)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2017-01-24 21:22:27 UTC (rev 211099)
+++ branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2017-01-24 21:22:36 UTC (rev 211100)
</span><span class="lines">@@ -457,6 +457,6 @@
</span><span class="cx">     SetUseIconLoadingClient(bool useIconLoadingClient)
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(GAMEPAD)
</span><del>-    GamepadActivity(Vector&lt;WebKit::GamepadData&gt; gamepadDatas)
</del><ins>+    GamepadActivity(Vector&lt;WebKit::GamepadData&gt; gamepadDatas, bool shouldMakeGamepadsVisible)
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>