Chromium Code Reviews| 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 5cb5f0877bd765fc03d22d855cac2daff5b0626b..914d13605b1df9fda25e610b7bafd0b25ebb9459 100644 |
| --- a/third_party/WebKit/Source/web/WebViewImpl.cpp |
| +++ b/third_party/WebKit/Source/web/WebViewImpl.cpp |
| @@ -1804,7 +1804,7 @@ void WebViewImpl::ResizeVisualViewport(const WebSize& new_size) { |
| GetPage()->GetVisualViewport().ClampToBoundaries(); |
| } |
| -void WebViewImpl::PerformResize() { |
| +void WebViewImpl::UpdateICBAndResizeViewport() { |
| // We'll keep the initial containing block size from changing when the top |
| // controls hide so that the ICB will always be the same size as the |
| // viewport with the browser controls shown. |
| @@ -1825,7 +1825,7 @@ void WebViewImpl::PerformResize() { |
| if (MainFrameImpl()->GetFrameView()) { |
| MainFrameImpl()->GetFrameView()->SetInitialViewportSize(icb_size); |
| if (!MainFrameImpl()->GetFrameView()->NeedsLayout()) |
| - PostLayoutResize(MainFrameImpl()); |
| + ResizeFrameView(MainFrameImpl()); |
| } |
| } |
| @@ -1845,7 +1845,7 @@ void WebViewImpl::UpdateBrowserControlsState(WebBrowserControlsState constraint, |
| constraint == kWebBrowserControlsBoth) || |
| (old_permitted_state == kWebBrowserControlsBoth && |
| constraint == kWebBrowserControlsHidden)) { |
| - PerformResize(); |
| + UpdateICBAndResizeViewport(); |
| } |
| if (layer_tree_view_) |
| @@ -1901,7 +1901,7 @@ void WebViewImpl::ResizeViewWhileAnchored(float browser_controls_height, |
| // Avoids unnecessary invalidations while various bits of state in |
| // TextAutosizer are updated. |
| TextAutosizer::DeferUpdatePageInfo defer_update_page_info(GetPage()); |
| - PerformResize(); |
| + UpdateICBAndResizeViewport(); |
| } |
| fullscreen_controller_->UpdateSize(); |
| @@ -3657,7 +3657,7 @@ void WebViewImpl::DidCommitLoad(bool is_new_navigation, |
| EndActiveFlingAnimation(); |
| } |
| -void WebViewImpl::PostLayoutResize(WebLocalFrameImpl* webframe) { |
| +void WebViewImpl::ResizeFrameView(WebLocalFrameImpl* webframe) { |
| FrameView* view = webframe->GetFrame()->View(); |
| if (webframe == MainFrame()) |
| resize_viewport_anchor_->ResizeFrameView(MainFrameSize()); |
| @@ -3665,7 +3665,7 @@ void WebViewImpl::PostLayoutResize(WebLocalFrameImpl* webframe) { |
| view->Resize(webframe->GetFrameView()->Size()); |
| } |
| -void WebViewImpl::LayoutUpdated(WebLocalFrameImpl* webframe) { |
| +void WebViewImpl::ResizeAfterLayout(WebLocalFrameImpl* webframe) { |
| LocalFrame* frame = webframe->GetFrame(); |
| if (!client_ || !client_->CanUpdateLayout() || !frame->IsMainFrame()) |
| return; |
| @@ -3687,12 +3687,19 @@ void WebViewImpl::LayoutUpdated(WebLocalFrameImpl* webframe) { |
| if (GetPageScaleConstraintsSet().ConstraintsDirty()) |
| RefreshPageScaleFactorAfterLayout(); |
| - FrameView* view = webframe->GetFrame()->View(); |
| + UpdateICBAndResizeViewport(); |
| +} |
| - PostLayoutResize(webframe); |
| +void WebViewImpl::LayoutUpdated(WebLocalFrameImpl* webframe) { |
| + LocalFrame* frame = webframe->GetFrame(); |
| + if (!client_ || !client_->CanUpdateLayout() || !frame->IsMainFrame()) |
| + return; |
| + |
| + ResizeAfterLayout(webframe); |
| // Relayout immediately to avoid violating the rule that needsLayout() |
| // isn't set at the end of a layout. |
| + FrameView* view = webframe->GetFrame()->View(); |
|
skobes
2017/04/28 20:52:13
nit: this could just be frame->View()
szager1
2017/04/29 09:11:00
Done.
|
| if (view->NeedsLayout()) |
| view->UpdateLayout(); |