Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: Source/core/rendering/RenderLayerRepainter.cpp

Issue 59063003: Don't coerce pointers to compositor layer mappings to booleans. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Respond to reviewer feedback. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 ASSERT(m_repaintStatus == NeedsFullRepaintForPositionedMovementLayout); 128 ASSERT(m_repaintStatus == NeedsFullRepaintForPositionedMovementLayout);
129 return m_renderer->compositingState() != PaintsIntoOwnBacking; 129 return m_renderer->compositingState() != PaintsIntoOwnBacking;
130 } 130 }
131 131
132 // Since we're only painting non-composited layers, we know that they all share the same repaintContainer. 132 // Since we're only painting non-composited layers, we know that they all share the same repaintContainer.
133 void RenderLayerRepainter::repaintIncludingNonCompositingDescendants(RenderLayer ModelObject* repaintContainer) 133 void RenderLayerRepainter::repaintIncludingNonCompositingDescendants(RenderLayer ModelObject* repaintContainer)
134 { 134 {
135 m_renderer->repaintUsingContainer(repaintContainer, pixelSnappedIntRect(m_re nderer->clippedOverflowRectForRepaint(repaintContainer))); 135 m_renderer->repaintUsingContainer(repaintContainer, pixelSnappedIntRect(m_re nderer->clippedOverflowRectForRepaint(repaintContainer)));
136 136
137 for (RenderLayer* curr = m_renderer->layer()->firstChild(); curr; curr = cur r->nextSibling()) { 137 for (RenderLayer* curr = m_renderer->layer()->firstChild(); curr; curr = cur r->nextSibling()) {
138 if (!curr->compositedLayerMapping()) 138 // FIXME: we also want to paint those layers who have a backing but pain t into
139 // our repaint container.
140 if (curr->compositingState() == NotComposited)
shawnsingh 2013/11/12 09:55:50 I don't understand this FIXME... why cant we just
Ian Vollick 2013/11/14 04:12:47 Ah right. We want to paint those layers that paint
139 curr->repainter().repaintIncludingNonCompositingDescendants(repaintC ontainer); 141 curr->repainter().repaintIncludingNonCompositingDescendants(repaintC ontainer);
140 } 142 }
141 } 143 }
142 144
143 LayoutRect RenderLayerRepainter::repaintRectIncludingNonCompositingDescendants() const 145 LayoutRect RenderLayerRepainter::repaintRectIncludingNonCompositingDescendants() const
144 { 146 {
145 LayoutRect repaintRect = m_repaintRect; 147 LayoutRect repaintRect = m_repaintRect;
146 for (RenderLayer* child = m_renderer->layer()->firstChild(); child; child = child->nextSibling()) { 148 for (RenderLayer* child = m_renderer->layer()->firstChild(); child; child = child->nextSibling()) {
147 // Don't include repaint rects for composited child layers; they will pa int themselves and have a different origin. 149 // Don't include repaint rects for composited child layers; they will pa int themselves and have a different origin.
148 if (child->compositedLayerMapping()) 150 // FIXME: we also want to include those layers who have a backing but pa int into
151 // our repaint container.
152 if (child->compositingState() != NotComposited)
shawnsingh 2013/11/12 09:55:50 This code doesn't seem to require a FIXME, either?
Ian Vollick 2013/11/14 04:12:47 Same as above.
149 continue; 153 continue;
150 154
151 repaintRect.unite(child->repainter().repaintRectIncludingNonCompositingD escendants()); 155 repaintRect.unite(child->repainter().repaintRectIncludingNonCompositingD escendants());
152 } 156 }
153 return repaintRect; 157 return repaintRect;
154 } 158 }
155 159
156 void RenderLayerRepainter::setBackingNeedsRepaint() 160 void RenderLayerRepainter::setBackingNeedsRepaint()
157 { 161 {
158 ASSERT(m_renderer->compositedLayerMapping()); 162 ASSERT(m_renderer->hasCompositedLayerMapping());
159 m_renderer->compositedLayerMapping()->setContentsNeedDisplay(); 163 m_renderer->compositedLayerMapping()->setContentsNeedDisplay();
160 } 164 }
161 165
162 void RenderLayerRepainter::setBackingNeedsRepaintInRect(const LayoutRect& r) 166 void RenderLayerRepainter::setBackingNeedsRepaintInRect(const LayoutRect& r)
163 { 167 {
164 // https://bugs.webkit.org/show_bug.cgi?id=61159 describes an unreproducible crash here, 168 // https://bugs.webkit.org/show_bug.cgi?id=61159 describes an unreproducible crash here,
165 // so assert but check that the layer is composited. 169 // so assert but check that the layer is composited.
166 ASSERT(m_renderer->compositedLayerMapping()); 170 ASSERT(m_renderer->hasCompositedLayerMapping());
167 if (!m_renderer->compositedLayerMapping()) { 171 if (!m_renderer->hasCompositedLayerMapping()) {
168 // If we're trying to repaint the placeholder document layer, propagate the 172 // If we're trying to repaint the placeholder document layer, propagate the
169 // repaint to the native view system. 173 // repaint to the native view system.
170 LayoutRect absRect(r); 174 LayoutRect absRect(r);
171 LayoutPoint delta; 175 LayoutPoint delta;
172 m_renderer->layer()->convertToLayerCoords(m_renderer->layer()->root(), d elta); 176 m_renderer->layer()->convertToLayerCoords(m_renderer->layer()->root(), d elta);
173 absRect.moveBy(delta); 177 absRect.moveBy(delta);
174 178
175 RenderView* view = m_renderer->view(); 179 RenderView* view = m_renderer->view();
176 if (view) 180 if (view)
177 view->repaintViewRectangle(absRect); 181 view->repaintViewRectangle(absRect);
(...skipping 27 matching lines...) Expand all
205 // shader can address any ouput pixel. 209 // shader can address any ouput pixel.
206 // Note: This is only for output rect, so there's no need to expand the dirty source rect. 210 // Note: This is only for output rect, so there's no need to expand the dirty source rect.
207 rectForRepaint.unite(m_renderer->layer()->calculateLayerBounds(m_rendere r->layer())); 211 rectForRepaint.unite(m_renderer->layer()->calculateLayerBounds(m_rendere r->layer()));
208 } 212 }
209 213
210 RenderLayer* parentLayer = enclosingFilterRepaintLayer(); 214 RenderLayer* parentLayer = enclosingFilterRepaintLayer();
211 ASSERT(parentLayer); 215 ASSERT(parentLayer);
212 FloatQuad repaintQuad(rectForRepaint); 216 FloatQuad repaintQuad(rectForRepaint);
213 LayoutRect parentLayerRect = m_renderer->localToContainerQuad(repaintQuad, p arentLayer->renderer()).enclosingBoundingBox(); 217 LayoutRect parentLayerRect = m_renderer->localToContainerQuad(repaintQuad, p arentLayer->renderer()).enclosingBoundingBox();
214 218
215 if (parentLayer->compositedLayerMapping()) { 219 if (parentLayer->compositingState() == PaintsIntoOwnBacking) {
216 parentLayer->repainter().setBackingNeedsRepaintInRect(parentLayerRect); 220 parentLayer->repainter().setBackingNeedsRepaintInRect(parentLayerRect);
217 return; 221 return;
218 } 222 }
219 223
220 if (parentLayer->paintsWithFilters()) { 224 if (parentLayer->paintsWithFilters()) {
221 parentLayer->repainter().setFilterBackendNeedsRepaintingInRect(parentLay erRect); 225 parentLayer->repainter().setFilterBackendNeedsRepaintingInRect(parentLay erRect);
222 return; 226 return;
223 } 227 }
224 228
225 if (parentLayer->isRootLayer()) { 229 if (parentLayer->isRootLayer()) {
226 RenderView* view = toRenderView(parentLayer->renderer()); 230 RenderView* view = toRenderView(parentLayer->renderer());
227 view->repaintViewRectangle(parentLayerRect); 231 view->repaintViewRectangle(parentLayerRect);
228 return; 232 return;
229 } 233 }
230 234
231 ASSERT_NOT_REACHED(); 235 ASSERT_NOT_REACHED();
232 } 236 }
233 237
234 RenderLayer* RenderLayerRepainter::enclosingFilterRepaintLayer() const 238 RenderLayer* RenderLayerRepainter::enclosingFilterRepaintLayer() const
235 { 239 {
236 for (const RenderLayer* curr = m_renderer->layer(); curr; curr = curr->paren t()) { 240 for (const RenderLayer* curr = m_renderer->layer(); curr; curr = curr->paren t()) {
237 if ((curr != m_renderer->layer() && curr->requiresFullLayerImageForFilte rs()) || curr->compositingState() == PaintsIntoOwnBacking || curr->isRootLayer() ) 241 if ((curr != m_renderer->layer() && curr->requiresFullLayerImageForFilte rs()) || curr->compositingState() == PaintsIntoOwnBacking || curr->isRootLayer() )
238 return const_cast<RenderLayer*>(curr); 242 return const_cast<RenderLayer*>(curr);
239 } 243 }
240 return 0; 244 return 0;
241 } 245 }
242 246
243 } // Namespace WebCore 247 } // Namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698