| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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->paintInvalidator().computePaintInvalidationRectsIncludingNonC
ompositingDescendants(); | 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 paintInvalidationContainer. |
| 76 void RenderLayerRepainter::paintInvalidationIncludingNonCompositingDescendants() | 76 void RenderLayerRepainter::paintInvalidationIncludingNonCompositingDescendants() |
| 77 { | 77 { |
| 78 repaintIncludingNonCompositingDescendantsInternal(m_renderer.containerForPai
ntInvalidation()); | 78 paintInvalidationIncludingNonCompositingDescendantsInternal(m_renderer.conta
inerForPaintInvalidation()); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void RenderLayerRepainter::repaintIncludingNonCompositingDescendantsInternal(con
st RenderLayerModelObject* repaintContainer) | 81 void RenderLayerRepainter::paintInvalidationIncludingNonCompositingDescendantsIn
ternal(const RenderLayerModelObject* paintInvalidationContainer) |
| 82 { | 82 { |
| 83 m_renderer.invalidatePaintUsingContainer(repaintContainer, m_renderer.previo
usPaintInvalidationRect(), InvalidationLayer); | 83 m_renderer.invalidatePaintUsingContainer(paintInvalidationContainer, m_rende
rer.previousPaintInvalidationRect(), 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->paintInvalidator().repaintIncludingNonCompositingDescendantsIn
ternal(repaintContainer); | 90 curr->paintInvalidator().paintInvalidationIncludingNonCompositingDes
cendantsInternal(paintInvalidationContainer); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 LayoutRect RenderLayerRepainter::repaintRectIncludingNonCompositingDescendants()
const | 94 LayoutRect RenderLayerRepainter::paintInvalidationRectIncludingNonCompositingDes
cendants() const |
| 95 { | 95 { |
| 96 LayoutRect repaintRect = m_renderer.previousPaintInvalidationRect(); | 96 LayoutRect paintInvalidationRect = 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 paint invalidation rects for composited child layers; t
hey will paint 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->paintInvalidator().repaintRectIncludingNonCompo
sitingDescendants()); | 103 paintInvalidationRect.unite(child->paintInvalidator().paintInvalidationR
ectIncludingNonCompositingDescendants()); |
| 104 } | 104 } |
| 105 return repaintRect; | 105 return paintInvalidationRect; |
| 106 } | 106 } |
| 107 | 107 |
| 108 void RenderLayerRepainter::setBackingNeedsRepaintInRect(const LayoutRect& r) | 108 void RenderLayerRepainter::setBackingNeedsPaintInvalidationInRect(const LayoutRe
ct& 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 if (m_renderer.compositingState() == NotComposited) { | 113 if (m_renderer.compositingState() == NotComposited) { |
| 114 // If we're trying to repaint the placeholder document layer, propagate
the | 114 // If we're trying to issue paint invalidations of the placeholder docum
ent layer, propagate the |
| 115 // repaint to the native view system. | 115 // paint invalidation to the native view system. |
| 116 LayoutRect absRect(r); | 116 LayoutRect absRect(r); |
| 117 LayoutPoint delta; | 117 LayoutPoint delta; |
| 118 m_renderer.layer()->convertToLayerCoords(m_renderer.layer()->root(), del
ta); | 118 m_renderer.layer()->convertToLayerCoords(m_renderer.layer()->root(), del
ta); |
| 119 absRect.moveBy(delta); | 119 absRect.moveBy(delta); |
| 120 | 120 |
| 121 if (absRect.isEmpty()) | 121 if (absRect.isEmpty()) |
| 122 return; | 122 return; |
| 123 | 123 |
| 124 RenderView* view = m_renderer.view(); | 124 RenderView* view = m_renderer.view(); |
| 125 if (view) | 125 if (view) |
| 126 view->invalidatePaintForRectangle(absRect); | 126 view->invalidatePaintForRectangle(absRect); |
| 127 return; | 127 return; |
| 128 } | 128 } |
| 129 // FIXME: generalize accessors to backing GraphicsLayers so that this code i
s squasphing-agnostic. | 129 // FIXME: generalize accessors to backing GraphicsLayers so that this code i
s squasphing-agnostic. |
| 130 if (m_renderer.layer()->groupedMapping()) { | 130 if (m_renderer.layer()->groupedMapping()) { |
| 131 LayoutRect repaintRect = r; | 131 LayoutRect paintInvalidationRect = r; |
| 132 repaintRect.move(m_renderer.layer()->subpixelAccumulation()); | 132 paintInvalidationRect.move(m_renderer.layer()->subpixelAccumulation()); |
| 133 if (GraphicsLayer* squashingLayer = m_renderer.layer()->groupedMapping()
->squashingLayer()) | 133 if (GraphicsLayer* squashingLayer = m_renderer.layer()->groupedMapping()
->squashingLayer()) |
| 134 squashingLayer->setNeedsDisplayInRect(pixelSnappedIntRect(repaintRec
t)); | 134 squashingLayer->setNeedsDisplayInRect(pixelSnappedIntRect(paintInval
idationRect)); |
| 135 } else { | 135 } else { |
| 136 m_renderer.layer()->compositedLayerMapping()->setContentsNeedDisplayInRe
ct(r); | 136 m_renderer.layer()->compositedLayerMapping()->setContentsNeedDisplayInRe
ct(r); |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 | 139 |
| 140 void RenderLayerRepainter::setFilterBackendNeedsRepaintingInRect(const LayoutRec
t& rect) | 140 void RenderLayerRepainter::setFilterBackendNeedsPaintInvalidationInRect(const La
youtRect& rect) |
| 141 { | 141 { |
| 142 if (rect.isEmpty()) | 142 if (rect.isEmpty()) |
| 143 return; | 143 return; |
| 144 LayoutRect rectForRepaint = rect; | 144 LayoutRect rectForPaintInvalidation = rect; |
| 145 m_renderer.style()->filterOutsets().expandRect(rectForRepaint); | 145 m_renderer.style()->filterOutsets().expandRect(rectForPaintInvalidation); |
| 146 | 146 |
| 147 ASSERT(m_renderer.layer()->filterInfo()); | 147 ASSERT(m_renderer.layer()->filterInfo()); |
| 148 | 148 |
| 149 RenderLayer* parentLayer = enclosingFilterRepaintLayer(); | 149 RenderLayer* parentLayer = enclosingFilterPaintInvalidationLayer(); |
| 150 ASSERT(parentLayer); | 150 ASSERT(parentLayer); |
| 151 FloatQuad repaintQuad(rectForRepaint); | 151 FloatQuad paintInvalidationQuad(rectForPaintInvalidation); |
| 152 LayoutRect parentLayerRect = m_renderer.localToContainerQuad(repaintQuad, pa
rentLayer->renderer()).enclosingBoundingBox(); | 152 LayoutRect parentLayerRect = m_renderer.localToContainerQuad(paintInvalidati
onQuad, parentLayer->renderer()).enclosingBoundingBox(); |
| 153 | 153 |
| 154 if (parentLayerRect.isEmpty()) | 154 if (parentLayerRect.isEmpty()) |
| 155 return; | 155 return; |
| 156 | 156 |
| 157 if (parentLayer->hasCompositedLayerMapping()) { | 157 if (parentLayer->hasCompositedLayerMapping()) { |
| 158 parentLayer->paintInvalidator().setBackingNeedsRepaintInRect(parentLayer
Rect); | 158 parentLayer->paintInvalidator().setBackingNeedsPaintInvalidationInRect(p
arentLayerRect); |
| 159 return; | 159 return; |
| 160 } | 160 } |
| 161 | 161 |
| 162 if (parentLayer->paintsWithFilters()) { | 162 if (parentLayer->paintsWithFilters()) { |
| 163 parentLayer->paintInvalidator().setFilterBackendNeedsRepaintingInRect(pa
rentLayerRect); | 163 parentLayer->paintInvalidator().setFilterBackendNeedsPaintInvalidationIn
Rect(parentLayerRect); |
| 164 return; | 164 return; |
| 165 } | 165 } |
| 166 | 166 |
| 167 if (parentLayer->isRootLayer()) { | 167 if (parentLayer->isRootLayer()) { |
| 168 RenderView* view = toRenderView(parentLayer->renderer()); | 168 RenderView* view = toRenderView(parentLayer->renderer()); |
| 169 view->invalidatePaintForRectangle(parentLayerRect); | 169 view->invalidatePaintForRectangle(parentLayerRect); |
| 170 return; | 170 return; |
| 171 } | 171 } |
| 172 | 172 |
| 173 ASSERT_NOT_REACHED(); | 173 ASSERT_NOT_REACHED(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 RenderLayer* RenderLayerRepainter::enclosingFilterRepaintLayer() const | 176 RenderLayer* RenderLayerRepainter::enclosingFilterPaintInvalidationLayer() const |
| 177 { | 177 { |
| 178 for (const RenderLayer* curr = m_renderer.layer(); curr; curr = curr->parent
()) { | 178 for (const RenderLayer* curr = m_renderer.layer(); curr; curr = curr->parent
()) { |
| 179 if ((curr != m_renderer.layer() && curr->requiresFullLayerImageForFilter
s()) || curr->compositingState() == PaintsIntoOwnBacking || curr->isRootLayer()) | 179 if ((curr != m_renderer.layer() && curr->requiresFullLayerImageForFilter
s()) || curr->compositingState() == PaintsIntoOwnBacking || curr->isRootLayer()) |
| 180 return const_cast<RenderLayer*>(curr); | 180 return const_cast<RenderLayer*>(curr); |
| 181 } | 181 } |
| 182 return 0; | 182 return 0; |
| 183 } | 183 } |
| 184 | 184 |
| 185 } // namespace blink | 185 } // namespace blink |
| OLD | NEW |