| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 void RenderLayerStackingNode::dirtyZOrderLists() | 90 void RenderLayerStackingNode::dirtyZOrderLists() |
| 91 { | 91 { |
| 92 ASSERT(m_layerListMutationAllowed); | 92 ASSERT(m_layerListMutationAllowed); |
| 93 ASSERT(isStackingContext()); | 93 ASSERT(isStackingContext()); |
| 94 | 94 |
| 95 #if ENABLE(ASSERT) | 95 #if ENABLE(ASSERT) |
| 96 updateStackingParentForZOrderLists(0); | 96 updateStackingParentForZOrderLists(0); |
| 97 #endif | 97 #endif |
| 98 | 98 |
| 99 if (m_posZOrderList) | 99 if (m_zOrderList) |
| 100 m_posZOrderList->clear(); | 100 m_zOrderList->clear(); |
| 101 if (m_negZOrderList) | |
| 102 m_negZOrderList->clear(); | |
| 103 m_zOrderListsDirty = true; | 101 m_zOrderListsDirty = true; |
| 104 } | 102 } |
| 105 | 103 |
| 106 void RenderLayerStackingNode::dirtyStackingContextZOrderLists() | 104 void RenderLayerStackingNode::dirtyStackingContextZOrderLists() |
| 107 { | 105 { |
| 108 if (RenderLayerStackingNode* stackingNode = ancestorStackingContextNode()) | 106 if (RenderLayerStackingNode* stackingNode = ancestorStackingContextNode()) |
| 109 stackingNode->dirtyZOrderLists(); | 107 stackingNode->dirtyZOrderLists(); |
| 110 } | 108 } |
| 111 | 109 |
| 112 void RenderLayerStackingNode::dirtyNormalFlowList() | 110 void RenderLayerStackingNode::dirtyNormalFlowList() |
| 113 { | 111 { |
| 114 ASSERT(m_layerListMutationAllowed); | 112 ASSERT(m_layerListMutationAllowed); |
| 115 | 113 |
| 116 #if ENABLE(ASSERT) | 114 #if ENABLE(ASSERT) |
| 117 updateStackingParentForNormalFlowList(0); | 115 updateStackingParentForNormalFlowList(0); |
| 118 #endif | 116 #endif |
| 119 | 117 |
| 120 if (m_normalFlowList) | 118 if (m_normalFlowList) |
| 121 m_normalFlowList->clear(); | 119 m_normalFlowList->clear(); |
| 122 m_normalFlowListDirty = true; | 120 m_normalFlowListDirty = true; |
| 123 } | 121 } |
| 124 | 122 |
| 125 void RenderLayerStackingNode::rebuildZOrderLists() | 123 void RenderLayerStackingNode::rebuildZOrderLists() |
| 126 { | 124 { |
| 127 ASSERT(m_layerListMutationAllowed); | 125 ASSERT(m_layerListMutationAllowed); |
| 128 ASSERT(isDirtyStackingContext()); | 126 ASSERT(isDirtyStackingContext()); |
| 129 | 127 |
| 130 for (RenderLayer* child = layer()->firstChild(); child; child = child->nextS
ibling()) | 128 for (RenderLayer* child = layer()->firstChild(); child; child = child->nextS
ibling()) |
| 131 child->stackingNode()->collectLayers(m_posZOrderList, m_negZOrderList); | 129 child->stackingNode()->collectLayers(m_zOrderList); |
| 132 | 130 |
| 133 // Sort the two lists. | 131 if (m_zOrderList) |
| 134 if (m_posZOrderList) | 132 std::stable_sort(m_zOrderList->begin(), m_zOrderList->end(), compareZInd
ex); |
| 135 std::stable_sort(m_posZOrderList->begin(), m_posZOrderList->end(), compa
reZIndex); | |
| 136 | |
| 137 if (m_negZOrderList) | |
| 138 std::stable_sort(m_negZOrderList->begin(), m_negZOrderList->end(), compa
reZIndex); | |
| 139 | 133 |
| 140 #if ENABLE(ASSERT) | 134 #if ENABLE(ASSERT) |
| 141 updateStackingParentForZOrderLists(this); | 135 updateStackingParentForZOrderLists(this); |
| 142 #endif | 136 #endif |
| 143 | 137 |
| 144 m_zOrderListsDirty = false; | 138 m_zOrderListsDirty = false; |
| 145 } | 139 } |
| 146 | 140 |
| 147 void RenderLayerStackingNode::updateNormalFlowList() | 141 void RenderLayerStackingNode::updateNormalFlowList() |
| 148 { | 142 { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 159 } | 153 } |
| 160 } | 154 } |
| 161 | 155 |
| 162 #if ENABLE(ASSERT) | 156 #if ENABLE(ASSERT) |
| 163 updateStackingParentForNormalFlowList(this); | 157 updateStackingParentForNormalFlowList(this); |
| 164 #endif | 158 #endif |
| 165 | 159 |
| 166 m_normalFlowListDirty = false; | 160 m_normalFlowListDirty = false; |
| 167 } | 161 } |
| 168 | 162 |
| 169 void RenderLayerStackingNode::collectLayers(OwnPtr<Vector<RenderLayerStackingNod
e*> >& posBuffer, OwnPtr<Vector<RenderLayerStackingNode*> >& negBuffer) | 163 void RenderLayerStackingNode::collectLayers(OwnPtr<Vector<RenderLayerStackingNod
e*> >& buffer) |
| 170 { | 164 { |
| 171 if (!isNormalFlowOnly()) { | 165 if (!isNormalFlowOnly()) { |
| 172 OwnPtr<Vector<RenderLayerStackingNode*> >& buffer = (zIndex() >= 0) ? po
sBuffer : negBuffer; | |
| 173 if (!buffer) | 166 if (!buffer) |
| 174 buffer = adoptPtr(new Vector<RenderLayerStackingNode*>); | 167 buffer = adoptPtr(new Vector<RenderLayerStackingNode*>); |
| 175 buffer->append(this); | 168 buffer->append(this); |
| 176 } | 169 } |
| 177 | 170 |
| 178 if (!isStackingContext()) { | 171 if (!isStackingContext()) { |
| 179 for (RenderLayer* child = layer()->firstChild(); child; child = child->n
extSibling()) | 172 for (RenderLayer* child = layer()->firstChild(); child; child = child->n
extSibling()) |
| 180 child->stackingNode()->collectLayers(posBuffer, negBuffer); | 173 child->stackingNode()->collectLayers(buffer); |
| 181 } | 174 } |
| 182 } | 175 } |
| 183 | 176 |
| 184 #if ENABLE(ASSERT) | 177 #if ENABLE(ASSERT) |
| 185 bool RenderLayerStackingNode::isInStackingParentZOrderLists() const | 178 bool RenderLayerStackingNode::isInStackingParentZOrderLists() const |
| 186 { | 179 { |
| 187 if (!m_stackingParent || m_stackingParent->zOrderListsDirty()) | 180 if (!m_stackingParent || m_stackingParent->zOrderListsDirty()) |
| 188 return false; | 181 return false; |
| 189 | 182 |
| 190 if (m_stackingParent->posZOrderList() && m_stackingParent->posZOrderList()->
find(this) != kNotFound) | 183 if (m_stackingParent->zOrderList() && m_stackingParent->zOrderList()->find(t
his) != kNotFound) |
| 191 return true; | |
| 192 | |
| 193 if (m_stackingParent->negZOrderList() && m_stackingParent->negZOrderList()->
find(this) != kNotFound) | |
| 194 return true; | 184 return true; |
| 195 | 185 |
| 196 return false; | 186 return false; |
| 197 } | 187 } |
| 198 | 188 |
| 199 bool RenderLayerStackingNode::isInStackingParentNormalFlowList() const | 189 bool RenderLayerStackingNode::isInStackingParentNormalFlowList() const |
| 200 { | 190 { |
| 201 if (!m_stackingParent || m_stackingParent->normalFlowListDirty()) | 191 if (!m_stackingParent || m_stackingParent->normalFlowListDirty()) |
| 202 return false; | 192 return false; |
| 203 | 193 |
| 204 return (m_stackingParent->normalFlowList() && m_stackingParent->normalFlowLi
st()->find(this) != kNotFound); | 194 return (m_stackingParent->normalFlowList() && m_stackingParent->normalFlowLi
st()->find(this) != kNotFound); |
| 205 } | 195 } |
| 206 | 196 |
| 207 void RenderLayerStackingNode::updateStackingParentForZOrderLists(RenderLayerStac
kingNode* stackingParent) | 197 void RenderLayerStackingNode::updateStackingParentForZOrderLists(RenderLayerStac
kingNode* stackingParent) |
| 208 { | 198 { |
| 209 if (m_posZOrderList) { | 199 if (m_zOrderList) { |
| 210 for (size_t i = 0; i < m_posZOrderList->size(); ++i) | 200 for (size_t i = 0; i < m_zOrderList->size(); ++i) |
| 211 m_posZOrderList->at(i)->setStackingParent(stackingParent); | 201 m_zOrderList->at(i)->setStackingParent(stackingParent); |
| 212 } | |
| 213 | |
| 214 if (m_negZOrderList) { | |
| 215 for (size_t i = 0; i < m_negZOrderList->size(); ++i) | |
| 216 m_negZOrderList->at(i)->setStackingParent(stackingParent); | |
| 217 } | 202 } |
| 218 } | 203 } |
| 219 | 204 |
| 220 void RenderLayerStackingNode::updateStackingParentForNormalFlowList(RenderLayerS
tackingNode* stackingParent) | 205 void RenderLayerStackingNode::updateStackingParentForNormalFlowList(RenderLayerS
tackingNode* stackingParent) |
| 221 { | 206 { |
| 222 if (m_normalFlowList) { | 207 if (m_normalFlowList) { |
| 223 for (size_t i = 0; i < m_normalFlowList->size(); ++i) | 208 for (size_t i = 0; i < m_normalFlowList->size(); ++i) |
| 224 m_normalFlowList->at(i)->setStackingParent(stackingParent); | 209 m_normalFlowList->at(i)->setStackingParent(stackingParent); |
| 225 } | 210 } |
| 226 } | 211 } |
| 227 #endif | 212 #endif |
| 228 | 213 |
| 229 void RenderLayerStackingNode::updateLayerListsIfNeeded() | 214 void RenderLayerStackingNode::updateLayerListsIfNeeded() |
| 230 { | 215 { |
| 231 updateZOrderLists(); | 216 updateZOrderLists(); |
| 232 updateNormalFlowList(); | 217 updateNormalFlowList(); |
| 233 } | 218 } |
| 234 | 219 |
| 235 void RenderLayerStackingNode::updateStackingNodesAfterStyleChange(const RenderSt
yle* oldStyle) | 220 void RenderLayerStackingNode::updateStackingNodesAfterStyleChange(const RenderSt
yle* oldStyle) |
| 236 { | 221 { |
| 237 bool wasStackingContext = oldStyle ? !oldStyle->hasAutoZIndex() : false; | 222 bool wasStackingContext = oldStyle ? !oldStyle->hasAutoZIndex() : false; |
| 238 int oldZIndex = oldStyle ? oldStyle->zIndex() : 0; | 223 unsigned oldZIndex = oldStyle ? oldStyle->zIndex() : 0; |
| 239 | 224 |
| 240 bool isStackingContext = this->isStackingContext(); | 225 bool isStackingContext = this->isStackingContext(); |
| 241 if (isStackingContext == wasStackingContext && oldZIndex == zIndex()) | 226 if (isStackingContext == wasStackingContext && oldZIndex == zIndex()) |
| 242 return; | 227 return; |
| 243 | 228 |
| 244 dirtyStackingContextZOrderLists(); | 229 dirtyStackingContextZOrderLists(); |
| 245 | 230 |
| 246 if (isStackingContext) | 231 if (isStackingContext) |
| 247 dirtyZOrderLists(); | 232 dirtyZOrderLists(); |
| 248 else | 233 else |
| (...skipping 28 matching lines...) Expand all Loading... |
| 277 } | 262 } |
| 278 return 0; | 263 return 0; |
| 279 } | 264 } |
| 280 | 265 |
| 281 RenderLayerModelObject* RenderLayerStackingNode::renderer() const | 266 RenderLayerModelObject* RenderLayerStackingNode::renderer() const |
| 282 { | 267 { |
| 283 return m_layer->renderer(); | 268 return m_layer->renderer(); |
| 284 } | 269 } |
| 285 | 270 |
| 286 } // namespace blink | 271 } // namespace blink |
| OLD | NEW |