Diff
Modified: branches/safari-607-branch/Source/WebKit/ChangeLog (239808 => 239809)
--- branches/safari-607-branch/Source/WebKit/ChangeLog 2019-01-10 01:38:36 UTC (rev 239808)
+++ branches/safari-607-branch/Source/WebKit/ChangeLog 2019-01-10 01:38:40 UTC (rev 239809)
@@ -1,5 +1,96 @@
2019-01-09 Kocsen Chung <kocsen_ch...@apple.com>
+ Cherry-pick r239777. rdar://problem/47158629
+
+ [PSON] Flash of blank content while transitioning from page A to page B.
+ https://bugs.webkit.org/show_bug.cgi?id=193283
+
+ Reviewed by Chris Dumez.
+
+ Layer tree is not frozen during WebPage construction. If the flush timer (started for the initial
+ empty document) manages to run before the actual page load starts, we'll get a flash.
+
+ * Shared/WebPageCreationParameters.cpp:
+ (WebKit::WebPageCreationParameters::encode const):
+ (WebKit::WebPageCreationParameters::decode):
+ * Shared/WebPageCreationParameters.h:
+
+ Rename shouldDelayAttachingDrawingArea bit to isSwapFromSuspended and make it available on all platforms.
+
+ * UIProcess/RemoteLayerTree/mac/ScrollerMac.h: Removed.
+ * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm: Removed.
+ * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.h: Removed.
+ * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm: Removed.
+ * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp: Removed.
+ * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h: Removed.
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::swapToWebProcess):
+ (WebKit::WebPageProxy::finishAttachingToWebProcess):
+ (WebKit::WebPageProxy::initializeWebPage):
+ (WebKit::WebPageProxy::continueNavigationInNewProcess):
+ * UIProcess/WebPageProxy.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
+
+ Freeze the layer tree in WebPage constructor if this is a swap from a suspended process.
+
+ (WebKit::WebPage::reinitializeWebPage):
+ (WebKit::WebPage::didCompletePageTransition):
+
+ Unfreeze on first non-initial empty document page transition.
+
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+ (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239777 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-01-09 Antti Koivisto <an...@apple.com>
+
+ [PSON] Flash of blank content while transitioning from page A to page B.
+ https://bugs.webkit.org/show_bug.cgi?id=193283
+
+ Reviewed by Chris Dumez.
+
+ Layer tree is not frozen during WebPage construction. If the flush timer (started for the initial
+ empty document) manages to run before the actual page load starts, we'll get a flash.
+
+ * Shared/WebPageCreationParameters.cpp:
+ (WebKit::WebPageCreationParameters::encode const):
+ (WebKit::WebPageCreationParameters::decode):
+ * Shared/WebPageCreationParameters.h:
+
+ Rename shouldDelayAttachingDrawingArea bit to isSwapFromSuspended and make it available on all platforms.
+
+ * UIProcess/RemoteLayerTree/mac/ScrollerMac.h: Removed.
+ * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm: Removed.
+ * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.h: Removed.
+ * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm: Removed.
+ * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp: Removed.
+ * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h: Removed.
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::swapToWebProcess):
+ (WebKit::WebPageProxy::finishAttachingToWebProcess):
+ (WebKit::WebPageProxy::initializeWebPage):
+ (WebKit::WebPageProxy::continueNavigationInNewProcess):
+ * UIProcess/WebPageProxy.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
+
+ Freeze the layer tree in WebPage constructor if this is a swap from a suspended process.
+
+ (WebKit::WebPage::reinitializeWebPage):
+ (WebKit::WebPage::didCompletePageTransition):
+
+ Unfreeze on first non-initial empty document page transition.
+
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+ (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
+
+2019-01-09 Kocsen Chung <kocsen_ch...@apple.com>
+
Cherry-pick r239694. rdar://problem/47158722
Deactivate audio session whenever possible
Modified: branches/safari-607-branch/Source/WebKit/Shared/WebPageCreationParameters.cpp (239808 => 239809)
--- branches/safari-607-branch/Source/WebKit/Shared/WebPageCreationParameters.cpp 2019-01-10 01:38:36 UTC (rev 239808)
+++ branches/safari-607-branch/Source/WebKit/Shared/WebPageCreationParameters.cpp 2019-01-10 01:38:40 UTC (rev 239809)
@@ -73,12 +73,12 @@
encoder.encodeEnum(layerHostingMode);
encoder << mimeTypesWithCustomContentProviders;
encoder << controlledByAutomation;
+ encoder << isSwapFromSuspended;
#if PLATFORM(MAC)
encoder << colorSpace;
encoder << useSystemAppearance;
encoder << useDarkAppearance;
- encoder << shouldDelayAttachingDrawingArea;
#endif
#if PLATFORM(IOS_FAMILY)
encoder << screenSize;
@@ -227,6 +227,8 @@
return WTF::nullopt;
if (!decoder.decode(parameters.controlledByAutomation))
return WTF::nullopt;
+ if (!decoder.decode(parameters.isSwapFromSuspended))
+ return WTF::nullopt;
#if PLATFORM(MAC)
if (!decoder.decode(parameters.colorSpace))
@@ -235,8 +237,6 @@
return WTF::nullopt;
if (!decoder.decode(parameters.useDarkAppearance))
return WTF::nullopt;
- if (!decoder.decode(parameters.shouldDelayAttachingDrawingArea))
- return WTF::nullopt;
#endif
#if PLATFORM(IOS_FAMILY)
Modified: branches/safari-607-branch/Source/WebKit/Shared/WebPageCreationParameters.h (239808 => 239809)
--- branches/safari-607-branch/Source/WebKit/Shared/WebPageCreationParameters.h 2019-01-10 01:38:36 UTC (rev 239808)
+++ branches/safari-607-branch/Source/WebKit/Shared/WebPageCreationParameters.h 2019-01-10 01:38:40 UTC (rev 239809)
@@ -129,12 +129,12 @@
Vector<String> mimeTypesWithCustomContentProviders;
bool controlledByAutomation;
+ bool isSwapFromSuspended { false };
#if PLATFORM(MAC)
ColorSpaceData colorSpace;
bool useSystemAppearance;
bool useDarkAppearance;
- bool shouldDelayAttachingDrawingArea { false };
#endif
#if PLATFORM(IOS_FAMILY)
WebCore::FloatSize screenSize;
Modified: branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.cpp (239808 => 239809)
--- branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-01-10 01:38:36 UTC (rev 239808)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-01-10 01:38:40 UTC (rev 239809)
@@ -772,7 +772,7 @@
return true;
}
-void WebPageProxy::swapToWebProcess(Ref<WebProcessProxy>&& process, std::unique_ptr<SuspendedPageProxy>&& destinationSuspendedPage, ShouldDelayAttachingDrawingArea shouldDelayAttachingDrawingArea)
+void WebPageProxy::swapToWebProcess(Ref<WebProcessProxy>&& process, std::unique_ptr<SuspendedPageProxy>&& destinationSuspendedPage, IsSwapFromSuspended isSwapFromSuspended)
{
ASSERT(!m_isClosed);
RELEASE_LOG_IF_ALLOWED(Loading, "swapToWebProcess: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID);
@@ -800,10 +800,10 @@
m_process->addExistingWebPage(*this, m_pageID, WebProcessProxy::BeginsUsingDataStore::No);
m_process->addMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_pageID, *this);
- finishAttachingToWebProcess(shouldDelayAttachingDrawingArea);
+ finishAttachingToWebProcess(isSwapFromSuspended);
}
-void WebPageProxy::finishAttachingToWebProcess(ShouldDelayAttachingDrawingArea shouldDelayAttachingDrawingArea)
+void WebPageProxy::finishAttachingToWebProcess(IsSwapFromSuspended isSwapFromSuspended)
{
ASSERT(m_process->state() != ChildProcessProxy::State::Terminated);
@@ -839,7 +839,7 @@
m_editableImageController = std::make_unique<EditableImageController>(*this);
#endif
- initializeWebPage(shouldDelayAttachingDrawingArea);
+ initializeWebPage(isSwapFromSuspended);
m_inspector->updateForNewPageProcess(this);
@@ -904,7 +904,7 @@
return WTFMove(navigation);
}
-void WebPageProxy::initializeWebPage(ShouldDelayAttachingDrawingArea shouldDelayAttachingDrawingArea)
+void WebPageProxy::initializeWebPage(IsSwapFromSuspended isSwapFromSuspended)
{
ASSERT(isValid());
@@ -922,11 +922,7 @@
#endif
auto parameters = creationParameters();
-#if PLATFORM(MAC)
- parameters.shouldDelayAttachingDrawingArea = shouldDelayAttachingDrawingArea == ShouldDelayAttachingDrawingArea::Yes;
-#else
- UNUSED_PARAM(shouldDelayAttachingDrawingArea);
-#endif
+ parameters.isSwapFromSuspended = isSwapFromSuspended == IsSwapFromSuspended::Yes;
#if ENABLE(SERVICE_WORKER)
parameters.hasRegisteredServiceWorkers = process().processPool().mayHaveRegisteredServiceWorkers(m_websiteDataStore);
@@ -2763,7 +2759,7 @@
bool didSuspendPreviousPage = suspendCurrentPageIfPossible(navigation, mainFrameIDInPreviousProcess, processSwapRequestedByClient);
m_process->removeWebPage(*this, m_pageID, WebProcessProxy::EndsUsingDataStore::No);
- swapToWebProcess(WTFMove(process), WTFMove(suspendedPageProxy), didSuspendPreviousPage ? ShouldDelayAttachingDrawingArea::Yes : ShouldDelayAttachingDrawingArea::No);
+ swapToWebProcess(WTFMove(process), WTFMove(suspendedPageProxy), didSuspendPreviousPage ? IsSwapFromSuspended::Yes : IsSwapFromSuspended::No);
if (auto* item = navigation.targetItem()) {
LOG(Loading, "WebPageProxy %p continueNavigationInNewProcess to back item URL %s", this, item->url().utf8().data());
Modified: branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.h (239808 => 239809)
--- branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.h 2019-01-10 01:38:36 UTC (rev 239808)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.h 2019-01-10 01:38:40 UTC (rev 239809)
@@ -458,8 +458,8 @@
API::IconLoadingClient& iconLoadingClient() { return *m_iconLoadingClient; }
void setIconLoadingClient(std::unique_ptr<API::IconLoadingClient>&&);
- enum class ShouldDelayAttachingDrawingArea { No, Yes };
- void initializeWebPage(ShouldDelayAttachingDrawingArea = ShouldDelayAttachingDrawingArea::No);
+ enum class IsSwapFromSuspended { No, Yes };
+ void initializeWebPage(IsSwapFromSuspended = IsSwapFromSuspended::No);
WeakPtr<SecKeyProxyStore> secKeyProxyStore(const WebCore::AuthenticationChallenge&);
@@ -1574,11 +1574,11 @@
void setCanShortCircuitHorizontalWheelEvents(bool canShortCircuitHorizontalWheelEvents) { m_canShortCircuitHorizontalWheelEvents = canShortCircuitHorizontalWheelEvents; }
void reattachToWebProcess();
- void swapToWebProcess(Ref<WebProcessProxy>&&, std::unique_ptr<SuspendedPageProxy>&&, ShouldDelayAttachingDrawingArea);
+ void swapToWebProcess(Ref<WebProcessProxy>&&, std::unique_ptr<SuspendedPageProxy>&&, IsSwapFromSuspended);
void didFailToSuspendAfterProcessSwap();
void didSuspendAfterProcessSwap();
- void finishAttachingToWebProcess(ShouldDelayAttachingDrawingArea = ShouldDelayAttachingDrawingArea::No);
+ void finishAttachingToWebProcess(IsSwapFromSuspended = IsSwapFromSuspended::No);
RefPtr<API::Navigation> reattachToWebProcessForReload();
RefPtr<API::Navigation> reattachToWebProcessWithItem(WebBackForwardListItem&);
Modified: branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp (239808 => 239809)
--- branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2019-01-10 01:38:36 UTC (rev 239808)
+++ branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2019-01-10 01:38:40 UTC (rev 239809)
@@ -402,7 +402,7 @@
, m_overrideContentSecurityPolicy { parameters.overrideContentSecurityPolicy }
, m_cpuLimit(parameters.cpuLimit)
#if PLATFORM(MAC)
- , m_shouldAttachDrawingAreaOnPageTransition(parameters.shouldDelayAttachingDrawingArea)
+ , m_shouldAttachDrawingAreaOnPageTransition(parameters.isSwapFromSuspended)
#endif
{
ASSERT(m_pageID);
@@ -472,6 +472,9 @@
m_drawingArea->setPaintingEnabled(false);
m_drawingArea->setShouldScaleViewToFitDocument(parameters.shouldScaleViewToFitDocument);
+ if (parameters.isSwapFromSuspended)
+ freezeLayerTree(LayerTreeFreezeReason::SwapFromSuspended);
+
#if ENABLE(ASYNC_SCROLLING)
m_useAsyncScrolling = parameters.store.getBoolValueForKey(WebPreferencesKey::threadedScrollingEnabledKey());
if (!m_drawingArea->supportsAsyncScrolling())
@@ -694,7 +697,7 @@
m_drawingArea->updatePreferences(parameters.store);
m_drawingArea->setPaintingEnabled(true);
#if PLATFORM(MAC)
- m_shouldAttachDrawingAreaOnPageTransition = parameters.shouldDelayAttachingDrawingArea;
+ m_shouldAttachDrawingAreaOnPageTransition = parameters.isSwapFromSuspended;
#endif
unfreezeLayerTree(LayerTreeFreezeReason::PageSuspended);
}
@@ -3098,8 +3101,11 @@
{
unfreezeLayerTree(LayerTreeFreezeReason::PageTransition);
+ bool isInitialEmptyDocument = !m_mainFrame;
+ if (!isInitialEmptyDocument)
+ unfreezeLayerTree(LayerTreeFreezeReason::SwapFromSuspended);
+
#if PLATFORM(MAC)
- bool isInitialEmptyDocument = !m_mainFrame;
if (m_shouldAttachDrawingAreaOnPageTransition && !isInitialEmptyDocument) {
m_shouldAttachDrawingAreaOnPageTransition = false;
// Unfreezing the layer tree above schedules a layer flush so we delay attaching the drawing area
Modified: branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/WebPage.h (239808 => 239809)
--- branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-01-10 01:38:36 UTC (rev 239808)
+++ branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-01-10 01:38:40 UTC (rev 239809)
@@ -696,6 +696,7 @@
ProcessSuspended = 1 << 2,
PageSuspended = 1 << 3,
Printing = 1 << 4,
+ SwapFromSuspended = 1 << 5,
};
void freezeLayerTree(LayerTreeFreezeReason);
void unfreezeLayerTree(LayerTreeFreezeReason);
Modified: branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (239808 => 239809)
--- branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2019-01-10 01:38:36 UTC (rev 239808)
+++ branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2019-01-10 01:38:40 UTC (rev 239809)
@@ -97,7 +97,7 @@
updateLayerHostingContext();
setColorSpace(parameters.colorSpace);
- if (!parameters.shouldDelayAttachingDrawingArea)
+ if (!parameters.isSwapFromSuspended)
attach();
}