Index: third_party/WebKit/Source/core/paint/PaintLayerStackingNode.h |
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.h b/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.h |
index 15a42259b6a14da477a716952d36812365143d2f..9193cbc968e8369d3ccc215fed52ebd90b23ce94 100644 |
--- a/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.h |
+++ b/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.h |
@@ -64,7 +64,7 @@ class LayoutBoxModelObject; |
// Stacking contexts are the basis for the CSS painting algorithm. The paint |
// order is determined by walking stacking contexts (or elements treated like a |
// stacking context like positioned objects or floats) in an order defined by |
-// ‘z-index’. This walk is interleaved with content that is not a stacking. |
+// ‘z-index’. This walk is interleaved with content that is not a stacking |
// context. See CSS 2.1 appendix E for the actual algorithm |
// http://www.w3.org/TR/CSS21/zindex.html |
// See also PaintLayerPainter (in particular paintLayerContents) for |
@@ -105,8 +105,8 @@ public: |
bool hasPositiveZOrderList() const { return posZOrderList() && posZOrderList()->size(); } |
bool hasNegativeZOrderList() const { return negZOrderList() && negZOrderList()->size(); } |
- bool isTreatedAsOrStackingContext() const { return m_isTreatedAsOrStackingContext; } |
- void updateIsTreatedAsStackingContext(); |
+ bool isStacked() const { return m_isStacked; } |
+ void updateIsStacked(); |
void updateStackingNodesAfterStyleChange(const ComputedStyle* oldStyle); |
@@ -119,6 +119,18 @@ public: |
void setLayerListMutationAllowed(bool flag) { m_layerListMutationAllowed = flag; } |
#endif |
+ // Stacking contexts and positioned elements[1] are stacked (sorted in negZOrderList |
+ // and posZOrderList) in their enclosing stacking contexts. |
+ // |
+ // [1] According to CSS2.1, Appendix E.2.8 (https://www.w3.org/TR/CSS21/zindex.html), |
+ // positioned elements with 'z-index: auto' are "treated as if it created a new |
+ // stacking context" and z-ordered together with other elements with 'z-index: 0'. |
+ // The difference of them from normal stacking contexts is that they don't determine |
+ // the stacking of the elements underneath them. |
+ // (Note: There are also other elements treated as stacking context during painting, |
+ // but not managed in stacks. See ObjectPainter::paintAllPhasesAtomically().) |
pdr.
2016/03/16 02:22:53
Optional, may want to add a link to the markdown t
Xianzhu
2016/03/16 18:10:24
Done.
|
+ static bool shouldStackObject(const LayoutObject& object) { return object.styleRef().isStackingContext() || object.isPositioned(); } |
+ |
private: |
friend class PaintLayerStackingNodeIterator; |
friend class PaintLayerStackingNodeReverseIterator; |
@@ -147,8 +159,6 @@ private: |
void setStackingParent(PaintLayerStackingNode* stackingParent) { m_stackingParent = stackingParent; } |
#endif |
- bool shouldBeTreatedAsOrStackingContext() const { return layoutObject()->style()->isTreatedAsOrStackingContext(); } |
- |
bool isDirtyStackingContext() const { return m_zOrderListsDirty && isStackingContext(); } |
PaintLayerCompositor* compositor() const; |
@@ -158,7 +168,7 @@ private: |
PaintLayer* m_layer; |
// m_posZOrderList holds a sorted list of all the descendant nodes within |
- // that have z-indices of 0 or greater (auto will count as 0). |
+ // that have z-indices of 0 (or is treated as 0 for positioned objects) or greater. |
// m_negZOrderList holds descendants within our stacking context with |
// negative z-indices. |
OwnPtr<Vector<PaintLayerStackingNode*>> m_posZOrderList; |
@@ -169,11 +179,10 @@ private: |
// have z-order lists. |
unsigned m_zOrderListsDirty : 1; |
- // This attribute caches whether the element was a stacking context or |
- // was treated like a stacking context, so that we can do comparison against |
+ // This attribute caches whether the element was stacked, so that we can do comparison against |
// it during style change (styleDidChange in particular), as we have lost |
// the previous style information. |
- unsigned m_isTreatedAsOrStackingContext: 1; |
+ unsigned m_isStacked: 1; |
#if ENABLE(ASSERT) |
unsigned m_layerListMutationAllowed : 1; |