OLD | NEW |
---|---|
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 shoulBeTreatedAsStackingContext() 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 = shouldStackObject(*layoutObject()); |
chrishtr
2016/03/16 16:26:16
Why is this code caching shouldStackObject(*layout
Xianzhu
2016/03/16 18:10:24
According to the comment for PaintLayerStackingNod
chrishtr
2016/03/16 18:15:09
Ok then I suggest renaming updateIsStacked to styl
Xianzhu
2016/03/16 21:28:41
The static shouldStackObject was also for another
| |
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 Loading... | |
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 return; | 227 return; |
228 | 228 |
229 dirtyStackingContextZOrderLists(); | 229 dirtyStackingContextZOrderLists(); |
230 | 230 |
231 if (isStackingContext) | 231 if (isStackingContext) |
232 dirtyZOrderLists(); | 232 dirtyZOrderLists(); |
233 else | 233 else |
234 clearZOrderLists(); | 234 clearZOrderLists(); |
235 } | 235 } |
236 | 236 |
237 void PaintLayerStackingNode::updateIsTreatedAsStackingContext() | 237 void PaintLayerStackingNode::updateIsStacked() |
238 { | 238 { |
239 bool isTreatedAsOrStackingContext = shouldBeTreatedAsOrStackingContext(); | 239 bool isStackedContent = shouldStackObject(*layoutObject()); |
240 if (isTreatedAsOrStackingContext == this->isTreatedAsOrStackingContext()) | 240 if (isStackedContent == m_isStacked) |
241 return; | 241 return; |
242 | 242 |
243 m_isTreatedAsOrStackingContext = isTreatedAsOrStackingContext; | 243 m_isStacked = isStackedContent; |
244 if (!layoutObject()->documentBeingDestroyed() && !layer()->isRootLayer()) | 244 if (!layoutObject()->documentBeingDestroyed() && !layer()->isRootLayer()) |
245 compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree); | 245 compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree); |
246 dirtyStackingContextZOrderLists(); | 246 dirtyStackingContextZOrderLists(); |
247 } | 247 } |
248 | 248 |
249 PaintLayerStackingNode* PaintLayerStackingNode::ancestorStackingContextNode() co nst | 249 PaintLayerStackingNode* PaintLayerStackingNode::ancestorStackingContextNode() co nst |
250 { | 250 { |
251 for (PaintLayer* ancestor = layer()->parent(); ancestor; ancestor = ancestor ->parent()) { | 251 for (PaintLayer* ancestor = layer()->parent(); ancestor; ancestor = ancestor ->parent()) { |
252 PaintLayerStackingNode* stackingNode = ancestor->stackingNode(); | 252 PaintLayerStackingNode* stackingNode = ancestor->stackingNode(); |
253 if (stackingNode->isStackingContext()) | 253 if (stackingNode->isStackingContext()) |
254 return stackingNode; | 254 return stackingNode; |
255 } | 255 } |
256 return 0; | 256 return 0; |
257 } | 257 } |
258 | 258 |
259 LayoutBoxModelObject* PaintLayerStackingNode::layoutObject() const | 259 LayoutBoxModelObject* PaintLayerStackingNode::layoutObject() const |
260 { | 260 { |
261 return m_layer->layoutObject(); | 261 return m_layer->layoutObject(); |
262 } | 262 } |
263 | 263 |
264 } // namespace blink | 264 } // namespace blink |
OLD | NEW |