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

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

Issue 264183002: RAL: Eliminate n^2 walk to find repaint containers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: With less asserts :( Created 6 years, 7 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 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 1101
1102 const RenderLayer* RenderLayer::compositingContainer() const 1102 const RenderLayer* RenderLayer::compositingContainer() const
1103 { 1103 {
1104 if (stackingNode()->isNormalFlowOnly()) 1104 if (stackingNode()->isNormalFlowOnly())
1105 return parent(); 1105 return parent();
1106 if (RenderLayerStackingNode* ancestorStackingNode = stackingNode()->ancestor StackingContainerNode()) 1106 if (RenderLayerStackingNode* ancestorStackingNode = stackingNode()->ancestor StackingContainerNode())
1107 return ancestorStackingNode->layer(); 1107 return ancestorStackingNode->layer();
1108 return 0; 1108 return 0;
1109 } 1109 }
1110 1110
1111 bool RenderLayer::isRepaintContainer() const
1112 {
1113 return compositingState() == PaintsIntoOwnBacking || compositingState() == P aintsIntoGroupedBacking;
1114 }
1115
1111 // FIXME: having two different functions named enclosingCompositingLayer and enc losingCompositingLayerForRepaint 1116 // FIXME: having two different functions named enclosingCompositingLayer and enc losingCompositingLayerForRepaint
1112 // is error-prone and misleading for reading code that uses these functions - es pecially compounded with 1117 // is error-prone and misleading for reading code that uses these functions - es pecially compounded with
1113 // the includeSelf option. It is very likely that we don't even want either of t hese functions; A layer 1118 // the includeSelf option. It is very likely that we don't even want either of t hese functions; A layer
1114 // should be told explicitly which GraphicsLayer is the repaintContainer for a R enderLayer, and 1119 // should be told explicitly which GraphicsLayer is the repaintContainer for a R enderLayer, and
1115 // any other use cases should probably have an API between the non-compositing a nd compositing sides of code. 1120 // any other use cases should probably have an API between the non-compositing a nd compositing sides of code.
1116 RenderLayer* RenderLayer::enclosingCompositingLayer(IncludeSelfOrNot includeSelf ) const 1121 RenderLayer* RenderLayer::enclosingCompositingLayer(IncludeSelfOrNot includeSelf ) const
1117 { 1122 {
1118 ASSERT(isAllowedToQueryCompositingState()); 1123 ASSERT(isAllowedToQueryCompositingState());
1119 1124
1120 if ((includeSelf == IncludeSelf) && compositingState() != NotComposited && c ompositingState() != PaintsIntoGroupedBacking) 1125 if ((includeSelf == IncludeSelf) && compositingState() != NotComposited && c ompositingState() != PaintsIntoGroupedBacking)
1121 return const_cast<RenderLayer*>(this); 1126 return const_cast<RenderLayer*>(this);
1122 1127
1123 for (const RenderLayer* curr = compositingContainer(); curr; curr = curr->co mpositingContainer()) { 1128 for (const RenderLayer* curr = compositingContainer(); curr; curr = curr->co mpositingContainer()) {
1124 if (curr->compositingState() != NotComposited && curr->compositingState( ) != PaintsIntoGroupedBacking) 1129 if (curr->compositingState() != NotComposited && curr->compositingState( ) != PaintsIntoGroupedBacking)
1125 return const_cast<RenderLayer*>(curr); 1130 return const_cast<RenderLayer*>(curr);
1126 } 1131 }
1127 1132
1128 return 0; 1133 return 0;
1129 } 1134 }
1130 1135
1131 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(IncludeSelfOrNot i ncludeSelf) const 1136 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(IncludeSelfOrNot i ncludeSelf) const
1132 { 1137 {
1133 ASSERT(isAllowedToQueryCompositingState()); 1138 ASSERT(isAllowedToQueryCompositingState());
1134 1139
1135 if ((includeSelf == IncludeSelf) && (compositingState() == PaintsIntoOwnBack ing || compositingState() == PaintsIntoGroupedBacking)) 1140 if ((includeSelf == IncludeSelf) && isRepaintContainer())
1136 return const_cast<RenderLayer*>(this); 1141 return const_cast<RenderLayer*>(this);
1137 1142
1138 for (const RenderLayer* curr = compositingContainer(); curr; curr = curr->co mpositingContainer()) { 1143 for (const RenderLayer* curr = compositingContainer(); curr; curr = curr->co mpositingContainer()) {
1139 if (curr->compositingState() == PaintsIntoOwnBacking || curr->compositin gState() == PaintsIntoGroupedBacking) 1144 if (curr->isRepaintContainer())
1140 return const_cast<RenderLayer*>(curr); 1145 return const_cast<RenderLayer*>(curr);
1141 } 1146 }
1142 1147
1143 return 0; 1148 return 0;
1144 } 1149 }
1145 1150
1146 RenderLayer* RenderLayer::ancestorCompositedScrollingLayer() const 1151 RenderLayer* RenderLayer::ancestorCompositedScrollingLayer() const
1147 { 1152 {
1148 if (!compositor()->legacyOrCurrentAcceleratedCompositingForOverflowScrollEna bled()) 1153 if (!compositor()->legacyOrCurrentAcceleratedCompositingForOverflowScrollEna bled())
1149 return 0; 1154 return 0;
(...skipping 2870 matching lines...) Expand 10 before | Expand all | Expand 10 after
4020 } 4025 }
4021 } 4026 }
4022 4027
4023 void showLayerTree(const WebCore::RenderObject* renderer) 4028 void showLayerTree(const WebCore::RenderObject* renderer)
4024 { 4029 {
4025 if (!renderer) 4030 if (!renderer)
4026 return; 4031 return;
4027 showLayerTree(renderer->enclosingLayer()); 4032 showLayerTree(renderer->enclosingLayer());
4028 } 4033 }
4029 #endif 4034 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698