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

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

Issue 18601002: Add infrastructure for partial layouts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address reviewer comments. Add PartialLayoutState and PartialLayoutDisabler Created 7 years, 4 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/page/FrameView.cpp
diff --git a/Source/core/page/FrameView.cpp b/Source/core/page/FrameView.cpp
index 8ed41521d20c67e53485fcd93b12ce409f7e4450..af8143660ee447e131a8ff20d27b0e3fc6b581c3 100644
--- a/Source/core/page/FrameView.cpp
+++ b/Source/core/page/FrameView.cpp
@@ -179,6 +179,7 @@ FrameView::FrameView(Frame* frame)
, m_didRunAutosize(false)
, m_hasSoftwareFilters(false)
, m_visibleContentScaleFactor(1)
+ , m_partialLayout(PartialLayoutState())
{
init();
@@ -279,6 +280,7 @@ void FrameView::reset()
m_firstVisuallyNonEmptyLayoutCallbackPending = true;
m_maintainScrollPositionAnchor = 0;
m_disableRepaints = 0;
+ m_partialLayout.reset();
}
void FrameView::removeFromAXObjectCache()
@@ -876,20 +878,25 @@ void FrameView::performLayout(RenderObject* rootForThisLayout, bool inSubtreeLay
// performLayout is the actual guts of layout().
// FIXME: The 300 other lines in layout() probably belong in other helper functions
// so that a single human could understand what layout() is actually doing.
+ {
+ bool disableLayoutState = false;
+ if (inSubtreeLayout) {
+ RenderView* view = rootForThisLayout->view();
+ disableLayoutState = view->shouldDisableLayoutStateForSubtree(rootForThisLayout);
+ view->pushLayoutState(rootForThisLayout);
+ }
+ LayoutStateDisabler layoutStateDisabler(disableLayoutState ? rootForThisLayout->view() : 0);
- bool disableLayoutState = false;
- if (inSubtreeLayout) {
- RenderView* view = rootForThisLayout->view();
- disableLayoutState = view->shouldDisableLayoutStateForSubtree(rootForThisLayout);
- view->pushLayoutState(rootForThisLayout);
- }
- LayoutStateDisabler layoutStateDisabler(disableLayoutState ? rootForThisLayout->view() : 0);
-
- m_inLayout = true;
- beginDeferredRepaints();
- forceLayoutParentViewIfNeeded();
+ m_inLayout = true;
+ beginDeferredRepaints();
+ forceLayoutParentViewIfNeeded();
- rootForThisLayout->layout(); // THIS IS WHERE LAYOUT ACTUALLY HAPPENS.
+ // Text Autosizing requires two-pass layout which is incompatible with partial layout. If
+ // enabled, only do partial layout for the second layout.
+ // FIXME (crbug.com/256657): Do not do two layouts for text autosizing.
+ PartialLayoutDisabler partialLayoutDisabler(partialLayout(), m_frame->settings() && m_frame->settings()->textAutosizingEnabled());
+ rootForThisLayout->layout(); // THIS IS WHERE LAYOUT ACTUALLY HAPPENS.
+ }
bool autosized = frame()->document()->textAutosizer()->processSubtree(rootForThisLayout);
if (autosized && rootForThisLayout->needsLayout()) {
@@ -946,6 +953,8 @@ void FrameView::layout(bool allowSubtree)
if (m_inLayout)
return;
+ ASSERT(!m_partialLayout.shouldStop());
+
TRACE_EVENT0("webkit", "FrameView::layout");
TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "Layout");
@@ -1049,15 +1058,24 @@ void FrameView::layout(bool allowSubtree)
layer = rootForThisLayout->enclosingLayer();
m_actionScheduler->pause();
+ // Non-overlay scrollbars can cause a second layout; disable partial layout for the first of these layouts.
+ PartialLayoutDisabler partialLayoutDisabler(partialLayout(), m_frame->settings() && !m_frame->settings()->usesOverlayScrollbars());
performLayout(rootForThisLayout, inSubtreeLayout);
m_layoutRoot = 0;
} // Reset m_layoutSchedulingEnabled to its previous value.
+ if (partialLayout().shouldStop())
+ return;
+
bool neededFullRepaint = m_doFullRepaint;
if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->printing())
adjustViewSize();
+ // adjustViewSize() can cause a layout due to scrollbars so a second shouldStop() check is required.
+ if (partialLayout().shouldStop())
+ return;
+
m_doFullRepaint = neededFullRepaint;
// Now update the positions of all layers.

Powered by Google App Engine
This is Rietveld 408576698