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

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: Fix for SVG 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 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 1102
1103 const RenderLayer* RenderLayer::compositingContainer() const 1103 const RenderLayer* RenderLayer::compositingContainer() const
1104 { 1104 {
1105 if (stackingNode()->isNormalFlowOnly()) 1105 if (stackingNode()->isNormalFlowOnly())
1106 return parent(); 1106 return parent();
1107 if (RenderLayerStackingNode* ancestorStackingNode = stackingNode()->ancestor StackingContainerNode()) 1107 if (RenderLayerStackingNode* ancestorStackingNode = stackingNode()->ancestor StackingContainerNode())
1108 return ancestorStackingNode->layer(); 1108 return ancestorStackingNode->layer();
1109 return 0; 1109 return 0;
1110 } 1110 }
1111 1111
1112 bool RenderLayer::isRepaintContainer() const
1113 {
1114 return compositingState() == PaintsIntoOwnBacking || compositingState() == P aintsIntoGroupedBacking;
eseidel 2014/05/08 00:43:02 When is this compositing information determined?
1115 }
1116
1112 // FIXME: having two different functions named enclosingCompositingLayer and enc losingCompositingLayerForRepaint 1117 // FIXME: having two different functions named enclosingCompositingLayer and enc losingCompositingLayerForRepaint
1113 // is error-prone and misleading for reading code that uses these functions - es pecially compounded with 1118 // is error-prone and misleading for reading code that uses these functions - es pecially compounded with
1114 // the includeSelf option. It is very likely that we don't even want either of t hese functions; A layer 1119 // the includeSelf option. It is very likely that we don't even want either of t hese functions; A layer
1115 // should be told explicitly which GraphicsLayer is the repaintContainer for a R enderLayer, and 1120 // should be told explicitly which GraphicsLayer is the repaintContainer for a R enderLayer, and
1116 // any other use cases should probably have an API between the non-compositing a nd compositing sides of code. 1121 // any other use cases should probably have an API between the non-compositing a nd compositing sides of code.
1117 RenderLayer* RenderLayer::enclosingCompositingLayer(IncludeSelfOrNot includeSelf ) const 1122 RenderLayer* RenderLayer::enclosingCompositingLayer(IncludeSelfOrNot includeSelf ) const
1118 { 1123 {
1119 ASSERT(isAllowedToQueryCompositingState()); 1124 ASSERT(isAllowedToQueryCompositingState());
1120 1125
1121 if ((includeSelf == IncludeSelf) && compositingState() != NotComposited && c ompositingState() != PaintsIntoGroupedBacking) 1126 if ((includeSelf == IncludeSelf) && compositingState() != NotComposited && c ompositingState() != PaintsIntoGroupedBacking)
1122 return const_cast<RenderLayer*>(this); 1127 return const_cast<RenderLayer*>(this);
1123 1128
1124 for (const RenderLayer* curr = compositingContainer(); curr; curr = curr->co mpositingContainer()) { 1129 for (const RenderLayer* curr = compositingContainer(); curr; curr = curr->co mpositingContainer()) {
1125 if (curr->compositingState() != NotComposited && curr->compositingState( ) != PaintsIntoGroupedBacking) 1130 if (curr->compositingState() != NotComposited && curr->compositingState( ) != PaintsIntoGroupedBacking)
1126 return const_cast<RenderLayer*>(curr); 1131 return const_cast<RenderLayer*>(curr);
1127 } 1132 }
1128 1133
1129 return 0; 1134 return 0;
1130 } 1135 }
1131 1136
1132 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(IncludeSelfOrNot i ncludeSelf) const 1137 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(IncludeSelfOrNot i ncludeSelf) const
1133 { 1138 {
1134 ASSERT(isAllowedToQueryCompositingState()); 1139 ASSERT(isAllowedToQueryCompositingState());
1135 1140
1136 if ((includeSelf == IncludeSelf) && (compositingState() == PaintsIntoOwnBack ing || compositingState() == PaintsIntoGroupedBacking)) 1141 if ((includeSelf == IncludeSelf) && isRepaintContainer())
1137 return const_cast<RenderLayer*>(this); 1142 return const_cast<RenderLayer*>(this);
1138 1143
1139 for (const RenderLayer* curr = compositingContainer(); curr; curr = curr->co mpositingContainer()) { 1144 for (const RenderLayer* curr = compositingContainer(); curr; curr = curr->co mpositingContainer()) {
1140 if (curr->compositingState() == PaintsIntoOwnBacking || curr->compositin gState() == PaintsIntoGroupedBacking) 1145 if (curr->isRepaintContainer())
1141 return const_cast<RenderLayer*>(curr); 1146 return const_cast<RenderLayer*>(curr);
1142 } 1147 }
1143 1148
1144 return 0; 1149 return 0;
1145 } 1150 }
1146 1151
1147 RenderLayer* RenderLayer::ancestorCompositedScrollingLayer() const 1152 RenderLayer* RenderLayer::ancestorCompositedScrollingLayer() const
1148 { 1153 {
1149 if (!compositor()->legacyOrCurrentAcceleratedCompositingForOverflowScrollEna bled()) 1154 if (!compositor()->legacyOrCurrentAcceleratedCompositingForOverflowScrollEna bled())
1150 return 0; 1155 return 0;
(...skipping 2865 matching lines...) Expand 10 before | Expand all | Expand 10 after
4016 } 4021 }
4017 } 4022 }
4018 4023
4019 void showLayerTree(const WebCore::RenderObject* renderer) 4024 void showLayerTree(const WebCore::RenderObject* renderer)
4020 { 4025 {
4021 if (!renderer) 4026 if (!renderer)
4022 return; 4027 return;
4023 showLayerTree(renderer->enclosingLayer()); 4028 showLayerTree(renderer->enclosingLayer());
4024 } 4029 }
4025 #endif 4030 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698