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/BlockPainter.h" | 9 #include "core/paint/BlockPainter.h" |
10 #include "core/paint/LineBoxListPainter.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 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 void BlockFlowPainter::paintContents(const PaintInfo& paintInfo, | 16 void BlockFlowPainter::paintContents(const PaintInfo& paintInfo, |
17 const LayoutPoint& paintOffset) { | 17 const LayoutPoint& paintOffset) { |
18 // Avoid painting descendants of the root element when stylesheets haven't loa
ded. This eliminates FOUC. | 18 // Avoid painting descendants of the root element when stylesheets haven't |
19 // It's ok not to draw, because later on, when all the stylesheets do load, st
yleResolverMayHaveChanged() | 19 // loaded. This eliminates FOUC. It's ok not to draw, because later on, when |
20 // on Document will trigger a full paint invalidation. | 20 // all the stylesheets do load, styleResolverMayHaveChanged() on Document will |
| 21 // trigger a full paint invalidation. |
21 if (m_layoutBlockFlow.document().didLayoutWithPendingStylesheets() && | 22 if (m_layoutBlockFlow.document().didLayoutWithPendingStylesheets() && |
22 !m_layoutBlockFlow.isLayoutView()) | 23 !m_layoutBlockFlow.isLayoutView()) |
23 return; | 24 return; |
24 | 25 |
25 if (!m_layoutBlockFlow.childrenInline()) { | 26 if (!m_layoutBlockFlow.childrenInline()) { |
26 BlockPainter(m_layoutBlockFlow).paintContents(paintInfo, paintOffset); | 27 BlockPainter(m_layoutBlockFlow).paintContents(paintInfo, paintOffset); |
27 return; | 28 return; |
28 } | 29 } |
29 if (shouldPaintDescendantOutlines(paintInfo.phase)) | 30 if (shouldPaintDescendantOutlines(paintInfo.phase)) |
30 ObjectPainter(m_layoutBlockFlow) | 31 ObjectPainter(m_layoutBlockFlow) |
(...skipping 14 matching lines...) Expand all Loading... |
45 PaintInfo floatPaintInfo(paintInfo); | 46 PaintInfo floatPaintInfo(paintInfo); |
46 if (paintInfo.phase == PaintPhaseFloat) | 47 if (paintInfo.phase == PaintPhaseFloat) |
47 floatPaintInfo.phase = PaintPhaseForeground; | 48 floatPaintInfo.phase = PaintPhaseForeground; |
48 | 49 |
49 for (const auto& floatingObject : | 50 for (const auto& floatingObject : |
50 m_layoutBlockFlow.floatingObjects()->set()) { | 51 m_layoutBlockFlow.floatingObjects()->set()) { |
51 if (!floatingObject->shouldPaint()) | 52 if (!floatingObject->shouldPaint()) |
52 continue; | 53 continue; |
53 | 54 |
54 const LayoutBox* floatingLayoutObject = floatingObject->layoutObject(); | 55 const LayoutBox* floatingLayoutObject = floatingObject->layoutObject(); |
55 // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin would make
this much cleaner. | 56 // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin would make |
| 57 // this much cleaner. |
56 LayoutPoint childPoint = m_layoutBlockFlow.flipFloatForWritingModeForChild( | 58 LayoutPoint childPoint = m_layoutBlockFlow.flipFloatForWritingModeForChild( |
57 *floatingObject, | 59 *floatingObject, |
58 LayoutPoint(paintOffset.x() + | 60 LayoutPoint(paintOffset.x() + |
59 m_layoutBlockFlow.xPositionForFloatIncludingMargin( | 61 m_layoutBlockFlow.xPositionForFloatIncludingMargin( |
60 *floatingObject) - | 62 *floatingObject) - |
61 floatingLayoutObject->location().x(), | 63 floatingLayoutObject->location().x(), |
62 paintOffset.y() + | 64 paintOffset.y() + |
63 m_layoutBlockFlow.yPositionForFloatIncludingMargin( | 65 m_layoutBlockFlow.yPositionForFloatIncludingMargin( |
64 *floatingObject) - | 66 *floatingObject) - |
65 floatingLayoutObject->location().y())); | 67 floatingLayoutObject->location().y())); |
66 ObjectPainter(*floatingLayoutObject) | 68 ObjectPainter(*floatingLayoutObject) |
67 .paintAllPhasesAtomically(floatPaintInfo, childPoint); | 69 .paintAllPhasesAtomically(floatPaintInfo, childPoint); |
68 } | 70 } |
69 } | 71 } |
70 | 72 |
71 } // namespace blink | 73 } // namespace blink |
OLD | NEW |