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

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

Issue 301843002: Store repaint rects in the coordinate space of their backing GraphicsLayer. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix comment. Created 6 years, 6 months 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 absRect.moveBy(delta); 199 absRect.moveBy(delta);
200 200
201 if (absRect.isEmpty()) 201 if (absRect.isEmpty())
202 return; 202 return;
203 203
204 RenderView* view = m_renderer.view(); 204 RenderView* view = m_renderer.view();
205 if (view) 205 if (view)
206 view->repaintViewRectangle(absRect); 206 view->repaintViewRectangle(absRect);
207 return; 207 return;
208 } 208 }
209 if (m_renderer.compositingState() == PaintsIntoGroupedBacking) { 209 IntRect repaintRect = pixelSnappedIntRect(r);
210 LayoutRect updatedRect(r); 210 // FIXME: generalize accessors to backing GraphicsLayers so that this code i s squashing-agnostic.
211 211 if (m_renderer.groupedMapping()) {
212 ASSERT(m_renderer.layer());
213 ASSERT(m_renderer.layer()->enclosingTransformedAncestor());
214 ASSERT(m_renderer.layer()->enclosingTransformedAncestor()->renderer());
215
216 // FIXME: this defensive code should not have to exist. None of these po inters should ever be 0. See crbug.com/370410.
217 RenderLayerModelObject* transformedAncestor = 0;
218 if (RenderLayer* ancestor = m_renderer.layer()->enclosingTransformedAnce stor())
219 transformedAncestor = ancestor->renderer();
220 if (!transformedAncestor)
221 return;
222
223 // If the transformedAncestor is actually the RenderView, we might get
224 // confused and think that we can use LayoutState. Ideally, we'd made
225 // LayoutState work for all composited layers as well, but until then
226 // we need to disable LayoutState for squashed layers.
227 LayoutStateDisabler layoutStateDisabler(*transformedAncestor);
228
229 // This code adjusts the repaint rectangle to be in the space of the tra nsformed ancestor of the grouped (i.e. squashed)
230 // layer. This is because all layers that squash together need to repain t w.r.t. a single container that is
231 // an ancestor of all of them, in order to properly take into account an y local transforms etc.
232 // FIXME: remove this special-case code that works around the repainting code structure.
233 m_renderer.computeRectForRepaint(transformedAncestor, updatedRect);
234 updatedRect.moveBy(-m_renderer.layer()->groupedMapping()->squashingOffse tFromTransformedAncestor());
235
236 IntRect repaintRect = pixelSnappedIntRect(updatedRect);
237 if (GraphicsLayer* squashingLayer = m_renderer.groupedMapping()->squashi ngLayer()) 212 if (GraphicsLayer* squashingLayer = m_renderer.groupedMapping()->squashi ngLayer())
238 squashingLayer->setNeedsDisplayInRect(repaintRect); 213 squashingLayer->setNeedsDisplayInRect(repaintRect);
239 } else { 214 } else {
240 IntRect repaintRect = pixelSnappedIntRect(r);
241 m_renderer.compositedLayerMapping()->setContentsNeedDisplayInRect(repain tRect); 215 m_renderer.compositedLayerMapping()->setContentsNeedDisplayInRect(repain tRect);
242 } 216 }
243 } 217 }
244 218
245 void RenderLayerRepainter::setFilterBackendNeedsRepaintingInRect(const LayoutRec t& rect) 219 void RenderLayerRepainter::setFilterBackendNeedsRepaintingInRect(const LayoutRec t& rect)
246 { 220 {
247 if (rect.isEmpty()) 221 if (rect.isEmpty())
248 return; 222 return;
249
250 LayoutRect rectForRepaint = rect; 223 LayoutRect rectForRepaint = rect;
251 m_renderer.style()->filterOutsets().expandRect(rectForRepaint); 224 m_renderer.style()->filterOutsets().expandRect(rectForRepaint);
252 225
253 RenderLayerFilterInfo* filterInfo = m_renderer.layer()->filterInfo(); 226 RenderLayerFilterInfo* filterInfo = m_renderer.layer()->filterInfo();
254 ASSERT(filterInfo); 227 ASSERT(filterInfo);
255 filterInfo->expandDirtySourceRect(rectForRepaint); 228 filterInfo->expandDirtySourceRect(rectForRepaint);
256 229
257 RenderLayer* parentLayer = enclosingFilterRepaintLayer(); 230 RenderLayer* parentLayer = enclosingFilterRepaintLayer();
258 ASSERT(parentLayer); 231 ASSERT(parentLayer);
259 FloatQuad repaintQuad(rectForRepaint); 232 FloatQuad repaintQuad(rectForRepaint);
(...skipping 24 matching lines...) Expand all
284 RenderLayer* RenderLayerRepainter::enclosingFilterRepaintLayer() const 257 RenderLayer* RenderLayerRepainter::enclosingFilterRepaintLayer() const
285 { 258 {
286 for (const RenderLayer* curr = m_renderer.layer(); curr; curr = curr->parent ()) { 259 for (const RenderLayer* curr = m_renderer.layer(); curr; curr = curr->parent ()) {
287 if ((curr != m_renderer.layer() && curr->requiresFullLayerImageForFilter s()) || curr->compositingState() == PaintsIntoOwnBacking || curr->isRootLayer()) 260 if ((curr != m_renderer.layer() && curr->requiresFullLayerImageForFilter s()) || curr->compositingState() == PaintsIntoOwnBacking || curr->isRootLayer())
288 return const_cast<RenderLayer*>(curr); 261 return const_cast<RenderLayer*>(curr);
289 } 262 }
290 return 0; 263 return 0;
291 } 264 }
292 265
293 } // Namespace WebCore 266 } // Namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698