| 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 ObjectPainter(m_layoutBlock).checkPaintOffset(paintInfo, paintOffset); | 33 ObjectPainter(m_layoutBlock).checkPaintOffset(paintInfo, paintOffset); |
| 33 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location(); | 34 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location(); |
| 34 if (!intersectsPaintRect(paintInfo, adjustedPaintOffset)) | 35 if (!intersectsPaintRect(paintInfo, adjustedPaintOffset)) |
| 35 return; | 36 return; |
| 36 | 37 |
| 37 PaintInfo localPaintInfo(paintInfo); | 38 PaintInfo localPaintInfo(paintInfo); |
| 38 PaintPhase originalPhase = localPaintInfo.phase; | 39 PaintPhase originalPhase = localPaintInfo.phase; |
| 39 | 40 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 toLayoutBox(LineLayoutAPIShim::layoutObjectFrom( | 157 toLayoutBox(LineLayoutAPIShim::layoutObjectFrom( |
| 157 inlineBox.getLineLayoutItem())), | 158 inlineBox.getLineLayoutItem())), |
| 158 childPoint); | 159 childPoint); |
| 159 } | 160 } |
| 160 | 161 |
| 161 ObjectPainter( | 162 ObjectPainter( |
| 162 *LineLayoutAPIShim::constLayoutObjectFrom(inlineBox.getLineLayoutItem())) | 163 *LineLayoutAPIShim::constLayoutObjectFrom(inlineBox.getLineLayoutItem())) |
| 163 .paintAllPhasesAtomically(paintInfo, childPoint); | 164 .paintAllPhasesAtomically(paintInfo, childPoint); |
| 164 } | 165 } |
| 165 | 166 |
| 167 DISABLE_CFI_PERF |
| 166 void BlockPainter::paintObject(const PaintInfo& paintInfo, | 168 void BlockPainter::paintObject(const PaintInfo& paintInfo, |
| 167 const LayoutPoint& paintOffset) { | 169 const LayoutPoint& paintOffset) { |
| 168 const PaintPhase paintPhase = paintInfo.phase; | 170 const PaintPhase paintPhase = paintInfo.phase; |
| 169 | 171 |
| 170 if (shouldPaintSelfBlockBackground(paintPhase)) { | 172 if (shouldPaintSelfBlockBackground(paintPhase)) { |
| 171 if (m_layoutBlock.style()->visibility() == EVisibility::Visible && | 173 if (m_layoutBlock.style()->visibility() == EVisibility::Visible && |
| 172 m_layoutBlock.hasBoxDecorationBackground()) | 174 m_layoutBlock.hasBoxDecorationBackground()) |
| 173 m_layoutBlock.paintBoxDecorationBackground(paintInfo, paintOffset); | 175 m_layoutBlock.paintBoxDecorationBackground(paintInfo, paintOffset); |
| 174 // We're done. We don't bother painting any children. | 176 // We're done. We don't bother painting any children. |
| 175 if (paintPhase == PaintPhaseSelfBlockBackgroundOnly) | 177 if (paintPhase == PaintPhaseSelfBlockBackgroundOnly) |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 LocalFrame* frame = m_layoutBlock.frame(); | 257 LocalFrame* frame = m_layoutBlock.frame(); |
| 256 | 258 |
| 257 if (m_layoutBlock.hasCursorCaret()) | 259 if (m_layoutBlock.hasCursorCaret()) |
| 258 frame->selection().paintCaret(paintInfo.context, paintOffset); | 260 frame->selection().paintCaret(paintInfo.context, paintOffset); |
| 259 | 261 |
| 260 if (m_layoutBlock.hasDragCaret()) | 262 if (m_layoutBlock.hasDragCaret()) |
| 261 frame->page()->dragCaretController().paintDragCaret( | 263 frame->page()->dragCaretController().paintDragCaret( |
| 262 frame, paintInfo.context, paintOffset); | 264 frame, paintInfo.context, paintOffset); |
| 263 } | 265 } |
| 264 | 266 |
| 267 DISABLE_CFI_PERF |
| 265 bool BlockPainter::intersectsPaintRect( | 268 bool BlockPainter::intersectsPaintRect( |
| 266 const PaintInfo& paintInfo, | 269 const PaintInfo& paintInfo, |
| 267 const LayoutPoint& adjustedPaintOffset) const { | 270 const LayoutPoint& adjustedPaintOffset) const { |
| 268 LayoutRect overflowRect; | 271 LayoutRect overflowRect; |
| 269 if (paintInfo.isPrinting() && m_layoutBlock.isAnonymousBlock() && | 272 if (paintInfo.isPrinting() && m_layoutBlock.isAnonymousBlock() && |
| 270 m_layoutBlock.childrenInline()) { | 273 m_layoutBlock.childrenInline()) { |
| 271 // For case <a href="..."><div>...</div></a>, when m_layoutBlock is the | 274 // For case <a href="..."><div>...</div></a>, when m_layoutBlock is the |
| 272 // anonymous container of <a>, the anonymous container's visual overflow is | 275 // anonymous container of <a>, the anonymous container's visual overflow is |
| 273 // empty, but we need to continue painting to output <a>'s PDF URL rect | 276 // empty, but we need to continue painting to output <a>'s PDF URL rect |
| 274 // which covers the continuations, as if we included <a>'s PDF URL rect into | 277 // which covers the continuations, as if we included <a>'s PDF URL rect into |
| (...skipping 24 matching lines...) Expand all Loading... |
| 299 } | 302 } |
| 300 | 303 |
| 301 void BlockPainter::paintContents(const PaintInfo& paintInfo, | 304 void BlockPainter::paintContents(const PaintInfo& paintInfo, |
| 302 const LayoutPoint& paintOffset) { | 305 const LayoutPoint& paintOffset) { |
| 303 DCHECK(!m_layoutBlock.childrenInline()); | 306 DCHECK(!m_layoutBlock.childrenInline()); |
| 304 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); | 307 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); |
| 305 m_layoutBlock.paintChildren(paintInfoForDescendants, paintOffset); | 308 m_layoutBlock.paintChildren(paintInfoForDescendants, paintOffset); |
| 306 } | 309 } |
| 307 | 310 |
| 308 } // namespace blink | 311 } // namespace blink |
| OLD | NEW |