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

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

Issue 1294233004: Subtree caching implementation in blink-core (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: s/setSelfNeedsRepaint/setNeedsRepaint/ 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 fa3bd8fdc40e0f87b703d8c4106853eab75b144f..9c1a5a36e7af498059060876b357e7b91f8a1b04 100644
--- a/Source/core/paint/BlockPainter.cpp
+++ b/Source/core/paint/BlockPainter.cpp
@@ -17,34 +17,19 @@
#include "core/paint/DeprecatedPaintLayer.h"
#include "core/paint/InlinePainter.h"
#include "core/paint/LayoutObjectDrawingRecorder.h"
+#include "core/paint/LayoutObjectSubtreeRecorder.h"
#include "core/paint/LineBoxListPainter.h"
#include "core/paint/PaintInfo.h"
#include "core/paint/ScopeRecorder.h"
#include "core/paint/ScrollRecorder.h"
#include "core/paint/ScrollableAreaPainter.h"
#include "platform/graphics/paint/ClipRecorder.h"
-#include "platform/graphics/paint/SubtreeRecorder.h"
#include "wtf/Optional.h"
namespace blink {
-// 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.
-static bool needsSubtreeRecorder(const LayoutBlock& layoutBlock)
-{
- return (layoutBlock.firstChild() && layoutBlock.firstChild()->nextSibling())
- || (layoutBlock.isLayoutBlockFlow() && toLayoutBlockFlow(layoutBlock).firstLineBox() && toLayoutBlockFlow(layoutBlock).firstLineBox()->nextLineBox());
-}
-
void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
- Optional<SubtreeRecorder> subtreeRecorder;
- if (needsSubtreeRecorder(m_layoutBlock)) {
- subtreeRecorder.emplace(*paintInfo.context, m_layoutBlock, paintInfo.phase);
- if (subtreeRecorder->canUseCache())
- return;
- }
-
PaintInfo localPaintInfo(paintInfo);
LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location();
@@ -58,6 +43,10 @@ void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOff
if (!overflowBox.intersects(LayoutRect(localPaintInfo.rect)))
return;
+ LayoutObjectSubtreeRecorder subtreeRecorder(*paintInfo.context, m_layoutBlock, paintInfo.phase);
+ if (subtreeRecorder.canUseCache())
+ return;
+
// There are some cases where not all clipped visual overflow is accounted for.
// FIXME: reduce the number of such cases.
ContentsClipBehavior contentsClipBehavior = ForceContentsClip;

Powered by Google App Engine
This is Rietveld 408576698