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

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

Issue 1197843004: Allocate a drawing recorder locally to BoxPainter code in the mask phase. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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/FrameSelection.h" 8 #include "core/editing/FrameSelection.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/layout/LayoutFlexibleBox.h" 10 #include "core/layout/LayoutFlexibleBox.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 layoutObject.paint(info, childPoint); 153 layoutObject.paint(info, childPoint);
154 info.phase = PaintPhaseForeground; 154 info.phase = PaintPhaseForeground;
155 layoutObject.paint(info, childPoint); 155 layoutObject.paint(info, childPoint);
156 info.phase = PaintPhaseOutline; 156 info.phase = PaintPhaseOutline;
157 layoutObject.paint(info, childPoint); 157 layoutObject.paint(info, childPoint);
158 } 158 }
159 } 159 }
160 160
161 void BlockPainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) 161 void BlockPainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset)
162 { 162 {
163 PaintPhase paintPhase = paintInfo.phase; 163 const PaintPhase paintPhase = paintInfo.phase;
164 164
165 LayoutRect bounds; 165 LayoutRect bounds;
166 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { 166 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
167 bounds = m_layoutBlock.visualOverflowRect(); 167 bounds = m_layoutBlock.visualOverflowRect();
168 bounds.moveBy(paintOffset); 168 bounds.moveBy(paintOffset);
169 } 169 }
170 170
171 if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChil dBlockBackground) 171 if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChil dBlockBackground)
172 && m_layoutBlock.style()->visibility() == VISIBLE 172 && m_layoutBlock.style()->visibility() == VISIBLE
173 && m_layoutBlock.hasBoxDecorationBackground()) 173 && m_layoutBlock.hasBoxDecorationBackground())
174 m_layoutBlock.paintBoxDecorationBackground(paintInfo, paintOffset); 174 m_layoutBlock.paintBoxDecorationBackground(paintInfo, paintOffset);
175 175
176 if (paintPhase == PaintPhaseMask && m_layoutBlock.style()->visibility() == V ISIBLE) { 176 if (paintPhase == PaintPhaseMask && m_layoutBlock.style()->visibility() == V ISIBLE) {
177 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutBlock, paintPhase, bounds); 177 m_layoutBlock.paintMask(paintInfo, paintOffset);
178 if (!recorder.canUseCachedDrawing())
179 m_layoutBlock.paintMask(paintInfo, paintOffset);
180 return; 178 return;
181 } 179 }
182 180
183 if (paintPhase == PaintPhaseClippingMask && m_layoutBlock.style()->visibilit y() == VISIBLE) { 181 if (paintPhase == PaintPhaseClippingMask && m_layoutBlock.style()->visibilit y() == VISIBLE) {
184 BoxPainter(m_layoutBlock).paintClippingMask(paintInfo, paintOffset); 182 BoxPainter(m_layoutBlock).paintClippingMask(paintInfo, paintOffset);
185 return; 183 return;
186 } 184 }
187 185
188 // FIXME: When Skia supports annotation rect covering (https://code.google.c om/p/skia/issues/detail?id=3872), 186 // FIXME: When Skia supports annotation rect covering (https://code.google.c om/p/skia/issues/detail?id=3872),
189 // this rect may be covered by foreground and descendant drawings. Then we m ay need a dedicated paint phase. 187 // this rect may be covered by foreground and descendant drawings. Then we m ay need a dedicated paint phase.
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 LayoutBlock* block = flow->containingBlock(); 344 LayoutBlock* block = flow->containingBlock();
347 for ( ; block && block != &m_layoutBlock; block = block->containingBlock ()) 345 for ( ; block && block != &m_layoutBlock; block = block->containingBlock ())
348 accumulatedPaintOffset.moveBy(block->location()); 346 accumulatedPaintOffset.moveBy(block->location());
349 ASSERT(block); 347 ASSERT(block);
350 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); 348 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset);
351 } 349 }
352 } 350 }
353 351
354 352
355 } // namespace blink 353 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698