From 3d35ba88209b8b99c43505abdc796330fd04a6bf Mon Sep 17 00:00:00 2001 From: chrishtr Date: Wed, 20 Jan 2016 18:30:15 -0800 Subject: Don't schedule additional frames inside WebViewImpl::resize(). Previously, we would schedule additional frames in some cases. This should no longer be necessary now that we are always synchronously updating all lifecycle phases after changing layout size of the main frame (https://codereview.chromium.org/1585793002). BUG=545039 TBR=tommycli Review URL: https://codereview.chromium.org/1590433007 Cr-Commit-Position: refs/heads/master@{#370584} --- third_party/WebKit/Source/web/WebViewImpl.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to '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 1742482..016169a 100644 --- a/third_party/WebKit/Source/web/WebViewImpl.cpp +++ b/third_party/WebKit/Source/web/WebViewImpl.cpp @@ -3338,6 +3338,13 @@ void WebViewImpl::refreshPageScaleFactorAfterLayout() setPageScaleFactor(newPageScaleFactor); updateLayerTreeViewport(); + + // Changes to page-scale during layout may require an additional frame. + // We can't update the lifecycle here because we may be in the middle of layout in the + // caller of this method. + // TODO(chrishtr): clean all this up. All layout should happen in one lifecycle run (crbug.com/578239). + if (mainFrameImpl()->frameView()->needsLayout()) + scheduleAnimation(); } void WebViewImpl::updatePageDefinedViewportConstraints(const ViewportDescription& description) @@ -3401,12 +3408,13 @@ void WebViewImpl::updatePageDefinedViewportConstraints(const ViewportDescription mainFrameImpl()->frameView()->setNeedsLayout(); } - updateMainFrameLayoutSize(); if (LocalFrame* frame = page()->deprecatedLocalMainFrame()) { if (TextAutosizer* textAutosizer = frame->document()->textAutosizer()) textAutosizer->updatePageInfoInAllFrames(); } + + updateMainFrameLayoutSize(); } void WebViewImpl::updateMainFrameLayoutSize() @@ -3427,12 +3435,6 @@ void WebViewImpl::updateMainFrameLayoutSize() layoutSize.height = 0; view->setLayoutSize(layoutSize); - - // Resizing marks the frame as needsLayout. Inform clients so that they - // will perform the layout. Widgets held by WebPluginContainerImpl do not otherwise - // see this resize layout invalidation. - if (client()) - client()->didUpdateLayoutSize(layoutSize); } IntSize WebViewImpl::contentsSize() const @@ -3467,7 +3469,6 @@ void WebViewImpl::disableViewport() { settings()->setViewportEnabled(false); pageScaleConstraintsSet().clearPageDefinedConstraints(); - updateMainFrameLayoutSize(); } float WebViewImpl::defaultMinimumPageScaleFactor() const -- cgit v1.1