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/LineLayoutBox.h" | 14 #include "core/layout/api/LineLayoutBox.h" |
14 #include "core/page/Page.h" | 15 #include "core/page/Page.h" |
15 #include "core/paint/BoxClipper.h" | 16 #include "core/paint/BoxClipper.h" |
16 #include "core/paint/BoxPainter.h" | 17 #include "core/paint/BoxPainter.h" |
17 #include "core/paint/InlinePainter.h" | 18 #include "core/paint/InlinePainter.h" |
18 #include "core/paint/LayoutObjectDrawingRecorder.h" | 19 #include "core/paint/LayoutObjectDrawingRecorder.h" |
19 #include "core/paint/LineBoxListPainter.h" | 20 #include "core/paint/LineBoxListPainter.h" |
20 #include "core/paint/LineLayoutPaintShim.h" | |
21 #include "core/paint/PaintInfo.h" | 21 #include "core/paint/PaintInfo.h" |
22 #include "core/paint/PaintLayer.h" | 22 #include "core/paint/PaintLayer.h" |
23 #include "core/paint/ScopeRecorder.h" | 23 #include "core/paint/ScopeRecorder.h" |
24 #include "core/paint/ScrollRecorder.h" | 24 #include "core/paint/ScrollRecorder.h" |
25 #include "core/paint/ScrollableAreaPainter.h" | 25 #include "core/paint/ScrollableAreaPainter.h" |
26 #include "platform/graphics/paint/ClipRecorder.h" | 26 #include "platform/graphics/paint/ClipRecorder.h" |
27 #include "wtf/Optional.h" | 27 #include "wtf/Optional.h" |
28 | 28 |
29 namespace blink { | 29 namespace blink { |
30 | 30 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 void BlockPainter::paintInlineBox(const InlineBox& inlineBox, const PaintInfo& p
aintInfo, const LayoutPoint& paintOffset) | 114 void BlockPainter::paintInlineBox(const InlineBox& inlineBox, const PaintInfo& p
aintInfo, const LayoutPoint& paintOffset) |
115 { | 115 { |
116 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection) | 116 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection) |
117 return; | 117 return; |
118 | 118 |
119 // Text clips are painted only for the direct inline children of the object
that has a text clip style on it, not block children. | 119 // Text clips are painted only for the direct inline children of the object
that has a text clip style on it, not block children. |
120 ASSERT(paintInfo.phase != PaintPhaseTextClip); | 120 ASSERT(paintInfo.phase != PaintPhaseTextClip); |
121 | 121 |
122 LayoutPoint childPoint = paintOffset; | 122 LayoutPoint childPoint = paintOffset; |
123 if (inlineBox.parent()->lineLayoutItem().style()->isFlippedBlocksWritingMode
()) // Faster than calling containingBlock(). | 123 if (inlineBox.parent()->lineLayoutItem().style()->isFlippedBlocksWritingMode
()) // Faster than calling containingBlock(). |
124 childPoint = LineLayoutPaintShim::layoutObjectFrom(inlineBox.lineLayoutI
tem())->containingBlock()->flipForWritingModeForChild(&toLayoutBox(inlineBox.lay
outObject()), childPoint); | 124 childPoint = LineLayoutAPIShim::layoutObjectFrom(inlineBox.lineLayoutIte
m())->containingBlock()->flipForWritingModeForChild(&toLayoutBox(inlineBox.layou
tObject()), childPoint); |
125 | 125 |
126 ObjectPainter(*LineLayoutPaintShim::constLayoutObjectFrom(inlineBox.lineLayo
utItem())).paintAsPseudoStackingContext(paintInfo, childPoint); | 126 ObjectPainter(*LineLayoutAPIShim::constLayoutObjectFrom(inlineBox.lineLayout
Item())).paintAsPseudoStackingContext(paintInfo, childPoint); |
127 } | 127 } |
128 | 128 |
129 void BlockPainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) | 129 void BlockPainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) |
130 { | 130 { |
131 if (RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && m_layoutB
lock.childrenInline() && !paintInfo.context.paintController().skippingCache()) { | 131 if (RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && m_layoutB
lock.childrenInline() && !paintInfo.context.paintController().skippingCache()) { |
132 if (m_layoutBlock.paintOffsetChanged(paintOffset)) { | 132 if (m_layoutBlock.paintOffsetChanged(paintOffset)) { |
133 LineBoxListPainter(m_layoutBlock.lineBoxes()).invalidateLineBoxPaint
Offsets(paintInfo); | 133 LineBoxListPainter(m_layoutBlock.lineBoxes()).invalidateLineBoxPaint
Offsets(paintInfo); |
134 paintInfo.context.paintController().invalidatePaintOffset(m_layoutBl
ock); | 134 paintInfo.context.paintController().invalidatePaintOffset(m_layoutBl
ock); |
135 } | 135 } |
136 // Set previousPaintOffset here in case that m_layoutBlock paints nothin
g and no | 136 // Set previousPaintOffset here in case that m_layoutBlock paints nothin
g and no |
(...skipping 114 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 |