| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // sit above the background/border. | 67 // sit above the background/border. |
| 68 localPaintInfo.phase = originalPhase; | 68 localPaintInfo.phase = originalPhase; |
| 69 paintOverflowControlsIfNeeded(localPaintInfo, adjustedPaintOffset); | 69 paintOverflowControlsIfNeeded(localPaintInfo, adjustedPaintOffset); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void BlockPainter::paintOverflowControlsIfNeeded(const PaintInfo& paintInfo, con
st LayoutPoint& paintOffset) | 72 void BlockPainter::paintOverflowControlsIfNeeded(const PaintInfo& paintInfo, con
st LayoutPoint& paintOffset) |
| 73 { | 73 { |
| 74 if (m_layoutBlock.hasOverflowClip() | 74 if (m_layoutBlock.hasOverflowClip() |
| 75 && m_layoutBlock.style()->visibility() == VISIBLE | 75 && m_layoutBlock.style()->visibility() == VISIBLE |
| 76 && shouldPaintSelfBlockBackground(paintInfo.phase) | 76 && shouldPaintSelfBlockBackground(paintInfo.phase) |
| 77 && paintInfo.shouldPaintWithinRoot(&m_layoutBlock) |
| 77 && !paintInfo.paintRootBackgroundOnly()) { | 78 && !paintInfo.paintRootBackgroundOnly()) { |
| 78 Optional<ClipRecorder> clipRecorder; | 79 Optional<ClipRecorder> clipRecorder; |
| 79 if (!m_layoutBlock.layer()->isSelfPaintingLayer()) { | 80 if (!m_layoutBlock.layer()->isSelfPaintingLayer()) { |
| 80 LayoutRect clipRect = m_layoutBlock.borderBoxRect(); | 81 LayoutRect clipRect = m_layoutBlock.borderBoxRect(); |
| 81 clipRect.moveBy(paintOffset); | 82 clipRect.moveBy(paintOffset); |
| 82 clipRecorder.emplace(paintInfo.context, m_layoutBlock, DisplayItem::
ClipScrollbarsToBoxBounds, clipRect); | 83 clipRecorder.emplace(paintInfo.context, m_layoutBlock, DisplayItem::
ClipScrollbarsToBoxBounds, clipRect); |
| 83 } | 84 } |
| 84 ScrollableAreaPainter(*m_layoutBlock.layer()->scrollableArea()).paintOve
rflowControls(paintInfo.context, roundedIntPoint(paintOffset), paintInfo.cullRec
t(), false /* paintingOverlayControls */); | 85 ScrollableAreaPainter(*m_layoutBlock.layer()->scrollableArea()).paintOve
rflowControls(paintInfo.context, roundedIntPoint(paintOffset), paintInfo.cullRec
t(), false /* paintingOverlayControls */); |
| 85 } | 86 } |
| 86 } | 87 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 106 | 107 |
| 107 void BlockPainter::paintChildAsPseudoStackingContext(const LayoutBox& child, con
st PaintInfo& paintInfo, const LayoutPoint& paintOffset) | 108 void BlockPainter::paintChildAsPseudoStackingContext(const LayoutBox& child, con
st PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
| 108 { | 109 { |
| 109 LayoutPoint childPoint = m_layoutBlock.flipForWritingModeForChild(&child, pa
intOffset); | 110 LayoutPoint childPoint = m_layoutBlock.flipForWritingModeForChild(&child, pa
intOffset); |
| 110 if (!child.hasSelfPaintingLayer() && !child.isFloating()) | 111 if (!child.hasSelfPaintingLayer() && !child.isFloating()) |
| 111 ObjectPainter(child).paintAsPseudoStackingContext(paintInfo, childPoint)
; | 112 ObjectPainter(child).paintAsPseudoStackingContext(paintInfo, childPoint)
; |
| 112 } | 113 } |
| 113 | 114 |
| 114 void BlockPainter::paintInlineBox(const InlineBox& inlineBox, const PaintInfo& p
aintInfo, const LayoutPoint& paintOffset) | 115 void BlockPainter::paintInlineBox(const InlineBox& inlineBox, const PaintInfo& p
aintInfo, const LayoutPoint& paintOffset) |
| 115 { | 116 { |
| 116 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection) | 117 if (!paintInfo.shouldPaintWithinRoot(LineLayoutPaintShim::constLayoutObjectF
rom(inlineBox.lineLayoutItem())) || (paintInfo.phase != PaintPhaseForeground &&
paintInfo.phase != PaintPhaseSelection)) |
| 117 return; | 118 return; |
| 118 | 119 |
| 119 LayoutPoint childPoint = paintOffset; | 120 LayoutPoint childPoint = paintOffset; |
| 120 if (inlineBox.parent()->lineLayoutItem().style()->isFlippedBlocksWritingMode
()) // Faster than calling containingBlock(). | 121 if (inlineBox.parent()->lineLayoutItem().style()->isFlippedBlocksWritingMode
()) // Faster than calling containingBlock(). |
| 121 childPoint = LineLayoutPaintShim::layoutObjectFrom(inlineBox.lineLayoutI
tem())->containingBlock()->flipForWritingModeForChild(&toLayoutBox(inlineBox.lay
outObject()), childPoint); | 122 childPoint = LineLayoutPaintShim::layoutObjectFrom(inlineBox.lineLayoutI
tem())->containingBlock()->flipForWritingModeForChild(&toLayoutBox(inlineBox.lay
outObject()), childPoint); |
| 122 | 123 |
| 123 ObjectPainter(*LineLayoutPaintShim::constLayoutObjectFrom(inlineBox.lineLayo
utItem())).paintAsPseudoStackingContext(paintInfo, childPoint); | 124 ObjectPainter(*LineLayoutPaintShim::constLayoutObjectFrom(inlineBox.lineLayo
utItem())).paintAsPseudoStackingContext(paintInfo, childPoint); |
| 124 } | 125 } |
| 125 | 126 |
| 126 void BlockPainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) | 127 void BlockPainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 if (m_layoutBlock.document().didLayoutWithPendingStylesheets() && !m_layoutB
lock.isLayoutView()) | 244 if (m_layoutBlock.document().didLayoutWithPendingStylesheets() && !m_layoutB
lock.isLayoutView()) |
| 244 return; | 245 return; |
| 245 | 246 |
| 246 if (m_layoutBlock.childrenInline()) { | 247 if (m_layoutBlock.childrenInline()) { |
| 247 if (shouldPaintDescendantOutlines(paintInfo.phase)) | 248 if (shouldPaintDescendantOutlines(paintInfo.phase)) |
| 248 ObjectPainter(m_layoutBlock).paintInlineChildrenOutlines(paintInfo,
paintOffset); | 249 ObjectPainter(m_layoutBlock).paintInlineChildrenOutlines(paintInfo,
paintOffset); |
| 249 else | 250 else |
| 250 LineBoxListPainter(m_layoutBlock.lineBoxes()).paint(m_layoutBlock, p
aintInfo, paintOffset); | 251 LineBoxListPainter(m_layoutBlock.lineBoxes()).paint(m_layoutBlock, p
aintInfo, paintOffset); |
| 251 } else { | 252 } else { |
| 252 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); | 253 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); |
| 254 paintInfoForDescendants.updatePaintingRootForChildren(&m_layoutBlock); |
| 253 m_layoutBlock.paintChildren(paintInfoForDescendants, paintOffset); | 255 m_layoutBlock.paintChildren(paintInfoForDescendants, paintOffset); |
| 254 } | 256 } |
| 255 } | 257 } |
| 256 | 258 |
| 257 } // namespace blink | 259 } // namespace blink |
| OLD | NEW |