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

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: Viewport media query, comments, 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..faf08b9a60436adc55a6d7dc6f9f3cb4b0a39812 100644
--- a/Source/core/frame/FrameView.cpp
+++ b/Source/core/frame/FrameView.cpp
@@ -3179,8 +3179,40 @@ 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();
Julien - ping for review 2014/03/11 01:23:37 Wouldn't it be possible to remove FrameView::conte
Xianzhu 2014/03/11 19:05:13 Agreed. Need to carefully check all callsites of i
+
+ if (widthChanged) {
+ setNeedsLayout();
+ return;
+ }
+
+ if (RenderView* renderView = this->renderView()) {
Julien - ping for review 2014/03/11 01:23:37 This would be better with an early return, especia
Xianzhu 2014/03/11 19:05:13 Done.
+ // If needsLayout, the next layout will do all the things required on layoutSize change.
+ if (renderView->needsLayout())
+ 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