Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerStackingNode.h

Issue 2640163004: Replace ENABLE(ASSERT) with DCHECK_IS_ON(). (Closed)
Patch Set: m_domTreeVersion initialization Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 bool hasNegativeZOrderList() const { 125 bool hasNegativeZOrderList() const {
126 return negZOrderList() && negZOrderList()->size(); 126 return negZOrderList() && negZOrderList()->size();
127 } 127 }
128 128
129 void styleDidChange(const ComputedStyle* oldStyle); 129 void styleDidChange(const ComputedStyle* oldStyle);
130 130
131 PaintLayerStackingNode* ancestorStackingContextNode() const; 131 PaintLayerStackingNode* ancestorStackingContextNode() const;
132 132
133 PaintLayer* layer() const { return m_layer; } 133 PaintLayer* layer() const { return m_layer; }
134 134
135 #if ENABLE(ASSERT) 135 #if DCHECK_IS_ON()
136 bool layerListMutationAllowed() const { return m_layerListMutationAllowed; } 136 bool layerListMutationAllowed() const { return m_layerListMutationAllowed; }
137 void setLayerListMutationAllowed(bool flag) { 137 void setLayerListMutationAllowed(bool flag) {
138 m_layerListMutationAllowed = flag; 138 m_layerListMutationAllowed = flag;
139 } 139 }
140 #endif 140 #endif
141 141
142 private: 142 private:
143 friend class PaintLayerStackingNodeIterator; 143 friend class PaintLayerStackingNodeIterator;
144 friend class PaintLayerStackingNodeReverseIterator; 144 friend class PaintLayerStackingNodeReverseIterator;
145 friend class LayoutTreeAsText; 145 friend class LayoutTreeAsText;
146 146
147 Vector<PaintLayerStackingNode*>* posZOrderList() const { 147 Vector<PaintLayerStackingNode*>* posZOrderList() const {
148 DCHECK(!m_zOrderListsDirty); 148 DCHECK(!m_zOrderListsDirty);
149 DCHECK(isStackingContext() || !m_posZOrderList); 149 DCHECK(isStackingContext() || !m_posZOrderList);
150 return m_posZOrderList.get(); 150 return m_posZOrderList.get();
151 } 151 }
152 152
153 Vector<PaintLayerStackingNode*>* negZOrderList() const { 153 Vector<PaintLayerStackingNode*>* negZOrderList() const {
154 DCHECK(!m_zOrderListsDirty); 154 DCHECK(!m_zOrderListsDirty);
155 DCHECK(isStackingContext() || !m_negZOrderList); 155 DCHECK(isStackingContext() || !m_negZOrderList);
156 return m_negZOrderList.get(); 156 return m_negZOrderList.get();
157 } 157 }
158 158
159 void rebuildZOrderLists(); 159 void rebuildZOrderLists();
160 void collectLayers( 160 void collectLayers(
161 std::unique_ptr<Vector<PaintLayerStackingNode*>>& posZOrderList, 161 std::unique_ptr<Vector<PaintLayerStackingNode*>>& posZOrderList,
162 std::unique_ptr<Vector<PaintLayerStackingNode*>>& negZOrderList); 162 std::unique_ptr<Vector<PaintLayerStackingNode*>>& negZOrderList);
163 163
164 #if ENABLE(ASSERT) 164 #if DCHECK_IS_ON()
165 bool isInStackingParentZOrderLists() const; 165 bool isInStackingParentZOrderLists() const;
166 void updateStackingParentForZOrderLists( 166 void updateStackingParentForZOrderLists(
167 PaintLayerStackingNode* stackingParent); 167 PaintLayerStackingNode* stackingParent);
168 void setStackingParent(PaintLayerStackingNode* stackingParent) { 168 void setStackingParent(PaintLayerStackingNode* stackingParent) {
169 m_stackingParent = stackingParent; 169 m_stackingParent = stackingParent;
170 } 170 }
171 #endif 171 #endif
172 172
173 bool isDirtyStackingContext() const { 173 bool isDirtyStackingContext() const {
174 return m_zOrderListsDirty && isStackingContext(); 174 return m_zOrderListsDirty && isStackingContext();
(...skipping 17 matching lines...) Expand all
192 // It is only ever set for stacking contexts, as no other element can 192 // It is only ever set for stacking contexts, as no other element can
193 // have z-order lists. 193 // have z-order lists.
194 bool m_zOrderListsDirty : 1; 194 bool m_zOrderListsDirty : 1;
195 195
196 // This attribute caches whether the element was stacked. It's needed to check 196 // This attribute caches whether the element was stacked. It's needed to check
197 // the current stacked status (instead of the new stacked status determined by 197 // the current stacked status (instead of the new stacked status determined by
198 // the new style which has not been realized yet) when a layer is removed due 198 // the new style which has not been realized yet) when a layer is removed due
199 // to style change. 199 // to style change.
200 bool m_isStacked : 1; 200 bool m_isStacked : 1;
201 201
202 #if ENABLE(ASSERT) 202 #if DCHECK_IS_ON()
203 bool m_layerListMutationAllowed : 1; 203 bool m_layerListMutationAllowed : 1;
204 PaintLayerStackingNode* m_stackingParent; 204 PaintLayerStackingNode* m_stackingParent;
205 #endif 205 #endif
206 }; 206 };
207 207
208 inline void PaintLayerStackingNode::clearZOrderLists() { 208 inline void PaintLayerStackingNode::clearZOrderLists() {
209 DCHECK(!isStackingContext()); 209 DCHECK(!isStackingContext());
210 210
211 #if ENABLE(ASSERT) 211 #if DCHECK_IS_ON()
212 updateStackingParentForZOrderLists(0); 212 updateStackingParentForZOrderLists(0);
213 #endif 213 #endif
214 214
215 m_posZOrderList.reset(); 215 m_posZOrderList.reset();
216 m_negZOrderList.reset(); 216 m_negZOrderList.reset();
217 } 217 }
218 218
219 inline void PaintLayerStackingNode::updateZOrderLists() { 219 inline void PaintLayerStackingNode::updateZOrderLists() {
220 if (!m_zOrderListsDirty) 220 if (!m_zOrderListsDirty)
221 return; 221 return;
222 222
223 if (!isStackingContext()) { 223 if (!isStackingContext()) {
224 clearZOrderLists(); 224 clearZOrderLists();
225 m_zOrderListsDirty = false; 225 m_zOrderListsDirty = false;
226 return; 226 return;
227 } 227 }
228 228
229 rebuildZOrderLists(); 229 rebuildZOrderLists();
230 } 230 }
231 231
232 #if ENABLE(ASSERT) 232 #if DCHECK_IS_ON()
233 class LayerListMutationDetector { 233 class LayerListMutationDetector {
234 public: 234 public:
235 explicit LayerListMutationDetector(PaintLayerStackingNode* stackingNode) 235 explicit LayerListMutationDetector(PaintLayerStackingNode* stackingNode)
236 : m_stackingNode(stackingNode), 236 : m_stackingNode(stackingNode),
237 m_previousMutationAllowedState( 237 m_previousMutationAllowedState(
238 stackingNode->layerListMutationAllowed()) { 238 stackingNode->layerListMutationAllowed()) {
239 m_stackingNode->setLayerListMutationAllowed(false); 239 m_stackingNode->setLayerListMutationAllowed(false);
240 } 240 }
241 241
242 ~LayerListMutationDetector() { 242 ~LayerListMutationDetector() {
243 m_stackingNode->setLayerListMutationAllowed(m_previousMutationAllowedState); 243 m_stackingNode->setLayerListMutationAllowed(m_previousMutationAllowedState);
244 } 244 }
245 245
246 private: 246 private:
247 PaintLayerStackingNode* m_stackingNode; 247 PaintLayerStackingNode* m_stackingNode;
248 bool m_previousMutationAllowedState; 248 bool m_previousMutationAllowedState;
249 }; 249 };
250 #endif 250 #endif
251 251
252 } // namespace blink 252 } // namespace blink
253 253
254 #endif // PaintLayerStackingNode_h 254 #endif // PaintLayerStackingNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698