| 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/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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 return; | 178 return; |
| 179 } | 179 } |
| 180 | 180 |
| 181 if (paintPhase == PaintPhaseClippingMask && m_layoutBlock.style()->visibilit
y() == VISIBLE) { | 181 if (paintPhase == PaintPhaseClippingMask && m_layoutBlock.style()->visibilit
y() == VISIBLE) { |
| 182 BoxPainter(m_layoutBlock).paintClippingMask(paintInfo, paintOffset); | 182 BoxPainter(m_layoutBlock).paintClippingMask(paintInfo, paintOffset); |
| 183 return; | 183 return; |
| 184 } | 184 } |
| 185 | 185 |
| 186 // 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), |
| 187 // 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. |
| 188 if (paintPhase == PaintPhaseForeground && paintInfo.context->printing()) | 188 if (paintPhase == PaintPhaseForeground && paintInfo.printing()) |
| 189 ObjectPainter(m_layoutBlock).addPDFURLRectIfNeeded(paintInfo, paintOffse
t); | 189 ObjectPainter(m_layoutBlock).addPDFURLRectIfNeeded(paintInfo, paintOffse
t); |
| 190 | 190 |
| 191 { | 191 { |
| 192 Optional<ScrollRecorder> scrollRecorder; | 192 Optional<ScrollRecorder> scrollRecorder; |
| 193 Optional<PaintInfo> scrolledPaintInfo; | 193 Optional<PaintInfo> scrolledPaintInfo; |
| 194 if (m_layoutBlock.hasOverflowClip()) { | 194 if (m_layoutBlock.hasOverflowClip()) { |
| 195 IntSize scrollOffset = m_layoutBlock.scrolledContentOffset(); | 195 IntSize scrollOffset = m_layoutBlock.scrolledContentOffset(); |
| 196 if (m_layoutBlock.layer()->scrollsOverflow() || !scrollOffset.isZero
()) { | 196 if (m_layoutBlock.layer()->scrollsOverflow() || !scrollOffset.isZero
()) { |
| 197 scrollRecorder.emplace(*paintInfo.context, m_layoutBlock, paintP
hase, scrollOffset); | 197 scrollRecorder.emplace(*paintInfo.context, m_layoutBlock, paintP
hase, scrollOffset); |
| 198 scrolledPaintInfo.emplace(paintInfo); | 198 scrolledPaintInfo.emplace(paintInfo); |
| 199 scrolledPaintInfo->rect.move(scrollOffset); | 199 scrolledPaintInfo->rect.move(scrollOffset); |
| 200 } | 200 } |
| 201 } | 201 } |
| 202 | 202 |
| 203 // We're done. We don't bother painting any children. | 203 // We're done. We don't bother painting any children. |
| 204 if (paintPhase == PaintPhaseBlockBackground || paintInfo.paintRootBackgr
oundOnly()) | 204 if (paintPhase == PaintPhaseBlockBackground || paintInfo.paintRootBackgr
oundOnly()) |
| 205 return; | 205 return; |
| 206 | 206 |
| 207 const PaintInfo& contentsPaintInfo = scrolledPaintInfo ? *scrolledPaintI
nfo : paintInfo; | 207 const PaintInfo& contentsPaintInfo = scrolledPaintInfo ? *scrolledPaintI
nfo : paintInfo; |
| 208 | 208 |
| 209 if (paintPhase != PaintPhaseSelfOutline) | 209 if (paintPhase != PaintPhaseSelfOutline) |
| 210 paintContents(contentsPaintInfo, paintOffset); | 210 paintContents(contentsPaintInfo, paintOffset); |
| 211 | 211 |
| 212 if (paintPhase == PaintPhaseForeground && !m_layoutBlock.document().prin
ting()) | 212 if (paintPhase == PaintPhaseForeground && !paintInfo.printing()) |
| 213 m_layoutBlock.paintSelection(contentsPaintInfo, paintOffset); // Fil
l in gaps in selection on lines and between blocks. | 213 m_layoutBlock.paintSelection(contentsPaintInfo, paintOffset); // Fil
l in gaps in selection on lines and between blocks. |
| 214 | 214 |
| 215 if (paintPhase == PaintPhaseFloat || paintPhase == PaintPhaseSelection |
| paintPhase == PaintPhaseTextClip) | 215 if (paintPhase == PaintPhaseFloat || paintPhase == PaintPhaseSelection |
| paintPhase == PaintPhaseTextClip) |
| 216 m_layoutBlock.paintFloats(contentsPaintInfo, paintOffset, paintPhase
== PaintPhaseSelection || paintPhase == PaintPhaseTextClip); | 216 m_layoutBlock.paintFloats(contentsPaintInfo, paintOffset, paintPhase
== PaintPhaseSelection || paintPhase == PaintPhaseTextClip); |
| 217 } | 217 } |
| 218 | 218 |
| 219 if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline)
&& m_layoutBlock.style()->hasOutline() && m_layoutBlock.style()->visibility() =
= VISIBLE) { | 219 if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline)
&& m_layoutBlock.style()->hasOutline() && m_layoutBlock.style()->visibility() =
= VISIBLE) { |
| 220 // Don't paint focus ring for anonymous block continuation because the | 220 // Don't paint focus ring for anonymous block continuation because the |
| 221 // inline element having outline-style:auto paints the whole focus ring. | 221 // inline element having outline-style:auto paints the whole focus ring. |
| 222 if (!m_layoutBlock.style()->outlineStyleIsAuto() || !m_layoutBlock.isAno
nymousBlockContinuation()) | 222 if (!m_layoutBlock.style()->outlineStyleIsAuto() || !m_layoutBlock.isAno
nymousBlockContinuation()) |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 LayoutBlock* block = flow->containingBlock(); | 347 LayoutBlock* block = flow->containingBlock(); |
| 348 for ( ; block && block != &m_layoutBlock; block = block->containingBlock
()) | 348 for ( ; block && block != &m_layoutBlock; block = block->containingBlock
()) |
| 349 accumulatedPaintOffset.moveBy(block->location()); | 349 accumulatedPaintOffset.moveBy(block->location()); |
| 350 ASSERT(block); | 350 ASSERT(block); |
| 351 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); | 351 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); |
| 352 } | 352 } |
| 353 } | 353 } |
| 354 | 354 |
| 355 | 355 |
| 356 } // namespace blink | 356 } // namespace blink |
| OLD | NEW |