| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 = LineLayoutAPIShim::layoutObjectFrom(inlineBox.lineLayoutIte
m())->containingBlock()->flipForWritingModeForChild(toLayoutBox(LineLayoutAPIShi
m::layoutObjectFrom(inlineBox.lineLayoutItem())), childPoint); | 124 childPoint = LineLayoutAPIShim::layoutObjectFrom(inlineBox.lineLayoutIte
m())->containingBlock()->flipForWritingModeForChild(toLayoutBox(LineLayoutAPIShi
m::layoutObjectFrom(inlineBox.lineLayoutItem())), childPoint); |
| 125 | 125 |
| 126 ObjectPainter(*LineLayoutAPIShim::constLayoutObjectFrom(inlineBox.lineLayout
Item())).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()) { | |
| 132 if (m_layoutBlock.paintOffsetChanged(paintOffset)) { | |
| 133 LineBoxListPainter(m_layoutBlock.lineBoxes()).invalidateLineBoxPaint
Offsets(paintInfo); | |
| 134 paintInfo.context.paintController().invalidatePaintOffset(m_layoutBl
ock); | |
| 135 } | |
| 136 // Set previousPaintOffset here in case that m_layoutBlock paints nothin
g and no | |
| 137 // LayoutObjectDrawingRecorder updates its previousPaintOffset. | |
| 138 // TODO(wangxianzhu): Integrate paint offset checking into new paint inv
alidation. | |
| 139 m_layoutBlock.mutableForPainting().setPreviousPaintOffset(paintOffset); | |
| 140 } | |
| 141 | |
| 142 const PaintPhase paintPhase = paintInfo.phase; | 131 const PaintPhase paintPhase = paintInfo.phase; |
| 143 | 132 |
| 144 if (shouldPaintSelfBlockBackground(paintPhase)) { | 133 if (shouldPaintSelfBlockBackground(paintPhase)) { |
| 145 if (m_layoutBlock.style()->visibility() == VISIBLE && m_layoutBlock.hasB
oxDecorationBackground()) | 134 if (m_layoutBlock.style()->visibility() == VISIBLE && m_layoutBlock.hasB
oxDecorationBackground()) |
| 146 m_layoutBlock.paintBoxDecorationBackground(paintInfo, paintOffset); | 135 m_layoutBlock.paintBoxDecorationBackground(paintInfo, paintOffset); |
| 147 // We're done. We don't bother painting any children. | 136 // We're done. We don't bother painting any children. |
| 148 if (paintPhase == PaintPhaseSelfBlockBackgroundOnly) | 137 if (paintPhase == PaintPhaseSelfBlockBackgroundOnly) |
| 149 return; | 138 return; |
| 150 } | 139 } |
| 151 | 140 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 177 |
| 189 if (paintPhase == PaintPhaseFloat || paintPhase == PaintPhaseSelection |
| paintPhase == PaintPhaseTextClip) | 178 if (paintPhase == PaintPhaseFloat || paintPhase == PaintPhaseSelection |
| paintPhase == PaintPhaseTextClip) |
| 190 m_layoutBlock.paintFloats(contentsPaintInfo, paintOffset); | 179 m_layoutBlock.paintFloats(contentsPaintInfo, paintOffset); |
| 191 } | 180 } |
| 192 | 181 |
| 193 if (shouldPaintSelfOutline(paintPhase)) | 182 if (shouldPaintSelfOutline(paintPhase)) |
| 194 ObjectPainter(m_layoutBlock).paintOutline(paintInfo, paintOffset); | 183 ObjectPainter(m_layoutBlock).paintOutline(paintInfo, paintOffset); |
| 195 | 184 |
| 196 // If the caret's node's layout object's containing block is this block, and
the paint action is PaintPhaseForeground, | 185 // If the caret's node's layout object's containing block is this block, and
the paint action is PaintPhaseForeground, |
| 197 // then paint the caret. | 186 // then paint the caret. |
| 198 if (paintPhase == PaintPhaseForeground && m_layoutBlock.hasCaret() && !Layou
tObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_layoutBl
ock, DisplayItem::Caret, paintOffset)) { | 187 if (paintPhase == PaintPhaseForeground && m_layoutBlock.hasCaret() && !Layou
tObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_layoutBl
ock, DisplayItem::Caret)) { |
| 199 LayoutRect bounds = m_layoutBlock.visualOverflowRect(); | 188 LayoutRect bounds = m_layoutBlock.visualOverflowRect(); |
| 200 bounds.moveBy(paintOffset); | 189 bounds.moveBy(paintOffset); |
| 201 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutBlock, D
isplayItem::Caret, bounds, paintOffset); | 190 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutBlock, D
isplayItem::Caret, bounds, paintOffset); |
| 202 paintCarets(paintInfo, paintOffset); | 191 paintCarets(paintInfo, paintOffset); |
| 203 } | 192 } |
| 204 } | 193 } |
| 205 | 194 |
| 206 void BlockPainter::paintCarets(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) | 195 void BlockPainter::paintCarets(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) |
| 207 { | 196 { |
| 208 LocalFrame* frame = m_layoutBlock.frame(); | 197 LocalFrame* frame = m_layoutBlock.frame(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 ObjectPainter(m_layoutBlock).paintInlineChildrenOutlines(paintInfo,
paintOffset); | 240 ObjectPainter(m_layoutBlock).paintInlineChildrenOutlines(paintInfo,
paintOffset); |
| 252 else | 241 else |
| 253 LineBoxListPainter(m_layoutBlock.lineBoxes()).paint(m_layoutBlock, p
aintInfo, paintOffset); | 242 LineBoxListPainter(m_layoutBlock.lineBoxes()).paint(m_layoutBlock, p
aintInfo, paintOffset); |
| 254 } else { | 243 } else { |
| 255 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); | 244 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); |
| 256 m_layoutBlock.paintChildren(paintInfoForDescendants, paintOffset); | 245 m_layoutBlock.paintChildren(paintInfoForDescendants, paintOffset); |
| 257 } | 246 } |
| 258 } | 247 } |
| 259 | 248 |
| 260 } // namespace blink | 249 } // namespace blink |
| OLD | NEW |