| 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/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
| 10 #include "core/layout/LayoutBlockFlow.h" | 10 #include "core/layout/LayoutBlockFlow.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 if (m_layoutBlock.hasOverflowClip() | 75 if (m_layoutBlock.hasOverflowClip() |
| 76 && m_layoutBlock.style()->visibility() == VISIBLE | 76 && m_layoutBlock.style()->visibility() == VISIBLE |
| 77 && shouldPaintSelfBlockBackground(paintInfo.phase) | 77 && shouldPaintSelfBlockBackground(paintInfo.phase) |
| 78 && !paintInfo.paintRootBackgroundOnly()) { | 78 && !paintInfo.paintRootBackgroundOnly()) { |
| 79 Optional<ClipRecorder> clipRecorder; | 79 Optional<ClipRecorder> clipRecorder; |
| 80 if (!m_layoutBlock.layer()->isSelfPaintingLayer()) { | 80 if (!m_layoutBlock.layer()->isSelfPaintingLayer()) { |
| 81 LayoutRect clipRect = m_layoutBlock.borderBoxRect(); | 81 LayoutRect clipRect = m_layoutBlock.borderBoxRect(); |
| 82 clipRect.moveBy(paintOffset); | 82 clipRect.moveBy(paintOffset); |
| 83 clipRecorder.emplace(paintInfo.context, m_layoutBlock, DisplayItem::
ClipScrollbarsToBoxBounds, clipRect); | 83 clipRecorder.emplace(paintInfo.context, m_layoutBlock, DisplayItem::
ClipScrollbarsToBoxBounds, clipRect); |
| 84 } | 84 } |
| 85 ScrollableAreaPainter(*m_layoutBlock.layer()->scrollableArea()).paintOve
rflowControls(paintInfo.context, roundedIntPoint(paintOffset), paintInfo.cullRec
t(), false /* paintingOverlayControls */); | 85 ScrollableAreaPainter(*m_layoutBlock.layer()->getScrollableArea()).paint
OverflowControls(paintInfo.context, roundedIntPoint(paintOffset), paintInfo.cull
Rect(), false /* paintingOverlayControls */); |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 void BlockPainter::paintChildren(const PaintInfo& paintInfo, const LayoutPoint&
paintOffset) | 89 void BlockPainter::paintChildren(const PaintInfo& paintInfo, const LayoutPoint&
paintOffset) |
| 90 { | 90 { |
| 91 for (LayoutBox* child = m_layoutBlock.firstChildBox(); child; child = child-
>nextSiblingBox()) | 91 for (LayoutBox* child = m_layoutBlock.firstChildBox(); child; child = child-
>nextSiblingBox()) |
| 92 paintChild(*child, paintInfo, paintOffset); | 92 paintChild(*child, paintInfo, paintOffset); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void BlockPainter::paintChild(const LayoutBox& child, const PaintInfo& paintInfo
, const LayoutPoint& paintOffset) | 95 void BlockPainter::paintChild(const LayoutBox& child, const PaintInfo& paintInfo
, const LayoutPoint& paintOffset) |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 if (paintPhase == PaintPhaseForeground && paintInfo.isPrinting()) | 155 if (paintPhase == PaintPhaseForeground && paintInfo.isPrinting()) |
| 156 ObjectPainter(m_layoutBlock).addPDFURLRectIfNeeded(paintInfo, paintOffse
t); | 156 ObjectPainter(m_layoutBlock).addPDFURLRectIfNeeded(paintInfo, paintOffse
t); |
| 157 | 157 |
| 158 if (paintPhase != PaintPhaseSelfOutlineOnly) { | 158 if (paintPhase != PaintPhaseSelfOutlineOnly) { |
| 159 Optional<ScopedPaintChunkProperties> m_scopedScrollProperty; | 159 Optional<ScopedPaintChunkProperties> m_scopedScrollProperty; |
| 160 Optional<ScrollRecorder> scrollRecorder; | 160 Optional<ScrollRecorder> scrollRecorder; |
| 161 Optional<PaintInfo> scrolledPaintInfo; | 161 Optional<PaintInfo> scrolledPaintInfo; |
| 162 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 162 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 163 const auto* objectProperties = m_layoutBlock.objectPaintProperties()
; | 163 const auto* objectProperties = m_layoutBlock.objectPaintProperties()
; |
| 164 if (auto* scrollTranslation = objectProperties ? objectProperties->s
crollTranslation() : nullptr) { | 164 if (auto* scrollTranslation = objectProperties ? objectProperties->s
crollTranslation() : nullptr) { |
| 165 PaintChunkProperties properties(paintInfo.context.paintControlle
r().currentPaintChunkProperties()); | 165 PaintChunkProperties properties(paintInfo.context.getPaintContro
ller().currentPaintChunkProperties()); |
| 166 properties.transform = scrollTranslation; | 166 properties.transform = scrollTranslation; |
| 167 m_scopedScrollProperty.emplace(paintInfo.context.paintController
(), properties); | 167 m_scopedScrollProperty.emplace(paintInfo.context.getPaintControl
ler(), properties); |
| 168 scrolledPaintInfo.emplace(paintInfo); | 168 scrolledPaintInfo.emplace(paintInfo); |
| 169 scrolledPaintInfo->updateCullRect(scrollTranslation->matrix().to
AffineTransform()); | 169 scrolledPaintInfo->updateCullRect(scrollTranslation->matrix().to
AffineTransform()); |
| 170 } | 170 } |
| 171 } else if (m_layoutBlock.hasOverflowClip()) { | 171 } else if (m_layoutBlock.hasOverflowClip()) { |
| 172 IntSize scrollOffset = m_layoutBlock.scrolledContentOffset(); | 172 IntSize scrollOffset = m_layoutBlock.scrolledContentOffset(); |
| 173 if (m_layoutBlock.layer()->scrollsOverflow() || !scrollOffset.isZero
()) { | 173 if (m_layoutBlock.layer()->scrollsOverflow() || !scrollOffset.isZero
()) { |
| 174 scrollRecorder.emplace(paintInfo.context, m_layoutBlock, paintPh
ase, scrollOffset); | 174 scrollRecorder.emplace(paintInfo.context, m_layoutBlock, paintPh
ase, scrollOffset); |
| 175 scrolledPaintInfo.emplace(paintInfo); | 175 scrolledPaintInfo.emplace(paintInfo); |
| 176 AffineTransform transform; | 176 AffineTransform transform; |
| 177 transform.translate(-scrollOffset.width(), -scrollOffset.height(
)); | 177 transform.translate(-scrollOffset.width(), -scrollOffset.height(
)); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 ObjectPainter(m_layoutBlock).paintInlineChildrenOutlines(paintInfo,
paintOffset); | 251 ObjectPainter(m_layoutBlock).paintInlineChildrenOutlines(paintInfo,
paintOffset); |
| 252 else | 252 else |
| 253 LineBoxListPainter(m_layoutBlock.lineBoxes()).paint(m_layoutBlock, p
aintInfo, paintOffset); | 253 LineBoxListPainter(m_layoutBlock.lineBoxes()).paint(m_layoutBlock, p
aintInfo, paintOffset); |
| 254 } else { | 254 } else { |
| 255 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); | 255 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); |
| 256 m_layoutBlock.paintChildren(paintInfoForDescendants, paintOffset); | 256 m_layoutBlock.paintChildren(paintInfoForDescendants, paintOffset); |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 | 259 |
| 260 } // namespace blink | 260 } // namespace blink |
| OLD | NEW |