Reviewers: dglazkov, bokan, kouhei (catching-up),
https://codereview.chromium.org/1380363005/diff/1/third_party/WebKit/Source/web/WebViewImpl.cpp
File third_party/WebKit/Source/web/WebViewImpl.cpp (right):
https://codereview.chromium.org/1380363005/diff/1/third_party/WebKit/Source/web/WebViewImpl.cpp#newcode3889
third_party/WebKit/Source/web/WebViewImpl.cpp:3889:
m_pageImportanceSignals.onCommitLoad();
As a side question, do these two lines need to be under
"if (isNewNavigation)"? Looks like we have to exec them on every commit
(including, for example, BackForwardCommit).
I'm adding the authors of these lines to look at this.
Description:
Find a better place for setting Layout/Paint hook related flags.
These hooks are supposed to be called once after a commit, not after
the WebViewImpl's root graphics layer was reset to 0.
Setting these flags in didCommitLoad looks much more sane and
straightforward. Also this fixes a subtle bug: if you don't create
the WebView with a proper size right away, and instead create it with
0x0 size, navigate and then resize, you won't get the hooks called.
BUG=
Please review this at
https://codereview.chromium.org/1380363005/
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Affected files (+8, -5 lines):
M third_party/WebKit/Source/web/WebViewImpl.cpp
Index: third_party/WebKit/Source/web/WebViewImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp
b/third_party/WebKit/Source/web/WebViewImpl.cpp
index
b708684218ae54a865aeae4eeb2b26bc81067bdf..aaae12c8c6983414012c430a304fe752f3665f82
100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -3880,9 +3880,14 @@ void WebViewImpl::setSelectionColors(unsigned
activeBackgroundColor,
void WebViewImpl::didCommitLoad(bool isNewNavigation, bool
isNavigationWithinPage)
{
- if (isNewNavigation && !isNavigationWithinPage) {
- pageScaleConstraintsSet().setNeedsReset(true);
- m_pageImportanceSignals.onCommitLoad();
+ if (!isNavigationWithinPage) {
+ m_shouldDispatchFirstVisuallyNonEmptyLayout = true;
+ m_shouldDispatchFirstLayoutAfterFinishedParsing = true;
+
+ if (isNewNavigation) {
+ pageScaleConstraintsSet().setNeedsReset(true);
+ m_pageImportanceSignals.onCommitLoad();
+ }
}
// Give the visual viewport's scroll layer its initial size.
@@ -4163,8 +4168,6 @@ 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;
- m_shouldDispatchFirstLayoutAfterFinishedParsing = true;
page()->frameHost().visualViewport().clearLayersForTreeView(m_layerTreeView);
}
}