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

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

Issue 22419002: Set up clip and scroll parents on the blink side. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . Created 7 years, 3 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 | « Source/core/rendering/RenderLayer.h ('k') | Source/core/rendering/RenderLayerBacking.h » ('j') | 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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 const RenderLayer* scrollingLayer = ancestorScrollingLayer(); 486 const RenderLayer* scrollingLayer = ancestorScrollingLayer();
487 if (!scrollingLayer || scrollingLayer->isStackingContainer()) 487 if (!scrollingLayer || scrollingLayer->isStackingContainer())
488 return false; 488 return false;
489 489
490 if (scrollingLayer->m_canBePromotedToStackingContainerDirty) { 490 if (scrollingLayer->m_canBePromotedToStackingContainerDirty) {
491 // We don't know if it's safe to promote to stacking container, and 491 // We don't know if it's safe to promote to stacking container, and
492 // aren't in a position to find out, so we have to assume the worst. 492 // aren't in a position to find out, so we have to assume the worst.
493 return true; 493 return true;
494 } 494 }
495 495
496 return !scrollingLayer->canBeStackingContainer(); 496 return !scrollingLayer->needsToBeStackingContainer();
497 } 497 }
498 498
499 // FIXME: This is a temporary flag and should be removed once accelerated 499 // FIXME: This is a temporary flag and should be removed once accelerated
500 // overflow scroll is ready (crbug.com/254111). 500 // overflow scroll is ready (crbug.com/254111).
501 bool RenderLayer::compositorDrivenAcceleratedScrollingEnabled() const 501 bool RenderLayer::compositorDrivenAcceleratedScrollingEnabled() const
502 { 502 {
503 if (!acceleratedCompositingForOverflowScrollEnabled()) 503 if (!acceleratedCompositingForOverflowScrollEnabled())
504 return false; 504 return false;
505 505
506 const Settings* settings = renderer()->document().settings(); 506 const Settings* settings = renderer()->document().settings();
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after
2075 bool RenderLayer::needsCompositedScrolling() const 2075 bool RenderLayer::needsCompositedScrolling() const
2076 { 2076 {
2077 return adjustForForceCompositedScrollingMode(m_needsCompositedScrolling); 2077 return adjustForForceCompositedScrollingMode(m_needsCompositedScrolling);
2078 } 2078 }
2079 2079
2080 bool RenderLayer::needsToBeStackingContainer() const 2080 bool RenderLayer::needsToBeStackingContainer() const
2081 { 2081 {
2082 return adjustForForceCompositedScrollingMode(m_needsToBeStackingContainer); 2082 return adjustForForceCompositedScrollingMode(m_needsToBeStackingContainer);
2083 } 2083 }
2084 2084
2085 bool RenderLayer::hasScrollParent() const
2086 {
2087 if (!useCompositorDrivenAcceleratedScrolling())
2088 return false;
2089
2090 // A layer scrolls with its containing block. So to find the overflow scroll ing layer
2091 // that we scroll with respect to, we must ascend the layer tree until we re ach the
2092 // first overflow scrolling div at or above our containing block. I will ref er to this
2093 // layer as our 'scrolling ancestor'.
2094 //
2095 // Now, if we reside in a normal flow list, then we will naturally scroll wi th our scrolling
2096 // ancestor, and we need not be composited. If, on the other hand, we reside in a z-order
2097 // list, and on our walk upwards to our scrolling ancestor we find no layer that is a stacking
2098 // context, then we know that in the stacking tree, we will not be in the su btree rooted at
2099 // our scrolling ancestor, and we will therefore not scroll with it. In this case, we must
2100 // be a composited layer since the compositor will need to take special meas ures to ensure
2101 // that we scroll with our scrolling ancestor and it cannot do this if we do not promote.
2102 RenderLayer* scrollParent = ancestorScrollingLayer();
2103
2104 if (!scrollParent || scrollParent->isStackingContext())
2105 return false;
2106
2107 // If we hit a stacking context on our way up to the ancestor scrolling laye r, it will already
2108 // be composited due to an overflow scrolling parent, so we don't need to.
2109 for (RenderLayer* ancestor = parent(); ancestor && ancestor != scrollParent; ancestor = ancestor->parent()) {
2110 if (ancestor->isStackingContext())
2111 return false;
2112 }
2113
2114 return true;
2115 }
2116
2085 void RenderLayer::updateNeedsCompositedScrolling() 2117 void RenderLayer::updateNeedsCompositedScrolling()
2086 { 2118 {
2087 TRACE_EVENT0("comp-scroll", "RenderLayer::updateNeedsCompositedScrolling"); 2119 TRACE_EVENT0("comp-scroll", "RenderLayer::updateNeedsCompositedScrolling");
2088 2120
2089 updateCanBeStackingContainer(); 2121 updateCanBeStackingContainer();
2090 updateDescendantDependentFlags(); 2122 updateDescendantDependentFlags();
2091 2123
2092 ASSERT(renderer()->view()->frameView() && renderer()->view()->frameView()->c ontainsScrollableArea(scrollableArea())); 2124 ASSERT(renderer()->view()->frameView() && renderer()->view()->frameView()->c ontainsScrollableArea(scrollableArea()));
2093 const bool needsToBeStackingContainer = acceleratedCompositingForOverflowScr ollEnabled() 2125 const bool needsToBeStackingContainer = acceleratedCompositingForOverflowScr ollEnabled()
2094 && canBeStackingContainer() 2126 && canBeStackingContainer()
(...skipping 3370 matching lines...) Expand 10 before | Expand all | Expand 10 after
5465 bool RenderLayer::hasCompositedMask() const 5497 bool RenderLayer::hasCompositedMask() const
5466 { 5498 {
5467 return m_backing && m_backing->hasMaskLayer(); 5499 return m_backing && m_backing->hasMaskLayer();
5468 } 5500 }
5469 5501
5470 GraphicsLayer* RenderLayer::layerForScrolling() const 5502 GraphicsLayer* RenderLayer::layerForScrolling() const
5471 { 5503 {
5472 return m_backing ? m_backing->scrollingContentsLayer() : 0; 5504 return m_backing ? m_backing->scrollingContentsLayer() : 0;
5473 } 5505 }
5474 5506
5507 GraphicsLayer* RenderLayer::layerForScrollChild() const
5508 {
5509 // If we have an ancestor clipping layer because of our scroll parent, we do not want to
5510 // scroll that clip layer -- we need it to stay put and we will slide within it. If, on
5511 // the other hand, we have an ancestor clipping layer due to some other clip ping layer, we
5512 // want to scroll the root of the layer's associate graphics layer subtree. I.e., we want it
5513 // and its clip to move in concert.
5514
5515 if (!backing())
5516 return 0;
5517
5518 if (backing()->hasAncestorScrollClippingLayer()) {
5519 return backing()->hasAncestorClippingLayer()
5520 ? backing()->ancestorClippingLayer()
5521 : backing()->graphicsLayer();
5522 }
5523
5524 if (renderer()->containingBlock()->enclosingLayer() == ancestorScrollingLaye r())
5525 return backing()->graphicsLayer();
5526
5527 return backing()->childForSuperlayers();
5528 }
5529
5475 GraphicsLayer* RenderLayer::layerForHorizontalScrollbar() const 5530 GraphicsLayer* RenderLayer::layerForHorizontalScrollbar() const
5476 { 5531 {
5477 return m_backing ? m_backing->layerForHorizontalScrollbar() : 0; 5532 return m_backing ? m_backing->layerForHorizontalScrollbar() : 0;
5478 } 5533 }
5479 5534
5480 GraphicsLayer* RenderLayer::layerForVerticalScrollbar() const 5535 GraphicsLayer* RenderLayer::layerForVerticalScrollbar() const
5481 { 5536 {
5482 return m_backing ? m_backing->layerForVerticalScrollbar() : 0; 5537 return m_backing ? m_backing->layerForVerticalScrollbar() : 0;
5483 } 5538 }
5484 5539
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
6498 } 6553 }
6499 } 6554 }
6500 6555
6501 void showLayerTree(const WebCore::RenderObject* renderer) 6556 void showLayerTree(const WebCore::RenderObject* renderer)
6502 { 6557 {
6503 if (!renderer) 6558 if (!renderer)
6504 return; 6559 return;
6505 showLayerTree(renderer->enclosingLayer()); 6560 showLayerTree(renderer->enclosingLayer());
6506 } 6561 }
6507 #endif 6562 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | Source/core/rendering/RenderLayerBacking.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698