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/layout/FloatingObjects.h" | 8 #include "core/layout/FloatingObjects.h" |
9 #include "core/layout/Layer.h" | 9 #include "core/layout/Layer.h" |
10 #include "core/layout/LayoutBlockFlow.h" | 10 #include "core/layout/LayoutBlockFlow.h" |
11 #include "core/layout/PaintInfo.h" | 11 #include "core/layout/PaintInfo.h" |
12 #include "core/paint/LayoutObjectDrawingRecorder.h" | 12 #include "core/paint/LayoutObjectDrawingRecorder.h" |
13 #include "platform/graphics/paint/ClipRecorderStack.h" | 13 #include "platform/graphics/paint/ClipRecorderStack.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 void BlockFlowPainter::paintFloats(const PaintInfo& paintInfo, const LayoutPoint
& paintOffset, bool preservePhase) | 17 void BlockFlowPainter::paintFloats(const PaintInfo& paintInfo, const LayoutPoint
& paintOffset, bool preservePhase) |
18 { | 18 { |
19 if (!m_layoutBlockFlow.floatingObjects()) | 19 if (!m_layoutBlockFlow.floatingObjects()) |
20 return; | 20 return; |
21 | 21 |
22 const FloatingObjectSet& floatingObjectSet = m_layoutBlockFlow.floatingObjec
ts()->set(); | 22 const FloatingObjectSet& floatingObjectSet = m_layoutBlockFlow.floatingObjec
ts()->set(); |
23 FloatingObjectSetIterator end = floatingObjectSet.end(); | 23 FloatingObjectSetIterator end = floatingObjectSet.end(); |
24 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { | 24 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { |
25 FloatingObject* floatingObject = it->get(); | 25 FloatingObject& floatingObject = *it->get(); |
26 // Only paint the object if our m_shouldPaint flag is set. | 26 // Only paint the object if our m_shouldPaint flag is set. |
27 if (floatingObject->shouldPaint() && !floatingObject->layoutObject()->ha
sSelfPaintingLayer()) { | 27 if (floatingObject.shouldPaint() && !floatingObject.layoutObject()->hasS
elfPaintingLayer()) { |
28 PaintInfo currentPaintInfo(paintInfo); | 28 PaintInfo currentPaintInfo(paintInfo); |
29 currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhas
eBlockBackground; | 29 currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhas
eBlockBackground; |
30 // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin wo
uld make this much cleaner. | 30 // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin wo
uld make this much cleaner. |
31 LayoutPoint childPoint = m_layoutBlockFlow.flipFloatForWritingModeFo
rChild( | 31 LayoutPoint childPoint = m_layoutBlockFlow.flipFloatForWritingModeFo
rChild( |
32 floatingObject, LayoutPoint(paintOffset.x() | 32 floatingObject, LayoutPoint(paintOffset.x() |
33 + m_layoutBlockFlow.xPositionForFloatIncludingMargin(floatingObj
ect) - floatingObject->layoutObject()->location().x(), paintOffset.y() | 33 + m_layoutBlockFlow.xPositionForFloatIncludingMargin(floatingObj
ect) - floatingObject.layoutObject()->location().x(), paintOffset.y() |
34 + m_layoutBlockFlow.yPositionForFloatIncludingMargin(floatingObj
ect) - floatingObject->layoutObject()->location().y())); | 34 + m_layoutBlockFlow.yPositionForFloatIncludingMargin(floatingObj
ect) - floatingObject.layoutObject()->location().y())); |
35 floatingObject->layoutObject()->paint(currentPaintInfo, childPoint); | 35 floatingObject.layoutObject()->paint(currentPaintInfo, childPoint); |
36 if (!preservePhase) { | 36 if (!preservePhase) { |
37 currentPaintInfo.phase = PaintPhaseChildBlockBackgrounds; | 37 currentPaintInfo.phase = PaintPhaseChildBlockBackgrounds; |
38 floatingObject->layoutObject()->paint(currentPaintInfo, childPoi
nt); | 38 floatingObject.layoutObject()->paint(currentPaintInfo, childPoin
t); |
39 currentPaintInfo.phase = PaintPhaseFloat; | 39 currentPaintInfo.phase = PaintPhaseFloat; |
40 floatingObject->layoutObject()->paint(currentPaintInfo, childPoi
nt); | 40 floatingObject.layoutObject()->paint(currentPaintInfo, childPoin
t); |
41 currentPaintInfo.phase = PaintPhaseForeground; | 41 currentPaintInfo.phase = PaintPhaseForeground; |
42 floatingObject->layoutObject()->paint(currentPaintInfo, childPoi
nt); | 42 floatingObject.layoutObject()->paint(currentPaintInfo, childPoin
t); |
43 currentPaintInfo.phase = PaintPhaseOutline; | 43 currentPaintInfo.phase = PaintPhaseOutline; |
44 floatingObject->layoutObject()->paint(currentPaintInfo, childPoi
nt); | 44 floatingObject.layoutObject()->paint(currentPaintInfo, childPoin
t); |
45 } | 45 } |
46 } | 46 } |
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 void BlockFlowPainter::paintSelection(const PaintInfo& paintInfo, const LayoutPo
int& paintOffset) | 50 void BlockFlowPainter::paintSelection(const PaintInfo& paintInfo, const LayoutPo
int& paintOffset) |
51 { | 51 { |
52 if (m_layoutBlockFlow.shouldPaintSelectionGaps() && paintInfo.phase == Paint
PhaseForeground) { | 52 if (m_layoutBlockFlow.shouldPaintSelectionGaps() && paintInfo.phase == Paint
PhaseForeground) { |
53 LayoutUnit lastTop = 0; | 53 LayoutUnit lastTop = 0; |
54 LayoutUnit lastLeft = m_layoutBlockFlow.logicalLeftSelectionOffset(&m_la
youtBlockFlow, lastTop); | 54 LayoutUnit lastLeft = m_layoutBlockFlow.logicalLeftSelectionOffset(&m_la
youtBlockFlow, lastTop); |
(...skipping 18 matching lines...) Expand all Loading... |
73 gapRectsBounds = LayoutRect(m_layoutBlockFlow.localToContainerQu
ad(FloatRect(localBounds), layer->layoutObject()).enclosingBoundingBox()); | 73 gapRectsBounds = LayoutRect(m_layoutBlockFlow.localToContainerQu
ad(FloatRect(localBounds), layer->layoutObject()).enclosingBoundingBox()); |
74 if (layer->layoutObject()->hasOverflowClip()) | 74 if (layer->layoutObject()->hasOverflowClip()) |
75 gapRectsBounds.move(layer->layoutBox()->scrolledContentOffse
t()); | 75 gapRectsBounds.move(layer->layoutBox()->scrolledContentOffse
t()); |
76 } | 76 } |
77 layer->addBlockSelectionGapsBounds(gapRectsBounds); | 77 layer->addBlockSelectionGapsBounds(gapRectsBounds); |
78 } | 78 } |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 } // namespace blink | 82 } // namespace blink |
OLD | NEW |