| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "core/rendering/RenderView.h" | 49 #include "core/rendering/RenderView.h" |
| 50 #include "core/rendering/compositing/CompositedLayerMapping.h" | 50 #include "core/rendering/compositing/CompositedLayerMapping.h" |
| 51 | 51 |
| 52 namespace blink { | 52 namespace blink { |
| 53 | 53 |
| 54 RenderLayerRepainter::RenderLayerRepainter(RenderLayerModelObject& renderer) | 54 RenderLayerRepainter::RenderLayerRepainter(RenderLayerModelObject& renderer) |
| 55 : m_renderer(renderer) | 55 : m_renderer(renderer) |
| 56 { | 56 { |
| 57 } | 57 } |
| 58 | 58 |
| 59 void RenderLayerRepainter::computeRepaintRectsIncludingNonCompositingDescendants
() | 59 void RenderLayerRepainter::computePaintInvalidationRectsIncludingNonCompositingD
escendants() |
| 60 { | 60 { |
| 61 // FIXME: boundsRectForPaintInvalidation() has to walk up the parent chain | 61 // FIXME: boundsRectForPaintInvalidation() has to walk up the parent chain |
| 62 // for every layer to compute the rects. We should make this more efficient. | 62 // for every layer to compute the rects. We should make this more efficient. |
| 63 // FIXME: it's wrong to call this when layout is not up-to-date, which we do
. | 63 // FIXME: it's wrong to call this when layout is not up-to-date, which we do
. |
| 64 m_renderer.setPreviousPaintInvalidationRect(m_renderer.boundsRectForPaintInv
alidation(m_renderer.containerForPaintInvalidation())); | 64 m_renderer.setPreviousPaintInvalidationRect(m_renderer.boundsRectForPaintInv
alidation(m_renderer.containerForPaintInvalidation())); |
| 65 // FIXME: We are only updating the paint invalidation bounds but not | 65 // FIXME: We are only updating the paint invalidation bounds but not |
| 66 // the positionFromPaintInvalidationContainer. This means that we may | 66 // the positionFromPaintInvalidationContainer. This means that we may |
| 67 // forcing a full invaliation of the new position. Is this really correct? | 67 // forcing a full invaliation of the new position. Is this really correct? |
| 68 | 68 |
| 69 for (RenderLayer* layer = m_renderer.layer()->firstChild(); layer; layer = l
ayer->nextSibling()) { | 69 for (RenderLayer* layer = m_renderer.layer()->firstChild(); layer; layer = l
ayer->nextSibling()) { |
| 70 if (layer->compositingState() != PaintsIntoOwnBacking && layer->composit
ingState() != PaintsIntoGroupedBacking) | 70 if (layer->compositingState() != PaintsIntoOwnBacking && layer->composit
ingState() != PaintsIntoGroupedBacking) |
| 71 layer->repainter().computeRepaintRectsIncludingNonCompositingDescend
ants(); | 71 layer->paintInvalidator().computePaintInvalidationRectsIncludingNonC
ompositingDescendants(); |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 | 74 |
| 75 // Since we're only painting non-composited layers, we know that they all share
the same repaintContainer. | 75 // Since we're only painting non-composited layers, we know that they all share
the same repaintContainer. |
| 76 void RenderLayerRepainter::repaintIncludingNonCompositingDescendants() | 76 void RenderLayerRepainter::paintInvalidationIncludingNonCompositingDescendants() |
| 77 { | 77 { |
| 78 repaintIncludingNonCompositingDescendantsInternal(m_renderer.containerForPai
ntInvalidation()); | 78 repaintIncludingNonCompositingDescendantsInternal(m_renderer.containerForPai
ntInvalidation()); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void RenderLayerRepainter::repaintIncludingNonCompositingDescendantsInternal(con
st RenderLayerModelObject* repaintContainer) | 81 void RenderLayerRepainter::repaintIncludingNonCompositingDescendantsInternal(con
st RenderLayerModelObject* repaintContainer) |
| 82 { | 82 { |
| 83 m_renderer.invalidatePaintUsingContainer(repaintContainer, m_renderer.previo
usPaintInvalidationRect(), InvalidationLayer); | 83 m_renderer.invalidatePaintUsingContainer(repaintContainer, m_renderer.previo
usPaintInvalidationRect(), InvalidationLayer); |
| 84 | 84 |
| 85 // Disable for reading compositingState() below. | 85 // Disable for reading compositingState() below. |
| 86 DisableCompositingQueryAsserts disabler; | 86 DisableCompositingQueryAsserts disabler; |
| 87 | 87 |
| 88 for (RenderLayer* curr = m_renderer.layer()->firstChild(); curr; curr = curr
->nextSibling()) { | 88 for (RenderLayer* curr = m_renderer.layer()->firstChild(); curr; curr = curr
->nextSibling()) { |
| 89 if (curr->compositingState() != PaintsIntoOwnBacking && curr->compositin
gState() != PaintsIntoGroupedBacking) | 89 if (curr->compositingState() != PaintsIntoOwnBacking && curr->compositin
gState() != PaintsIntoGroupedBacking) |
| 90 curr->repainter().repaintIncludingNonCompositingDescendantsInternal(
repaintContainer); | 90 curr->paintInvalidator().repaintIncludingNonCompositingDescendantsIn
ternal(repaintContainer); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 LayoutRect RenderLayerRepainter::repaintRectIncludingNonCompositingDescendants()
const | 94 LayoutRect RenderLayerRepainter::repaintRectIncludingNonCompositingDescendants()
const |
| 95 { | 95 { |
| 96 LayoutRect repaintRect = m_renderer.previousPaintInvalidationRect(); | 96 LayoutRect repaintRect = m_renderer.previousPaintInvalidationRect(); |
| 97 | 97 |
| 98 for (RenderLayer* child = m_renderer.layer()->firstChild(); child; child = c
hild->nextSibling()) { | 98 for (RenderLayer* child = m_renderer.layer()->firstChild(); child; child = c
hild->nextSibling()) { |
| 99 // Don't include repaint rects for composited child layers; they will pa
int themselves and have a different origin. | 99 // Don't include repaint rects for composited child layers; they will pa
int themselves and have a different origin. |
| 100 if (child->compositingState() == PaintsIntoOwnBacking || child->composit
ingState() == PaintsIntoGroupedBacking) | 100 if (child->compositingState() == PaintsIntoOwnBacking || child->composit
ingState() == PaintsIntoGroupedBacking) |
| 101 continue; | 101 continue; |
| 102 | 102 |
| 103 repaintRect.unite(child->repainter().repaintRectIncludingNonCompositingD
escendants()); | 103 repaintRect.unite(child->paintInvalidator().repaintRectIncludingNonCompo
sitingDescendants()); |
| 104 } | 104 } |
| 105 return repaintRect; | 105 return repaintRect; |
| 106 } | 106 } |
| 107 | 107 |
| 108 void RenderLayerRepainter::setBackingNeedsRepaintInRect(const LayoutRect& r) | 108 void RenderLayerRepainter::setBackingNeedsRepaintInRect(const LayoutRect& r) |
| 109 { | 109 { |
| 110 // https://bugs.webkit.org/show_bug.cgi?id=61159 describes an unreproducible
crash here, | 110 // https://bugs.webkit.org/show_bug.cgi?id=61159 describes an unreproducible
crash here, |
| 111 // so assert but check that the layer is composited. | 111 // so assert but check that the layer is composited. |
| 112 ASSERT(m_renderer.compositingState() != NotComposited); | 112 ASSERT(m_renderer.compositingState() != NotComposited); |
| 113 // FIXME: generalize accessors to backing GraphicsLayers so that this code i
s squasphing-agnostic. | 113 // FIXME: generalize accessors to backing GraphicsLayers so that this code i
s squasphing-agnostic. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 132 | 132 |
| 133 RenderLayer* parentLayer = enclosingFilterRepaintLayer(); | 133 RenderLayer* parentLayer = enclosingFilterRepaintLayer(); |
| 134 ASSERT(parentLayer); | 134 ASSERT(parentLayer); |
| 135 FloatQuad repaintQuad(rectForRepaint); | 135 FloatQuad repaintQuad(rectForRepaint); |
| 136 LayoutRect parentLayerRect = m_renderer.localToContainerQuad(repaintQuad, pa
rentLayer->renderer()).enclosingBoundingBox(); | 136 LayoutRect parentLayerRect = m_renderer.localToContainerQuad(repaintQuad, pa
rentLayer->renderer()).enclosingBoundingBox(); |
| 137 | 137 |
| 138 if (parentLayerRect.isEmpty()) | 138 if (parentLayerRect.isEmpty()) |
| 139 return; | 139 return; |
| 140 | 140 |
| 141 if (parentLayer->hasCompositedLayerMapping()) { | 141 if (parentLayer->hasCompositedLayerMapping()) { |
| 142 parentLayer->repainter().setBackingNeedsRepaintInRect(parentLayerRect); | 142 parentLayer->paintInvalidator().setBackingNeedsRepaintInRect(parentLayer
Rect); |
| 143 return; | 143 return; |
| 144 } | 144 } |
| 145 | 145 |
| 146 if (parentLayer->paintsWithFilters()) { | 146 if (parentLayer->paintsWithFilters()) { |
| 147 parentLayer->repainter().setFilterBackendNeedsRepaintingInRect(parentLay
erRect); | 147 parentLayer->paintInvalidator().setFilterBackendNeedsRepaintingInRect(pa
rentLayerRect); |
| 148 return; | 148 return; |
| 149 } | 149 } |
| 150 | 150 |
| 151 if (parentLayer->isRootLayer()) { | 151 if (parentLayer->isRootLayer()) { |
| 152 RenderView* view = toRenderView(parentLayer->renderer()); | 152 RenderView* view = toRenderView(parentLayer->renderer()); |
| 153 view->invalidatePaintForRectangle(parentLayerRect); | 153 view->invalidatePaintForRectangle(parentLayerRect); |
| 154 return; | 154 return; |
| 155 } | 155 } |
| 156 | 156 |
| 157 ASSERT_NOT_REACHED(); | 157 ASSERT_NOT_REACHED(); |
| 158 } | 158 } |
| 159 | 159 |
| 160 RenderLayer* RenderLayerRepainter::enclosingFilterRepaintLayer() const | 160 RenderLayer* RenderLayerRepainter::enclosingFilterRepaintLayer() const |
| 161 { | 161 { |
| 162 for (const RenderLayer* curr = m_renderer.layer(); curr; curr = curr->parent
()) { | 162 for (const RenderLayer* curr = m_renderer.layer(); curr; curr = curr->parent
()) { |
| 163 if ((curr != m_renderer.layer() && curr->requiresFullLayerImageForFilter
s()) || curr->compositingState() == PaintsIntoOwnBacking || curr->isRootLayer()) | 163 if ((curr != m_renderer.layer() && curr->requiresFullLayerImageForFilter
s()) || curr->compositingState() == PaintsIntoOwnBacking || curr->isRootLayer()) |
| 164 return const_cast<RenderLayer*>(curr); | 164 return const_cast<RenderLayer*>(curr); |
| 165 } | 165 } |
| 166 return 0; | 166 return 0; |
| 167 } | 167 } |
| 168 | 168 |
| 169 } // namespace blink | 169 } // namespace blink |
| OLD | NEW |