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 "config.h" | 5 #include "config.h" |
6 #include "core/paint/BlockFlowPainter.h" | 6 #include "core/paint/BlockFlowPainter.h" |
7 | 7 |
8 #include "core/rendering/FloatingObjects.h" | 8 #include "core/rendering/FloatingObjects.h" |
9 #include "core/rendering/PaintInfo.h" | 9 #include "core/rendering/PaintInfo.h" |
10 #include "core/rendering/RenderBlockFlow.h" | 10 #include "core/rendering/RenderBlockFlow.h" |
11 #include "core/rendering/RenderLayer.h" | 11 #include "core/rendering/RenderLayer.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 void BlockFlowPainter::paintFloats(const PaintInfo& paintInfo, const LayoutPoint
& paintOffset, bool preservePhase) | 15 void BlockFlowPainter::paintFloats(const PaintInfo& paintInfo, const LayoutPoint
& paintOffset, bool preservePhase) |
16 { | 16 { |
17 if (!m_renderBlockFlow.floatingObjects()) | 17 if (!m_renderBlockFlow.floatingObjects()) |
18 return; | 18 return; |
19 | 19 |
20 const FloatingObjectSet& floatingObjectSet = m_renderBlockFlow.floatingObjec
ts()->set(); | 20 const FloatingObjectSet& floatingObjectSet = m_renderBlockFlow.floatingObjec
ts()->set(); |
21 FloatingObjectSetIterator end = floatingObjectSet.end(); | 21 FloatingObjectSetIterator end = floatingObjectSet.end(); |
22 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { | 22 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { |
23 FloatingObject* floatingObject = it->get(); | 23 FloatingObject* floatingObject = it->get(); |
24 // Only paint the object if our m_shouldPaint flag is set. | 24 // Only paint the object if our m_shouldPaint flag is set. |
25 if (floatingObject->shouldPaint() && !floatingObject->renderer()->hasSel
fPaintingLayer()) { | 25 if (floatingObject->shouldPaint() && !floatingObject->renderer()->hasSel
fPaintingLayer()) { |
26 PaintInfo currentPaintInfo(paintInfo); | 26 PaintInfo currentPaintInfo(paintInfo); |
27 currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhas
eBlockBackground; | 27 currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhas
eBlockBackground; |
28 // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin wo
uld make this much cleaner. | 28 // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin wo
uld make this much cleaner. |
29 LayoutPoint childPoint = m_renderBlockFlow.flipFloatForWritingModeFo
rChild( | 29 LayoutPoint childPoint = m_renderBlockFlow.flipFloatForWritingModeFo
rChild( |
30 floatingObject, LayoutPoint(paintOffset.x() | 30 *floatingObject, LayoutPoint(paintOffset.x() |
31 + m_renderBlockFlow.xPositionForFloatIncludingMargin(floatingObj
ect) - floatingObject->renderer()->x(), paintOffset.y() | 31 + m_renderBlockFlow.xPositionForFloatIncludingMargin(*floatingOb
ject) - floatingObject->renderer()->x(), paintOffset.y() |
32 + m_renderBlockFlow.yPositionForFloatIncludingMargin(floatingObj
ect) - floatingObject->renderer()->y())); | 32 + m_renderBlockFlow.yPositionForFloatIncludingMargin(*floatingOb
ject) - floatingObject->renderer()->y())); |
33 floatingObject->renderer()->paint(currentPaintInfo, childPoint); | 33 floatingObject->renderer()->paint(currentPaintInfo, childPoint); |
34 if (!preservePhase) { | 34 if (!preservePhase) { |
35 currentPaintInfo.phase = PaintPhaseChildBlockBackgrounds; | 35 currentPaintInfo.phase = PaintPhaseChildBlockBackgrounds; |
36 floatingObject->renderer()->paint(currentPaintInfo, childPoint); | 36 floatingObject->renderer()->paint(currentPaintInfo, childPoint); |
37 currentPaintInfo.phase = PaintPhaseFloat; | 37 currentPaintInfo.phase = PaintPhaseFloat; |
38 floatingObject->renderer()->paint(currentPaintInfo, childPoint); | 38 floatingObject->renderer()->paint(currentPaintInfo, childPoint); |
39 currentPaintInfo.phase = PaintPhaseForeground; | 39 currentPaintInfo.phase = PaintPhaseForeground; |
40 floatingObject->renderer()->paint(currentPaintInfo, childPoint); | 40 floatingObject->renderer()->paint(currentPaintInfo, childPoint); |
41 currentPaintInfo.phase = PaintPhaseOutline; | 41 currentPaintInfo.phase = PaintPhaseOutline; |
42 floatingObject->renderer()->paint(currentPaintInfo, childPoint); | 42 floatingObject->renderer()->paint(currentPaintInfo, childPoint); |
(...skipping 20 matching lines...) Expand all Loading... |
63 gapRectsBounds = m_renderBlockFlow.localToContainerQuad(FloatRec
t(localBounds), layer->renderer()).enclosingBoundingBox(); | 63 gapRectsBounds = m_renderBlockFlow.localToContainerQuad(FloatRec
t(localBounds), layer->renderer()).enclosingBoundingBox(); |
64 if (layer->renderer()->hasOverflowClip()) | 64 if (layer->renderer()->hasOverflowClip()) |
65 gapRectsBounds.move(layer->renderBox()->scrolledContentOffse
t()); | 65 gapRectsBounds.move(layer->renderBox()->scrolledContentOffse
t()); |
66 } | 66 } |
67 layer->addBlockSelectionGapsBounds(gapRectsBounds); | 67 layer->addBlockSelectionGapsBounds(gapRectsBounds); |
68 } | 68 } |
69 } | 69 } |
70 } | 70 } |
71 | 71 |
72 } // namespace blink | 72 } // namespace blink |
OLD | NEW |