| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 void BlockPainter::paintChild(const LayoutBox& child, const PaintInfo& paintInfo
, const LayoutPoint& paintOffset) | 95 void BlockPainter::paintChild(const LayoutBox& child, const PaintInfo& paintInfo
, const LayoutPoint& paintOffset) |
| 96 { | 96 { |
| 97 LayoutPoint childPoint = m_layoutBlock.flipForWritingModeForChild(&child, pa
intOffset); | 97 LayoutPoint childPoint = m_layoutBlock.flipForWritingModeForChild(&child, pa
intOffset); |
| 98 if (!child.hasSelfPaintingLayer() && !child.isFloating() && !child.isColumnS
panAll()) | 98 if (!child.hasSelfPaintingLayer() && !child.isFloating() && !child.isColumnS
panAll()) |
| 99 child.paint(paintInfo, childPoint); | 99 child.paint(paintInfo, childPoint); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void BlockPainter::paintChildrenOfFlexibleBox(const LayoutFlexibleBox& layoutFle
xibleBox, const PaintInfo& paintInfo, const LayoutPoint& paintOffset) | 102 void BlockPainter::paintChildrenOfFlexibleBox(const LayoutFlexibleBox& layoutFle
xibleBox, const PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
| 103 { | 103 { |
| 104 for (const LayoutBox* child = layoutFlexibleBox.orderIterator().first(); chi
ld; child = layoutFlexibleBox.orderIterator().next()) | 104 for (const LayoutBox* child = layoutFlexibleBox.orderIterator().first(); chi
ld; child = layoutFlexibleBox.orderIterator().next()) |
| 105 BlockPainter(layoutFlexibleBox).paintChildAsPseudoStackingContext(*child
, paintInfo, paintOffset); | 105 BlockPainter(layoutFlexibleBox).paintChildAllPhasesAtomically(*child, pa
intInfo, paintOffset); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void BlockPainter::paintChildAsPseudoStackingContext(const LayoutBox& child, con
st PaintInfo& paintInfo, const LayoutPoint& paintOffset) | 108 void BlockPainter::paintChildAllPhasesAtomically(const LayoutBox& child, const P
aintInfo& paintInfo, const LayoutPoint& paintOffset) |
| 109 { | 109 { |
| 110 LayoutPoint childPoint = m_layoutBlock.flipForWritingModeForChild(&child, pa
intOffset); | 110 LayoutPoint childPoint = m_layoutBlock.flipForWritingModeForChild(&child, pa
intOffset); |
| 111 if (!child.hasSelfPaintingLayer() && !child.isFloating()) | 111 if (!child.hasSelfPaintingLayer() && !child.isFloating()) |
| 112 ObjectPainter(child).paintAsPseudoStackingContext(paintInfo, childPoint)
; | 112 ObjectPainter(child).paintAllPhasesAtomically(paintInfo, childPoint); |
| 113 } | 113 } |
| 114 | 114 |
| 115 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) |
| 116 { | 116 { |
| 117 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection) | 117 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection) |
| 118 return; | 118 return; |
| 119 | 119 |
| 120 // 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 // Text clips are painted only for the direct inline children of the object
that has a text clip style on it, not block children. |
| 121 ASSERT(paintInfo.phase != PaintPhaseTextClip); | 121 ASSERT(paintInfo.phase != PaintPhaseTextClip); |
| 122 | 122 |
| 123 LayoutPoint childPoint = paintOffset; | 123 LayoutPoint childPoint = paintOffset; |
| 124 if (inlineBox.parent()->getLineLayoutItem().style()->isFlippedBlocksWritingM
ode()) // Faster than calling containingBlock(). | 124 if (inlineBox.parent()->getLineLayoutItem().style()->isFlippedBlocksWritingM
ode()) // Faster than calling containingBlock(). |
| 125 childPoint = LineLayoutAPIShim::layoutObjectFrom(inlineBox.getLineLayout
Item())->containingBlock()->flipForWritingModeForChild(toLayoutBox(LineLayoutAPI
Shim::layoutObjectFrom(inlineBox.getLineLayoutItem())), childPoint); | 125 childPoint = LineLayoutAPIShim::layoutObjectFrom(inlineBox.getLineLayout
Item())->containingBlock()->flipForWritingModeForChild(toLayoutBox(LineLayoutAPI
Shim::layoutObjectFrom(inlineBox.getLineLayoutItem())), childPoint); |
| 126 | 126 |
| 127 ObjectPainter(*LineLayoutAPIShim::constLayoutObjectFrom(inlineBox.getLineLay
outItem())).paintAsPseudoStackingContext(paintInfo, childPoint); | 127 ObjectPainter(*LineLayoutAPIShim::constLayoutObjectFrom(inlineBox.getLineLay
outItem())).paintAllPhasesAtomically(paintInfo, childPoint); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void BlockPainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) | 130 void BlockPainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) |
| 131 { | 131 { |
| 132 const PaintPhase paintPhase = paintInfo.phase; | 132 const PaintPhase paintPhase = paintInfo.phase; |
| 133 | 133 |
| 134 if (shouldPaintSelfBlockBackground(paintPhase)) { | 134 if (shouldPaintSelfBlockBackground(paintPhase)) { |
| 135 if (m_layoutBlock.style()->visibility() == VISIBLE && m_layoutBlock.hasB
oxDecorationBackground()) | 135 if (m_layoutBlock.style()->visibility() == VISIBLE && m_layoutBlock.hasB
oxDecorationBackground()) |
| 136 m_layoutBlock.paintBoxDecorationBackground(paintInfo, paintOffset); | 136 m_layoutBlock.paintBoxDecorationBackground(paintInfo, paintOffset); |
| 137 // We're done. We don't bother painting any children. | 137 // We're done. We don't bother painting any children. |
| (...skipping 113 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 |