Chromium Code Reviews| 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(); |