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" |
11 #include "core/layout/LayoutFlexibleBox.h" | 11 #include "core/layout/LayoutFlexibleBox.h" |
12 #include "core/layout/LayoutInline.h" | 12 #include "core/layout/LayoutInline.h" |
13 #include "core/layout/api/LineLayoutAPIShim.h" | 13 #include "core/layout/api/LineLayoutAPIShim.h" |
14 #include "core/layout/api/LineLayoutBox.h" | 14 #include "core/layout/api/LineLayoutBox.h" |
15 #include "core/page/Page.h" | 15 #include "core/page/Page.h" |
16 #include "core/paint/BoxClipper.h" | 16 #include "core/paint/BoxClipper.h" |
17 #include "core/paint/BoxPainter.h" | 17 #include "core/paint/BoxPainter.h" |
18 #include "core/paint/InlinePainter.h" | 18 #include "core/paint/InlinePainter.h" |
19 #include "core/paint/LayoutObjectDrawingRecorder.h" | 19 #include "core/paint/LayoutObjectDrawingRecorder.h" |
20 #include "core/paint/LineBoxListPainter.h" | 20 #include "core/paint/LineBoxListPainter.h" |
| 21 #include "core/paint/ObjectPaintProperties.h" |
21 #include "core/paint/PaintInfo.h" | 22 #include "core/paint/PaintInfo.h" |
22 #include "core/paint/PaintLayer.h" | 23 #include "core/paint/PaintLayer.h" |
23 #include "core/paint/ScopeRecorder.h" | 24 #include "core/paint/ScopeRecorder.h" |
24 #include "core/paint/ScrollRecorder.h" | 25 #include "core/paint/ScrollRecorder.h" |
25 #include "core/paint/ScrollableAreaPainter.h" | 26 #include "core/paint/ScrollableAreaPainter.h" |
26 #include "platform/graphics/paint/ClipRecorder.h" | 27 #include "platform/graphics/paint/ClipRecorder.h" |
27 #include "wtf/Optional.h" | 28 #include "wtf/Optional.h" |
28 | 29 |
29 namespace blink { | 30 namespace blink { |
30 | 31 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 149 |
149 if (paintPhase == PaintPhaseClippingMask && m_layoutBlock.style()->visibilit
y() == VISIBLE) { | 150 if (paintPhase == PaintPhaseClippingMask && m_layoutBlock.style()->visibilit
y() == VISIBLE) { |
150 BoxPainter(m_layoutBlock).paintClippingMask(paintInfo, paintOffset); | 151 BoxPainter(m_layoutBlock).paintClippingMask(paintInfo, paintOffset); |
151 return; | 152 return; |
152 } | 153 } |
153 | 154 |
154 if (paintPhase == PaintPhaseForeground && paintInfo.isPrinting()) | 155 if (paintPhase == PaintPhaseForeground && paintInfo.isPrinting()) |
155 ObjectPainter(m_layoutBlock).addPDFURLRectIfNeeded(paintInfo, paintOffse
t); | 156 ObjectPainter(m_layoutBlock).addPDFURLRectIfNeeded(paintInfo, paintOffse
t); |
156 | 157 |
157 if (paintPhase != PaintPhaseSelfOutlineOnly) { | 158 if (paintPhase != PaintPhaseSelfOutlineOnly) { |
| 159 Optional<ScopedPaintChunkProperties> m_scopedScrollProperty; |
158 Optional<ScrollRecorder> scrollRecorder; | 160 Optional<ScrollRecorder> scrollRecorder; |
159 Optional<PaintInfo> scrolledPaintInfo; | 161 Optional<PaintInfo> scrolledPaintInfo; |
160 if (m_layoutBlock.hasOverflowClip()) { | 162 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 163 const auto* objectProperties = m_layoutBlock.objectPaintProperties()
; |
| 164 if (auto* scrollTranslation = objectProperties ? objectProperties->s
crollTranslation() : nullptr) { |
| 165 PaintChunkProperties properties(paintInfo.context.paintControlle
r().currentPaintChunkProperties()); |
| 166 properties.transform = scrollTranslation; |
| 167 m_scopedScrollProperty.emplace(paintInfo.context.paintController
(), properties); |
| 168 scrolledPaintInfo.emplace(paintInfo); |
| 169 scrolledPaintInfo->updateCullRect(scrollTranslation->matrix().to
AffineTransform()); |
| 170 } |
| 171 } else if (m_layoutBlock.hasOverflowClip()) { |
161 IntSize scrollOffset = m_layoutBlock.scrolledContentOffset(); | 172 IntSize scrollOffset = m_layoutBlock.scrolledContentOffset(); |
162 if (m_layoutBlock.layer()->scrollsOverflow() || !scrollOffset.isZero
()) { | 173 if (m_layoutBlock.layer()->scrollsOverflow() || !scrollOffset.isZero
()) { |
163 scrollRecorder.emplace(paintInfo.context, m_layoutBlock, paintPh
ase, scrollOffset); | 174 scrollRecorder.emplace(paintInfo.context, m_layoutBlock, paintPh
ase, scrollOffset); |
164 scrolledPaintInfo.emplace(paintInfo); | 175 scrolledPaintInfo.emplace(paintInfo); |
165 AffineTransform transform; | 176 AffineTransform transform; |
166 transform.translate(-scrollOffset.width(), -scrollOffset.height(
)); | 177 transform.translate(-scrollOffset.width(), -scrollOffset.height(
)); |
167 scrolledPaintInfo->updateCullRect(transform); | 178 scrolledPaintInfo->updateCullRect(transform); |
168 } | 179 } |
169 } | 180 } |
170 | 181 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 ObjectPainter(m_layoutBlock).paintInlineChildrenOutlines(paintInfo,
paintOffset); | 251 ObjectPainter(m_layoutBlock).paintInlineChildrenOutlines(paintInfo,
paintOffset); |
241 else | 252 else |
242 LineBoxListPainter(m_layoutBlock.lineBoxes()).paint(m_layoutBlock, p
aintInfo, paintOffset); | 253 LineBoxListPainter(m_layoutBlock.lineBoxes()).paint(m_layoutBlock, p
aintInfo, paintOffset); |
243 } else { | 254 } else { |
244 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); | 255 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); |
245 m_layoutBlock.paintChildren(paintInfoForDescendants, paintOffset); | 256 m_layoutBlock.paintChildren(paintInfoForDescendants, paintOffset); |
246 } | 257 } |
247 } | 258 } |
248 | 259 |
249 } // namespace blink | 260 } // namespace blink |
OLD | NEW |