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

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

Issue 344733003: Clean up ancestorScrollingLayer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Make sure we pass Adam's layout test. 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 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 return const_cast<RenderLayer*>(this); 1081 return const_cast<RenderLayer*>(this);
1082 1082
1083 for (const RenderLayer* curr = compositingContainer(); curr; curr = curr->co mpositingContainer()) { 1083 for (const RenderLayer* curr = compositingContainer(); curr; curr = curr->co mpositingContainer()) {
1084 if (curr->isRepaintContainer()) 1084 if (curr->isRepaintContainer())
1085 return const_cast<RenderLayer*>(curr); 1085 return const_cast<RenderLayer*>(curr);
1086 } 1086 }
1087 1087
1088 return 0; 1088 return 0;
1089 } 1089 }
1090 1090
1091 RenderLayer* RenderLayer::ancestorCompositedScrollingLayer() const
1092 {
1093 if (!compositor()->acceleratedCompositingForOverflowScrollEnabled())
1094 return 0;
1095
1096 RenderObject* containingBlock = renderer()->containingBlock();
1097 if (!containingBlock)
1098 return 0;
1099
1100 RenderLayer* ancestorCompositedScrollingLayer = 0;
1101 for (RenderLayer* ancestorLayer = containingBlock->enclosingLayer(); ancesto rLayer; ancestorLayer = ancestorLayer->parent()) {
1102 if (ancestorLayer->needsCompositedScrolling()) {
1103 ancestorCompositedScrollingLayer = ancestorLayer;
1104 break;
1105 }
1106 }
1107
1108 return ancestorCompositedScrollingLayer;
1109 }
1110
1111 RenderLayer* RenderLayer::ancestorScrollingLayer() const 1091 RenderLayer* RenderLayer::ancestorScrollingLayer() const
1112 { 1092 {
1113 RenderObject* containingBlock = renderer()->containingBlock(); 1093 for (RenderObject* container = renderer()->containingBlock(); container; con tainer = container->containingBlock()) {
1114 if (!containingBlock) 1094 RenderLayer* currentLayer = container->enclosingLayer();
1115 return 0; 1095 if (currentLayer->scrollsOverflow())
1116 1096 return currentLayer;
1117 for (RenderLayer* ancestorLayer = containingBlock->enclosingLayer(); ancesto rLayer; ancestorLayer = ancestorLayer->parent()) {
1118 if (ancestorLayer->scrollsOverflow())
1119 return ancestorLayer;
1120 } 1097 }
1121 1098
1122 return 0; 1099 return 0;
1123 } 1100 }
1124 1101
1125 RenderLayer* RenderLayer::enclosingFilterLayer(IncludeSelfOrNot includeSelf) con st 1102 RenderLayer* RenderLayer::enclosingFilterLayer(IncludeSelfOrNot includeSelf) con st
1126 { 1103 {
1127 const RenderLayer* curr = (includeSelf == IncludeSelf) ? this : parent(); 1104 const RenderLayer* curr = (includeSelf == IncludeSelf) ? this : parent();
1128 for (; curr; curr = curr->parent()) { 1105 for (; curr; curr = curr->parent()) {
1129 if (curr->requiresFullLayerImageForFilters()) 1106 if (curr->requiresFullLayerImageForFilters())
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 // layer as our 'scrolling ancestor'. 1591 // layer as our 'scrolling ancestor'.
1615 // 1592 //
1616 // Now, if we reside in a normal flow list, then we will naturally scroll wi th our scrolling 1593 // Now, if we reside in a normal flow list, then we will naturally scroll wi th our scrolling
1617 // ancestor, and we need not be composited. If, on the other hand, we reside in a z-order 1594 // ancestor, and we need not be composited. If, on the other hand, we reside in a z-order
1618 // list, and on our walk upwards to our scrolling ancestor we find no layer that is a stacking 1595 // list, and on our walk upwards to our scrolling ancestor we find no layer that is a stacking
1619 // context, then we know that in the stacking tree, we will not be in the su btree rooted at 1596 // context, then we know that in the stacking tree, we will not be in the su btree rooted at
1620 // our scrolling ancestor, and we will therefore not scroll with it. In this case, we must 1597 // our scrolling ancestor, and we will therefore not scroll with it. In this case, we must
1621 // be a composited layer since the compositor will need to take special meas ures to ensure 1598 // be a composited layer since the compositor will need to take special meas ures to ensure
1622 // that we scroll with our scrolling ancestor and it cannot do this if we do not promote. 1599 // that we scroll with our scrolling ancestor and it cannot do this if we do not promote.
1623 1600
1624 RenderLayer* scrollParent = ancestorCompositedScrollingLayer(); 1601 RenderLayer* scrollParent = ancestorScrollingLayer();
1625 if (!scrollParent || scrollParent->stackingNode()->isStackingContext()) 1602 if (!scrollParent || scrollParent->stackingNode()->isStackingContext())
1626 return 0; 1603 return 0;
1627 1604
1628 // If we hit a stacking context on our way up to the ancestor scrolling laye r, it will already 1605 // If we hit a stacking context on our way up to the ancestor scrolling laye r, it will already
1629 // be composited due to an overflow scrolling parent, so we don't need to. 1606 // be composited due to an overflow scrolling parent, so we don't need to.
1630 for (RenderLayer* ancestor = parent(); ancestor && ancestor != scrollParent; ancestor = ancestor->parent()) { 1607 for (RenderLayer* ancestor = parent(); ancestor && ancestor != scrollParent; ancestor = ancestor->parent()) {
1631 if (ancestor->stackingNode()->isStackingContext()) { 1608 if (ancestor->stackingNode()->isStackingContext()) {
1632 scrollParent = 0; 1609 scrollParent = 0;
1633 break; 1610 break;
1634 } 1611 }
(...skipping 2231 matching lines...) Expand 10 before | Expand all | Expand 10 after
3866 } 3843 }
3867 } 3844 }
3868 3845
3869 void showLayerTree(const WebCore::RenderObject* renderer) 3846 void showLayerTree(const WebCore::RenderObject* renderer)
3870 { 3847 {
3871 if (!renderer) 3848 if (!renderer)
3872 return; 3849 return;
3873 showLayerTree(renderer->enclosingLayer()); 3850 showLayerTree(renderer->enclosingLayer());
3874 } 3851 }
3875 #endif 3852 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | Source/core/rendering/compositing/CompositedLayerMapping.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698