| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * | 4 * |
| 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 6 * | 6 * |
| 7 * Other contributors: | 7 * Other contributors: |
| 8 * Robert O'Callahan <roc+@cs.cmu.edu> | 8 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 9 * David Baron <dbaron@fas.harvard.edu> | 9 * David Baron <dbaron@fas.harvard.edu> |
| 10 * Christian Biesinger <cbiesinger@web.de> | 10 * Christian Biesinger <cbiesinger@web.de> |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 #endif | 67 #endif |
| 68 { | 68 { |
| 69 m_isStacked = layoutObject()->styleRef().isStacked(); | 69 m_isStacked = layoutObject()->styleRef().isStacked(); |
| 70 | 70 |
| 71 // Non-stacking contexts should have empty z-order lists. As this is already | 71 // Non-stacking contexts should have empty z-order lists. As this is already |
| 72 // the case, there is no need to dirty / recompute these lists. | 72 // the case, there is no need to dirty / recompute these lists. |
| 73 m_zOrderListsDirty = isStackingContext(); | 73 m_zOrderListsDirty = isStackingContext(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 PaintLayerStackingNode::~PaintLayerStackingNode() { | 76 PaintLayerStackingNode::~PaintLayerStackingNode() { |
| 77 #if ENABLE(ASSERT) | 77 #if DCHECK_IS_ON() |
| 78 if (!layoutObject()->documentBeingDestroyed()) { | 78 if (!layoutObject()->documentBeingDestroyed()) { |
| 79 DCHECK(!isInStackingParentZOrderLists()); | 79 DCHECK(!isInStackingParentZOrderLists()); |
| 80 | 80 |
| 81 updateStackingParentForZOrderLists(0); | 81 updateStackingParentForZOrderLists(0); |
| 82 } | 82 } |
| 83 #endif | 83 #endif |
| 84 } | 84 } |
| 85 | 85 |
| 86 // Helper for the sorting of layers by z-index. | 86 // Helper for the sorting of layers by z-index. |
| 87 static inline bool compareZIndex(PaintLayerStackingNode* first, | 87 static inline bool compareZIndex(PaintLayerStackingNode* first, |
| 88 PaintLayerStackingNode* second) { | 88 PaintLayerStackingNode* second) { |
| 89 return first->zIndex() < second->zIndex(); | 89 return first->zIndex() < second->zIndex(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 PaintLayerCompositor* PaintLayerStackingNode::compositor() const { | 92 PaintLayerCompositor* PaintLayerStackingNode::compositor() const { |
| 93 DCHECK(layoutObject()->view()); | 93 DCHECK(layoutObject()->view()); |
| 94 return layoutObject()->view()->compositor(); | 94 return layoutObject()->view()->compositor(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void PaintLayerStackingNode::dirtyZOrderLists() { | 97 void PaintLayerStackingNode::dirtyZOrderLists() { |
| 98 #if DCHECK_IS_ON() | 98 #if DCHECK_IS_ON() |
| 99 DCHECK(m_layerListMutationAllowed); | 99 DCHECK(m_layerListMutationAllowed); |
| 100 #endif | 100 #endif |
| 101 DCHECK(isStackingContext()); | 101 DCHECK(isStackingContext()); |
| 102 | 102 |
| 103 #if ENABLE(ASSERT) | 103 #if DCHECK_IS_ON() |
| 104 updateStackingParentForZOrderLists(0); | 104 updateStackingParentForZOrderLists(0); |
| 105 #endif | 105 #endif |
| 106 | 106 |
| 107 if (m_posZOrderList) | 107 if (m_posZOrderList) |
| 108 m_posZOrderList->clear(); | 108 m_posZOrderList->clear(); |
| 109 if (m_negZOrderList) | 109 if (m_negZOrderList) |
| 110 m_negZOrderList->clear(); | 110 m_negZOrderList->clear(); |
| 111 m_zOrderListsDirty = true; | 111 m_zOrderListsDirty = true; |
| 112 | 112 |
| 113 if (!layoutObject()->documentBeingDestroyed()) | 113 if (!layoutObject()->documentBeingDestroyed()) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // Create the buffer if it doesn't exist yet. | 160 // Create the buffer if it doesn't exist yet. |
| 161 if (!m_posZOrderList) { | 161 if (!m_posZOrderList) { |
| 162 m_posZOrderList = | 162 m_posZOrderList = |
| 163 WTF::wrapUnique(new Vector<PaintLayerStackingNode*>); | 163 WTF::wrapUnique(new Vector<PaintLayerStackingNode*>); |
| 164 } | 164 } |
| 165 m_posZOrderList->push_back(layer->stackingNode()); | 165 m_posZOrderList->push_back(layer->stackingNode()); |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 | 169 |
| 170 #if ENABLE(ASSERT) | 170 #if DCHECK_IS_ON() |
| 171 updateStackingParentForZOrderLists(this); | 171 updateStackingParentForZOrderLists(this); |
| 172 #endif | 172 #endif |
| 173 | 173 |
| 174 m_zOrderListsDirty = false; | 174 m_zOrderListsDirty = false; |
| 175 } | 175 } |
| 176 | 176 |
| 177 void PaintLayerStackingNode::collectLayers( | 177 void PaintLayerStackingNode::collectLayers( |
| 178 std::unique_ptr<Vector<PaintLayerStackingNode*>>& posBuffer, | 178 std::unique_ptr<Vector<PaintLayerStackingNode*>>& posBuffer, |
| 179 std::unique_ptr<Vector<PaintLayerStackingNode*>>& negBuffer) { | 179 std::unique_ptr<Vector<PaintLayerStackingNode*>>& negBuffer) { |
| 180 if (layer()->isInTopLayer()) | 180 if (layer()->isInTopLayer()) |
| 181 return; | 181 return; |
| 182 | 182 |
| 183 if (isStacked()) { | 183 if (isStacked()) { |
| 184 std::unique_ptr<Vector<PaintLayerStackingNode*>>& buffer = | 184 std::unique_ptr<Vector<PaintLayerStackingNode*>>& buffer = |
| 185 (zIndex() >= 0) ? posBuffer : negBuffer; | 185 (zIndex() >= 0) ? posBuffer : negBuffer; |
| 186 if (!buffer) | 186 if (!buffer) |
| 187 buffer = WTF::wrapUnique(new Vector<PaintLayerStackingNode*>); | 187 buffer = WTF::wrapUnique(new Vector<PaintLayerStackingNode*>); |
| 188 buffer->push_back(this); | 188 buffer->push_back(this); |
| 189 } | 189 } |
| 190 | 190 |
| 191 if (!isStackingContext()) { | 191 if (!isStackingContext()) { |
| 192 for (PaintLayer* child = layer()->firstChild(); child; | 192 for (PaintLayer* child = layer()->firstChild(); child; |
| 193 child = child->nextSibling()) | 193 child = child->nextSibling()) |
| 194 child->stackingNode()->collectLayers(posBuffer, negBuffer); | 194 child->stackingNode()->collectLayers(posBuffer, negBuffer); |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 | 197 |
| 198 #if ENABLE(ASSERT) | 198 #if DCHECK_IS_ON() |
| 199 bool PaintLayerStackingNode::isInStackingParentZOrderLists() const { | 199 bool PaintLayerStackingNode::isInStackingParentZOrderLists() const { |
| 200 if (!m_stackingParent || m_stackingParent->zOrderListsDirty()) | 200 if (!m_stackingParent || m_stackingParent->zOrderListsDirty()) |
| 201 return false; | 201 return false; |
| 202 | 202 |
| 203 if (m_stackingParent->posZOrderList() && | 203 if (m_stackingParent->posZOrderList() && |
| 204 m_stackingParent->posZOrderList()->find(this) != kNotFound) | 204 m_stackingParent->posZOrderList()->find(this) != kNotFound) |
| 205 return true; | 205 return true; |
| 206 | 206 |
| 207 if (m_stackingParent->negZOrderList() && | 207 if (m_stackingParent->negZOrderList() && |
| 208 m_stackingParent->negZOrderList()->find(this) != kNotFound) | 208 m_stackingParent->negZOrderList()->find(this) != kNotFound) |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 return stackingNode; | 263 return stackingNode; |
| 264 } | 264 } |
| 265 return 0; | 265 return 0; |
| 266 } | 266 } |
| 267 | 267 |
| 268 LayoutBoxModelObject* PaintLayerStackingNode::layoutObject() const { | 268 LayoutBoxModelObject* PaintLayerStackingNode::layoutObject() const { |
| 269 return m_layer->layoutObject(); | 269 return m_layer->layoutObject(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 } // namespace blink | 272 } // namespace blink |
| OLD | NEW |