| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // To implement any z-order list iterations, use | 82 // To implement any z-order list iterations, use |
| 83 // DeprecatedPaintLayerStackingNodeIterator and | 83 // DeprecatedPaintLayerStackingNodeIterator and |
| 84 // DeprecatedPaintLayerStackingNodeReverseIterator. | 84 // DeprecatedPaintLayerStackingNodeReverseIterator. |
| 85 // | 85 // |
| 86 // This class is NOT DEPRECATED, DeprecatedPaintLayer is and we match its | 86 // This class is NOT DEPRECATED, DeprecatedPaintLayer is and we match its |
| 87 // naming. | 87 // naming. |
| 88 class CORE_EXPORT DeprecatedPaintLayerStackingNode { | 88 class CORE_EXPORT DeprecatedPaintLayerStackingNode { |
| 89 WTF_MAKE_FAST_ALLOCATED(DeprecatedPaintLayerStackingNode); | 89 WTF_MAKE_FAST_ALLOCATED(DeprecatedPaintLayerStackingNode); |
| 90 WTF_MAKE_NONCOPYABLE(DeprecatedPaintLayerStackingNode); | 90 WTF_MAKE_NONCOPYABLE(DeprecatedPaintLayerStackingNode); |
| 91 public: | 91 public: |
| 92 explicit DeprecatedPaintLayerStackingNode(LayoutBoxModelObject&); | 92 explicit DeprecatedPaintLayerStackingNode(DeprecatedPaintLayer*); |
| 93 ~DeprecatedPaintLayerStackingNode(); | 93 ~DeprecatedPaintLayerStackingNode(); |
| 94 | 94 |
| 95 int zIndex() const { return layoutObject().style()->zIndex(); } | 95 int zIndex() const { return layoutObject()->style()->zIndex(); } |
| 96 | 96 |
| 97 bool isStackingContext() const { return layoutObject().style()->isStackingCo
ntext(); } | 97 bool isStackingContext() const { return layoutObject()->style()->isStackingC
ontext(); } |
| 98 | 98 |
| 99 // Update our normal and z-index lists. | 99 // Update our normal and z-index lists. |
| 100 void updateLayerListsIfNeeded(); | 100 void updateLayerListsIfNeeded(); |
| 101 | 101 |
| 102 bool zOrderListsDirty() const { return m_zOrderListsDirty; } | 102 bool zOrderListsDirty() const { return m_zOrderListsDirty; } |
| 103 void dirtyZOrderLists(); | 103 void dirtyZOrderLists(); |
| 104 void updateZOrderLists(); | 104 void updateZOrderLists(); |
| 105 void clearZOrderLists(); | 105 void clearZOrderLists(); |
| 106 void dirtyStackingContextZOrderLists(); | 106 void dirtyStackingContextZOrderLists(); |
| 107 | 107 |
| 108 bool hasPositiveZOrderList() const { return posZOrderList() && posZOrderList
()->size(); } | 108 bool hasPositiveZOrderList() const { return posZOrderList() && posZOrderList
()->size(); } |
| 109 bool hasNegativeZOrderList() const { return negZOrderList() && negZOrderList
()->size(); } | 109 bool hasNegativeZOrderList() const { return negZOrderList() && negZOrderList
()->size(); } |
| 110 | 110 |
| 111 bool isTreatedAsOrStackingContext() const { return m_isTreatedAsOrStackingCo
ntext; } | 111 bool isTreatedAsOrStackingContext() const { return m_isTreatedAsOrStackingCo
ntext; } |
| 112 void updateIsTreatedAsStackingContext(); | 112 void updateIsTreatedAsStackingContext(); |
| 113 | 113 |
| 114 void updateStackingNodesAfterStyleChange(const ComputedStyle* oldStyle); | 114 void updateStackingNodesAfterStyleChange(const ComputedStyle* oldStyle); |
| 115 | 115 |
| 116 DeprecatedPaintLayerStackingNode* ancestorStackingContextNode() const; | 116 DeprecatedPaintLayerStackingNode* ancestorStackingContextNode() const; |
| 117 | 117 |
| 118 // FIXME: A lot of code depends on this function but shouldn't. We should | 118 DeprecatedPaintLayer* layer() const { return m_layer; } |
| 119 // build our code on top of LayoutBoxModelObject, not DeprecatedPaintLayer. | |
| 120 DeprecatedPaintLayer* layer() const; | |
| 121 | 119 |
| 122 #if ENABLE(ASSERT) | 120 #if ENABLE(ASSERT) |
| 123 bool layerListMutationAllowed() const { return m_layerListMutationAllowed; } | 121 bool layerListMutationAllowed() const { return m_layerListMutationAllowed; } |
| 124 void setLayerListMutationAllowed(bool flag) { m_layerListMutationAllowed = f
lag; } | 122 void setLayerListMutationAllowed(bool flag) { m_layerListMutationAllowed = f
lag; } |
| 125 #endif | 123 #endif |
| 126 | 124 |
| 127 private: | 125 private: |
| 128 friend class DeprecatedPaintLayerStackingNodeIterator; | 126 friend class DeprecatedPaintLayerStackingNodeIterator; |
| 129 friend class DeprecatedPaintLayerStackingNodeReverseIterator; | 127 friend class DeprecatedPaintLayerStackingNodeReverseIterator; |
| 130 friend class LayoutTreeAsText; | 128 friend class LayoutTreeAsText; |
| 131 | 129 |
| 132 Vector<DeprecatedPaintLayerStackingNode*>* posZOrderList() const | 130 Vector<DeprecatedPaintLayerStackingNode*>* posZOrderList() const |
| 133 { | 131 { |
| 134 ASSERT(!m_zOrderListsDirty); | 132 ASSERT(!m_zOrderListsDirty); |
| 135 ASSERT(isStackingContext() || !m_posZOrderList); | 133 ASSERT(isStackingContext() || !m_posZOrderList); |
| 136 return m_posZOrderList.get(); | 134 return m_posZOrderList.get(); |
| 137 } | 135 } |
| 138 | 136 |
| 139 Vector<DeprecatedPaintLayerStackingNode*>* negZOrderList() const | 137 Vector<DeprecatedPaintLayerStackingNode*>* negZOrderList() const |
| 140 { | 138 { |
| 141 ASSERT(!m_zOrderListsDirty); | 139 ASSERT(!m_zOrderListsDirty); |
| 142 ASSERT(isStackingContext() || !m_negZOrderList); | 140 ASSERT(isStackingContext() || !m_negZOrderList); |
| 143 return m_negZOrderList.get(); | 141 return m_negZOrderList.get(); |
| 144 } | 142 } |
| 145 | 143 |
| 146 void rebuildZOrderLists(); | 144 void rebuildZOrderLists(); |
| 145 void collectLayers(OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>>& posZOr
derList, OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>>& negZOrderList); |
| 147 | 146 |
| 148 #if ENABLE(ASSERT) | 147 #if ENABLE(ASSERT) |
| 149 bool isInStackingParentZOrderLists() const; | 148 bool isInStackingParentZOrderLists() const; |
| 150 void updateStackingParentForZOrderLists(DeprecatedPaintLayerStackingNode* st
ackingParent); | 149 void updateStackingParentForZOrderLists(DeprecatedPaintLayerStackingNode* st
ackingParent); |
| 151 void setStackingParent(DeprecatedPaintLayerStackingNode* stackingParent) { m
_stackingParent = stackingParent; } | 150 void setStackingParent(DeprecatedPaintLayerStackingNode* stackingParent) { m
_stackingParent = stackingParent; } |
| 152 #endif | 151 #endif |
| 153 | 152 |
| 154 bool shouldBeTreatedAsOrStackingContext() const { return layoutObject().styl
e()->isTreatedAsOrStackingContext(); } | 153 bool shouldBeTreatedAsOrStackingContext() const { return layoutObject()->sty
le()->isTreatedAsOrStackingContext(); } |
| 155 | 154 |
| 156 bool isDirtyStackingContext() const { return m_zOrderListsDirty && isStackin
gContext(); } | 155 bool isDirtyStackingContext() const { return m_zOrderListsDirty && isStackin
gContext(); } |
| 157 | 156 |
| 158 DeprecatedPaintLayerCompositor* compositor() const; | 157 DeprecatedPaintLayerCompositor* compositor() const; |
| 159 // We can't return a LayoutBox as LayoutInline can be a stacking context. | 158 // We can't return a LayoutBox as LayoutInline can be a stacking context. |
| 160 LayoutBoxModelObject& layoutObject() const { return m_layoutObject; } | 159 LayoutBoxModelObject* layoutObject() const; |
| 161 | 160 |
| 162 LayoutBoxModelObject& m_layoutObject; | 161 DeprecatedPaintLayer* m_layer; |
| 163 | 162 |
| 164 // m_posZOrderList holds a sorted list of all the descendant nodes within | 163 // m_posZOrderList holds a sorted list of all the descendant nodes within |
| 165 // that have z-indices of 0 or greater (auto will count as 0). | 164 // that have z-indices of 0 or greater (auto will count as 0). |
| 166 // m_negZOrderList holds descendants within our stacking context with | 165 // m_negZOrderList holds descendants within our stacking context with |
| 167 // negative z-indices. | 166 // negative z-indices. |
| 168 OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>> m_posZOrderList; | 167 OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>> m_posZOrderList; |
| 169 OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>> m_negZOrderList; | 168 OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>> m_negZOrderList; |
| 170 | 169 |
| 171 // This boolean caches whether the z-order lists above are dirty. | 170 // This boolean caches whether the z-order lists above are dirty. |
| 172 // It is only ever set for stacking contexts, as no other element can | 171 // It is only ever set for stacking contexts, as no other element can |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 227 |
| 229 private: | 228 private: |
| 230 DeprecatedPaintLayerStackingNode* m_stackingNode; | 229 DeprecatedPaintLayerStackingNode* m_stackingNode; |
| 231 bool m_previousMutationAllowedState; | 230 bool m_previousMutationAllowedState; |
| 232 }; | 231 }; |
| 233 #endif | 232 #endif |
| 234 | 233 |
| 235 } // namespace blink | 234 } // namespace blink |
| 236 | 235 |
| 237 #endif // DeprecatedPaintLayerStackingNode_h | 236 #endif // DeprecatedPaintLayerStackingNode_h |
| OLD | NEW |