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

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

Issue 13937017: Implement lazy block layout prototype behind a runtime flag. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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
Index: Source/core/page/FrameView.cpp
diff --git a/Source/core/page/FrameView.cpp b/Source/core/page/FrameView.cpp
index b08e5a8d8bd183031e777c31c4d2bd5256beebc0..85270c9f03cdb66086b905b9920fcfe5e85091cc 100644
--- a/Source/core/page/FrameView.cpp
+++ b/Source/core/page/FrameView.cpp
@@ -68,6 +68,7 @@
#include "core/rendering/RenderLayer.h"
#include "core/rendering/RenderLayerBacking.h"
#include "core/rendering/RenderLayerCompositor.h"
+#include "core/rendering/RenderLazyBlock.h"
#include "core/rendering/RenderPart.h"
#include "core/rendering/RenderScrollbar.h"
#include "core/rendering/RenderScrollbarPart.h"
@@ -1119,6 +1120,8 @@ void FrameView::layout(bool allowSubtree)
cache->postNotification(root, AXObjectCache::AXLayoutComplete, true);
updateAnnotatedRegions();
+ layoutLazyBlocks();
+
ASSERT(!root->needsLayout());
updateCanBlitOnScrollRecursively();
@@ -1168,6 +1171,35 @@ void FrameView::layout(bool allowSubtree)
page->chrome()->client()->layoutUpdated(frame());
}
+void FrameView::layoutLazyBlocks()
+{
+ // FIXME: This infinite recursion protection would seem to break plugins
+ // doing things that require lazy blocks to layout.
+ if (m_nestedLayoutCount != 1)
+ return;
+
+ if (!renderView()->firstLazyBlock())
eseidel 2013/04/27 09:09:34 Is this expensive?
+ return;
+
+ // First mark all lazy blocks as needing layout and perform another layout.
+ for (RenderLazyBlock* block = renderView()->firstLazyBlock(); block; block = block->next())
+ block->markForNestedLayout();
+
+ layout();
+
+ // FIXME: This is pretty awful if you start nesting lazy blocks, we should
+ // signal to the nested blocks to avoid doing work until the second pass.
+
+ // Next walk all lazy blocks and find nested ones, these need another layout
+ // since the first one would not have placed them correctly inside the viewport.
+ for (RenderLazyBlock* block = renderView()->firstLazyBlock(); block; block = block->next()) {
+ if (!block->isNested())
+ continue;
+ block->setNeedsLayout(true);
+ layout();
+ }
+}
+
RenderBox* FrameView::embeddedContentBox() const
{
#if ENABLE(SVG)
@@ -1644,6 +1676,8 @@ void FrameView::scrollPositionChanged()
if (RenderView* renderView = this->renderView()) {
if (renderView->usesCompositing())
renderView->compositor()->frameViewDidScroll();
+
+ renderView->markLazyBlocksForLayout();
}
}

Powered by Google App Engine
This is Rietveld 408576698