Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 1596573002: Remove extra calls of didMeaningfulLayout() during the same navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 3972 matching lines...) Expand 10 before | Expand all | Expand 10 after
3983 void WebViewImpl::setSelectionColors(unsigned activeBackgroundColor, 3983 void WebViewImpl::setSelectionColors(unsigned activeBackgroundColor,
3984 unsigned activeForegroundColor, 3984 unsigned activeForegroundColor,
3985 unsigned inactiveBackgroundColor, 3985 unsigned inactiveBackgroundColor,
3986 unsigned inactiveForegroundColor) { 3986 unsigned inactiveForegroundColor) {
3987 #if USE(DEFAULT_RENDER_THEME) 3987 #if USE(DEFAULT_RENDER_THEME)
3988 LayoutThemeDefault::setSelectionColors(activeBackgroundColor, activeForegrou ndColor, inactiveBackgroundColor, inactiveForegroundColor); 3988 LayoutThemeDefault::setSelectionColors(activeBackgroundColor, activeForegrou ndColor, inactiveBackgroundColor, inactiveForegroundColor);
3989 LayoutTheme::theme().platformColorsDidChange(); 3989 LayoutTheme::theme().platformColorsDidChange();
3990 #endif 3990 #endif
3991 } 3991 }
3992 3992
3993 void WebViewImpl::didCommitLoad(bool isNewNavigation, bool isNavigationWithinPag e) 3993 void WebViewImpl::didCommitLoad(HistoryCommitType commitType, bool isNavigationW ithinPage)
3994 { 3994 {
3995 if (!isNavigationWithinPage) { 3995 if (!isNavigationWithinPage) {
3996 m_shouldDispatchFirstVisuallyNonEmptyLayout = true; 3996 if (commitType == StandardCommit || commitType == BackForwardCommit) {
3997 m_shouldDispatchFirstLayoutAfterFinishedParsing = true; 3997 m_shouldDispatchFirstVisuallyNonEmptyLayout = true;
3998 m_shouldDispatchFirstLayoutAfterFinishedLoading = true; 3998 m_shouldDispatchFirstLayoutAfterFinishedParsing = true;
3999 m_shouldDispatchFirstLayoutAfterFinishedLoading = true;
4000 }
3999 4001
4000 if (isNewNavigation) { 4002 if (commitType == StandardCommit) {
4003 // A new session history item should be created for this load.
4001 pageScaleConstraintsSet().setNeedsReset(true); 4004 pageScaleConstraintsSet().setNeedsReset(true);
4002 m_pageImportanceSignals.onCommitLoad(); 4005 m_pageImportanceSignals.onCommitLoad();
4003 } 4006 }
4004 } 4007 }
4005 4008
4006 // Give the visual viewport's scroll layer its initial size. 4009 // Give the visual viewport's scroll layer its initial size.
4007 page()->frameHost().visualViewport().mainFrameDidChangeSize(); 4010 page()->frameHost().visualViewport().mainFrameDidChangeSize();
4008 4011
4009 // Make sure link highlight from previous page is cleared. 4012 // Make sure link highlight from previous page is cleared.
4010 m_linkHighlights.clear(); 4013 m_linkHighlights.clear();
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
4291 bool visible = page()->visibilityState() == PageVisibilityStateVisible; 4294 bool visible = page()->visibilityState() == PageVisibilityStateVisible;
4292 m_layerTreeView->setVisible(visible); 4295 m_layerTreeView->setVisible(visible);
4293 } else { 4296 } else {
4294 m_rootGraphicsLayer = nullptr; 4297 m_rootGraphicsLayer = nullptr;
4295 m_rootLayer = nullptr; 4298 m_rootLayer = nullptr;
4296 // This means that we're transitioning to a new page. Suppress 4299 // This means that we're transitioning to a new page. Suppress
4297 // commits until Blink generates invalidations so we don't 4300 // commits until Blink generates invalidations so we don't
4298 // attempt to paint too early in the next page load. 4301 // attempt to paint too early in the next page load.
4299 m_layerTreeView->setDeferCommits(true); 4302 m_layerTreeView->setDeferCommits(true);
4300 m_layerTreeView->clearRootLayer(); 4303 m_layerTreeView->clearRootLayer();
4304
4305 // didMeaningfulLayout() should be dispatched again.
4306 m_shouldDispatchFirstVisuallyNonEmptyLayout = true;
dglazkov 2016/01/15 19:41:48 Interesting! This is a partial revert of https://c
wychen 2016/01/15 22:31:02 This is still needed, for cases like refreshing, o
dglazkov 2016/01/15 22:36:43 Both refresh and redirect will result in a new did
wychen 2016/01/21 01:47:52 Ah. I filtered out HistoryInertCommit in this patc
4307 m_shouldDispatchFirstLayoutAfterFinishedParsing = true;
4308 m_shouldDispatchFirstLayoutAfterFinishedLoading = true;
4309
4301 visualViewport.clearLayersForTreeView(m_layerTreeView); 4310 visualViewport.clearLayersForTreeView(m_layerTreeView);
4302 } 4311 }
4303 } 4312 }
4304 4313
4305 void WebViewImpl::invalidateRect(const IntRect& rect) 4314 void WebViewImpl::invalidateRect(const IntRect& rect)
4306 { 4315 {
4307 if (m_layerTreeView) 4316 if (m_layerTreeView)
4308 updateLayerTreeViewport(); 4317 updateLayerTreeViewport();
4309 else if (m_client) 4318 else if (m_client)
4310 m_client->didInvalidateRect(rect); 4319 m_client->didInvalidateRect(rect);
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
4626 void WebViewImpl::detachPaintArtifactCompositor() 4635 void WebViewImpl::detachPaintArtifactCompositor()
4627 { 4636 {
4628 if (!m_layerTreeView) 4637 if (!m_layerTreeView)
4629 return; 4638 return;
4630 4639
4631 m_layerTreeView->setDeferCommits(true); 4640 m_layerTreeView->setDeferCommits(true);
4632 m_layerTreeView->clearRootLayer(); 4641 m_layerTreeView->clearRootLayer();
4633 } 4642 }
4634 4643
4635 } // namespace blink 4644 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698