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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/paint/BlockPainter.h" 6 #include "core/paint/BlockPainter.h"
7 7
8 #include "core/editing/DragCaretController.h" 8 #include "core/editing/DragCaretController.h"
9 #include "core/editing/FrameSelection.h" 9 #include "core/editing/FrameSelection.h"
10 #include "core/frame/Settings.h" 10 #include "core/frame/Settings.h"
11 #include "core/layout/LayoutFlexibleBox.h" 11 #include "core/layout/LayoutFlexibleBox.h"
12 #include "core/layout/LayoutInline.h" 12 #include "core/layout/LayoutInline.h"
13 #include "core/page/Page.h" 13 #include "core/page/Page.h"
14 #include "core/paint/BoxClipper.h" 14 #include "core/paint/BoxClipper.h"
15 #include "core/paint/BoxPainter.h" 15 #include "core/paint/BoxPainter.h"
16 #include "core/paint/DeprecatedPaintLayer.h" 16 #include "core/paint/DeprecatedPaintLayer.h"
17 #include "core/paint/InlinePainter.h" 17 #include "core/paint/InlinePainter.h"
18 #include "core/paint/LayoutObjectDrawingRecorder.h" 18 #include "core/paint/LayoutObjectDrawingRecorder.h"
19 #include "core/paint/LineBoxListPainter.h" 19 #include "core/paint/LineBoxListPainter.h"
20 #include "core/paint/PaintInfo.h" 20 #include "core/paint/PaintInfo.h"
21 #include "core/paint/ScopeRecorder.h" 21 #include "core/paint/ScopeRecorder.h"
22 #include "core/paint/ScrollRecorder.h" 22 #include "core/paint/ScrollRecorder.h"
23 #include "core/paint/ScrollableAreaPainter.h" 23 #include "core/paint/ScrollableAreaPainter.h"
24 #include "core/paint/SubtreeRecorder.h"
24 #include "platform/graphics/paint/ClipRecorder.h" 25 #include "platform/graphics/paint/ClipRecorder.h"
25 #include "wtf/Optional.h" 26 #include "wtf/Optional.h"
26 27
27 namespace blink { 28 namespace blink {
28 29
29 void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOff set) 30 void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOff set)
30 { 31 {
32 Optional<SubtreeRecorder> subtreeRecorder;
33 // We need to balance the benefit of subtree optimization and the cost of su btree display items.
34 // Only output subtree information if the block has multiple children or mul tiple line boxes.
35 if ((m_layoutBlock.childrenInline() && m_layoutBlock.lineBoxes() && m_layout Block.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.
36 || (m_layoutBlock.firstChild() && m_layoutBlock.firstChild()->nextSiblin g())) {
37 subtreeRecorder.emplace(*paintInfo.context, m_layoutBlock, paintInfo.pha se);
38 if (subtreeRecorder->canUseCache())
39 return;
40 }
41
31 PaintInfo localPaintInfo(paintInfo); 42 PaintInfo localPaintInfo(paintInfo);
32 43
33 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location(); 44 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location();
34 45
35 PaintPhase originalPhase = localPaintInfo.phase; 46 PaintPhase originalPhase = localPaintInfo.phase;
36 47
37 // Check if we need to do anything at all. 48 // Check if we need to do anything at all.
38 LayoutRect overflowBox = overflowRectForPaintRejection(); 49 LayoutRect overflowBox = overflowRectForPaintRejection();
39 m_layoutBlock.flipForWritingMode(overflowBox); 50 m_layoutBlock.flipForWritingMode(overflowBox);
40 overflowBox.moveBy(adjustedPaintOffset); 51 overflowBox.moveBy(adjustedPaintOffset);
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 LayoutBlock* block = flow->containingBlock(); 348 LayoutBlock* block = flow->containingBlock();
338 for ( ; block && block != &m_layoutBlock; block = block->containingBlock ()) 349 for ( ; block && block != &m_layoutBlock; block = block->containingBlock ())
339 accumulatedPaintOffset.moveBy(block->location()); 350 accumulatedPaintOffset.moveBy(block->location());
340 ASSERT(block); 351 ASSERT(block);
341 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); 352 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset);
342 } 353 }
343 } 354 }
344 355
345 356
346 } // namespace blink 357 } // namespace blink
OLDNEW
« 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