<!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>[206959] trunk/Source/WebKit2</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/206959">206959</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-10-08 13:42:52 -0700 (Sat, 08 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/206950">r206950</a>.
https://bugs.webkit.org/show_bug.cgi?id=163169

broke an API test (Requested by thorton on #webkit).

Reverted changeset:

&quot;Share more code between iOS and macOS ViewGestureController&quot;
https://bugs.webkit.org/show_bug.cgi?id=163158
http://trac.webkit.org/changeset/206950</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaViewGestureControllercpp">trunk/Source/WebKit2/UIProcess/Cocoa/ViewGestureController.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaViewGestureControllerh">trunk/Source/WebKit2/UIProcess/Cocoa/ViewGestureController.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosViewGestureControllerIOSmm">trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacViewGestureControllerMacmm">trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (206958 => 206959)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-10-08 20:14:22 UTC (rev 206958)
+++ trunk/Source/WebKit2/ChangeLog        2016-10-08 20:42:52 UTC (rev 206959)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-10-08  Commit Queue  &lt;commit-queue@webkit.org&gt;
+
+        Unreviewed, rolling out r206950.
+        https://bugs.webkit.org/show_bug.cgi?id=163169
+
+        broke an API test (Requested by thorton on #webkit).
+
+        Reverted changeset:
+
+        &quot;Share more code between iOS and macOS ViewGestureController&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=163158
+        http://trac.webkit.org/changeset/206950
+
</ins><span class="cx"> 2016-10-08  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Share more code between iOS and macOS ViewGestureController
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (206958 => 206959)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2016-10-08 20:14:22 UTC (rev 206958)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2016-10-08 20:42:52 UTC (rev 206959)
</span><span class="lines">@@ -2198,7 +2198,7 @@
</span><span class="cx">         if (!_gestureController) {
</span><span class="cx">             _gestureController = std::make_unique&lt;WebKit::ViewGestureController&gt;(*_page);
</span><span class="cx">             _gestureController-&gt;installSwipeHandler(self, [self scrollView]);
</span><del>-            _gestureController-&gt;setAlternateBackForwardListSourcePage([_configuration _alternateWebViewForNavigationGestures]-&gt;_page.get());
</del><ins>+            _gestureController-&gt;setAlternateBackForwardListSourceView([_configuration _alternateWebViewForNavigationGestures]);
</ins><span class="cx">         }
</span><span class="cx">     } else
</span><span class="cx">         _gestureController = nullptr;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaViewGestureControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/ViewGestureController.cpp (206958 => 206959)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/ViewGestureController.cpp        2016-10-08 20:14:22 UTC (rev 206958)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/ViewGestureController.cpp        2016-10-08 20:42:52 UTC (rev 206959)
</span><span class="lines">@@ -29,7 +29,6 @@
</span><span class="cx"> #import &quot;Logging.h&quot;
</span><span class="cx"> #import &quot;RemoteLayerTreeDrawingAreaProxy.h&quot;
</span><span class="cx"> #import &quot;ViewGestureControllerMessages.h&quot;
</span><del>-#import &quot;WebBackForwardList.h&quot;
</del><span class="cx"> #import &quot;WebPageProxy.h&quot;
</span><span class="cx"> #import &quot;WebProcessProxy.h&quot;
</span><span class="cx"> #import &lt;wtf/MathExtras.h&gt;
</span><span class="lines">@@ -60,7 +59,7 @@
</span><span class="cx">     : m_webPageProxy(webPageProxy)
</span><span class="cx">     , m_swipeActiveLoadMonitoringTimer(RunLoop::main(), this, &amp;ViewGestureController::checkForActiveLoads)
</span><span class="cx"> #if PLATFORM(MAC)
</span><del>-    , m_pendingSwipeTracker(webPageProxy, *this)
</del><ins>+    , m_pendingSwipeTracker(webPageProxy, std::bind(&amp;ViewGestureController::trackSwipeGesture, this, std::placeholders::_1, std::placeholders::_2))
</ins><span class="cx"> #endif
</span><span class="cx"> {
</span><span class="cx">     m_webPageProxy.process().addMessageReceiver(Messages::ViewGestureController::messageReceiverName(), m_webPageProxy.pageID(), *this);
</span><span class="lines">@@ -84,25 +83,7 @@
</span><span class="cx">         return nullptr;
</span><span class="cx">     return gestureControllerIter-&gt;value;
</span><span class="cx"> }
</span><del>-    
-void ViewGestureController::setAlternateBackForwardListSourcePage(WebPageProxy* page)
-{
-    if (page)
-        m_alternateBackForwardListSourcePage = page-&gt;createWeakPtr();
-    else
-        m_alternateBackForwardListSourcePage.clear();
-}
-    
-bool ViewGestureController::canSwipeInDirection(SwipeDirection direction) const
-{
-    RefPtr&lt;WebPageProxy&gt; alternateBackForwardListSourcePage = m_alternateBackForwardListSourcePage.get();
-    auto&amp; backForwardList = alternateBackForwardListSourcePage ? alternateBackForwardListSourcePage-&gt;backForwardList() : m_webPageProxy.backForwardList();
-    if (direction == SwipeDirection::Back)
-        return !!backForwardList.backItem();
-    return !!backForwardList.forwardItem();
-}
</del><span class="cx"> 
</span><del>-
</del><span class="cx"> void ViewGestureController::didFirstVisuallyNonEmptyLayoutForMainFrame()
</span><span class="cx"> {
</span><span class="cx">     if (!m_snapshotRemovalTracker.eventOccurred(SnapshotRemovalTracker::VisuallyNonEmptyLayout))
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaViewGestureControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/ViewGestureController.h (206958 => 206959)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/ViewGestureController.h        2016-10-08 20:14:22 UTC (rev 206958)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/ViewGestureController.h        2016-10-08 20:42:52 UTC (rev 206959)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;MessageReceiver.h&quot;
</span><span class="cx"> #include &quot;SameDocumentNavigationType.h&quot;
</span><ins>+#include &quot;WeakObjCPtr.h&quot;
</ins><span class="cx"> #include &lt;WebCore/Color.h&gt;
</span><span class="cx"> #include &lt;WebCore/FloatRect.h&gt;
</span><span class="cx"> #include &lt;chrono&gt;
</span><span class="lines">@@ -34,13 +35,15 @@
</span><span class="cx"> #include &lt;wtf/BlockPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/RunLoop.h&gt;
</span><del>-#include &lt;wtf/WeakPtr.h&gt;
</del><span class="cx"> 
</span><ins>+// FIXME: Move this file out of the mac/ subdirectory.
+
</ins><span class="cx"> OBJC_CLASS CALayer;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> OBJC_CLASS UIView;
</span><span class="cx"> OBJC_CLASS WKSwipeTransitionController;
</span><ins>+OBJC_CLASS WKWebView;
</ins><span class="cx"> OBJC_CLASS _UINavigationInteractiveTransitionBase;
</span><span class="cx"> OBJC_CLASS _UIViewControllerOneToOneTransitionContext;
</span><span class="cx"> OBJC_CLASS _UIViewControllerTransitionContext;
</span><span class="lines">@@ -106,15 +109,13 @@
</span><span class="cx">     bool isPhysicallySwipingLeft(SwipeDirection) const;
</span><span class="cx"> #else
</span><span class="cx">     void installSwipeHandler(UIView *gestureRecognizerView, UIView *swipingView);
</span><ins>+    void setAlternateBackForwardListSourceView(WKWebView *);
+    bool canSwipeInDirection(SwipeDirection);
</ins><span class="cx">     void beginSwipeGesture(_UINavigationInteractiveTransitionBase *, SwipeDirection);
</span><span class="cx">     void endSwipeGesture(WebBackForwardListItem* targetItem, _UIViewControllerTransitionContext *, bool cancelled);
</span><span class="cx">     void willCommitPostSwipeTransitionLayerTree(bool);
</span><span class="cx">     void setRenderTreeSize(uint64_t);
</span><span class="cx"> #endif
</span><del>-    
-    void setAlternateBackForwardListSourcePage(WebPageProxy*);
-    
-    bool canSwipeInDirection(SwipeDirection) const;
</del><span class="cx"> 
</span><span class="cx">     WebCore::Color backgroundColorForCurrentSnapshot() const { return m_backgroundColorForCurrentSnapshot; }
</span><span class="cx"> 
</span><span class="lines">@@ -201,7 +202,7 @@
</span><span class="cx"> 
</span><span class="cx">     class PendingSwipeTracker {
</span><span class="cx">     public:
</span><del>-        PendingSwipeTracker(WebPageProxy&amp;, ViewGestureController&amp;);
</del><ins>+        PendingSwipeTracker(WebPageProxy&amp;, std::function&lt;void(NSEvent *, SwipeDirection)&gt; trackSwipeCallback);
</ins><span class="cx">         bool handleEvent(NSEvent *);
</span><span class="cx">         void eventWasNotHandledByWebCore(NSEvent *);
</span><span class="cx"> 
</span><span class="lines">@@ -226,7 +227,7 @@
</span><span class="cx"> 
</span><span class="cx">         bool m_shouldIgnorePinnedState { false };
</span><span class="cx"> 
</span><del>-        ViewGestureController&amp; m_viewGestureController;
</del><ins>+        std::function&lt;void(NSEvent *, SwipeDirection)&gt; m_trackSwipeCallback;
</ins><span class="cx">         WebPageProxy&amp; m_webPageProxy;
</span><span class="cx">     };
</span><span class="cx"> #endif
</span><span class="lines">@@ -237,9 +238,6 @@
</span><span class="cx">     RunLoop::Timer&lt;ViewGestureController&gt; m_swipeActiveLoadMonitoringTimer;
</span><span class="cx"> 
</span><span class="cx">     WebCore::Color m_backgroundColorForCurrentSnapshot;
</span><del>-    
-    WeakPtr&lt;WebPageProxy&gt; m_alternateBackForwardListSourcePage;
-    RefPtr&lt;WebPageProxy&gt; m_webPageProxyForBackForwardListForCurrentSwipe;
</del><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     RefPtr&lt;ViewSnapshot&gt; m_currentSwipeSnapshot;
</span><span class="lines">@@ -279,6 +277,8 @@
</span><span class="cx">     RetainPtr&lt;WKSwipeTransitionController&gt; m_swipeInteractiveTransitionDelegate;
</span><span class="cx">     RetainPtr&lt;_UIViewControllerOneToOneTransitionContext&gt; m_swipeTransitionContext;
</span><span class="cx">     uint64_t m_snapshotRemovalTargetRenderTreeSize { 0 };
</span><ins>+    WeakObjCPtr&lt;WKWebView&gt; m_alternateBackForwardListSourceView;
+    RefPtr&lt;WebPageProxy&gt; m_webPageProxyForBackForwardListForCurrentSwipe;
</ins><span class="cx">     uint64_t m_gesturePendingSnapshotRemoval { 0 };
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (206958 => 206959)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2016-10-08 20:14:22 UTC (rev 206958)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2016-10-08 20:42:52 UTC (rev 206959)
</span><span class="lines">@@ -450,7 +450,6 @@
</span><span class="cx">     , m_configurationPreferenceValues(m_configuration-&gt;preferenceValues())
</span><span class="cx">     , m_potentiallyChangedViewStateFlags(ViewState::NoFlags)
</span><span class="cx">     , m_viewStateChangeWantsSynchronousReply(false)
</span><del>-    , m_weakPtrFactory(this)
</del><span class="cx"> {
</span><span class="cx">     m_webProcessLifetimeTracker.addObserver(m_visitedLinkStore);
</span><span class="cx">     m_webProcessLifetimeTracker.addObserver(m_websiteDataStore);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (206958 => 206959)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2016-10-08 20:14:22 UTC (rev 206958)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2016-10-08 20:42:52 UTC (rev 206959)
</span><span class="lines">@@ -1129,8 +1129,6 @@
</span><span class="cx"> #if ENABLE(GAMEPAD)
</span><span class="cx">     void gamepadActivity(const Vector&lt;GamepadData&gt;&amp;);
</span><span class="cx"> #endif
</span><del>-        
-    WeakPtr&lt;WebPageProxy&gt; createWeakPtr() const { return m_weakPtrFactory.createWeakPtr(); }
</del><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     WebPageProxy(PageClient&amp;, WebProcessProxy&amp;, uint64_t pageID, Ref&lt;API::PageConfiguration&gt;&amp;&amp;);
</span><span class="lines">@@ -1891,8 +1889,6 @@
</span><span class="cx"> #if ENABLE(DOWNLOAD_ATTRIBUTE)
</span><span class="cx">     bool m_syncNavigationActionHasDownloadAttribute { false };
</span><span class="cx"> #endif
</span><del>-        
-    WeakPtrFactory&lt;WebPageProxy&gt; m_weakPtrFactory;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosViewGestureControllerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm (206958 => 206959)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm        2016-10-08 20:14:22 UTC (rev 206958)
+++ trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm        2016-10-08 20:42:52 UTC (rev 206959)
</span><span class="lines">@@ -34,7 +34,6 @@
</span><span class="cx"> #import &quot;ViewSnapshotStore.h&quot;
</span><span class="cx"> #import &quot;WKBackForwardListItemInternal.h&quot;
</span><span class="cx"> #import &quot;WKWebViewInternal.h&quot;
</span><del>-#import &quot;WeakObjCPtr.h&quot;
</del><span class="cx"> #import &quot;WebBackForwardList.h&quot;
</span><span class="cx"> #import &quot;WebPageGroup.h&quot;
</span><span class="cx"> #import &quot;WebPageMessages.h&quot;
</span><span class="lines">@@ -141,6 +140,11 @@
</span><span class="cx">     [m_swipeInteractiveTransitionDelegate invalidate];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ViewGestureController::setAlternateBackForwardListSourceView(WKWebView *view)
+{
+    m_alternateBackForwardListSourceView = view;
+}
+
</ins><span class="cx"> void ViewGestureController::installSwipeHandler(UIView *gestureRecognizerView, UIView *swipingView)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!m_swipeInteractiveTransitionDelegate);
</span><span class="lines">@@ -155,9 +159,7 @@
</span><span class="cx"> 
</span><span class="cx">     m_webPageProxy.recordAutomaticNavigationSnapshot();
</span><span class="cx"> 
</span><del>-    RefPtr&lt;WebPageProxy&gt; alternateBackForwardListSourcePage = m_alternateBackForwardListSourcePage.get();
-    m_webPageProxyForBackForwardListForCurrentSwipe = alternateBackForwardListSourcePage ? alternateBackForwardListSourcePage.get() : &amp;m_webPageProxy;
-
</del><ins>+    m_webPageProxyForBackForwardListForCurrentSwipe = m_alternateBackForwardListSourceView.get() ? m_alternateBackForwardListSourceView.get()-&gt;_page : &amp;m_webPageProxy;
</ins><span class="cx">     m_webPageProxyForBackForwardListForCurrentSwipe-&gt;navigationGestureDidBegin();
</span><span class="cx">     if (&amp;m_webPageProxy != m_webPageProxyForBackForwardListForCurrentSwipe)
</span><span class="cx">         m_webPageProxy.navigationGestureDidBegin();
</span><span class="lines">@@ -237,6 +239,14 @@
</span><span class="cx">     m_activeGestureType = ViewGestureType::Swipe;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool ViewGestureController::canSwipeInDirection(SwipeDirection direction)
+{
+    auto&amp; backForwardList = m_alternateBackForwardListSourceView.get() ? m_alternateBackForwardListSourceView.get()-&gt;_page-&gt;backForwardList() : m_webPageProxy.backForwardList();
+    if (direction == SwipeDirection::Back)
+        return !!backForwardList.backItem();
+    return !!backForwardList.forwardItem();
+}
+
</ins><span class="cx"> void ViewGestureController::endSwipeGesture(WebBackForwardListItem* targetItem, _UIViewControllerTransitionContext *context, bool cancelled)
</span><span class="cx"> {
</span><span class="cx">     [context _setTransitionIsInFlight:NO];
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacViewGestureControllerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm (206958 => 206959)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm        2016-10-08 20:14:22 UTC (rev 206958)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm        2016-10-08 20:42:52 UTC (rev 206959)
</span><span class="lines">@@ -272,8 +272,8 @@
</span><span class="cx">     return std::abs(y) &gt;= std::abs(x) * minimumScrollEventRatioForSwipe;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-ViewGestureController::PendingSwipeTracker::PendingSwipeTracker(WebPageProxy&amp; webPageProxy, ViewGestureController&amp; viewGestureController)
-    : m_viewGestureController(viewGestureController)
</del><ins>+ViewGestureController::PendingSwipeTracker::PendingSwipeTracker(WebPageProxy&amp; webPageProxy, std::function&lt;void(NSEvent *, SwipeDirection)&gt; trackSwipeCallback)
+    : m_trackSwipeCallback(WTFMove(trackSwipeCallback))
</ins><span class="cx">     , m_webPageProxy(webPageProxy)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -292,16 +292,21 @@
</span><span class="cx">     bool isPinnedToLeft = m_shouldIgnorePinnedState || m_webPageProxy.isPinnedToLeftSide();
</span><span class="cx">     bool isPinnedToRight = m_shouldIgnorePinnedState || m_webPageProxy.isPinnedToRightSide();
</span><span class="cx"> 
</span><del>-    bool tryingToSwipeBack = event.scrollingDeltaX &gt; 0 &amp;&amp; isPinnedToLeft;
-    bool tryingToSwipeForward = event.scrollingDeltaX &lt; 0 &amp;&amp; isPinnedToRight;
-    if (m_webPageProxy.userInterfaceLayoutDirection() != WebCore::UserInterfaceLayoutDirection::LTR)
-        std::swap(tryingToSwipeBack, tryingToSwipeForward);
-    
-    if (!tryingToSwipeBack &amp;&amp; !tryingToSwipeForward)
</del><ins>+    bool willSwipeBack = false;
+    bool willSwipeForward = false;
+    if (m_webPageProxy.userInterfaceLayoutDirection() == WebCore::UserInterfaceLayoutDirection::LTR) {
+        willSwipeBack = event.scrollingDeltaX &gt; 0 &amp;&amp; isPinnedToLeft &amp;&amp; m_webPageProxy.backForwardList().backItem();
+        willSwipeForward = event.scrollingDeltaX &lt; 0 &amp;&amp; isPinnedToRight &amp;&amp; m_webPageProxy.backForwardList().forwardItem();
+    } else {
+        willSwipeBack = event.scrollingDeltaX &lt; 0 &amp;&amp; isPinnedToRight &amp;&amp; m_webPageProxy.backForwardList().backItem();
+        willSwipeForward = event.scrollingDeltaX &gt; 0 &amp;&amp; isPinnedToLeft &amp;&amp; m_webPageProxy.backForwardList().forwardItem();
+    }
+    if (!willSwipeBack &amp;&amp; !willSwipeForward)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    potentialSwipeDirection = tryingToSwipeBack ? SwipeDirection::Back : SwipeDirection::Forward;
-    return m_viewGestureController.canSwipeInDirection(potentialSwipeDirection);
</del><ins>+    potentialSwipeDirection = willSwipeBack ? ViewGestureController::SwipeDirection::Back : ViewGestureController::SwipeDirection::Forward;
+
+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool ViewGestureController::handleScrollWheelEvent(NSEvent *event)
</span><span class="lines">@@ -367,7 +372,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (std::abs(m_cumulativeDelta.width()) &gt;= minimumHorizontalSwipeDistance)
</span><del>-        m_viewGestureController.trackSwipeGesture(event, m_direction);
</del><ins>+        m_trackSwipeCallback(event, m_direction);
</ins><span class="cx">     else
</span><span class="cx">         m_state = State::InsufficientMagnitude;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>