Index: Source/web/WebViewImpl.cpp |
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp |
index c1af66e5d1624634ff37fb1f5521aa6ac6c7c217..df4319809529b451724ed42958a5c046f904ae13 100644 |
--- a/Source/web/WebViewImpl.cpp |
+++ b/Source/web/WebViewImpl.cpp |
@@ -76,6 +76,7 @@ |
#include "core/loader/DocumentLoader.h" |
#include "core/loader/FrameLoadRequest.h" |
#include "core/loader/FrameLoader.h" |
+#include "core/loader/FrameLoaderClient.h" |
#include "core/page/ContextMenuController.h" |
#include "core/page/ContextMenuProvider.h" |
#include "core/page/DragController.h" |
@@ -456,6 +457,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client) |
, m_backgroundColorOverride(Color::transparent) |
, m_zoomFactorOverride(0) |
, m_userGestureObserved(false) |
+ , m_shouldDispatchFirstVisuallyNonEmptyLayout(false) |
, m_displayMode(WebDisplayModeBrowser) |
, m_elasticOverscroll(FloatSize()) |
{ |
@@ -1930,6 +1932,15 @@ void WebViewImpl::layout() |
m_inspectorOverlay->layout(); |
for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
m_linkHighlights[i]->updateGeometry(); |
+ |
+ if (FrameView* view = mainFrameImpl()->frameView()) { |
+ if (m_shouldDispatchFirstVisuallyNonEmptyLayout && view->isVisuallyNonEmpty()) { |
+ m_shouldDispatchFirstVisuallyNonEmptyLayout = false; |
+ // TODO(esprehn): Move users of this callback to something |
+ // better, the heuristic for "visually non-empty" is bad. |
+ mainFrameImpl()->frame()->loader().client()->dispatchDidFirstVisuallyNonEmptyLayout(); |
+ } |
+ } |
} |
void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) |
@@ -4193,6 +4204,7 @@ void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) |
// attempt to paint too early in the next page load. |
m_layerTreeView->setDeferCommits(true); |
m_layerTreeView->clearRootLayer(); |
+ m_shouldDispatchFirstVisuallyNonEmptyLayout = true; |
page()->frameHost().visualViewport().clearLayersForTreeView(m_layerTreeView); |
} |