| 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/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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // inline element having outline-style:auto paints the whole focus ring. | 217 // inline element having outline-style:auto paints the whole focus ring. |
| 218 if (!m_layoutBlock.style()->outlineStyleIsAuto() || !m_layoutBlock.isAno
nymousBlockContinuation()) | 218 if (!m_layoutBlock.style()->outlineStyleIsAuto() || !m_layoutBlock.isAno
nymousBlockContinuation()) |
| 219 ObjectPainter(m_layoutBlock).paintOutline(paintInfo, LayoutRect(pain
tOffset, m_layoutBlock.size()), visualOverflowRectWithPaintOffset(m_layoutBlock,
paintOffset)); | 219 ObjectPainter(m_layoutBlock).paintOutline(paintInfo, LayoutRect(pain
tOffset, m_layoutBlock.size()), visualOverflowRectWithPaintOffset(m_layoutBlock,
paintOffset)); |
| 220 } | 220 } |
| 221 | 221 |
| 222 if (paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseChildOutlines
) | 222 if (paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseChildOutlines
) |
| 223 paintContinuationOutlines(paintInfo, paintOffset); | 223 paintContinuationOutlines(paintInfo, paintOffset); |
| 224 | 224 |
| 225 // If the caret's node's layout object's containing block is this block, and
the paint action is PaintPhaseForeground, | 225 // If the caret's node's layout object's containing block is this block, and
the paint action is PaintPhaseForeground, |
| 226 // then paint the caret. | 226 // then paint the caret. |
| 227 if (paintPhase == PaintPhaseForeground && hasCaret()) { | 227 if (paintPhase == PaintPhaseForeground && hasCaret() && !LayoutObjectDrawing
Recorder::useCachedDrawingIfPossible(*paintInfo.context, m_layoutBlock, DisplayI
tem::Caret)) { |
| 228 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutBlock,
DisplayItem::Caret, visualOverflowRectWithPaintOffset(m_layoutBlock, paintOffset
)); | 228 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutBlock,
DisplayItem::Caret, visualOverflowRectWithPaintOffset(m_layoutBlock, paintOffset
)); |
| 229 if (!recorder.canUseCachedDrawing()) | 229 paintCarets(paintInfo, paintOffset); |
| 230 paintCarets(paintInfo, paintOffset); | |
| 231 } | 230 } |
| 232 } | 231 } |
| 233 | 232 |
| 234 static inline bool caretBrowsingEnabled(const Frame* frame) | 233 static inline bool caretBrowsingEnabled(const Frame* frame) |
| 235 { | 234 { |
| 236 Settings* settings = frame->settings(); | 235 Settings* settings = frame->settings(); |
| 237 return settings && settings->caretBrowsingEnabled(); | 236 return settings && settings->caretBrowsingEnabled(); |
| 238 } | 237 } |
| 239 | 238 |
| 240 static inline bool hasCursorCaret(const FrameSelection& selection, const LayoutB
lock* block, bool caretBrowsing) | 239 static inline bool hasCursorCaret(const FrameSelection& selection, const LayoutB
lock* block, bool caretBrowsing) |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 LayoutBlock* block = flow->containingBlock(); | 345 LayoutBlock* block = flow->containingBlock(); |
| 347 for ( ; block && block != &m_layoutBlock; block = block->containingBlock
()) | 346 for ( ; block && block != &m_layoutBlock; block = block->containingBlock
()) |
| 348 accumulatedPaintOffset.moveBy(block->location()); | 347 accumulatedPaintOffset.moveBy(block->location()); |
| 349 ASSERT(block); | 348 ASSERT(block); |
| 350 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); | 349 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); |
| 351 } | 350 } |
| 352 } | 351 } |
| 353 | 352 |
| 354 | 353 |
| 355 } // namespace blink | 354 } // namespace blink |
| OLD | NEW |