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

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

Issue 313653004: Fix composited bounds of reflections. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3320 matching lines...) Expand 10 before | Expand all | Expand 10 after
3331 if (node->layer()->hasCompositedLayerMapping()) 3331 if (node->layer()->hasCompositedLayerMapping())
3332 continue; 3332 continue;
3333 // FIXME: Can we call physicalBoundingBoxIncludingReflectionAndStackingC hildren instead of boundingBoxForCompositing? 3333 // FIXME: Can we call physicalBoundingBoxIncludingReflectionAndStackingC hildren instead of boundingBoxForCompositing?
3334 result.unite(node->layer()->boundingBoxForCompositing(this)); 3334 result.unite(node->layer()->boundingBoxForCompositing(this));
3335 } 3335 }
3336 3336
3337 result.moveBy(offsetFromRoot); 3337 result.moveBy(offsetFromRoot);
3338 return result; 3338 return result;
3339 } 3339 }
3340 3340
3341 void expandCompositingRectForStackingChildren(const RenderLayer* ancestorLayer, RenderLayer::CalculateBoundsOptions options, LayoutRect& result)
ojan 2014/06/03 23:59:38 Did you mean this to be static?
chrishtr 2014/06/04 00:01:39 Static but not a member function.
3342 {
3343 RenderLayerStackingNodeIterator iterator(*ancestorLayer->stackingNode(), All Children);
3344 while (RenderLayerStackingNode* node = iterator.next()) {
3345 // Here we exclude both directly composited layers and squashing layers
3346 // because those RenderLayers don't paint into the graphics layer
3347 // for this RenderLayer. For example, the bounds of squashed RenderLayer s
3348 // will be included in the computation of the appropriate squashing
3349 // GraphicsLayer.
3350 if (options != RenderLayer::ApplyBoundsChickenEggHacks && node->layer()- >compositingState() != NotComposited)
3351 continue;
3352 result.unite(node->layer()->boundingBoxForCompositing(ancestorLayer, opt ions));
3353 }
3354 }
3355
3341 LayoutRect RenderLayer::boundingBoxForCompositing(const RenderLayer* ancestorLay er, CalculateBoundsOptions options) const 3356 LayoutRect RenderLayer::boundingBoxForCompositing(const RenderLayer* ancestorLay er, CalculateBoundsOptions options) const
3342 { 3357 {
3343 if (!isSelfPaintingLayer()) 3358 if (!isSelfPaintingLayer())
3344 return LayoutRect(); 3359 return LayoutRect();
3345 3360
3346 if (!ancestorLayer) 3361 if (!ancestorLayer)
3347 ancestorLayer = this; 3362 ancestorLayer = this;
3348 3363
3349 // FIXME: This could be improved to do a check like hasVisibleNonCompositing DescendantLayers() (bug 92580). 3364 // FIXME: This could be improved to do a check like hasVisibleNonCompositing DescendantLayers() (bug 92580).
3350 if (this != ancestorLayer && !hasVisibleContent() && !hasVisibleDescendant() ) 3365 if (this != ancestorLayer && !hasVisibleContent() && !hasVisibleDescendant() )
(...skipping 23 matching lines...) Expand all
3374 3389
3375 if (m_reflectionInfo && !m_reflectionInfo->reflectionLayer()->hasCompositedL ayerMapping()) 3390 if (m_reflectionInfo && !m_reflectionInfo->reflectionLayer()->hasCompositedL ayerMapping())
3376 result.unite(m_reflectionInfo->reflectionLayer()->boundingBoxForComposit ing(this)); 3391 result.unite(m_reflectionInfo->reflectionLayer()->boundingBoxForComposit ing(this));
3377 3392
3378 ASSERT(m_stackingNode->isStackingContext() || !m_stackingNode->hasPositiveZO rderList()); 3393 ASSERT(m_stackingNode->isStackingContext() || !m_stackingNode->hasPositiveZO rderList());
3379 3394
3380 #if !ASSERT_DISABLED 3395 #if !ASSERT_DISABLED
3381 LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(this)->st ackingNode()); 3396 LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(this)->st ackingNode());
3382 #endif 3397 #endif
3383 3398
3384 RenderLayerStackingNodeIterator iterator(*m_stackingNode.get(), AllChildren) ; 3399 // Reflections are implemented with RenderLayers that hang off of the reflec ted layer. However,
3385 while (RenderLayerStackingNode* node = iterator.next()) { 3400 // the reflection layer subtree does not include the subtree of the parent R enderLayer, so
3386 // Here we exclude both directly composited layers and squashing layers 3401 // a recursive computation of stacking children yields no results. This brea ks cases when there are stacking
3387 // because those RenderLayers don't paint into the graphics layer 3402 // children of the parent, that need to be included in reflected composited bounds.
3388 // for this RenderLayer. For example, the bounds of squashed RenderLayer s 3403 // Fix this by including composited bounds of stacking children of the refle cted RenderLayer.
3389 // will be included in the computation of the appropriate squashing 3404 if (parent() && parent()->reflectionInfo() && parent()->reflectionInfo()->re flectionLayer() == this)
3390 // GraphicsLayer. 3405 expandCompositingRectForStackingChildren(parent(), options, result);
3391 if (options != ApplyBoundsChickenEggHacks && node->layer()->compositingS tate() != NotComposited) 3406 else
3392 continue; 3407 expandCompositingRectForStackingChildren(this, options, result);
3393 result.unite(node->layer()->boundingBoxForCompositing(this, options));
3394 }
3395 3408
3396 // FIXME: We can optimize the size of the composited layers, by not enlargin g 3409 // FIXME: We can optimize the size of the composited layers, by not enlargin g
3397 // filtered areas with the outsets if we know that the filter is going to re nder in hardware. 3410 // filtered areas with the outsets if we know that the filter is going to re nder in hardware.
3398 // https://bugs.webkit.org/show_bug.cgi?id=81239 3411 // https://bugs.webkit.org/show_bug.cgi?id=81239
3399 m_renderer->style()->filterOutsets().expandRect(result); 3412 m_renderer->style()->filterOutsets().expandRect(result);
3400 3413
3401 if (shouldIncludeTransform) 3414 if (shouldIncludeTransform)
3402 result = transform()->mapRect(result); 3415 result = transform()->mapRect(result);
3403 3416
3404 LayoutPoint delta; 3417 LayoutPoint delta;
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
3927 } 3940 }
3928 } 3941 }
3929 3942
3930 void showLayerTree(const WebCore::RenderObject* renderer) 3943 void showLayerTree(const WebCore::RenderObject* renderer)
3931 { 3944 {
3932 if (!renderer) 3945 if (!renderer)
3933 return; 3946 return;
3934 showLayerTree(renderer->enclosingLayer()); 3947 showLayerTree(renderer->enclosingLayer());
3935 } 3948 }
3936 #endif 3949 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698