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

Side by Side Diff: Source/core/paint/BlockPainter.cpp

Issue 1315213002: (WIP) Paint invalidation for slimming paint v2 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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
« no previous file with comments | « Source/core/layout/LayoutTable.cpp ('k') | Source/core/paint/PaintPhase.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 10 matching lines...) Expand all
21 #include "core/paint/PaintInfo.h" 21 #include "core/paint/PaintInfo.h"
22 #include "core/paint/ScopeRecorder.h" 22 #include "core/paint/ScopeRecorder.h"
23 #include "core/paint/ScrollRecorder.h" 23 #include "core/paint/ScrollRecorder.h"
24 #include "core/paint/ScrollableAreaPainter.h" 24 #include "core/paint/ScrollableAreaPainter.h"
25 #include "core/paint/SubtreeRecorder.h" 25 #include "core/paint/SubtreeRecorder.h"
26 #include "platform/graphics/paint/ClipRecorder.h" 26 #include "platform/graphics/paint/ClipRecorder.h"
27 #include "wtf/Optional.h" 27 #include "wtf/Optional.h"
28 28
29 namespace blink { 29 namespace blink {
30 30
31 static inline LayoutRect visualOverflowRectWithPaintOffset(const LayoutBlock& la youtBox, const LayoutPoint& paintOffset)
32 {
33 if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
34 return LayoutRect();
35 LayoutRect bounds = layoutBox.visualOverflowRect();
36 bounds.moveBy(paintOffset);
37 return bounds;
38 }
39
31 void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOff set) 40 void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOff set)
32 { 41 {
33 PaintInfo localPaintInfo(paintInfo); 42 PaintInfo localPaintInfo(paintInfo);
34 43
35 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location(); 44 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location();
36 45
37 PaintPhase originalPhase = localPaintInfo.phase; 46 PaintPhase originalPhase = localPaintInfo.phase;
38 47
39 // Check if we need to do anything at all. 48 // Check if we need to do anything at all.
40 LayoutRect overflowBox = overflowRectForPaintRejection(); 49 LayoutRect overflowBox = overflowRectForPaintRejection();
41 m_layoutBlock.flipForWritingMode(overflowBox); 50 m_layoutBlock.flipForWritingMode(overflowBox);
42 overflowBox.moveBy(adjustedPaintOffset); 51 overflowBox.moveBy(adjustedPaintOffset);
43 if (!overflowBox.intersects(LayoutRect(localPaintInfo.rect))) 52 if (!overflowBox.intersects(LayoutRect(localPaintInfo.rect)))
44 return; 53 return;
45 54
55 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
56 m_layoutBlock.invalidatePaintIfNeededForSlimmingPaintV2(adjustedPaintOff set);
57
46 SubtreeRecorder subtreeRecorder(*paintInfo.context, m_layoutBlock, paintInfo .phase); 58 SubtreeRecorder subtreeRecorder(*paintInfo.context, m_layoutBlock, paintInfo .phase);
47 if (subtreeRecorder.canUseCache()) 59 if (subtreeRecorder.canUseCache())
48 return; 60 return;
49 61
50 // There are some cases where not all clipped visual overflow is accounted f or. 62 // There are some cases where not all clipped visual overflow is accounted f or.
51 // FIXME: reduce the number of such cases. 63 // FIXME: reduce the number of such cases.
52 ContentsClipBehavior contentsClipBehavior = ForceContentsClip; 64 ContentsClipBehavior contentsClipBehavior = ForceContentsClip;
53 if (m_layoutBlock.hasOverflowClip() && !m_layoutBlock.hasControlClip() && !( m_layoutBlock.shouldPaintSelectionGaps() && originalPhase == PaintPhaseForegroun d) && !hasCaret()) 65 if (m_layoutBlock.hasOverflowClip() && !m_layoutBlock.hasControlClip() && !( m_layoutBlock.shouldPaintSelectionGaps() && originalPhase == PaintPhaseForegroun d) && !hasCaret())
54 contentsClipBehavior = SkipContentsClipIfPossible; 66 contentsClipBehavior = SkipContentsClipIfPossible;
55 67
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 layoutObject.paint(info, childPoint); 156 layoutObject.paint(info, childPoint);
145 info.phase = PaintPhaseFloat; 157 info.phase = PaintPhaseFloat;
146 layoutObject.paint(info, childPoint); 158 layoutObject.paint(info, childPoint);
147 info.phase = PaintPhaseForeground; 159 info.phase = PaintPhaseForeground;
148 layoutObject.paint(info, childPoint); 160 layoutObject.paint(info, childPoint);
149 info.phase = PaintPhaseOutline; 161 info.phase = PaintPhaseOutline;
150 layoutObject.paint(info, childPoint); 162 layoutObject.paint(info, childPoint);
151 } 163 }
152 } 164 }
153 165
154 static inline LayoutRect visualOverflowRectWithPaintOffset(const LayoutBlock& la youtBox, const LayoutPoint& paintOffset)
155 {
156 if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
157 return LayoutRect();
158 LayoutRect bounds = layoutBox.visualOverflowRect();
159 bounds.moveBy(paintOffset);
160 return bounds;
161 }
162
163 void BlockPainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) 166 void BlockPainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset)
164 { 167 {
165 const PaintPhase paintPhase = paintInfo.phase; 168 const PaintPhase paintPhase = paintInfo.phase;
166 169
167 if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChil dBlockBackground) 170 if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChil dBlockBackground)
168 && m_layoutBlock.style()->visibility() == VISIBLE 171 && m_layoutBlock.style()->visibility() == VISIBLE
169 && m_layoutBlock.hasBoxDecorationBackground()) 172 && m_layoutBlock.hasBoxDecorationBackground())
170 m_layoutBlock.paintBoxDecorationBackground(paintInfo, paintOffset); 173 m_layoutBlock.paintBoxDecorationBackground(paintInfo, paintOffset);
171 174
172 if (paintPhase == PaintPhaseMask && m_layoutBlock.style()->visibility() == V ISIBLE) { 175 if (paintPhase == PaintPhaseMask && m_layoutBlock.style()->visibility() == V ISIBLE) {
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 LayoutBlock* block = flow->containingBlock(); 346 LayoutBlock* block = flow->containingBlock();
344 for ( ; block && block != &m_layoutBlock; block = block->containingBlock ()) 347 for ( ; block && block != &m_layoutBlock; block = block->containingBlock ())
345 accumulatedPaintOffset.moveBy(block->location()); 348 accumulatedPaintOffset.moveBy(block->location());
346 ASSERT(block); 349 ASSERT(block);
347 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); 350 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset);
348 } 351 }
349 } 352 }
350 353
351 354
352 } // namespace blink 355 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutTable.cpp ('k') | Source/core/paint/PaintPhase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698