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

Unified Diff: Source/core/frame/FrameView.cpp

Issue 190973007: Reland "Avoid layout/full-repaint on view height change if possible" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: computeOverflow, etc. Created 6 years, 9 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
Index: Source/core/frame/FrameView.cpp
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp
index 7746f348bf0c895e4966c9ba283bd36ddec8831a..283d7901c6818960293fe2e1c833ea749f9a458e 100644
--- a/Source/core/frame/FrameView.cpp
+++ b/Source/core/frame/FrameView.cpp
@@ -3179,8 +3179,42 @@ void FrameView::setLayoutSizeInternal(const IntSize& size)
if (m_layoutSize == size)
return;
+ bool widthChanged = m_layoutSize.width() != size.width();
m_layoutSize = size;
- contentsResized();
+
+ // Update scrollbars. Not calling this->contentsResized() to avoid setNeedsLayout.
+ ScrollView::contentsResized();
+
+ RenderView* renderView = this->renderView();
+ if (!renderView)
+ return;
+
+ // If needsLayout, the next layout will do all the things required on layoutSize change.
+ if (renderView->needsLayout())
+ return;
+
+ if (widthChanged) {
+ setNeedsLayout();
+ return;
+ }
+
+ performPreLayoutTasks();
+
+ // During pre-layout tasks, viewport media queries, viewport sizes and others may cause
+ // style update and set needsLayout flag.
+ if (renderView->needsLayout())
+ return;
+
+ if (!renderView->trySimplifiedLayoutOnHeightChange()) {
+ setNeedsLayout();
+ return;
+ }
+
+ // RenderView has finished a simplified layout for the height change. We need to perform
+ // necessary post-layout tasks for the simplified layout.
+ scheduleOrPerformPostLayoutTasks();
+ if (frame().page())
+ frame().page()->chrome().client().layoutUpdated(m_frame.get());
}
void FrameView::didAddScrollbar(Scrollbar* scrollbar, ScrollbarOrientation orientation)

Powered by Google App Engine
This is Rietveld 408576698