OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "core/paint/BlockFlowPainter.h" |
| 7 |
| 8 #include "core/rendering/FloatingObjects.h" |
| 9 #include "core/rendering/PaintInfo.h" |
| 10 #include "core/rendering/RenderBlockFlow.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 void BlockFlowPainter::paintFloats(PaintInfo& paintInfo, const LayoutPoint& pain
tOffset, bool preservePhase) |
| 15 { |
| 16 if (!m_renderBlockFlow.floatingObjects()) |
| 17 return; |
| 18 |
| 19 const FloatingObjectSet& floatingObjectSet = m_renderBlockFlow.floatingObjec
ts()->set(); |
| 20 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 21 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { |
| 22 FloatingObject* floatingObject = it->get(); |
| 23 // Only paint the object if our m_shouldPaint flag is set. |
| 24 if (floatingObject->shouldPaint() && !floatingObject->renderer()->hasSel
fPaintingLayer()) { |
| 25 PaintInfo currentPaintInfo(paintInfo); |
| 26 currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhas
eBlockBackground; |
| 27 // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin wo
uld make this much cleaner. |
| 28 LayoutPoint childPoint = m_renderBlockFlow.flipFloatForWritingModeFo
rChild( |
| 29 floatingObject, LayoutPoint(paintOffset.x() |
| 30 + m_renderBlockFlow.xPositionForFloatIncludingMargin(floatingObj
ect) - floatingObject->renderer()->x(), paintOffset.y() |
| 31 + m_renderBlockFlow.yPositionForFloatIncludingMargin(floatingObj
ect) - floatingObject->renderer()->y())); |
| 32 floatingObject->renderer()->paint(currentPaintInfo, childPoint); |
| 33 if (!preservePhase) { |
| 34 currentPaintInfo.phase = PaintPhaseChildBlockBackgrounds; |
| 35 floatingObject->renderer()->paint(currentPaintInfo, childPoint); |
| 36 currentPaintInfo.phase = PaintPhaseFloat; |
| 37 floatingObject->renderer()->paint(currentPaintInfo, childPoint); |
| 38 currentPaintInfo.phase = PaintPhaseForeground; |
| 39 floatingObject->renderer()->paint(currentPaintInfo, childPoint); |
| 40 currentPaintInfo.phase = PaintPhaseOutline; |
| 41 floatingObject->renderer()->paint(currentPaintInfo, childPoint); |
| 42 } |
| 43 } |
| 44 } |
| 45 } |
| 46 |
| 47 } // namespace blink |
OLD | NEW |