Diff
Modified: branches/safari-600.1-branch/Source/WebKit2/ChangeLog (172982 => 172983)
--- branches/safari-600.1-branch/Source/WebKit2/ChangeLog 2014-08-26 23:45:34 UTC (rev 172982)
+++ branches/safari-600.1-branch/Source/WebKit2/ChangeLog 2014-08-26 23:57:18 UTC (rev 172983)
@@ -1,3 +1,81 @@
+2014-08-26 Dana Burkart <[email protected]>
+
+ Merge r172966. <rdar://problem/18107826>
+
+ 2014-08-26 Tim Horton <[email protected]>
+
+ REGRESSION (r172771): Amazon product page becomes unresponsive after swiping back to it
+ https://bugs.webkit.org/show_bug.cgi?id=136260
+ <rdar://problem/18107826>
+
+ Reviewed by Dan Bernstein.
+
+ Previously, when a swipe ended up performing a same-document navigation,
+ we would never get didFinishLoadForMainFrame nor didFirstVisuallyNonEmptyLayoutForMainFrame
+ nor would we even get didHitRenderTreeSizeThreshold in all cases, so we would never
+ remove the swipe snapshot. Previous implementations removed the snapshot on
+ didSameDocumentNavigation for the main frame if the navigation type was Replace or Pop,
+ so we will match that behavior.
+
+ Also, reinstate the watchdog that starts at swipe-end which would have prevented
+ this bug from forever breaking the view it was associated with.
+
+ Also, defend against removing the snapshot before the swipe has finished (before
+ we have even caused the navigation that we're watching for the effects of).
+
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView _didSameDocumentNavigationForMainFrame:]):
+ * UIProcess/API/mac/WKViewInternal.h:
+ * UIProcess/PageClient.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
+ * UIProcess/ios/PageClientImplIOS.h:
+ * UIProcess/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame):
+ * UIProcess/mac/PageClientImpl.h:
+ * UIProcess/mac/PageClientImpl.mm:
+ (WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame):
+ Plumb main-frame same-document navigation notification from WebPageProxy
+ to ViewGestureControllerMac via PageClient and WKView.
+
+ * UIProcess/mac/ViewGestureController.h:
+ * UIProcess/mac/ViewGestureControllerMac.mm:
+ (WebKit::ViewGestureController::ViewGestureController):
+ (WebKit::ViewGestureController::beginSwipeGesture):
+ (WebKit::ViewGestureController::endSwipeGesture):
+ Keep track of whether a swipe is currently occurring. We can't use
+ activeGestureType for this because the swipe currently remains the "active"
+ gesture until the snapshot is removed.
+
+ Reintroduce the old swipeWatchdogTimer (and rename the shorter timer that starts
+ when we get a visually non-empty layout) so that we will always remove the
+ snapshot after 5 seconds, even if we haven't committed the load.
+ This could lead to flashing back to the old content if we fail to get a single
+ byte for 5 seconds, but that is a rare case and should eventually get additional
+ special treatment (dropping the tiles until we do get content, or some such).
+
+ (WebKit::ViewGestureController::didHitRenderTreeSizeThreshold):
+ If a swipe is still in progress, we haven't done our navigation and thus
+ don't care about render tree size changes.
+
+ (WebKit::ViewGestureController::didFirstVisuallyNonEmptyLayoutForMainFrame):
+ If a swipe is still in progress, we haven't done our navigation and thus
+ don't care about layouts.
+
+ Stop the 5 second overall watchdog if we start the 3 second after-visuallyNonEmptyLayout
+ watchdog. This means that the snapshot could stay up for a maximum of 8 seconds
+ for a very, very slow load.
+
+ (WebKit::ViewGestureController::didFinishLoadForMainFrame):
+ If a swipe is still in progress, we haven't done our navigation and thus
+ don't care about loads that complete.
+
+ (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
+ Remove the swipe snapshot after painting if we do replaceState or popState.
+
+ (WebKit::ViewGestureController::removeSwipeSnapshotAfterRepaint):
+ If a swipe is still in progress, we shouldn't remove the snapshot yet.
+
2014-08-19 Dana Burkart <[email protected]>
Merge r172643. <rdar://problem/18032571>
Modified: branches/safari-600.1-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm (172982 => 172983)
--- branches/safari-600.1-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm 2014-08-26 23:45:34 UTC (rev 172982)
+++ branches/safari-600.1-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm 2014-08-26 23:57:18 UTC (rev 172983)
@@ -3610,6 +3610,12 @@
_data->_gestureController->didFinishLoadForMainFrame();
}
+- (void)_didSameDocumentNavigationForMainFrame:(SameDocumentNavigationType)type
+{
+ if (_data->_gestureController)
+ _data->_gestureController->didSameDocumentNavigationForMainFrame(type);
+}
+
- (void)_removeNavigationGestureSnapshot
{
if (_data->_gestureController)
Modified: branches/safari-600.1-branch/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h (172982 => 172983)
--- branches/safari-600.1-branch/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h 2014-08-26 23:45:34 UTC (rev 172982)
+++ branches/safari-600.1-branch/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h 2014-08-26 23:57:18 UTC (rev 172983)
@@ -26,6 +26,7 @@
#import "WKViewPrivate.h"
#import "PluginComplexTextInputState.h"
+#import "SameDocumentNavigationType.h"
#import "WebFindOptions.h"
#import <wtf/Forward.h>
#import <wtf/RetainPtr.h>
@@ -109,6 +110,7 @@
- (void)_didFirstVisuallyNonEmptyLayoutForMainFrame;
- (void)_didFinishLoadForMainFrame;
+- (void)_didSameDocumentNavigationForMainFrame:(WebKit::SameDocumentNavigationType)type;
- (void)_removeNavigationGestureSnapshot;
#if WK_API_ENABLED
Modified: branches/safari-600.1-branch/Source/WebKit2/UIProcess/PageClient.h (172982 => 172983)
--- branches/safari-600.1-branch/Source/WebKit2/UIProcess/PageClient.h 2014-08-26 23:45:34 UTC (rev 172982)
+++ branches/safari-600.1-branch/Source/WebKit2/UIProcess/PageClient.h 2014-08-26 23:57:18 UTC (rev 172983)
@@ -305,6 +305,7 @@
virtual void didFirstVisuallyNonEmptyLayoutForMainFrame() = 0;
virtual void didFinishLoadForMainFrame() = 0;
+ virtual void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) = 0;
};
} // namespace WebKit
Modified: branches/safari-600.1-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp (172982 => 172983)
--- branches/safari-600.1-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp 2014-08-26 23:45:34 UTC (rev 172982)
+++ branches/safari-600.1-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp 2014-08-26 23:57:18 UTC (rev 172983)
@@ -2709,14 +2709,20 @@
auto transaction = m_pageLoadState.transaction();
- if (frame->isMainFrame())
+ bool isMainFrame = frame->isMainFrame();
+ if (isMainFrame)
m_pageLoadState.didSameDocumentNavigation(transaction, url);
m_pageLoadState.clearPendingAPIRequestURL(transaction);
frame->didSameDocumentNavigation(url);
m_pageLoadState.commitChanges();
- m_loaderClient->didSameDocumentNavigationForFrame(this, frame, navigationID, static_cast<SameDocumentNavigationType>(opaqueSameDocumentNavigationType), userData.get());
+
+ SameDocumentNavigationType navigationType = static_cast<SameDocumentNavigationType>(opaqueSameDocumentNavigationType);
+ m_loaderClient->didSameDocumentNavigationForFrame(this, frame, navigationID, navigationType, userData.get());
+
+ if (isMainFrame)
+ m_pageClient.didSameDocumentNavigationForMainFrame(navigationType);
}
void WebPageProxy::didReceiveTitleForFrame(uint64_t frameID, const String& title, IPC::MessageDecoder& decoder)
Modified: branches/safari-600.1-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (172982 => 172983)
--- branches/safari-600.1-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h 2014-08-26 23:45:34 UTC (rev 172982)
+++ branches/safari-600.1-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h 2014-08-26 23:57:18 UTC (rev 172983)
@@ -177,6 +177,7 @@
virtual void didFirstVisuallyNonEmptyLayoutForMainFrame() override;
virtual void didFinishLoadForMainFrame() override;
+ virtual void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) override;
WKContentView *m_contentView;
WKWebView *m_webView;
Modified: branches/safari-600.1-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (172982 => 172983)
--- branches/safari-600.1-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm 2014-08-26 23:45:34 UTC (rev 172982)
+++ branches/safari-600.1-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm 2014-08-26 23:57:18 UTC (rev 172983)
@@ -690,6 +690,10 @@
{
}
+void PageClientImpl::didSameDocumentNavigationForMainFrame(SameDocumentNavigationType)
+{
+}
+
} // namespace WebKit
#endif // PLATFORM(IOS)
Modified: branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h (172982 => 172983)
--- branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h 2014-08-26 23:45:34 UTC (rev 172982)
+++ branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h 2014-08-26 23:57:18 UTC (rev 172983)
@@ -181,6 +181,7 @@
virtual void didFirstVisuallyNonEmptyLayoutForMainFrame() override;
virtual void didFinishLoadForMainFrame() override;
+ virtual void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) override;
virtual void removeNavigationGestureSnapshot() override;
WKView *m_wkView;
Modified: branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (172982 => 172983)
--- branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm 2014-08-26 23:45:34 UTC (rev 172982)
+++ branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm 2014-08-26 23:57:18 UTC (rev 172983)
@@ -732,6 +732,11 @@
[m_wkView _didFinishLoadForMainFrame];
}
+void PageClientImpl::didSameDocumentNavigationForMainFrame(SameDocumentNavigationType type)
+{
+ [m_wkView _didSameDocumentNavigationForMainFrame:type];
+}
+
void PageClientImpl::removeNavigationGestureSnapshot()
{
[m_wkView _removeNavigationGestureSnapshot];
Modified: branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/ViewGestureController.h (172982 => 172983)
--- branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/ViewGestureController.h 2014-08-26 23:45:34 UTC (rev 172982)
+++ branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/ViewGestureController.h 2014-08-26 23:57:18 UTC (rev 172983)
@@ -27,6 +27,7 @@
#define ViewGestureController_h
#include "MessageReceiver.h"
+#include "SameDocumentNavigationType.h"
#include "WeakObjCPtr.h"
#include <WebCore/FloatRect.h>
#include <wtf/RetainPtr.h>
@@ -107,6 +108,7 @@
void didFirstVisuallyNonEmptyLayoutForMainFrame();
void didFinishLoadForMainFrame();
+ void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType);
#else
void installSwipeHandler(UIView *gestureRecognizerView, UIView *swipingView);
void setAlternateBackForwardListSourceView(WKWebView *);
@@ -158,6 +160,8 @@
#endif
#if PLATFORM(MAC)
+ RunLoop::Timer<ViewGestureController> m_swipeWatchdogAfterFirstVisuallyNonEmptyLayoutTimer;
+
double m_magnification;
WebCore::FloatPoint m_magnificationOrigin;
@@ -190,6 +194,7 @@
bool m_swipeWaitingForVisuallyNonEmptyLayout;
bool m_swipeWaitingForRenderTreeSizeThreshold;
bool m_swipeWaitingForRepaint;
+ bool m_swipeInProgress;
#else
UIView *m_liveSwipeView;
RetainPtr<UIView> m_liveSwipeViewClippingView;
Modified: branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm (172982 => 172983)
--- branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm 2014-08-26 23:45:34 UTC (rev 172982)
+++ branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm 2014-08-26 23:57:18 UTC (rev 172983)
@@ -77,7 +77,8 @@
static const float minimumScrollEventRatioForSwipe = 0.5;
static const float swipeSnapshotRemovalRenderTreeSizeTargetFraction = 0.5;
-static const std::chrono::seconds swipeSnapshotRemovalWatchdogDuration = 3_s;
+static const std::chrono::seconds swipeSnapshotRemovalWatchdogDuration = 5_s;
+static const std::chrono::seconds swipeSnapshotRemovalWatchdogAfterFirstVisuallyNonEmptyLayoutDuration = 3_s;
@interface WKSwipeCancellationTracker : NSObject {
@private
@@ -98,6 +99,7 @@
: m_webPageProxy(webPageProxy)
, m_activeGestureType(ViewGestureType::None)
, m_swipeWatchdogTimer(RunLoop::main(), this, &ViewGestureController::swipeSnapshotWatchdogTimerFired)
+ , m_swipeWatchdogAfterFirstVisuallyNonEmptyLayoutTimer(RunLoop::main(), this, &ViewGestureController::swipeSnapshotWatchdogTimerFired)
, m_lastMagnificationGestureWasSmartMagnification(false)
, m_visibleContentRectIsValid(false)
, m_frameHandlesMagnificationGesture(false)
@@ -108,6 +110,7 @@
, m_swipeWaitingForVisuallyNonEmptyLayout(false)
, m_swipeWaitingForRenderTreeSizeThreshold(false)
, m_swipeWaitingForRepaint(false)
+ , m_swipeInProgress(false)
{
m_webPageProxy.process().addMessageReceiver(Messages::ViewGestureController::messageReceiverName(), m_webPageProxy.pageID(), *this);
}
@@ -505,6 +508,7 @@
m_webPageProxy.navigationGestureDidBegin();
m_activeGestureType = ViewGestureType::Swipe;
+ m_swipeInProgress = true;
CALayer *rootContentLayer = m_webPageProxy.acceleratedCompositingRootLayer();
@@ -627,6 +631,8 @@
m_swipeCancellationTracker = nullptr;
+ m_swipeInProgress = false;
+
CALayer *rootLayer = m_webPageProxy.acceleratedCompositingRootLayer();
[rootLayer setShadowOpacity:0];
@@ -649,11 +655,13 @@
m_webPageProxy.navigationGestureDidEnd(true, *targetItem);
m_webPageProxy.goToBackForwardItem(targetItem);
+
+ m_swipeWatchdogTimer.startOneShot(swipeSnapshotRemovalWatchdogDuration.count());
}
void ViewGestureController::didHitRenderTreeSizeThreshold()
{
- if (m_activeGestureType != ViewGestureType::Swipe)
+ if (m_activeGestureType != ViewGestureType::Swipe || m_swipeInProgress)
return;
m_swipeWaitingForRenderTreeSizeThreshold = false;
@@ -664,20 +672,27 @@
void ViewGestureController::didFirstVisuallyNonEmptyLayoutForMainFrame()
{
- if (m_activeGestureType != ViewGestureType::Swipe)
+ if (m_activeGestureType != ViewGestureType::Swipe || m_swipeInProgress)
return;
m_swipeWaitingForVisuallyNonEmptyLayout = false;
if (!m_swipeWaitingForRenderTreeSizeThreshold)
removeSwipeSnapshotAfterRepaint();
- else
- m_swipeWatchdogTimer.startOneShot(swipeSnapshotRemovalWatchdogDuration.count());
+ else {
+ m_swipeWatchdogAfterFirstVisuallyNonEmptyLayoutTimer.startOneShot(swipeSnapshotRemovalWatchdogAfterFirstVisuallyNonEmptyLayoutDuration.count());
+ m_swipeWatchdogTimer.stop();
+ }
}
void ViewGestureController::didFinishLoadForMainFrame()
{
- if (m_activeGestureType != ViewGestureType::Swipe)
+ removeSwipeSnapshotAfterRepaint();
+}
+
+void ViewGestureController::didSameDocumentNavigationForMainFrame(SameDocumentNavigationType type)
+{
+ if (type != SameDocumentNavigationSessionStateReplace && type != SameDocumentNavigationSessionStatePop)
return;
removeSwipeSnapshotAfterRepaint();
@@ -690,7 +705,7 @@
void ViewGestureController::removeSwipeSnapshotAfterRepaint()
{
- if (m_activeGestureType != ViewGestureType::Swipe)
+ if (m_activeGestureType != ViewGestureType::Swipe || m_swipeInProgress)
return;
if (m_swipeWaitingForRepaint)
@@ -709,6 +724,7 @@
m_swipeWaitingForRepaint = false;
m_swipeWatchdogTimer.stop();
+ m_swipeWatchdogAfterFirstVisuallyNonEmptyLayoutTimer.stop();
if (m_activeGestureType != ViewGestureType::Swipe)
return;