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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerStackingNode.cpp

Issue 1798263002: Rename isTreatedAsOrStackingContext to isStacked (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows compile Created 4 years, 9 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
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 #include "core/layout/LayoutView.h" 46 #include "core/layout/LayoutView.h"
47 #include "core/layout/compositing/PaintLayerCompositor.h" 47 #include "core/layout/compositing/PaintLayerCompositor.h"
48 #include "core/paint/PaintLayer.h" 48 #include "core/paint/PaintLayer.h"
49 #include "public/platform/Platform.h" 49 #include "public/platform/Platform.h"
50 #include <algorithm> 50 #include <algorithm>
51 51
52 namespace blink { 52 namespace blink {
53 53
54 // FIXME: This should not require PaintLayer. There is currently a cycle where 54 // FIXME: This should not require PaintLayer. There is currently a cycle where
55 // in order to determine if we shoulBeTreatedAsStackingContext() we have to ask the paint 55 // in order to determine if we isStacked() we have to ask the paint
56 // layer about some of its state. 56 // layer about some of its state.
57 PaintLayerStackingNode::PaintLayerStackingNode(PaintLayer* layer) 57 PaintLayerStackingNode::PaintLayerStackingNode(PaintLayer* layer)
58 : m_layer(layer) 58 : m_layer(layer)
59 #if ENABLE(ASSERT) 59 #if ENABLE(ASSERT)
60 , m_layerListMutationAllowed(true) 60 , m_layerListMutationAllowed(true)
61 , m_stackingParent(0) 61 , m_stackingParent(0)
62 #endif 62 #endif
63 { 63 {
64 m_isTreatedAsOrStackingContext = shouldBeTreatedAsOrStackingContext(); 64 m_isStacked = layoutObject()->styleRef().isStacked();
65 65
66 // Non-stacking contexts should have empty z-order lists. As this is already the case, 66 // Non-stacking contexts should have empty z-order lists. As this is already the case,
67 // there is no need to dirty / recompute these lists. 67 // there is no need to dirty / recompute these lists.
68 m_zOrderListsDirty = isStackingContext(); 68 m_zOrderListsDirty = isStackingContext();
69 } 69 }
70 70
71 PaintLayerStackingNode::~PaintLayerStackingNode() 71 PaintLayerStackingNode::~PaintLayerStackingNode()
72 { 72 {
73 #if ENABLE(ASSERT) 73 #if ENABLE(ASSERT)
74 if (!layoutObject()->documentBeingDestroyed()) { 74 if (!layoutObject()->documentBeingDestroyed()) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 #endif 154 #endif
155 155
156 m_zOrderListsDirty = false; 156 m_zOrderListsDirty = false;
157 } 157 }
158 158
159 void PaintLayerStackingNode::collectLayers(OwnPtr<Vector<PaintLayerStackingNode* >>& posBuffer, OwnPtr<Vector<PaintLayerStackingNode*>>& negBuffer) 159 void PaintLayerStackingNode::collectLayers(OwnPtr<Vector<PaintLayerStackingNode* >>& posBuffer, OwnPtr<Vector<PaintLayerStackingNode*>>& negBuffer)
160 { 160 {
161 if (layer()->isInTopLayer()) 161 if (layer()->isInTopLayer())
162 return; 162 return;
163 163
164 if (isTreatedAsOrStackingContext()) { 164 if (isStacked()) {
165 OwnPtr<Vector<PaintLayerStackingNode*>>& buffer = (zIndex() >= 0) ? posB uffer : negBuffer; 165 OwnPtr<Vector<PaintLayerStackingNode*>>& buffer = (zIndex() >= 0) ? posB uffer : negBuffer;
166 if (!buffer) 166 if (!buffer)
167 buffer = adoptPtr(new Vector<PaintLayerStackingNode*>); 167 buffer = adoptPtr(new Vector<PaintLayerStackingNode*>);
168 buffer->append(this); 168 buffer->append(this);
169 } 169 }
170 170
171 if (!isStackingContext()) { 171 if (!isStackingContext()) {
172 for (PaintLayer* child = layer()->firstChild(); child; child = child->ne xtSibling()) { 172 for (PaintLayer* child = layer()->firstChild(); child; child = child->ne xtSibling()) {
173 if (!layer()->reflectionInfo() || layer()->reflectionInfo()->reflect ionLayer() != child) 173 if (!layer()->reflectionInfo() || layer()->reflectionInfo()->reflect ionLayer() != child)
174 child->stackingNode()->collectLayers(posBuffer, negBuffer); 174 child->stackingNode()->collectLayers(posBuffer, negBuffer);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 { 210 {
211 updateZOrderLists(); 211 updateZOrderLists();
212 212
213 if (!layer()->reflectionInfo()) 213 if (!layer()->reflectionInfo())
214 return; 214 return;
215 215
216 PaintLayer* reflectionLayer = layer()->reflectionInfo()->reflectionLayer(); 216 PaintLayer* reflectionLayer = layer()->reflectionInfo()->reflectionLayer();
217 reflectionLayer->stackingNode()->updateZOrderLists(); 217 reflectionLayer->stackingNode()->updateZOrderLists();
218 } 218 }
219 219
220 void PaintLayerStackingNode::updateStackingNodesAfterStyleChange(const ComputedS tyle* oldStyle) 220 void PaintLayerStackingNode::styleDidChange(const ComputedStyle* oldStyle)
221 { 221 {
222 bool wasStackingContext = oldStyle ? !oldStyle->hasAutoZIndex() : false; 222 bool wasStackingContext = oldStyle ? oldStyle->isStackingContext() : false;
223 int oldZIndex = oldStyle ? oldStyle->zIndex() : 0; 223 int oldZIndex = oldStyle ? oldStyle->zIndex() : 0;
224 224
225 bool isStackingContext = this->isStackingContext(); 225 bool isStackingContext = this->isStackingContext();
226 if (isStackingContext == wasStackingContext && oldZIndex == zIndex()) 226 bool shouldBeStacked = layoutObject()->styleRef().isStacked();
227 if (isStackingContext == wasStackingContext && m_isStacked == shouldBeStacke d && oldZIndex == zIndex())
227 return; 228 return;
228 229
229 dirtyStackingContextZOrderLists(); 230 dirtyStackingContextZOrderLists();
230 231
231 if (isStackingContext) 232 if (isStackingContext)
232 dirtyZOrderLists(); 233 dirtyZOrderLists();
233 else 234 else
234 clearZOrderLists(); 235 clearZOrderLists();
235 }
236 236
237 void PaintLayerStackingNode::updateIsTreatedAsStackingContext() 237 if (m_isStacked != shouldBeStacked) {
238 { 238 m_isStacked = shouldBeStacked;
239 bool isTreatedAsOrStackingContext = shouldBeTreatedAsOrStackingContext(); 239 if (!layoutObject()->documentBeingDestroyed() && !layer()->isRootLayer() )
240 if (isTreatedAsOrStackingContext == this->isTreatedAsOrStackingContext()) 240 compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree );
241 return; 241 }
242
243 m_isTreatedAsOrStackingContext = isTreatedAsOrStackingContext;
244 if (!layoutObject()->documentBeingDestroyed() && !layer()->isRootLayer())
245 compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree);
246 dirtyStackingContextZOrderLists();
247 } 242 }
248 243
249 PaintLayerStackingNode* PaintLayerStackingNode::ancestorStackingContextNode() co nst 244 PaintLayerStackingNode* PaintLayerStackingNode::ancestorStackingContextNode() co nst
250 { 245 {
251 for (PaintLayer* ancestor = layer()->parent(); ancestor; ancestor = ancestor ->parent()) { 246 for (PaintLayer* ancestor = layer()->parent(); ancestor; ancestor = ancestor ->parent()) {
252 PaintLayerStackingNode* stackingNode = ancestor->stackingNode(); 247 PaintLayerStackingNode* stackingNode = ancestor->stackingNode();
253 if (stackingNode->isStackingContext()) 248 if (stackingNode->isStackingContext())
254 return stackingNode; 249 return stackingNode;
255 } 250 }
256 return 0; 251 return 0;
257 } 252 }
258 253
259 LayoutBoxModelObject* PaintLayerStackingNode::layoutObject() const 254 LayoutBoxModelObject* PaintLayerStackingNode::layoutObject() const
260 { 255 {
261 return m_layer->layoutObject(); 256 return m_layer->layoutObject();
262 } 257 }
263 258
264 } // namespace blink 259 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698