| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Intel Corporation. All rights reserved. | 3 * Copyright (C) 2013 Intel Corporation. All rights 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 class RenderLayer; | 55 class RenderLayer; |
| 56 class RenderStyle; | 56 class RenderStyle; |
| 57 | 57 |
| 58 class RenderLayerStackingNode { | 58 class RenderLayerStackingNode { |
| 59 WTF_MAKE_NONCOPYABLE(RenderLayerStackingNode); | 59 WTF_MAKE_NONCOPYABLE(RenderLayerStackingNode); |
| 60 public: | 60 public: |
| 61 explicit RenderLayerStackingNode(RenderLayer*); | 61 explicit RenderLayerStackingNode(RenderLayer*); |
| 62 ~RenderLayerStackingNode(); | 62 ~RenderLayerStackingNode(); |
| 63 | 63 |
| 64 int zIndex() const { return renderer()->style()->zIndex(); } | 64 unsigned zIndex() const { return renderer()->style()->zIndex(); } |
| 65 | 65 |
| 66 // A stacking context is a layer that has a non-auto z-index. | 66 // A stacking context is a layer that has a non-auto z-index. |
| 67 bool isStackingContext() const { return !renderer()->style()->hasAutoZIndex(
); } | 67 bool isStackingContext() const { return !renderer()->style()->hasAutoZIndex(
); } |
| 68 | 68 |
| 69 // Update our normal and z-index lists. | 69 // Update our normal and z-index lists. |
| 70 void updateLayerListsIfNeeded(); | 70 void updateLayerListsIfNeeded(); |
| 71 | 71 |
| 72 bool zOrderListsDirty() const { return m_zOrderListsDirty; } | 72 bool zOrderListsDirty() const { return m_zOrderListsDirty; } |
| 73 void dirtyZOrderLists(); | 73 void dirtyZOrderLists(); |
| 74 void updateZOrderLists(); | 74 void updateZOrderLists(); |
| 75 void clearZOrderLists(); | 75 void clearZOrderLists(); |
| 76 void dirtyStackingContextZOrderLists(); | 76 void dirtyStackingContextZOrderLists(); |
| 77 | 77 |
| 78 bool hasPositiveZOrderList() const { return posZOrderList() && posZOrderList
()->size(); } | 78 bool hasPositiveZOrderList() const { return zOrderList() && zOrderList()->si
ze(); } |
| 79 bool hasNegativeZOrderList() const { return negZOrderList() && negZOrderList
()->size(); } | |
| 80 | 79 |
| 81 // FIXME: should check for dirtiness here? | 80 // FIXME: should check for dirtiness here? |
| 82 bool isNormalFlowOnly() const { return m_isNormalFlowOnly; } | 81 bool isNormalFlowOnly() const { return m_isNormalFlowOnly; } |
| 83 void updateIsNormalFlowOnly(); | 82 void updateIsNormalFlowOnly(); |
| 84 bool normalFlowListDirty() const { return m_normalFlowListDirty; } | 83 bool normalFlowListDirty() const { return m_normalFlowListDirty; } |
| 85 void dirtyNormalFlowList(); | 84 void dirtyNormalFlowList(); |
| 86 | 85 |
| 87 void updateStackingNodesAfterStyleChange(const RenderStyle* oldStyle); | 86 void updateStackingNodesAfterStyleChange(const RenderStyle* oldStyle); |
| 88 | 87 |
| 89 RenderLayerStackingNode* ancestorStackingContextNode() const; | 88 RenderLayerStackingNode* ancestorStackingContextNode() const; |
| 90 | 89 |
| 91 // Gets the enclosing stacking context for this node, possibly the node | 90 // Gets the enclosing stacking context for this node, possibly the node |
| 92 // itself, if it is a stacking context. | 91 // itself, if it is a stacking context. |
| 93 RenderLayerStackingNode* enclosingStackingContextNode() { return isStackingC
ontext() ? this : ancestorStackingContextNode(); } | 92 RenderLayerStackingNode* enclosingStackingContextNode() { return isStackingC
ontext() ? this : ancestorStackingContextNode(); } |
| 94 | 93 |
| 95 RenderLayer* layer() const { return m_layer; } | 94 RenderLayer* layer() const { return m_layer; } |
| 96 | 95 |
| 97 #if ENABLE(ASSERT) | 96 #if ENABLE(ASSERT) |
| 98 bool layerListMutationAllowed() const { return m_layerListMutationAllowed; } | 97 bool layerListMutationAllowed() const { return m_layerListMutationAllowed; } |
| 99 void setLayerListMutationAllowed(bool flag) { m_layerListMutationAllowed = f
lag; } | 98 void setLayerListMutationAllowed(bool flag) { m_layerListMutationAllowed = f
lag; } |
| 100 #endif | 99 #endif |
| 101 | 100 |
| 102 private: | 101 private: |
| 103 friend class RenderLayerStackingNodeIterator; | 102 friend class RenderLayerStackingNodeIterator; |
| 104 friend class RenderLayerStackingNodeReverseIterator; | 103 friend class RenderLayerStackingNodeReverseIterator; |
| 105 friend class RenderTreeAsText; | 104 friend class RenderTreeAsText; |
| 106 | 105 |
| 107 Vector<RenderLayerStackingNode*>* posZOrderList() const | 106 Vector<RenderLayerStackingNode*>* zOrderList() const |
| 108 { | 107 { |
| 109 ASSERT(!m_zOrderListsDirty); | 108 ASSERT(!m_zOrderListsDirty); |
| 110 ASSERT(isStackingContext() || !m_posZOrderList); | 109 ASSERT(isStackingContext() || !m_zOrderList); |
| 111 return m_posZOrderList.get(); | 110 return m_zOrderList.get(); |
| 112 } | 111 } |
| 113 | 112 |
| 114 Vector<RenderLayerStackingNode*>* normalFlowList() const | 113 Vector<RenderLayerStackingNode*>* normalFlowList() const |
| 115 { | 114 { |
| 116 ASSERT(!m_normalFlowListDirty); | 115 ASSERT(!m_normalFlowListDirty); |
| 117 return m_normalFlowList.get(); | 116 return m_normalFlowList.get(); |
| 118 } | 117 } |
| 119 | 118 |
| 120 Vector<RenderLayerStackingNode*>* negZOrderList() const | |
| 121 { | |
| 122 ASSERT(!m_zOrderListsDirty); | |
| 123 ASSERT(isStackingContext() || !m_negZOrderList); | |
| 124 return m_negZOrderList.get(); | |
| 125 } | |
| 126 | |
| 127 void rebuildZOrderLists(); | 119 void rebuildZOrderLists(); |
| 128 void collectLayers(OwnPtr<Vector<RenderLayerStackingNode*> >& posZOrderList,
OwnPtr<Vector<RenderLayerStackingNode*> >& negZOrderList); | 120 void collectLayers(OwnPtr<Vector<RenderLayerStackingNode*> >& zOrderList); |
| 129 | 121 |
| 130 #if ENABLE(ASSERT) | 122 #if ENABLE(ASSERT) |
| 131 bool isInStackingParentZOrderLists() const; | 123 bool isInStackingParentZOrderLists() const; |
| 132 bool isInStackingParentNormalFlowList() const; | 124 bool isInStackingParentNormalFlowList() const; |
| 133 void updateStackingParentForZOrderLists(RenderLayerStackingNode* stackingPar
ent); | 125 void updateStackingParentForZOrderLists(RenderLayerStackingNode* stackingPar
ent); |
| 134 void updateStackingParentForNormalFlowList(RenderLayerStackingNode* stacking
Parent); | 126 void updateStackingParentForNormalFlowList(RenderLayerStackingNode* stacking
Parent); |
| 135 void setStackingParent(RenderLayerStackingNode* stackingParent) { m_stacking
Parent = stackingParent; } | 127 void setStackingParent(RenderLayerStackingNode* stackingParent) { m_stacking
Parent = stackingParent; } |
| 136 #endif | 128 #endif |
| 137 | 129 |
| 138 bool shouldBeNormalFlowOnly() const; | 130 bool shouldBeNormalFlowOnly() const; |
| 139 | 131 |
| 140 void updateNormalFlowList(); | 132 void updateNormalFlowList(); |
| 141 | 133 |
| 142 bool isDirtyStackingContext() const { return m_zOrderListsDirty && isStackin
gContext(); } | 134 bool isDirtyStackingContext() const { return m_zOrderListsDirty && isStackin
gContext(); } |
| 143 | 135 |
| 144 // FIXME: Investigate changing this to Renderbox. | 136 // FIXME: Investigate changing this to Renderbox. |
| 145 RenderLayerModelObject* renderer() const; | 137 RenderLayerModelObject* renderer() const; |
| 146 | 138 |
| 147 RenderLayer* m_layer; | 139 RenderLayer* m_layer; |
| 148 | 140 |
| 149 // m_posZOrderList holds a sorted list of all the descendant nodes within | 141 // m_zOrderList holds a sorted list of all the descendant nodes within |
| 150 // that have z-indices of 0 or greater (auto will count as 0). | 142 // that have z-indices of 0 or greater (auto will count as 0). |
| 151 // m_negZOrderList holds descendants within our stacking context with | 143 OwnPtr<Vector<RenderLayerStackingNode*> > m_zOrderList; |
| 152 // negative z-indices. | |
| 153 OwnPtr<Vector<RenderLayerStackingNode*> > m_posZOrderList; | |
| 154 OwnPtr<Vector<RenderLayerStackingNode*> > m_negZOrderList; | |
| 155 | 144 |
| 156 // This list contains child nodes that cannot create stacking contexts. | 145 // This list contains child nodes that cannot create stacking contexts. |
| 157 OwnPtr<Vector<RenderLayerStackingNode*> > m_normalFlowList; | 146 OwnPtr<Vector<RenderLayerStackingNode*> > m_normalFlowList; |
| 158 | 147 |
| 159 unsigned m_zOrderListsDirty : 1; | 148 unsigned m_zOrderListsDirty : 1; |
| 160 unsigned m_normalFlowListDirty: 1; | 149 unsigned m_normalFlowListDirty: 1; |
| 161 unsigned m_isNormalFlowOnly : 1; | 150 unsigned m_isNormalFlowOnly : 1; |
| 162 | 151 |
| 163 #if ENABLE(ASSERT) | 152 #if ENABLE(ASSERT) |
| 164 unsigned m_layerListMutationAllowed : 1; | 153 unsigned m_layerListMutationAllowed : 1; |
| 165 RenderLayerStackingNode* m_stackingParent; | 154 RenderLayerStackingNode* m_stackingParent; |
| 166 #endif | 155 #endif |
| 167 }; | 156 }; |
| 168 | 157 |
| 169 inline void RenderLayerStackingNode::clearZOrderLists() | 158 inline void RenderLayerStackingNode::clearZOrderLists() |
| 170 { | 159 { |
| 171 ASSERT(!isStackingContext()); | 160 ASSERT(!isStackingContext()); |
| 172 | 161 |
| 173 #if ENABLE(ASSERT) | 162 #if ENABLE(ASSERT) |
| 174 updateStackingParentForZOrderLists(0); | 163 updateStackingParentForZOrderLists(0); |
| 175 #endif | 164 #endif |
| 176 | 165 |
| 177 m_posZOrderList.clear(); | 166 m_zOrderList.clear(); |
| 178 m_negZOrderList.clear(); | |
| 179 } | 167 } |
| 180 | 168 |
| 181 inline void RenderLayerStackingNode::updateZOrderLists() | 169 inline void RenderLayerStackingNode::updateZOrderLists() |
| 182 { | 170 { |
| 183 if (!m_zOrderListsDirty) | 171 if (!m_zOrderListsDirty) |
| 184 return; | 172 return; |
| 185 | 173 |
| 186 if (!isStackingContext()) { | 174 if (!isStackingContext()) { |
| 187 clearZOrderLists(); | 175 clearZOrderLists(); |
| 188 m_zOrderListsDirty = false; | 176 m_zOrderListsDirty = false; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 209 | 197 |
| 210 private: | 198 private: |
| 211 RenderLayerStackingNode* m_stackingNode; | 199 RenderLayerStackingNode* m_stackingNode; |
| 212 bool m_previousMutationAllowedState; | 200 bool m_previousMutationAllowedState; |
| 213 }; | 201 }; |
| 214 #endif | 202 #endif |
| 215 | 203 |
| 216 } // namespace blink | 204 } // namespace blink |
| 217 | 205 |
| 218 #endif // SKY_ENGINE_CORE_RENDERING_RENDERLAYERSTACKINGNODE_H_ | 206 #endif // SKY_ENGINE_CORE_RENDERING_RENDERLAYERSTACKINGNODE_H_ |
| OLD | NEW |