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/BlockPainter.h" |
10 #include "core/paint/LayoutObjectDrawingRecorder.h" | 10 #include "core/paint/LineBoxListPainter.h" |
11 #include "core/paint/ObjectPainter.h" | 11 #include "core/paint/ObjectPainter.h" |
12 #include "core/paint/PaintInfo.h" | 12 #include "core/paint/PaintInfo.h" |
13 #include "core/paint/PaintLayer.h" | |
14 | 13 |
15 namespace blink { | 14 namespace blink { |
16 | 15 |
| 16 void BlockFlowPainter::paintContents(const PaintInfo& paintInfo, const LayoutPoi
nt& paintOffset) |
| 17 { |
| 18 // Avoid painting descendants of the root element when stylesheets haven't l
oaded. This eliminates FOUC. |
| 19 // It's ok not to draw, because later on, when all the stylesheets do load,
styleResolverMayHaveChanged() |
| 20 // on Document will trigger a full paint invalidation. |
| 21 if (m_layoutBlockFlow.document().didLayoutWithPendingStylesheets() && !m_lay
outBlockFlow.isLayoutView()) |
| 22 return; |
| 23 |
| 24 if (!m_layoutBlockFlow.childrenInline()) { |
| 25 BlockPainter(m_layoutBlockFlow).paintContents(paintInfo, paintOffset); |
| 26 return; |
| 27 } |
| 28 if (shouldPaintDescendantOutlines(paintInfo.phase)) |
| 29 ObjectPainter(m_layoutBlockFlow).paintInlineChildrenOutlines(paintInfo,
paintOffset); |
| 30 else |
| 31 LineBoxListPainter(m_layoutBlockFlow.lineBoxes()).paint(m_layoutBlockFlo
w, paintInfo, paintOffset); |
| 32 } |
| 33 |
17 void BlockFlowPainter::paintFloats(const PaintInfo& paintInfo, const LayoutPoint
& paintOffset) | 34 void BlockFlowPainter::paintFloats(const PaintInfo& paintInfo, const LayoutPoint
& paintOffset) |
18 { | 35 { |
19 if (!m_layoutBlockFlow.floatingObjects()) | 36 if (!m_layoutBlockFlow.floatingObjects()) |
20 return; | 37 return; |
21 | 38 |
22 ASSERT(paintInfo.phase == PaintPhaseFloat || paintInfo.phase == PaintPhaseSe
lection || paintInfo.phase == PaintPhaseTextClip); | 39 ASSERT(paintInfo.phase == PaintPhaseFloat || paintInfo.phase == PaintPhaseSe
lection || paintInfo.phase == PaintPhaseTextClip); |
23 PaintInfo floatPaintInfo(paintInfo); | 40 PaintInfo floatPaintInfo(paintInfo); |
24 if (paintInfo.phase == PaintPhaseFloat) | 41 if (paintInfo.phase == PaintPhaseFloat) |
25 floatPaintInfo.phase = PaintPhaseForeground; | 42 floatPaintInfo.phase = PaintPhaseForeground; |
26 | 43 |
27 for (const auto& floatingObject : m_layoutBlockFlow.floatingObjects()->set()
) { | 44 for (const auto& floatingObject : m_layoutBlockFlow.floatingObjects()->set()
) { |
28 if (!floatingObject->shouldPaint()) | 45 if (!floatingObject->shouldPaint()) |
29 continue; | 46 continue; |
30 | 47 |
31 const LayoutBox* floatingLayoutObject = floatingObject->layoutObject(); | 48 const LayoutBox* floatingLayoutObject = floatingObject->layoutObject(); |
32 if (floatingLayoutObject->hasSelfPaintingLayer()) | 49 if (floatingLayoutObject->hasSelfPaintingLayer()) |
33 continue; | 50 continue; |
34 | 51 |
35 // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin would
make this much cleaner. | 52 // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin would
make this much cleaner. |
36 LayoutPoint childPoint = m_layoutBlockFlow.flipFloatForWritingModeForChi
ld( | 53 LayoutPoint childPoint = m_layoutBlockFlow.flipFloatForWritingModeForChi
ld( |
37 *floatingObject, LayoutPoint(paintOffset.x() | 54 *floatingObject, LayoutPoint(paintOffset.x() |
38 + m_layoutBlockFlow.xPositionForFloatIncludingMargin(*floatingObject
) - floatingLayoutObject->location().x(), paintOffset.y() | 55 + m_layoutBlockFlow.xPositionForFloatIncludingMargin(*floatingObject
) - floatingLayoutObject->location().x(), paintOffset.y() |
39 + m_layoutBlockFlow.yPositionForFloatIncludingMargin(*floatingObject
) - floatingLayoutObject->location().y())); | 56 + m_layoutBlockFlow.yPositionForFloatIncludingMargin(*floatingObject
) - floatingLayoutObject->location().y())); |
40 ObjectPainter(*floatingLayoutObject).paintAllPhasesAtomically(floatPaint
Info, childPoint); | 57 ObjectPainter(*floatingLayoutObject).paintAllPhasesAtomically(floatPaint
Info, childPoint); |
41 } | 58 } |
42 } | 59 } |
43 | 60 |
44 } // namespace blink | 61 } // namespace blink |
OLD | NEW |