OLD | NEW |
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/Caret.h" | 8 #include "core/editing/Caret.h" |
9 #include "core/editing/FrameSelection.h" | 9 #include "core/editing/FrameSelection.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 170 } |
171 | 171 |
172 if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChil
dBlockBackground) && m_renderBlock.style()->visibility() == VISIBLE) { | 172 if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChil
dBlockBackground) && m_renderBlock.style()->visibility() == VISIBLE) { |
173 if (m_renderBlock.hasBoxDecorationBackground()) | 173 if (m_renderBlock.hasBoxDecorationBackground()) |
174 m_renderBlock.paintBoxDecorationBackground(paintInfo, paintOffset); | 174 m_renderBlock.paintBoxDecorationBackground(paintInfo, paintOffset); |
175 if (m_renderBlock.hasColumns() && !paintInfo.paintRootBackgroundOnly()) | 175 if (m_renderBlock.hasColumns() && !paintInfo.paintRootBackgroundOnly()) |
176 paintColumnRules(paintInfo, scrolledOffset); | 176 paintColumnRules(paintInfo, scrolledOffset); |
177 } | 177 } |
178 | 178 |
179 if (paintPhase == PaintPhaseMask && m_renderBlock.style()->visibility() == V
ISIBLE) { | 179 if (paintPhase == PaintPhaseMask && m_renderBlock.style()->visibility() == V
ISIBLE) { |
180 RenderDrawingRecorder recorder(paintInfo.context, &m_renderBlock, paintP
hase, bounds); | 180 RenderDrawingRecorder recorder(paintInfo.context, m_renderBlock, paintPh
ase, bounds); |
181 m_renderBlock.paintMask(paintInfo, paintOffset); | 181 if (!recorder.canUseCachedDrawing()) |
| 182 m_renderBlock.paintMask(paintInfo, paintOffset); |
182 return; | 183 return; |
183 } | 184 } |
184 | 185 |
185 if (paintPhase == PaintPhaseClippingMask && m_renderBlock.style()->visibilit
y() == VISIBLE) { | 186 if (paintPhase == PaintPhaseClippingMask && m_renderBlock.style()->visibilit
y() == VISIBLE) { |
186 RenderDrawingRecorder recorder(paintInfo.context, &m_renderBlock, paintP
hase, bounds); | 187 RenderDrawingRecorder recorder(paintInfo.context, m_renderBlock, paintPh
ase, bounds); |
187 m_renderBlock.paintClippingMask(paintInfo, paintOffset); | 188 if (!recorder.canUseCachedDrawing()) |
| 189 m_renderBlock.paintClippingMask(paintInfo, paintOffset); |
188 return; | 190 return; |
189 } | 191 } |
190 | 192 |
191 // We're done. We don't bother painting any children. | 193 // We're done. We don't bother painting any children. |
192 if (paintPhase == PaintPhaseBlockBackground || paintInfo.paintRootBackground
Only()) | 194 if (paintPhase == PaintPhaseBlockBackground || paintInfo.paintRootBackground
Only()) |
193 return; | 195 return; |
194 | 196 |
195 if (paintPhase != PaintPhaseSelfOutline) { | 197 if (paintPhase != PaintPhaseSelfOutline) { |
196 if (m_renderBlock.hasColumns()) | 198 if (m_renderBlock.hasColumns()) |
197 paintColumnContents(paintInfo, scrolledOffset); | 199 paintColumnContents(paintInfo, scrolledOffset); |
(...skipping 19 matching lines...) Expand all Loading... |
217 if (!m_renderBlock.style()->outlineStyleIsAuto() || !m_renderBlock.isAno
nymousBlockContinuation()) | 219 if (!m_renderBlock.style()->outlineStyleIsAuto() || !m_renderBlock.isAno
nymousBlockContinuation()) |
218 ObjectPainter(m_renderBlock).paintOutline(paintInfo, LayoutRect(pain
tOffset, m_renderBlock.size())); | 220 ObjectPainter(m_renderBlock).paintOutline(paintInfo, LayoutRect(pain
tOffset, m_renderBlock.size())); |
219 } | 221 } |
220 | 222 |
221 if (paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseChildOutlines
) | 223 if (paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseChildOutlines
) |
222 paintContinuationOutlines(paintInfo, paintOffset); | 224 paintContinuationOutlines(paintInfo, paintOffset); |
223 | 225 |
224 // If the caret's node's render object's containing block is this block, and
the paint action is PaintPhaseForeground, | 226 // If the caret's node's render object's containing block is this block, and
the paint action is PaintPhaseForeground, |
225 // then paint the caret. | 227 // then paint the caret. |
226 if (paintPhase == PaintPhaseForeground) { | 228 if (paintPhase == PaintPhaseForeground) { |
227 RenderDrawingRecorder recorder(paintInfo.context, &m_renderBlock, paintP
hase, bounds); | 229 RenderDrawingRecorder recorder(paintInfo.context, m_renderBlock, paintPh
ase, bounds); |
228 paintCarets(paintInfo, paintOffset); | 230 if (!recorder.canUseCachedDrawing()) |
| 231 paintCarets(paintInfo, paintOffset); |
229 } | 232 } |
230 } | 233 } |
231 | 234 |
232 static inline bool caretBrowsingEnabled(const Frame* frame) | 235 static inline bool caretBrowsingEnabled(const Frame* frame) |
233 { | 236 { |
234 Settings* settings = frame->settings(); | 237 Settings* settings = frame->settings(); |
235 return settings && settings->caretBrowsingEnabled(); | 238 return settings && settings->caretBrowsingEnabled(); |
236 } | 239 } |
237 | 240 |
238 static inline bool hasCursorCaret(const FrameSelection& selection, const RenderB
lock* block, bool caretBrowsing) | 241 static inline bool hasCursorCaret(const FrameSelection& selection, const RenderB
lock* block, bool caretBrowsing) |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 RenderBlock* block = flow->containingBlock(); | 487 RenderBlock* block = flow->containingBlock(); |
485 for ( ; block && block != &m_renderBlock; block = block->containingBlock
()) | 488 for ( ; block && block != &m_renderBlock; block = block->containingBlock
()) |
486 accumulatedPaintOffset.moveBy(block->location()); | 489 accumulatedPaintOffset.moveBy(block->location()); |
487 ASSERT(block); | 490 ASSERT(block); |
488 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); | 491 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); |
489 } | 492 } |
490 } | 493 } |
491 | 494 |
492 | 495 |
493 } // namespace blink | 496 } // namespace blink |
OLD | NEW |