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

Unified Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 2848043002: Refactor WebView resize and update-after-layout methods (Closed)
Patch Set: nit Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..31b8efb1e4a0fbcfc86b4816ed5a7c8faaa38ae7 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();
+}
+
+void WebViewImpl::LayoutUpdated(WebLocalFrameImpl* webframe) {
+ LocalFrame* frame = webframe->GetFrame();
+ if (!client_ || !client_->CanUpdateLayout() || !frame->IsMainFrame())
+ return;
- PostLayoutResize(webframe);
+ ResizeAfterLayout(webframe);
// Relayout immediately to avoid violating the rule that needsLayout()
// isn't set at the end of a layout.
+ FrameView* view = frame->View();
if (view->NeedsLayout())
view->UpdateLayout();
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698