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