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

Unified Diff: Source/core/paint/BlockPainter.cpp

Issue 1282713003: Painter side preparation for subtree caching (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: V2 Created 5 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/paint/BlockPainter.cpp
diff --git a/Source/core/paint/BlockPainter.cpp b/Source/core/paint/BlockPainter.cpp
index c708c8ee63a3e7120256577053fd068462f51870..940e482fcb76f91b9d2620b87b319cde45811234 100644
--- a/Source/core/paint/BlockPainter.cpp
+++ b/Source/core/paint/BlockPainter.cpp
@@ -21,6 +21,7 @@
#include "core/paint/ScopeRecorder.h"
#include "core/paint/ScrollRecorder.h"
#include "core/paint/ScrollableAreaPainter.h"
+#include "core/paint/SubtreeRecorder.h"
#include "platform/graphics/paint/ClipRecorder.h"
#include "wtf/Optional.h"
@@ -28,6 +29,16 @@ namespace blink {
void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
+ Optional<SubtreeRecorder> subtreeRecorder;
+ // We need to balance the benefit of subtree optimization and the cost of subtree display items.
+ // Only output subtree information if the block has multiple children or multiple line boxes.
+ if ((m_layoutBlock.childrenInline() && m_layoutBlock.lineBoxes() && m_layoutBlock.lineBoxes()->firstLineBox() && m_layoutBlock.lineBoxes()->firstLineBox()->nextLineBox())
pdr. 2015/08/11 21:08:41 Can you break this big if statement into a helper
Xianzhu 2015/08/11 21:52:22 Done.
+ || (m_layoutBlock.firstChild() && m_layoutBlock.firstChild()->nextSibling())) {
+ subtreeRecorder.emplace(*paintInfo.context, m_layoutBlock, paintInfo.phase);
+ if (subtreeRecorder->canUseCache())
+ return;
+ }
+
PaintInfo localPaintInfo(paintInfo);
LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location();
« no previous file with comments | « no previous file | Source/core/paint/DisplayItemListPaintTest.cpp » ('j') | Source/core/paint/DisplayItemListPaintTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698