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