| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 } | 176 } |
| 177 | 177 |
| 178 void RenderLayerStackingNode::updateNormalFlowList() | 178 void RenderLayerStackingNode::updateNormalFlowList() |
| 179 { | 179 { |
| 180 if (!m_normalFlowListDirty) | 180 if (!m_normalFlowListDirty) |
| 181 return; | 181 return; |
| 182 | 182 |
| 183 ASSERT(m_layerListMutationAllowed); | 183 ASSERT(m_layerListMutationAllowed); |
| 184 | 184 |
| 185 for (RenderLayer* child = layer()->firstChild(); child; child = child->nextS
ibling()) { | 185 for (RenderLayer* child = layer()->firstChild(); child; child = child->nextS
ibling()) { |
| 186 // Ignore non-overflow layers and reflections. | |
| 187 if (child->stackingNode()->isNormalFlowOnly() && (!layer()->reflectionIn
fo() || layer()->reflectionInfo()->reflectionLayer() != child)) { | 186 if (child->stackingNode()->isNormalFlowOnly() && (!layer()->reflectionIn
fo() || layer()->reflectionInfo()->reflectionLayer() != child)) { |
| 188 if (!m_normalFlowList) | 187 if (!m_normalFlowList) |
| 189 m_normalFlowList = adoptPtr(new Vector<RenderLayerStackingNode*>
); | 188 m_normalFlowList = adoptPtr(new Vector<RenderLayerStackingNode*>
); |
| 190 m_normalFlowList->append(child->stackingNode()); | 189 m_normalFlowList->append(child->stackingNode()); |
| 191 } | 190 } |
| 192 } | 191 } |
| 193 | 192 |
| 194 #if !ASSERT_DISABLED | 193 #if !ASSERT_DISABLED |
| 195 updateStackingParentForNormalFlowList(this); | 194 updateStackingParentForNormalFlowList(this); |
| 196 #endif | 195 #endif |
| 197 | 196 |
| 198 m_normalFlowListDirty = false; | 197 m_normalFlowListDirty = false; |
| 199 } | 198 } |
| 200 | 199 |
| 201 void RenderLayerStackingNode::collectLayers(OwnPtr<Vector<RenderLayerStackingNod
e*> >& posBuffer, OwnPtr<Vector<RenderLayerStackingNode*> >& negBuffer) | 200 void RenderLayerStackingNode::collectLayers(OwnPtr<Vector<RenderLayerStackingNod
e*> >& posBuffer, OwnPtr<Vector<RenderLayerStackingNode*> >& negBuffer) |
| 202 { | 201 { |
| 203 if (layer()->isInTopLayer()) | 202 if (layer()->isInTopLayer()) |
| 204 return; | 203 return; |
| 205 | 204 |
| 206 layer()->updateDescendantDependentFlags(); | 205 layer()->updateDescendantDependentFlags(); |
| 207 | 206 |
| 208 // Overflow layers are just painted by their enclosing layers, so they don't
get put in zorder lists. | |
| 209 if (!isNormalFlowOnly()) { | 207 if (!isNormalFlowOnly()) { |
| 210 // Determine which buffer the child should be in. | |
| 211 OwnPtr<Vector<RenderLayerStackingNode*> >& buffer = (zIndex() >= 0) ? po
sBuffer : negBuffer; | 208 OwnPtr<Vector<RenderLayerStackingNode*> >& buffer = (zIndex() >= 0) ? po
sBuffer : negBuffer; |
| 212 | |
| 213 // Create the buffer if it doesn't exist yet. | |
| 214 if (!buffer) | 209 if (!buffer) |
| 215 buffer = adoptPtr(new Vector<RenderLayerStackingNode*>); | 210 buffer = adoptPtr(new Vector<RenderLayerStackingNode*>); |
| 216 | |
| 217 // Append ourselves at the end of the appropriate buffer. | |
| 218 buffer->append(this); | 211 buffer->append(this); |
| 219 } | 212 } |
| 220 | 213 |
| 221 // Recur into our children to collect more layers, but only if we don't esta
blish a stacking context. | |
| 222 if (!isStackingContext()) { | 214 if (!isStackingContext()) { |
| 223 for (RenderLayer* child = layer()->firstChild(); child; child = child->n
extSibling()) { | 215 for (RenderLayer* child = layer()->firstChild(); child; child = child->n
extSibling()) { |
| 224 // Ignore reflections. | |
| 225 if (!layer()->reflectionInfo() || layer()->reflectionInfo()->reflect
ionLayer() != child) | 216 if (!layer()->reflectionInfo() || layer()->reflectionInfo()->reflect
ionLayer() != child) |
| 226 child->stackingNode()->collectLayers(posBuffer, negBuffer); | 217 child->stackingNode()->collectLayers(posBuffer, negBuffer); |
| 227 } | 218 } |
| 228 } | 219 } |
| 229 } | 220 } |
| 230 | 221 |
| 231 #if !ASSERT_DISABLED | 222 #if !ASSERT_DISABLED |
| 232 bool RenderLayerStackingNode::isInStackingParentZOrderLists() const | 223 bool RenderLayerStackingNode::isInStackingParentZOrderLists() const |
| 233 { | 224 { |
| 234 if (!m_stackingParent || m_stackingParent->zOrderListsDirty()) | 225 if (!m_stackingParent || m_stackingParent->zOrderListsDirty()) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 return; | 287 return; |
| 297 | 288 |
| 298 dirtyStackingContextZOrderLists(); | 289 dirtyStackingContextZOrderLists(); |
| 299 | 290 |
| 300 if (isStackingContext) | 291 if (isStackingContext) |
| 301 dirtyZOrderLists(); | 292 dirtyZOrderLists(); |
| 302 else | 293 else |
| 303 clearZOrderLists(); | 294 clearZOrderLists(); |
| 304 } | 295 } |
| 305 | 296 |
| 297 // FIXME: Rename shouldBeNormalFlowOnly to something more accurate now that CSS |
| 298 // 2.1 defines the term "normal flow". |
| 306 bool RenderLayerStackingNode::shouldBeNormalFlowOnly() const | 299 bool RenderLayerStackingNode::shouldBeNormalFlowOnly() const |
| 307 { | 300 { |
| 308 RenderLayerModelObject* renderer = this->renderer(); | 301 return !isStackingContext() && !renderer()->isPositioned(); |
| 309 | |
| 310 const bool couldBeNormalFlow = renderer->hasOverflowClip() | |
| 311 || renderer->hasReflection() | |
| 312 || renderer->hasMask() | |
| 313 || renderer->isCanvas() | |
| 314 || renderer->isVideo() | |
| 315 || renderer->isEmbeddedObject() | |
| 316 || renderer->isRenderIFrame() | |
| 317 || (renderer->style()->specifiesColumns() && !layer()->isRootLayer()); | |
| 318 | |
| 319 const bool preventsElementFromBeingNormalFlow = renderer->isPositioned() | |
| 320 || renderer->hasTransform() | |
| 321 || renderer->hasClipPath() | |
| 322 || renderer->hasFilter() | |
| 323 || renderer->hasBlendMode() | |
| 324 || layer()->isTransparent(); | |
| 325 | |
| 326 return couldBeNormalFlow && !preventsElementFromBeingNormalFlow; | |
| 327 } | 302 } |
| 328 | 303 |
| 329 void RenderLayerStackingNode::updateIsNormalFlowOnly() | 304 void RenderLayerStackingNode::updateIsNormalFlowOnly() |
| 330 { | 305 { |
| 331 bool isNormalFlowOnly = shouldBeNormalFlowOnly(); | 306 bool isNormalFlowOnly = shouldBeNormalFlowOnly(); |
| 332 if (isNormalFlowOnly == this->isNormalFlowOnly()) | 307 if (isNormalFlowOnly == this->isNormalFlowOnly()) |
| 333 return; | 308 return; |
| 334 | 309 |
| 335 m_isNormalFlowOnly = isNormalFlowOnly; | 310 m_isNormalFlowOnly = isNormalFlowOnly; |
| 336 if (RenderLayer* p = layer()->parent()) | 311 if (RenderLayer* p = layer()->parent()) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 347 } | 322 } |
| 348 return 0; | 323 return 0; |
| 349 } | 324 } |
| 350 | 325 |
| 351 RenderLayerModelObject* RenderLayerStackingNode::renderer() const | 326 RenderLayerModelObject* RenderLayerStackingNode::renderer() const |
| 352 { | 327 { |
| 353 return m_layer->renderer(); | 328 return m_layer->renderer(); |
| 354 } | 329 } |
| 355 | 330 |
| 356 } // namespace WebCore | 331 } // namespace WebCore |
| OLD | NEW |