| 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/BlockFlowPainter.h" | 5 #include "core/paint/BlockFlowPainter.h" |
| 6 | 6 |
| 7 #include "core/layout/FloatingObjects.h" | 7 #include "core/layout/FloatingObjects.h" |
| 8 #include "core/layout/LayoutBlockFlow.h" | 8 #include "core/layout/LayoutBlockFlow.h" |
| 9 #include "core/paint/ClipScope.h" | 9 #include "core/paint/ClipScope.h" |
| 10 #include "core/paint/LayoutObjectDrawingRecorder.h" | 10 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 11 #include "core/paint/ObjectPainter.h" | |
| 12 #include "core/paint/PaintInfo.h" | 11 #include "core/paint/PaintInfo.h" |
| 13 #include "core/paint/PaintLayer.h" | 12 #include "core/paint/PaintLayer.h" |
| 14 | 13 |
| 15 namespace blink { | 14 namespace blink { |
| 16 | 15 |
| 17 void BlockFlowPainter::paintFloats(const PaintInfo& paintInfo, const LayoutPoint
& paintOffset) | 16 void BlockFlowPainter::paintFloats(const PaintInfo& paintInfo, const LayoutPoint
& paintOffset, bool preservePhase) |
| 18 { | 17 { |
| 19 if (!m_layoutBlockFlow.floatingObjects()) | 18 if (!m_layoutBlockFlow.floatingObjects()) |
| 20 return; | 19 return; |
| 21 | 20 |
| 22 ASSERT(paintInfo.phase == PaintPhaseFloat); | 21 const FloatingObjectSet& floatingObjectSet = m_layoutBlockFlow.floatingObjec
ts()->set(); |
| 23 PaintInfo floatPaintInfo(paintInfo); | 22 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 24 floatPaintInfo.phase = PaintPhaseForeground; | 23 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { |
| 25 | 24 const FloatingObject& floatingObject = *it->get(); |
| 26 for (const auto& floatingObject : m_layoutBlockFlow.floatingObjects()->set()
) { | 25 // Only paint the object if our m_shouldPaint flag is set. |
| 27 if (!floatingObject->shouldPaint()) | 26 if (floatingObject.shouldPaint() && !floatingObject.layoutObject()->hasS
elfPaintingLayer()) { |
| 28 continue; | 27 PaintInfo currentPaintInfo(paintInfo); |
| 29 | 28 currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhas
eBlockBackground; |
| 30 const LayoutBox* floatingLayoutObject = floatingObject->layoutObject(); | 29 // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin wo
uld make this much cleaner. |
| 31 if (floatingLayoutObject->hasSelfPaintingLayer()) | 30 LayoutPoint childPoint = m_layoutBlockFlow.flipFloatForWritingModeFo
rChild( |
| 32 continue; | 31 floatingObject, LayoutPoint(paintOffset.x() |
| 33 | 32 + m_layoutBlockFlow.xPositionForFloatIncludingMargin(floatingObj
ect) - floatingObject.layoutObject()->location().x(), paintOffset.y() |
| 34 // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin would
make this much cleaner. | 33 + m_layoutBlockFlow.yPositionForFloatIncludingMargin(floatingObj
ect) - floatingObject.layoutObject()->location().y())); |
| 35 LayoutPoint childPoint = m_layoutBlockFlow.flipFloatForWritingModeForChi
ld( | 34 floatingObject.layoutObject()->paint(currentPaintInfo, childPoint); |
| 36 *floatingObject, LayoutPoint(paintOffset.x() | 35 if (!preservePhase) { |
| 37 + m_layoutBlockFlow.xPositionForFloatIncludingMargin(*floatingObject
) - floatingLayoutObject->location().x(), paintOffset.y() | 36 currentPaintInfo.phase = PaintPhaseChildBlockBackgrounds; |
| 38 + m_layoutBlockFlow.yPositionForFloatIncludingMargin(*floatingObject
) - floatingLayoutObject->location().y())); | 37 floatingObject.layoutObject()->paint(currentPaintInfo, childPoin
t); |
| 39 ObjectPainter(*floatingLayoutObject).paintAsPseudoStackingContext(floatP
aintInfo, childPoint); | 38 currentPaintInfo.phase = PaintPhaseFloat; |
| 39 floatingObject.layoutObject()->paint(currentPaintInfo, childPoin
t); |
| 40 currentPaintInfo.phase = PaintPhaseForeground; |
| 41 floatingObject.layoutObject()->paint(currentPaintInfo, childPoin
t); |
| 42 currentPaintInfo.phase = PaintPhaseOutline; |
| 43 floatingObject.layoutObject()->paint(currentPaintInfo, childPoin
t); |
| 44 } |
| 45 } |
| 40 } | 46 } |
| 41 } | 47 } |
| 42 | 48 |
| 43 void BlockFlowPainter::paintSelection(const PaintInfo& paintInfo, const LayoutPo
int& paintOffset) | 49 void BlockFlowPainter::paintSelection(const PaintInfo& paintInfo, const LayoutPo
int& paintOffset) |
| 44 { | 50 { |
| 45 ASSERT(paintInfo.phase == PaintPhaseForeground); | 51 ASSERT(paintInfo.phase == PaintPhaseForeground); |
| 46 if (!m_layoutBlockFlow.shouldPaintSelectionGaps()) | 52 if (!m_layoutBlockFlow.shouldPaintSelectionGaps()) |
| 47 return; | 53 return; |
| 48 | 54 |
| 49 LayoutUnit lastTop = 0; | 55 LayoutUnit lastTop = 0; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 75 m_layoutBlockFlow.flipForWritingMode(localBounds); | 81 m_layoutBlockFlow.flipForWritingMode(localBounds); |
| 76 gapRectsBounds = LayoutRect(m_layoutBlockFlow.localToAncestorQuad(Fl
oatRect(localBounds), layer->layoutObject()).enclosingBoundingBox()); | 82 gapRectsBounds = LayoutRect(m_layoutBlockFlow.localToAncestorQuad(Fl
oatRect(localBounds), layer->layoutObject()).enclosingBoundingBox()); |
| 77 if (layer->layoutObject()->hasOverflowClip()) | 83 if (layer->layoutObject()->hasOverflowClip()) |
| 78 gapRectsBounds.move(layer->layoutBox()->scrolledContentOffset())
; | 84 gapRectsBounds.move(layer->layoutBox()->scrolledContentOffset())
; |
| 79 } | 85 } |
| 80 layer->addBlockSelectionGapsBounds(gapRectsBounds); | 86 layer->addBlockSelectionGapsBounds(gapRectsBounds); |
| 81 } | 87 } |
| 82 } | 88 } |
| 83 | 89 |
| 84 } // namespace blink | 90 } // namespace blink |
| OLD | NEW |