| 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 "core/paint/BlockPainter.h" | 5 #include "core/paint/BlockPainter.h" |
| 6 | 6 |
| 7 #include "core/editing/DragCaretController.h" | 7 #include "core/editing/DragCaretController.h" |
| 8 #include "core/editing/FrameSelection.h" | 8 #include "core/editing/FrameSelection.h" |
| 9 #include "core/layout/LayoutFlexibleBox.h" | 9 #include "core/layout/LayoutFlexibleBox.h" |
| 10 #include "core/layout/LayoutInline.h" | 10 #include "core/layout/LayoutInline.h" |
| 11 #include "core/layout/api/LineLayoutAPIShim.h" | 11 #include "core/layout/api/LineLayoutAPIShim.h" |
| 12 #include "core/layout/api/LineLayoutBox.h" | 12 #include "core/layout/api/LineLayoutBox.h" |
| 13 #include "core/page/Page.h" | 13 #include "core/page/Page.h" |
| 14 #include "core/paint/BlockFlowPainter.h" | 14 #include "core/paint/BlockFlowPainter.h" |
| 15 #include "core/paint/BoxClipper.h" | 15 #include "core/paint/BoxClipper.h" |
| 16 #include "core/paint/BoxPainter.h" | 16 #include "core/paint/BoxPainter.h" |
| 17 #include "core/paint/LayoutObjectDrawingRecorder.h" | 17 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 18 #include "core/paint/ObjectPaintProperties.h" | 18 #include "core/paint/ObjectPaintProperties.h" |
| 19 #include "core/paint/ObjectPainter.h" | 19 #include "core/paint/ObjectPainter.h" |
| 20 #include "core/paint/PaintInfo.h" | 20 #include "core/paint/PaintInfo.h" |
| 21 #include "core/paint/PaintLayer.h" | 21 #include "core/paint/PaintLayer.h" |
| 22 #include "core/paint/ScrollRecorder.h" | 22 #include "core/paint/ScrollRecorder.h" |
| 23 #include "core/paint/ScrollableAreaPainter.h" | 23 #include "core/paint/ScrollableAreaPainter.h" |
| 24 #include "platform/graphics/GraphicsLayer.h" | 24 #include "platform/graphics/GraphicsLayer.h" |
| 25 #include "platform/graphics/paint/ClipRecorder.h" | 25 #include "platform/graphics/paint/ClipRecorder.h" |
| 26 #include "wtf/Optional.h" | 26 #include "wtf/Optional.h" |
| 27 | 27 |
| 28 namespace blink { | 28 namespace blink { |
| 29 | 29 |
| 30 DISABLE_CFI_PERF |
| 30 void BlockPainter::paint(const PaintInfo& paintInfo, | 31 void BlockPainter::paint(const PaintInfo& paintInfo, |
| 31 const LayoutPoint& paintOffset) { | 32 const LayoutPoint& paintOffset) { |
| 32 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location(); | 33 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location(); |
| 33 if (!intersectsPaintRect(paintInfo, adjustedPaintOffset)) | 34 if (!intersectsPaintRect(paintInfo, adjustedPaintOffset)) |
| 34 return; | 35 return; |
| 35 | 36 |
| 36 PaintInfo localPaintInfo(paintInfo); | 37 PaintInfo localPaintInfo(paintInfo); |
| 37 PaintPhase originalPhase = localPaintInfo.phase; | 38 PaintPhase originalPhase = localPaintInfo.phase; |
| 38 | 39 |
| 39 // There are some cases where not all clipped visual overflow is accounted | 40 // There are some cases where not all clipped visual overflow is accounted |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 toLayoutBox(LineLayoutAPIShim::layoutObjectFrom( | 156 toLayoutBox(LineLayoutAPIShim::layoutObjectFrom( |
| 156 inlineBox.getLineLayoutItem())), | 157 inlineBox.getLineLayoutItem())), |
| 157 childPoint); | 158 childPoint); |
| 158 } | 159 } |
| 159 | 160 |
| 160 ObjectPainter( | 161 ObjectPainter( |
| 161 *LineLayoutAPIShim::constLayoutObjectFrom(inlineBox.getLineLayoutItem())) | 162 *LineLayoutAPIShim::constLayoutObjectFrom(inlineBox.getLineLayoutItem())) |
| 162 .paintAllPhasesAtomically(paintInfo, childPoint); | 163 .paintAllPhasesAtomically(paintInfo, childPoint); |
| 163 } | 164 } |
| 164 | 165 |
| 166 DISABLE_CFI_PERF |
| 165 void BlockPainter::paintObject(const PaintInfo& paintInfo, | 167 void BlockPainter::paintObject(const PaintInfo& paintInfo, |
| 166 const LayoutPoint& paintOffset) { | 168 const LayoutPoint& paintOffset) { |
| 167 const PaintPhase paintPhase = paintInfo.phase; | 169 const PaintPhase paintPhase = paintInfo.phase; |
| 168 | 170 |
| 169 if (shouldPaintSelfBlockBackground(paintPhase)) { | 171 if (shouldPaintSelfBlockBackground(paintPhase)) { |
| 170 if (m_layoutBlock.style()->visibility() == EVisibility::Visible && | 172 if (m_layoutBlock.style()->visibility() == EVisibility::Visible && |
| 171 m_layoutBlock.hasBoxDecorationBackground()) | 173 m_layoutBlock.hasBoxDecorationBackground()) |
| 172 m_layoutBlock.paintBoxDecorationBackground(paintInfo, paintOffset); | 174 m_layoutBlock.paintBoxDecorationBackground(paintInfo, paintOffset); |
| 173 // We're done. We don't bother painting any children. | 175 // We're done. We don't bother painting any children. |
| 174 if (paintPhase == PaintPhaseSelfBlockBackgroundOnly) | 176 if (paintPhase == PaintPhaseSelfBlockBackgroundOnly) |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 LocalFrame* frame = m_layoutBlock.frame(); | 256 LocalFrame* frame = m_layoutBlock.frame(); |
| 255 | 257 |
| 256 if (m_layoutBlock.hasCursorCaret()) | 258 if (m_layoutBlock.hasCursorCaret()) |
| 257 frame->selection().paintCaret(paintInfo.context, paintOffset); | 259 frame->selection().paintCaret(paintInfo.context, paintOffset); |
| 258 | 260 |
| 259 if (m_layoutBlock.hasDragCaret()) | 261 if (m_layoutBlock.hasDragCaret()) |
| 260 frame->page()->dragCaretController().paintDragCaret( | 262 frame->page()->dragCaretController().paintDragCaret( |
| 261 frame, paintInfo.context, paintOffset); | 263 frame, paintInfo.context, paintOffset); |
| 262 } | 264 } |
| 263 | 265 |
| 266 DISABLE_CFI_PERF |
| 264 bool BlockPainter::intersectsPaintRect( | 267 bool BlockPainter::intersectsPaintRect( |
| 265 const PaintInfo& paintInfo, | 268 const PaintInfo& paintInfo, |
| 266 const LayoutPoint& adjustedPaintOffset) const { | 269 const LayoutPoint& adjustedPaintOffset) const { |
| 267 LayoutRect overflowRect; | 270 LayoutRect overflowRect; |
| 268 if (paintInfo.isPrinting() && m_layoutBlock.isAnonymousBlock() && | 271 if (paintInfo.isPrinting() && m_layoutBlock.isAnonymousBlock() && |
| 269 m_layoutBlock.childrenInline()) { | 272 m_layoutBlock.childrenInline()) { |
| 270 // For case <a href="..."><div>...</div></a>, when m_layoutBlock is the | 273 // For case <a href="..."><div>...</div></a>, when m_layoutBlock is the |
| 271 // anonymous container of <a>, the anonymous container's visual overflow is | 274 // anonymous container of <a>, the anonymous container's visual overflow is |
| 272 // empty, but we need to continue painting to output <a>'s PDF URL rect | 275 // empty, but we need to continue painting to output <a>'s PDF URL rect |
| 273 // which covers the continuations, as if we included <a>'s PDF URL rect into | 276 // which covers the continuations, as if we included <a>'s PDF URL rect into |
| (...skipping 24 matching lines...) Expand all Loading... |
| 298 } | 301 } |
| 299 | 302 |
| 300 void BlockPainter::paintContents(const PaintInfo& paintInfo, | 303 void BlockPainter::paintContents(const PaintInfo& paintInfo, |
| 301 const LayoutPoint& paintOffset) { | 304 const LayoutPoint& paintOffset) { |
| 302 DCHECK(!m_layoutBlock.childrenInline()); | 305 DCHECK(!m_layoutBlock.childrenInline()); |
| 303 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); | 306 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); |
| 304 m_layoutBlock.paintChildren(paintInfoForDescendants, paintOffset); | 307 m_layoutBlock.paintChildren(paintInfoForDescendants, paintOffset); |
| 305 } | 308 } |
| 306 | 309 |
| 307 } // namespace blink | 310 } // namespace blink |
| OLD | NEW |