Chromium Code Reviews| 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 27 matching lines...) Expand all Loading... | |
| 99 void RenderLayerRepainter::clearRepaintRects() | 103 void RenderLayerRepainter::clearRepaintRects() |
| 100 { | 104 { |
| 101 ASSERT(!m_renderer->layer()->hasVisibleContent()); | 105 ASSERT(!m_renderer->layer()->hasVisibleContent()); |
| 102 | 106 |
| 103 m_repaintRect = IntRect(); | 107 m_repaintRect = IntRect(); |
| 104 m_outlineBox = IntRect(); | 108 m_outlineBox = IntRect(); |
| 105 } | 109 } |
| 106 | 110 |
| 107 void RenderLayerRepainter::computeRepaintRects(const RenderLayerModelObject* rep aintContainer, const RenderGeometryMap* geometryMap) | 111 void RenderLayerRepainter::computeRepaintRects(const RenderLayerModelObject* rep aintContainer, const RenderGeometryMap* geometryMap) |
| 108 { | 112 { |
| 113 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) | |
| 114 return; | |
| 115 | |
| 109 m_repaintRect = m_renderer->clippedOverflowRectForRepaint(repaintContainer); | 116 m_repaintRect = m_renderer->clippedOverflowRectForRepaint(repaintContainer); |
| 110 m_outlineBox = m_renderer->outlineBoundsForRepaint(repaintContainer, geometr yMap); | 117 m_outlineBox = m_renderer->outlineBoundsForRepaint(repaintContainer, geometr yMap); |
| 111 } | 118 } |
| 112 | 119 |
| 113 void RenderLayerRepainter::computeRepaintRectsIncludingDescendants() | 120 void RenderLayerRepainter::computeRepaintRectsIncludingDescendants() |
| 114 { | 121 { |
| 115 // FIXME: computeRepaintRects() has to walk up the parent chain for every la yer to compute the rects. | 122 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { |
| 116 // We should make this more efficient. | 123 // This is a little silly as we create and immediately destroy the RAII |
| 117 // FIXME: it's wrong to call this when layout is not up-to-date, which we do . | 124 // object but it makes sure we correctly set all of the repaint flags. |
|
Julien - ping for review
2014/03/04 18:22:10
It's also weird that we ignore all computeRepaintR
dsinclair
2014/03/04 19:21:52
This is used by the compositing code that I don't
| |
| 118 computeRepaintRects(m_renderer->containerForRepaint()); | 125 LayoutRectRecorder recorder(*m_renderer); |
| 126 | |
| 127 } else { | |
| 128 // FIXME: computeRepaintRects() has to walk up the parent chain for ever y layer to compute the rects. | |
| 129 // We should make this more efficient. | |
| 130 // FIXME: it's wrong to call this when layout is not up-to-date, which w e do. | |
| 131 computeRepaintRects(m_renderer->containerForRepaint()); | |
| 132 } | |
| 119 | 133 |
| 120 for (RenderLayer* layer = m_renderer->layer()->firstChild(); layer; layer = layer->nextSibling()) | 134 for (RenderLayer* layer = m_renderer->layer()->firstChild(); layer; layer = layer->nextSibling()) |
| 121 layer->repainter().computeRepaintRectsIncludingDescendants(); | 135 layer->repainter().computeRepaintRectsIncludingDescendants(); |
| 122 } | 136 } |
| 123 | 137 |
| 124 inline bool RenderLayerRepainter::shouldRepaintAfterLayout() const | 138 inline bool RenderLayerRepainter::shouldRepaintAfterLayout() const |
| 125 { | 139 { |
| 140 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) | |
| 141 return false; | |
| 142 | |
| 126 if (m_repaintStatus == NeedsNormalRepaint) | 143 if (m_repaintStatus == NeedsNormalRepaint) |
| 127 return true; | 144 return true; |
| 128 | 145 |
| 129 // Composited layers that were moved during a positioned movement only | 146 // Composited layers that were moved during a positioned movement only |
| 130 // layout, don't need to be repainted. They just need to be recomposited. | 147 // layout, don't need to be repainted. They just need to be recomposited. |
| 131 ASSERT(m_repaintStatus == NeedsFullRepaintForPositionedMovementLayout); | 148 ASSERT(m_repaintStatus == NeedsFullRepaintForPositionedMovementLayout); |
| 132 return m_renderer->compositingState() != PaintsIntoOwnBacking; | 149 return m_renderer->compositingState() != PaintsIntoOwnBacking; |
| 133 } | 150 } |
| 134 | 151 |
| 135 // Since we're only painting non-composited layers, we know that they all share the same repaintContainer. | 152 // Since we're only painting non-composited layers, we know that they all share the same repaintContainer. |
| 136 void RenderLayerRepainter::repaintIncludingNonCompositingDescendants(RenderLayer ModelObject* repaintContainer) | 153 void RenderLayerRepainter::repaintIncludingNonCompositingDescendants(RenderLayer ModelObject* repaintContainer) |
| 137 { | 154 { |
| 138 m_renderer->repaintUsingContainer(repaintContainer, pixelSnappedIntRect(m_re nderer->clippedOverflowRectForRepaint(repaintContainer))); | 155 m_renderer->repaintUsingContainer(repaintContainer, pixelSnappedIntRect(m_re nderer->clippedOverflowRectForRepaint(repaintContainer))); |
| 139 | 156 |
| 140 for (RenderLayer* curr = m_renderer->layer()->firstChild(); curr; curr = cur r->nextSibling()) { | 157 for (RenderLayer* curr = m_renderer->layer()->firstChild(); curr; curr = cur r->nextSibling()) { |
| 141 if (!curr->hasCompositedLayerMapping()) | 158 if (!curr->hasCompositedLayerMapping()) |
| 142 curr->repainter().repaintIncludingNonCompositingDescendants(repaintC ontainer); | 159 curr->repainter().repaintIncludingNonCompositingDescendants(repaintC ontainer); |
| 143 } | 160 } |
| 144 } | 161 } |
| 145 | 162 |
| 146 LayoutRect RenderLayerRepainter::repaintRectIncludingNonCompositingDescendants() const | 163 LayoutRect RenderLayerRepainter::repaintRectIncludingNonCompositingDescendants() const |
| 147 { | 164 { |
| 148 LayoutRect repaintRect = m_repaintRect; | 165 LayoutRect repaintRect; |
| 166 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) | |
| 167 repaintRect = m_renderer->newRepaintRect(); | |
| 168 else | |
| 169 repaintRect = m_repaintRect; | |
| 170 | |
| 149 for (RenderLayer* child = m_renderer->layer()->firstChild(); child; child = child->nextSibling()) { | 171 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. | 172 // Don't include repaint rects for composited child layers; they will pa int themselves and have a different origin. |
| 151 if (child->hasCompositedLayerMapping()) | 173 if (child->hasCompositedLayerMapping()) |
| 152 continue; | 174 continue; |
| 153 | 175 |
| 154 repaintRect.unite(child->repainter().repaintRectIncludingNonCompositingD escendants()); | 176 repaintRect.unite(child->repainter().repaintRectIncludingNonCompositingD escendants()); |
| 155 } | 177 } |
| 156 return repaintRect; | 178 return repaintRect; |
| 157 } | 179 } |
| 158 | 180 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 RenderLayer* RenderLayerRepainter::enclosingFilterRepaintLayer() const | 276 RenderLayer* RenderLayerRepainter::enclosingFilterRepaintLayer() const |
| 255 { | 277 { |
| 256 for (const RenderLayer* curr = m_renderer->layer(); curr; curr = curr->paren t()) { | 278 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() ) | 279 if ((curr != m_renderer->layer() && curr->requiresFullLayerImageForFilte rs()) || curr->compositingState() == PaintsIntoOwnBacking || curr->isRootLayer() ) |
| 258 return const_cast<RenderLayer*>(curr); | 280 return const_cast<RenderLayer*>(curr); |
| 259 } | 281 } |
| 260 return 0; | 282 return 0; |
| 261 } | 283 } |
| 262 | 284 |
| 263 } // Namespace WebCore | 285 } // Namespace WebCore |
| OLD | NEW |