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" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // properly with z-index. We paint after we painted the background/border, so | 71 // properly with z-index. We paint after we painted the background/border, so |
72 // that the scrollbars will sit above the background/border. | 72 // that the scrollbars will sit above the background/border. |
73 localPaintInfo.phase = originalPhase; | 73 localPaintInfo.phase = originalPhase; |
74 paintOverflowControlsIfNeeded(localPaintInfo, adjustedPaintOffset); | 74 paintOverflowControlsIfNeeded(localPaintInfo, adjustedPaintOffset); |
75 } | 75 } |
76 | 76 |
77 void BlockPainter::paintOverflowControlsIfNeeded( | 77 void BlockPainter::paintOverflowControlsIfNeeded( |
78 const PaintInfo& paintInfo, | 78 const PaintInfo& paintInfo, |
79 const LayoutPoint& paintOffset) { | 79 const LayoutPoint& paintOffset) { |
80 if (m_layoutBlock.hasOverflowClip() && | 80 if (m_layoutBlock.hasOverflowClip() && |
81 m_layoutBlock.style()->visibility() == EVisibility::Visible && | 81 m_layoutBlock.style()->visibility() == EVisibility::kVisible && |
82 shouldPaintSelfBlockBackground(paintInfo.phase) && | 82 shouldPaintSelfBlockBackground(paintInfo.phase) && |
83 !paintInfo.paintRootBackgroundOnly()) { | 83 !paintInfo.paintRootBackgroundOnly()) { |
84 Optional<ClipRecorder> clipRecorder; | 84 Optional<ClipRecorder> clipRecorder; |
85 if (!m_layoutBlock.layer()->isSelfPaintingLayer()) { | 85 if (!m_layoutBlock.layer()->isSelfPaintingLayer()) { |
86 LayoutRect clipRect = m_layoutBlock.borderBoxRect(); | 86 LayoutRect clipRect = m_layoutBlock.borderBoxRect(); |
87 clipRect.moveBy(paintOffset); | 87 clipRect.moveBy(paintOffset); |
88 clipRecorder.emplace(paintInfo.context, m_layoutBlock, | 88 clipRecorder.emplace(paintInfo.context, m_layoutBlock, |
89 DisplayItem::kClipScrollbarsToBoxBounds, | 89 DisplayItem::kClipScrollbarsToBoxBounds, |
90 pixelSnappedIntRect(clipRect)); | 90 pixelSnappedIntRect(clipRect)); |
91 } | 91 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 *LineLayoutAPIShim::constLayoutObjectFrom(inlineBox.getLineLayoutItem())) | 163 *LineLayoutAPIShim::constLayoutObjectFrom(inlineBox.getLineLayoutItem())) |
164 .paintAllPhasesAtomically(paintInfo, childPoint); | 164 .paintAllPhasesAtomically(paintInfo, childPoint); |
165 } | 165 } |
166 | 166 |
167 DISABLE_CFI_PERF | 167 DISABLE_CFI_PERF |
168 void BlockPainter::paintObject(const PaintInfo& paintInfo, | 168 void BlockPainter::paintObject(const PaintInfo& paintInfo, |
169 const LayoutPoint& paintOffset) { | 169 const LayoutPoint& paintOffset) { |
170 const PaintPhase paintPhase = paintInfo.phase; | 170 const PaintPhase paintPhase = paintInfo.phase; |
171 | 171 |
172 if (shouldPaintSelfBlockBackground(paintPhase)) { | 172 if (shouldPaintSelfBlockBackground(paintPhase)) { |
173 if (m_layoutBlock.style()->visibility() == EVisibility::Visible && | 173 if (m_layoutBlock.style()->visibility() == EVisibility::kVisible && |
174 m_layoutBlock.hasBoxDecorationBackground()) | 174 m_layoutBlock.hasBoxDecorationBackground()) |
175 m_layoutBlock.paintBoxDecorationBackground(paintInfo, paintOffset); | 175 m_layoutBlock.paintBoxDecorationBackground(paintInfo, paintOffset); |
176 // We're done. We don't bother painting any children. | 176 // We're done. We don't bother painting any children. |
177 if (paintPhase == PaintPhaseSelfBlockBackgroundOnly) | 177 if (paintPhase == PaintPhaseSelfBlockBackgroundOnly) |
178 return; | 178 return; |
179 } | 179 } |
180 | 180 |
181 if (paintInfo.paintRootBackgroundOnly()) | 181 if (paintInfo.paintRootBackgroundOnly()) |
182 return; | 182 return; |
183 | 183 |
184 if (paintPhase == PaintPhaseMask && | 184 if (paintPhase == PaintPhaseMask && |
185 m_layoutBlock.style()->visibility() == EVisibility::Visible) { | 185 m_layoutBlock.style()->visibility() == EVisibility::kVisible) { |
186 m_layoutBlock.paintMask(paintInfo, paintOffset); | 186 m_layoutBlock.paintMask(paintInfo, paintOffset); |
187 return; | 187 return; |
188 } | 188 } |
189 | 189 |
190 if (paintPhase == PaintPhaseClippingMask && | 190 if (paintPhase == PaintPhaseClippingMask && |
191 m_layoutBlock.style()->visibility() == EVisibility::Visible) { | 191 m_layoutBlock.style()->visibility() == EVisibility::kVisible) { |
192 BoxPainter(m_layoutBlock).paintClippingMask(paintInfo, paintOffset); | 192 BoxPainter(m_layoutBlock).paintClippingMask(paintInfo, paintOffset); |
193 return; | 193 return; |
194 } | 194 } |
195 | 195 |
196 if (paintPhase == PaintPhaseForeground && paintInfo.isPrinting()) | 196 if (paintPhase == PaintPhaseForeground && paintInfo.isPrinting()) |
197 ObjectPainter(m_layoutBlock).addPDFURLRectIfNeeded(paintInfo, paintOffset); | 197 ObjectPainter(m_layoutBlock).addPDFURLRectIfNeeded(paintInfo, paintOffset); |
198 | 198 |
199 if (paintPhase != PaintPhaseSelfOutlineOnly) { | 199 if (paintPhase != PaintPhaseSelfOutlineOnly) { |
200 Optional<ScopedPaintChunkProperties> m_scopedScrollProperty; | 200 Optional<ScopedPaintChunkProperties> m_scopedScrollProperty; |
201 Optional<ScrollRecorder> scrollRecorder; | 201 Optional<ScrollRecorder> scrollRecorder; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 } | 302 } |
303 | 303 |
304 void BlockPainter::paintContents(const PaintInfo& paintInfo, | 304 void BlockPainter::paintContents(const PaintInfo& paintInfo, |
305 const LayoutPoint& paintOffset) { | 305 const LayoutPoint& paintOffset) { |
306 DCHECK(!m_layoutBlock.childrenInline()); | 306 DCHECK(!m_layoutBlock.childrenInline()); |
307 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); | 307 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); |
308 m_layoutBlock.paintChildren(paintInfoForDescendants, paintOffset); | 308 m_layoutBlock.paintChildren(paintInfoForDescendants, paintOffset); |
309 } | 309 } |
310 | 310 |
311 } // namespace blink | 311 } // namespace blink |
OLD | NEW |