OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 27 matching lines...) Expand all Loading... |
38 * deletingthe provisions above and replace them with the notice and | 38 * deletingthe provisions above and replace them with the notice and |
39 * other provisions required by the MPL or the GPL, as the case may be. | 39 * other provisions required by the MPL or the GPL, as the case may be. |
40 * If you do not delete the provisions above, a recipient may use your | 40 * If you do not delete the provisions above, a recipient may use your |
41 * version of this file under any of the LGPL, the MPL or the GPL. | 41 * version of this file under any of the LGPL, the MPL or the GPL. |
42 */ | 42 */ |
43 | 43 |
44 #include "config.h" | 44 #include "config.h" |
45 #include "core/rendering/RenderLayerRepainter.h" | 45 #include "core/rendering/RenderLayerRepainter.h" |
46 | 46 |
47 #include "core/rendering/FilterEffectRenderer.h" | 47 #include "core/rendering/FilterEffectRenderer.h" |
| 48 #include "core/rendering/LayoutRectRecorder.h" |
48 #include "core/rendering/RenderLayer.h" | 49 #include "core/rendering/RenderLayer.h" |
49 #include "core/rendering/RenderView.h" | 50 #include "core/rendering/RenderView.h" |
50 #include "core/rendering/compositing/CompositedLayerMapping.h" | 51 #include "core/rendering/compositing/CompositedLayerMapping.h" |
51 | 52 |
52 namespace WebCore { | 53 namespace WebCore { |
53 | 54 |
54 RenderLayerRepainter::RenderLayerRepainter(RenderLayerModelObject* renderer) | 55 RenderLayerRepainter::RenderLayerRepainter(RenderLayerModelObject* renderer) |
55 : m_renderer(renderer) | 56 : m_renderer(renderer) |
56 , m_repaintStatus(NeedsNormalRepaint) | 57 , m_repaintStatus(NeedsNormalRepaint) |
57 { | 58 { |
58 } | 59 } |
59 | 60 |
60 void RenderLayerRepainter::repaintAfterLayout(RenderGeometryMap* geometryMap, bo
ol shouldCheckForRepaint) | 61 void RenderLayerRepainter::repaintAfterLayout(RenderGeometryMap* geometryMap, bo
ol shouldCheckForRepaint) |
61 { | 62 { |
| 63 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) |
| 64 return; |
| 65 |
62 // FIXME: really, we're in the repaint phase here, and the following queries
are legal. | 66 // FIXME: really, we're in the repaint phase here, and the following queries
are legal. |
63 // Until those states are fully fledged, I'll just disable the ASSERTS. | 67 // Until those states are fully fledged, I'll just disable the ASSERTS. |
64 DisableCompositingQueryAsserts disabler; | 68 DisableCompositingQueryAsserts disabler; |
65 if (m_renderer->layer()->hasVisibleContent()) { | 69 if (m_renderer->layer()->hasVisibleContent()) { |
66 RenderView* view = m_renderer->view(); | 70 RenderView* view = m_renderer->view(); |
67 ASSERT(view); | 71 ASSERT(view); |
68 // FIXME: LayoutState does not work with RenderLayers as there is not a
1-to-1 | 72 // FIXME: LayoutState does not work with RenderLayers as there is not a
1-to-1 |
69 // mapping between them and the RenderObjects. It would be neat to enabl
e | 73 // mapping between them and the RenderObjects. It would be neat to enabl
e |
70 // LayoutState outside the layout() phase and use it here. | 74 // LayoutState outside the layout() phase and use it here. |
71 ASSERT(!view->layoutStateEnabled()); | 75 ASSERT(!view->layoutStateEnabled()); |
(...skipping 28 matching lines...) Expand all Loading... |
100 void RenderLayerRepainter::clearRepaintRects() | 104 void RenderLayerRepainter::clearRepaintRects() |
101 { | 105 { |
102 ASSERT(!m_renderer->layer()->hasVisibleContent()); | 106 ASSERT(!m_renderer->layer()->hasVisibleContent()); |
103 | 107 |
104 m_repaintRect = IntRect(); | 108 m_repaintRect = IntRect(); |
105 m_outlineBox = IntRect(); | 109 m_outlineBox = IntRect(); |
106 } | 110 } |
107 | 111 |
108 void RenderLayerRepainter::computeRepaintRects(const RenderLayerModelObject* rep
aintContainer, const RenderGeometryMap* geometryMap) | 112 void RenderLayerRepainter::computeRepaintRects(const RenderLayerModelObject* rep
aintContainer, const RenderGeometryMap* geometryMap) |
109 { | 113 { |
| 114 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) |
| 115 return; |
| 116 |
110 m_repaintRect = m_renderer->clippedOverflowRectForRepaint(repaintContainer); | 117 m_repaintRect = m_renderer->clippedOverflowRectForRepaint(repaintContainer); |
111 m_outlineBox = m_renderer->outlineBoundsForRepaint(repaintContainer, geometr
yMap); | 118 m_outlineBox = m_renderer->outlineBoundsForRepaint(repaintContainer, geometr
yMap); |
112 } | 119 } |
113 | 120 |
114 void RenderLayerRepainter::computeRepaintRectsIncludingDescendants() | 121 void RenderLayerRepainter::computeRepaintRectsIncludingDescendants() |
115 { | 122 { |
116 // FIXME: computeRepaintRects() has to walk up the parent chain for every la
yer to compute the rects. | 123 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { |
117 // We should make this more efficient. | 124 // FIXME: We want RenderLayerRepainter to go away when |
118 // FIXME: it's wrong to call this when layout is not up-to-date, which we do
. | 125 // repaint-after-layout is on by default so we need to figure out how to |
119 computeRepaintRects(m_renderer->containerForRepaint()); | 126 // handle this update. |
| 127 // |
| 128 // This is a little silly as we create and immediately destroy the RAII |
| 129 // object but it makes sure we correctly set all of the repaint flags. |
| 130 LayoutRectRecorder recorder(*m_renderer); |
| 131 |
| 132 } else { |
| 133 // FIXME: computeRepaintRects() has to walk up the parent chain for ever
y layer to compute the rects. |
| 134 // We should make this more efficient. |
| 135 // FIXME: it's wrong to call this when layout is not up-to-date, which w
e do. |
| 136 computeRepaintRects(m_renderer->containerForRepaint()); |
| 137 } |
120 | 138 |
121 for (RenderLayer* layer = m_renderer->layer()->firstChild(); layer; layer =
layer->nextSibling()) | 139 for (RenderLayer* layer = m_renderer->layer()->firstChild(); layer; layer =
layer->nextSibling()) |
122 layer->repainter().computeRepaintRectsIncludingDescendants(); | 140 layer->repainter().computeRepaintRectsIncludingDescendants(); |
123 } | 141 } |
124 | 142 |
125 inline bool RenderLayerRepainter::shouldRepaintLayer() const | 143 inline bool RenderLayerRepainter::shouldRepaintLayer() const |
126 { | 144 { |
| 145 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) |
| 146 return false; |
| 147 |
127 if (m_repaintStatus != NeedsFullRepaintForPositionedMovementLayout) | 148 if (m_repaintStatus != NeedsFullRepaintForPositionedMovementLayout) |
128 return true; | 149 return true; |
129 | 150 |
130 // Composited layers that were moved during a positioned movement only | 151 // Composited layers that were moved during a positioned movement only |
131 // layout, don't need to be repainted. They just need to be recomposited. | 152 // layout, don't need to be repainted. They just need to be recomposited. |
132 return m_renderer->compositingState() != PaintsIntoOwnBacking; | 153 return m_renderer->compositingState() != PaintsIntoOwnBacking; |
133 } | 154 } |
134 | 155 |
135 // Since we're only painting non-composited layers, we know that they all share
the same repaintContainer. | 156 // Since we're only painting non-composited layers, we know that they all share
the same repaintContainer. |
136 void RenderLayerRepainter::repaintIncludingNonCompositingDescendants(RenderLayer
ModelObject* repaintContainer) | 157 void RenderLayerRepainter::repaintIncludingNonCompositingDescendants(RenderLayer
ModelObject* repaintContainer) |
137 { | 158 { |
138 m_renderer->repaintUsingContainer(repaintContainer, pixelSnappedIntRect(m_re
nderer->clippedOverflowRectForRepaint(repaintContainer))); | 159 m_renderer->repaintUsingContainer(repaintContainer, pixelSnappedIntRect(m_re
nderer->clippedOverflowRectForRepaint(repaintContainer))); |
139 | 160 |
140 for (RenderLayer* curr = m_renderer->layer()->firstChild(); curr; curr = cur
r->nextSibling()) { | 161 for (RenderLayer* curr = m_renderer->layer()->firstChild(); curr; curr = cur
r->nextSibling()) { |
141 if (!curr->hasCompositedLayerMapping()) | 162 if (!curr->hasCompositedLayerMapping()) |
142 curr->repainter().repaintIncludingNonCompositingDescendants(repaintC
ontainer); | 163 curr->repainter().repaintIncludingNonCompositingDescendants(repaintC
ontainer); |
143 } | 164 } |
144 } | 165 } |
145 | 166 |
146 LayoutRect RenderLayerRepainter::repaintRectIncludingNonCompositingDescendants()
const | 167 LayoutRect RenderLayerRepainter::repaintRectIncludingNonCompositingDescendants()
const |
147 { | 168 { |
148 LayoutRect repaintRect = m_repaintRect; | 169 LayoutRect repaintRect; |
| 170 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) |
| 171 repaintRect = m_renderer->newRepaintRect(); |
| 172 else |
| 173 repaintRect = m_repaintRect; |
| 174 |
149 for (RenderLayer* child = m_renderer->layer()->firstChild(); child; child =
child->nextSibling()) { | 175 for (RenderLayer* child = m_renderer->layer()->firstChild(); child; child =
child->nextSibling()) { |
150 // Don't include repaint rects for composited child layers; they will pa
int themselves and have a different origin. | 176 // Don't include repaint rects for composited child layers; they will pa
int themselves and have a different origin. |
151 if (child->hasCompositedLayerMapping()) | 177 if (child->hasCompositedLayerMapping()) |
152 continue; | 178 continue; |
153 | 179 |
154 repaintRect.unite(child->repainter().repaintRectIncludingNonCompositingD
escendants()); | 180 repaintRect.unite(child->repainter().repaintRectIncludingNonCompositingD
escendants()); |
155 } | 181 } |
156 return repaintRect; | 182 return repaintRect; |
157 } | 183 } |
158 | 184 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 RenderLayer* RenderLayerRepainter::enclosingFilterRepaintLayer() const | 280 RenderLayer* RenderLayerRepainter::enclosingFilterRepaintLayer() const |
255 { | 281 { |
256 for (const RenderLayer* curr = m_renderer->layer(); curr; curr = curr->paren
t()) { | 282 for (const RenderLayer* curr = m_renderer->layer(); curr; curr = curr->paren
t()) { |
257 if ((curr != m_renderer->layer() && curr->requiresFullLayerImageForFilte
rs()) || curr->compositingState() == PaintsIntoOwnBacking || curr->isRootLayer()
) | 283 if ((curr != m_renderer->layer() && curr->requiresFullLayerImageForFilte
rs()) || curr->compositingState() == PaintsIntoOwnBacking || curr->isRootLayer()
) |
258 return const_cast<RenderLayer*>(curr); | 284 return const_cast<RenderLayer*>(curr); |
259 } | 285 } |
260 return 0; | 286 return 0; |
261 } | 287 } |
262 | 288 |
263 } // Namespace WebCore | 289 } // Namespace WebCore |
OLD | NEW |