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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp

Issue 1413523007: Simplify computation of the invalidation rect for a frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 void PaintLayerClipper::clearClipRectsIncludingDescendants(ClipRectsCacheSlot ca cheSlot) 163 void PaintLayerClipper::clearClipRectsIncludingDescendants(ClipRectsCacheSlot ca cheSlot)
164 { 164 {
165 if (m_cache) 165 if (m_cache)
166 m_cache->clear(cacheSlot); 166 m_cache->clear(cacheSlot);
167 167
168 for (PaintLayer* layer = m_layoutObject.layer()->firstChild(); layer; layer = layer->nextSibling()) { 168 for (PaintLayer* layer = m_layoutObject.layer()->firstChild(); layer; layer = layer->nextSibling()) {
169 layer->clipper().clearClipRectsIncludingDescendants(cacheSlot); 169 layer->clipper().clearClipRectsIncludingDescendants(cacheSlot);
170 } 170 }
171 } 171 }
172 172
173 LayoutRect PaintLayerClipper::childrenClipRect() const
174 {
175 // FIXME: border-radius not accounted for.
176 // FIXME: Flow thread based columns not accounted for.
177 PaintLayer* clippingRootLayer = clippingRootForPainting();
178 LayoutRect layerBounds;
179 ClipRect backgroundRect, foregroundRect;
180 // Need to use uncached clip rects, because the value of 'dontClipToOverflow ' may be different from the painting path (<rdar://problem/11844909>).
181 ClipRectsContext context(clippingRootLayer, UncachedClipRects);
182 calculateRects(context, LayoutRect(m_layoutObject.view()->unscaledDocumentRe ct()), layerBounds, backgroundRect, foregroundRect);
183 return LayoutRect(clippingRootLayer->layoutObject()->localToAbsoluteQuad(Flo atQuad(FloatRect(foregroundRect.rect()))).enclosingBoundingBox());
184 }
185 173
186 LayoutRect PaintLayerClipper::localClipRect(const PaintLayer* clippingRootLayer) const 174 LayoutRect PaintLayerClipper::localClipRect(const PaintLayer* clippingRootLayer) const
187 { 175 {
188 LayoutRect layerBounds; 176 LayoutRect layerBounds;
189 ClipRect backgroundRect, foregroundRect; 177 ClipRect backgroundRect, foregroundRect;
190 ClipRectsContext context(clippingRootLayer, PaintingClipRects); 178 ClipRectsContext context(clippingRootLayer, PaintingClipRects);
191 calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()), layerBoun ds, backgroundRect, foregroundRect); 179 calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()), layerBoun ds, backgroundRect, foregroundRect);
192 180
193 LayoutRect clipRect = backgroundRect.rect(); 181 LayoutRect clipRect = backgroundRect.rect();
194 // TODO(chrishtr): avoid converting to IntRect and back. 182 // TODO(chrishtr): avoid converting to IntRect and back.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 } 307 }
320 308
321 void PaintLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context, ClipRects& clipRects) const 309 void PaintLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context, ClipRects& clipRects) const
322 { 310 {
323 if (context.usesCache()) 311 if (context.usesCache())
324 clipRects = *getClipRects(context); 312 clipRects = *getClipRects(context);
325 else 313 else
326 calculateClipRects(context, clipRects); 314 calculateClipRects(context, clipRects);
327 } 315 }
328 316
329 PaintLayer* PaintLayerClipper::clippingRootForPainting() const
330 {
331 const PaintLayer* current = m_layoutObject.layer();
332 // FIXME: getting rid of current->hasCompositedLayerMapping() here breaks th e
333 // compositing/backing/no-backing-for-clip.html layout test, because there i s a
334 // "composited but paints into ancestor" layer involved. However, it doesn't make sense that
335 // that check would be appropriate here but not inside the while loop below.
336 if (current->isPaintInvalidationContainer() || current->hasCompositedLayerMa pping())
337 return const_cast<PaintLayer*>(current);
338
339 while (current) {
340 if (current->isRootLayer())
341 return const_cast<PaintLayer*>(current);
342
343 current = current->compositingContainer();
344 ASSERT(current);
345 if (current->transform() || current->isPaintInvalidationContainer())
346 return const_cast<PaintLayer*>(current);
347 }
348
349 ASSERT_NOT_REACHED();
350 return 0;
351 }
352
353 bool PaintLayerClipper::shouldRespectOverflowClip(const ClipRectsContext& contex t) const 317 bool PaintLayerClipper::shouldRespectOverflowClip(const ClipRectsContext& contex t) const
354 { 318 {
355 PaintLayer* layer = m_layoutObject.layer(); 319 PaintLayer* layer = m_layoutObject.layer();
356 if (layer != context.rootLayer) 320 if (layer != context.rootLayer)
357 return true; 321 return true;
358 322
359 if (context.respectOverflowClip == IgnoreOverflowClip) 323 if (context.respectOverflowClip == IgnoreOverflowClip)
360 return false; 324 return false;
361 325
362 if (layer->isRootLayer() && context.respectOverflowClipForViewport == Ignore OverflowClip) 326 if (layer->isRootLayer() && context.respectOverflowClipForViewport == Ignore OverflowClip)
363 return false; 327 return false;
364 328
365 return true; 329 return true;
366 } 330 }
367 331
368 } // namespace blink 332 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerClipper.h ('k') | third_party/WebKit/Source/web/WebPluginContainerImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698