- Revision
- 167298
- Author
- simon.fra...@apple.com
- Date
- 2014-04-14 23:13:58 -0700 (Mon, 14 Apr 2014)
Log Message
[iOS WK2] Pages often blank on first load if page loaded by typing the URL
https://bugs.webkit.org/show_bug.cgi?id=131665
Reviewed by Tim Horton.
The document overlay-related code in RemoteLayerTreeDrawingArea::setRootCompositingLayer()
was triggering a compositing layer flush when called with a null rootLayer, which happens
for pages going into the page cache. This would trigger a layer flush that would clobber
the root layer for the visible page, resulting in missing content.
Also, rebuildCompositingLayerTree() is called recursively and the m_documentOverlayRootLayer
was being added to (and then removed from) every single compositing layers.
Fix both these by changing to a pull model, where RenderLayerCompositor requests
the overlay layer via ChromeClient, and gets it at the end of every flush,
adding to the children of the root layer.
Source/WebCore:
* WebCore.exp.in:
* page/ChromeClient.h:
(WebCore::ChromeClient::documentOverlayLayerForFrame):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::RenderLayerCompositor):
(WebCore::RenderLayerCompositor::flushPendingLayerChanges): Put visibleRect
into a variable for ease of debugging.
(WebCore::RenderLayerCompositor::updateCompositingLayers): Asser
that we're not in the page cache (this would have caught the bug).
(WebCore::RenderLayerCompositor::appendOverlayLayers):
(WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
(WebCore::RenderLayerCompositor::setDocumentOverlayRootLayer): Deleted.
* rendering/RenderLayerCompositor.h:
Source/WebKit2:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::documentOverlayLayerForFrame):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (167297 => 167298)
--- trunk/Source/WebCore/ChangeLog 2014-04-15 06:13:17 UTC (rev 167297)
+++ trunk/Source/WebCore/ChangeLog 2014-04-15 06:13:58 UTC (rev 167298)
@@ -1,3 +1,36 @@
+2014-04-14 Simon Fraser <simon.fra...@apple.com>
+
+ [iOS WK2] Pages often blank on first load if page loaded by typing the URL
+ https://bugs.webkit.org/show_bug.cgi?id=131665
+
+ Reviewed by Tim Horton.
+
+ The document overlay-related code in RemoteLayerTreeDrawingArea::setRootCompositingLayer()
+ was triggering a compositing layer flush when called with a null rootLayer, which happens
+ for pages going into the page cache. This would trigger a layer flush that would clobber
+ the root layer for the visible page, resulting in missing content.
+
+ Also, rebuildCompositingLayerTree() is called recursively and the m_documentOverlayRootLayer
+ was being added to (and then removed from) every single compositing layers.
+
+ Fix both these by changing to a pull model, where RenderLayerCompositor requests
+ the overlay layer via ChromeClient, and gets it at the end of every flush,
+ adding to the children of the root layer.
+
+ * WebCore.exp.in:
+ * page/ChromeClient.h:
+ (WebCore::ChromeClient::documentOverlayLayerForFrame):
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::RenderLayerCompositor):
+ (WebCore::RenderLayerCompositor::flushPendingLayerChanges): Put visibleRect
+ into a variable for ease of debugging.
+ (WebCore::RenderLayerCompositor::updateCompositingLayers): Asser
+ that we're not in the page cache (this would have caught the bug).
+ (WebCore::RenderLayerCompositor::appendOverlayLayers):
+ (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
+ (WebCore::RenderLayerCompositor::setDocumentOverlayRootLayer): Deleted.
+ * rendering/RenderLayerCompositor.h:
+
2014-04-14 Jon Honeycutt <jhoneyc...@apple.com>
Assertion failure under FEImage::determineAbsolutePaintRect()
Modified: trunk/Source/WebCore/WebCore.exp.in (167297 => 167298)
--- trunk/Source/WebCore/WebCore.exp.in 2014-04-15 06:13:17 UTC (rev 167297)
+++ trunk/Source/WebCore/WebCore.exp.in 2014-04-15 06:13:58 UTC (rev 167298)
@@ -871,7 +871,6 @@
__ZN7WebCore21NetworkStorageSession28createPrivateBrowsingSessionERKN3WTF6StringE
__ZN7WebCore21PlatformKeyboardEvent24disambiguateKeyDownEventENS_13PlatformEvent4TypeEb
__ZN7WebCore21RemoteCommandListener6createERNS_27RemoteCommandListenerClientE
-__ZN7WebCore21RenderLayerCompositor27setDocumentOverlayRootLayerEPNS_13GraphicsLayerE
__ZN7WebCore21ResourceLoadScheduler20servePendingRequestsENS_20ResourceLoadPriorityE
__ZN7WebCore21ResourceLoadScheduler20servePendingRequestsEPNS0_15HostInformationENS_20ResourceLoadPriorityE
__ZN7WebCore21ResourceLoadScheduler21resumePendingRequestsEv
Modified: trunk/Source/WebCore/page/ChromeClient.h (167297 => 167298)
--- trunk/Source/WebCore/page/ChromeClient.h 2014-04-15 06:13:17 UTC (rev 167297)
+++ trunk/Source/WebCore/page/ChromeClient.h 2014-04-15 06:13:58 UTC (rev 167298)
@@ -290,6 +290,8 @@
// Returns whether or not the client can render the composited layer,
// regardless of the settings.
virtual bool allowsAcceleratedCompositing() const { return true; }
+ // Supply a layer that will added as an overlay over other document layers (scrolling with the document).
+ virtual GraphicsLayer* documentOverlayLayerForFrame(Frame&) { return nullptr; }
enum CompositingTrigger {
ThreeDTransformTrigger = 1 << 0,
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (167297 => 167298)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2014-04-15 06:13:17 UTC (rev 167297)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2014-04-15 06:13:58 UTC (rev 167298)
@@ -255,7 +255,6 @@
, m_isTrackingRepaints(false)
, m_layersWithTiledBackingCount(0)
, m_rootLayerAttachment(RootLayerUnattached)
- , m_documentOverlayRootLayer(nullptr)
, m_layerFlushTimer(this, &RenderLayerCompositor::layerFlushTimerFired)
, m_layerFlushThrottlingEnabled(page() && page()->progress().isMainLoadProgressing())
, m_layerFlushThrottlingTemporarilyDisabledForInteraction(false)
@@ -430,7 +429,8 @@
#if PLATFORM(IOS)
double horizontalMargin = defaultTileWidth / pageScaleFactor();
double verticalMargin = defaultTileHeight / pageScaleFactor();
- rootLayer->flushCompositingState(frameView.computeCoverageRect(horizontalMargin, verticalMargin));
+ FloatRect visibleRect = frameView.computeCoverageRect(horizontalMargin, verticalMargin);
+ rootLayer->flushCompositingState(visibleRect);
#else
// Having a m_clipLayer indicates that we're doing scrolling via GraphicsLayers.
IntRect visibleRect = m_clipLayer ? IntRect(IntPoint(), frameView.contentsSize()) : frameView.visibleContentRect();
@@ -597,6 +597,8 @@
void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType updateType, RenderLayer* updateRoot)
{
m_updateCompositingLayersTimer.stop();
+
+ ASSERT(!m_renderView.document().inPageCache());
// Compositing layers will be updated in Document::implicitClose() if suppressed here.
if (!m_renderView.document().visualUpdatesAllowed())
@@ -689,6 +691,7 @@
// Host the document layer in the RenderView's root layer.
if (isFullUpdate) {
+ appendOverlayLayers(childList);
// Even when childList is empty, don't drop out of compositing mode if there are
// composited layers that we didn't hit in our traversal (e.g. because of visibility:hidden).
if (childList.isEmpty() && !hasAnyAdditionalCompositedLayers(*updateRoot))
@@ -721,6 +724,17 @@
InspectorInstrumentation::layerTreeDidChange(page());
}
+void RenderLayerCompositor::appendOverlayLayers(Vector<GraphicsLayer*>& childList)
+{
+ Frame& frame = m_renderView.frameView().frame();
+ Page* page = frame.page();
+ if (!page)
+ return;
+
+ if (GraphicsLayer* overlayLayer = page->chrome().client().documentOverlayLayerForFrame(frame))
+ childList.append(overlayLayer);
+}
+
void RenderLayerCompositor::layerBecameNonComposited(const RenderLayer& layer)
{
// Inform the inspector that the given RenderLayer was destroyed.
@@ -1461,9 +1475,6 @@
childLayersOfEnclosingLayer.append(layerBacking->childForSuperlayers());
}
-
- if (m_documentOverlayRootLayer)
- childLayersOfEnclosingLayer.append(m_documentOverlayRootLayer);
}
void RenderLayerCompositor::rebuildRegionCompositingLayerTree(RenderNamedFlowFragment* region, Vector<GraphicsLayer*>& childList, int depth)
@@ -3819,13 +3830,4 @@
m_renderView.frameView().firePaintRelatedMilestonesIfNeeded();
}
-void RenderLayerCompositor::setDocumentOverlayRootLayer(GraphicsLayer* documentOverlayRootLayer)
-{
- if (m_documentOverlayRootLayer)
- m_documentOverlayRootLayer->removeFromParent();
- m_documentOverlayRootLayer = documentOverlayRootLayer;
- setCompositingLayersNeedRebuild(true);
- scheduleCompositingLayerUpdate();
-}
-
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (167297 => 167298)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2014-04-15 06:13:17 UTC (rev 167297)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2014-04-15 06:13:58 UTC (rev 167298)
@@ -304,8 +304,6 @@
void setRootExtendedBackgroundColor(const Color&);
Color rootExtendedBackgroundColor() const { return m_rootExtendedBackgroundColor; }
- void setDocumentOverlayRootLayer(GraphicsLayer*);
-
private:
class OverlapMap;
@@ -366,6 +364,7 @@
bool layerHas3DContent(const RenderLayer&) const;
bool isRunningAcceleratedTransformAnimation(RenderLayerModelObject&) const;
+ void appendOverlayLayers(Vector<GraphicsLayer*>&);
bool hasAnyAdditionalCompositedLayers(const RenderLayer& rootLayer) const;
void ensureRootLayer();
@@ -508,8 +507,6 @@
std::unique_ptr<GraphicsLayer> m_layerForFooter;
#endif
- GraphicsLayer* m_documentOverlayRootLayer;
-
std::unique_ptr<GraphicsLayerUpdater> m_layerUpdater; // Updates tiled layer visible area periodically while animations are running.
Timer<RenderLayerCompositor> m_layerFlushTimer;
Modified: trunk/Source/WebKit2/ChangeLog (167297 => 167298)
--- trunk/Source/WebKit2/ChangeLog 2014-04-15 06:13:17 UTC (rev 167297)
+++ trunk/Source/WebKit2/ChangeLog 2014-04-15 06:13:58 UTC (rev 167298)
@@ -1,3 +1,28 @@
+2014-04-14 Simon Fraser <simon.fra...@apple.com>
+
+ [iOS WK2] Pages often blank on first load if page loaded by typing the URL
+ https://bugs.webkit.org/show_bug.cgi?id=131665
+
+ Reviewed by Tim Horton.
+
+ The document overlay-related code in RemoteLayerTreeDrawingArea::setRootCompositingLayer()
+ was triggering a compositing layer flush when called with a null rootLayer, which happens
+ for pages going into the page cache. This would trigger a layer flush that would clobber
+ the root layer for the visible page, resulting in missing content.
+
+ Also, rebuildCompositingLayerTree() is called recursively and the m_documentOverlayRootLayer
+ was being added to (and then removed from) every single compositing layers.
+
+ Fix both these by changing to a pull model, where RenderLayerCompositor requests
+ the overlay layer via ChromeClient, and gets it at the end of every flush,
+ adding to the children of the root layer.
+
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::documentOverlayLayerForFrame):
+ * WebProcess/WebCoreSupport/WebChromeClient.h:
+ * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
+ (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer):
+
2014-04-14 Tim Horton <timothy_hor...@apple.com>
Fix the 32-bit build.
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (167297 => 167298)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp 2014-04-15 06:13:17 UTC (rev 167297)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp 2014-04-15 06:13:58 UTC (rev 167298)
@@ -771,6 +771,14 @@
m_page->exitAcceleratedCompositingMode();
}
+GraphicsLayer* WebChromeClient::documentOverlayLayerForFrame(Frame& frame)
+{
+ if (&frame == &m_page->corePage()->mainFrame())
+ return m_page->pageOverlayController().documentOverlayRootLayer();
+
+ return nullptr;
+}
+
void WebChromeClient::setNeedsOneShotDrawingSynchronization()
{
notImplemented();
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (167297 => 167298)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h 2014-04-15 06:13:17 UTC (rev 167297)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h 2014-04-15 06:13:58 UTC (rev 167298)
@@ -202,6 +202,7 @@
virtual void attachRootGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*) override;
virtual void setNeedsOneShotDrawingSynchronization() override;
virtual void scheduleCompositingLayerFlush() override;
+ virtual WebCore::GraphicsLayer* documentOverlayLayerForFrame(WebCore::Frame&) override;
virtual CompositingTriggerFlags allowedCompositingTriggers() const
{
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm (167297 => 167298)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm 2014-04-15 06:13:17 UTC (rev 167297)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm 2014-04-15 06:13:58 UTC (rev 167298)
@@ -94,8 +94,6 @@
children.append(m_webPage->pageOverlayController().viewOverlayRootLayer());
}
m_rootLayer->setChildren(children);
-
- m_webPage->mainFrameView()->renderView()->compositor().setDocumentOverlayRootLayer(m_webPage->pageOverlayController().documentOverlayRootLayer());
}
void RemoteLayerTreeDrawingArea::updateGeometry(const IntSize& viewSize, const IntSize& layerPosition)
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (167297 => 167298)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2014-04-15 06:13:17 UTC (rev 167297)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2014-04-15 06:13:58 UTC (rev 167298)
@@ -449,8 +449,6 @@
[m_hostingLayer setSublayers:layer ? @[ layer, m_webPage->pageOverlayController().viewOverlayRootLayer()->platformLayer() ] : @[ ]];
- m_webPage->mainFrameView()->renderView()->compositor().setDocumentOverlayRootLayer(m_webPage->pageOverlayController().documentOverlayRootLayer());
-
bool hadRootLayer = !!m_rootLayer;
m_rootLayer = layer;
[m_rootLayer setSublayerTransform:m_transform];