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

Side by Side Diff: Source/core/layout/LayerStackingNode.h

Issue 898783003: Move rendering/RenderLayer* to layout/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/LayerScrollableArea.cpp ('k') | Source/core/layout/LayerStackingNode.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 24 matching lines...) Expand all
35 * applicable instead of those above. If you wish to allow use of your 35 * applicable instead of those above. If you wish to allow use of your
36 * version of this file only under the terms of one of those two 36 * version of this file only under the terms of one of those two
37 * licenses (the MPL or the GPL) and not to allow others to use your 37 * licenses (the MPL or the GPL) and not to allow others to use your
38 * version of this file under the LGPL, indicate your decision by 38 * version of this file under the LGPL, indicate your decision by
39 * deletingthe provisions above and replace them with the notice and 39 * deletingthe provisions above and replace them with the notice and
40 * other provisions required by the MPL or the GPL, as the case may be. 40 * other provisions required by the MPL or the GPL, as the case may be.
41 * If you do not delete the provisions above, a recipient may use your 41 * If you do not delete the provisions above, a recipient may use your
42 * version of this file under any of the LGPL, the MPL or the GPL. 42 * version of this file under any of the LGPL, the MPL or the GPL.
43 */ 43 */
44 44
45 #ifndef RenderLayerStackingNode_h 45 #ifndef LayerStackingNode_h
46 #define RenderLayerStackingNode_h 46 #define LayerStackingNode_h
47 47
48 #include "core/rendering/RenderLayerModelObject.h" 48 #include "core/layout/LayoutLayerModelObject.h"
49 #include "wtf/Noncopyable.h" 49 #include "wtf/Noncopyable.h"
50 #include "wtf/OwnPtr.h" 50 #include "wtf/OwnPtr.h"
51 #include "wtf/Vector.h" 51 #include "wtf/Vector.h"
52 52
53 namespace blink { 53 namespace blink {
54 54
55 class RenderLayer; 55 class Layer;
56 class RenderLayerCompositor; 56 class LayerCompositor;
57 class RenderStyle; 57 class RenderStyle;
58 58
59 class RenderLayerStackingNode { 59 class LayerStackingNode {
60 WTF_MAKE_NONCOPYABLE(RenderLayerStackingNode); 60 WTF_MAKE_NONCOPYABLE(LayerStackingNode);
61 public: 61 public:
62 explicit RenderLayerStackingNode(RenderLayer*); 62 explicit LayerStackingNode(Layer*);
63 ~RenderLayerStackingNode(); 63 ~LayerStackingNode();
64 64
65 int zIndex() const { return renderer()->style()->zIndex(); } 65 int zIndex() const { return renderer()->style()->zIndex(); }
66 66
67 // A stacking context is a layer that has a non-auto z-index. 67 // A stacking context is a layer that has a non-auto z-index.
68 bool isStackingContext() const { return !renderer()->style()->hasAutoZIndex( ); } 68 bool isStackingContext() const { return !renderer()->style()->hasAutoZIndex( ); }
69 69
70 // Update our normal and z-index lists. 70 // Update our normal and z-index lists.
71 void updateLayerListsIfNeeded(); 71 void updateLayerListsIfNeeded();
72 72
73 bool zOrderListsDirty() const { return m_zOrderListsDirty; } 73 bool zOrderListsDirty() const { return m_zOrderListsDirty; }
74 void dirtyZOrderLists(); 74 void dirtyZOrderLists();
75 void updateZOrderLists(); 75 void updateZOrderLists();
76 void clearZOrderLists(); 76 void clearZOrderLists();
77 void dirtyStackingContextZOrderLists(); 77 void dirtyStackingContextZOrderLists();
78 78
79 bool hasPositiveZOrderList() const { return posZOrderList() && posZOrderList ()->size(); } 79 bool hasPositiveZOrderList() const { return posZOrderList() && posZOrderList ()->size(); }
80 bool hasNegativeZOrderList() const { return negZOrderList() && negZOrderList ()->size(); } 80 bool hasNegativeZOrderList() const { return negZOrderList() && negZOrderList ()->size(); }
81 81
82 // FIXME: should check for dirtiness here? 82 // FIXME: should check for dirtiness here?
83 bool isNormalFlowOnly() const { return m_isNormalFlowOnly; } 83 bool isNormalFlowOnly() const { return m_isNormalFlowOnly; }
84 void updateIsNormalFlowOnly(); 84 void updateIsNormalFlowOnly();
85 bool normalFlowListDirty() const { return m_normalFlowListDirty; } 85 bool normalFlowListDirty() const { return m_normalFlowListDirty; }
86 void dirtyNormalFlowList(); 86 void dirtyNormalFlowList();
87 87
88 void updateStackingNodesAfterStyleChange(const RenderStyle* oldStyle); 88 void updateStackingNodesAfterStyleChange(const RenderStyle* oldStyle);
89 89
90 RenderLayerStackingNode* ancestorStackingContextNode() const; 90 LayerStackingNode* ancestorStackingContextNode() const;
91 91
92 RenderLayer* layer() const { return m_layer; } 92 Layer* layer() const { return m_layer; }
93 93
94 #if ENABLE(ASSERT) 94 #if ENABLE(ASSERT)
95 bool layerListMutationAllowed() const { return m_layerListMutationAllowed; } 95 bool layerListMutationAllowed() const { return m_layerListMutationAllowed; }
96 void setLayerListMutationAllowed(bool flag) { m_layerListMutationAllowed = f lag; } 96 void setLayerListMutationAllowed(bool flag) { m_layerListMutationAllowed = f lag; }
97 #endif 97 #endif
98 98
99 private: 99 private:
100 friend class RenderLayerStackingNodeIterator; 100 friend class LayerStackingNodeIterator;
101 friend class RenderLayerStackingNodeReverseIterator; 101 friend class LayerStackingNodeReverseIterator;
102 friend class LayoutTreeAsText; 102 friend class LayoutTreeAsText;
103 103
104 Vector<RenderLayerStackingNode*>* posZOrderList() const 104 Vector<LayerStackingNode*>* posZOrderList() const
105 { 105 {
106 ASSERT(!m_zOrderListsDirty); 106 ASSERT(!m_zOrderListsDirty);
107 ASSERT(isStackingContext() || !m_posZOrderList); 107 ASSERT(isStackingContext() || !m_posZOrderList);
108 return m_posZOrderList.get(); 108 return m_posZOrderList.get();
109 } 109 }
110 110
111 Vector<RenderLayerStackingNode*>* normalFlowList() const 111 Vector<LayerStackingNode*>* normalFlowList() const
112 { 112 {
113 ASSERT(!m_normalFlowListDirty); 113 ASSERT(!m_normalFlowListDirty);
114 return m_normalFlowList.get(); 114 return m_normalFlowList.get();
115 } 115 }
116 116
117 Vector<RenderLayerStackingNode*>* negZOrderList() const 117 Vector<LayerStackingNode*>* negZOrderList() const
118 { 118 {
119 ASSERT(!m_zOrderListsDirty); 119 ASSERT(!m_zOrderListsDirty);
120 ASSERT(isStackingContext() || !m_negZOrderList); 120 ASSERT(isStackingContext() || !m_negZOrderList);
121 return m_negZOrderList.get(); 121 return m_negZOrderList.get();
122 } 122 }
123 123
124 void rebuildZOrderLists(); 124 void rebuildZOrderLists();
125 void collectLayers(OwnPtr<Vector<RenderLayerStackingNode*> >& posZOrderList, OwnPtr<Vector<RenderLayerStackingNode*> >& negZOrderList); 125 void collectLayers(OwnPtr<Vector<LayerStackingNode*>>& posZOrderList, OwnPtr <Vector<LayerStackingNode*>>& negZOrderList);
126 126
127 #if ENABLE(ASSERT) 127 #if ENABLE(ASSERT)
128 bool isInStackingParentZOrderLists() const; 128 bool isInStackingParentZOrderLists() const;
129 bool isInStackingParentNormalFlowList() const; 129 bool isInStackingParentNormalFlowList() const;
130 void updateStackingParentForZOrderLists(RenderLayerStackingNode* stackingPar ent); 130 void updateStackingParentForZOrderLists(LayerStackingNode* stackingParent);
131 void updateStackingParentForNormalFlowList(RenderLayerStackingNode* stacking Parent); 131 void updateStackingParentForNormalFlowList(LayerStackingNode* stackingParent );
132 void setStackingParent(RenderLayerStackingNode* stackingParent) { m_stacking Parent = stackingParent; } 132 void setStackingParent(LayerStackingNode* stackingParent) { m_stackingParent = stackingParent; }
133 #endif 133 #endif
134 134
135 bool shouldBeNormalFlowOnly() const; 135 bool shouldBeNormalFlowOnly() const;
136 136
137 void updateNormalFlowList(); 137 void updateNormalFlowList();
138 138
139 bool isDirtyStackingContext() const { return m_zOrderListsDirty && isStackin gContext(); } 139 bool isDirtyStackingContext() const { return m_zOrderListsDirty && isStackin gContext(); }
140 140
141 RenderLayerCompositor* compositor() const; 141 LayerCompositor* compositor() const;
142 // FIXME: Investigate changing this to Renderbox. 142 // FIXME: Investigate changing this to Renderbox.
143 RenderLayerModelObject* renderer() const; 143 LayoutLayerModelObject* renderer() const;
144 144
145 RenderLayer* m_layer; 145 Layer* m_layer;
146 146
147 // m_posZOrderList holds a sorted list of all the descendant nodes within 147 // m_posZOrderList holds a sorted list of all the descendant nodes within
148 // that have z-indices of 0 or greater (auto will count as 0). 148 // that have z-indices of 0 or greater (auto will count as 0).
149 // m_negZOrderList holds descendants within our stacking context with 149 // m_negZOrderList holds descendants within our stacking context with
150 // negative z-indices. 150 // negative z-indices.
151 OwnPtr<Vector<RenderLayerStackingNode*> > m_posZOrderList; 151 OwnPtr<Vector<LayerStackingNode*>> m_posZOrderList;
152 OwnPtr<Vector<RenderLayerStackingNode*> > m_negZOrderList; 152 OwnPtr<Vector<LayerStackingNode*>> m_negZOrderList;
153 153
154 // This list contains child nodes that cannot create stacking contexts. 154 // This list contains child nodes that cannot create stacking contexts.
155 OwnPtr<Vector<RenderLayerStackingNode*> > m_normalFlowList; 155 OwnPtr<Vector<LayerStackingNode*>> m_normalFlowList;
156 156
157 unsigned m_zOrderListsDirty : 1; 157 unsigned m_zOrderListsDirty : 1;
158 unsigned m_normalFlowListDirty: 1; 158 unsigned m_normalFlowListDirty: 1;
159 unsigned m_isNormalFlowOnly : 1; 159 unsigned m_isNormalFlowOnly : 1;
160 160
161 #if ENABLE(ASSERT) 161 #if ENABLE(ASSERT)
162 unsigned m_layerListMutationAllowed : 1; 162 unsigned m_layerListMutationAllowed : 1;
163 RenderLayerStackingNode* m_stackingParent; 163 LayerStackingNode* m_stackingParent;
164 #endif 164 #endif
165 }; 165 };
166 166
167 inline void RenderLayerStackingNode::clearZOrderLists() 167 inline void LayerStackingNode::clearZOrderLists()
168 { 168 {
169 ASSERT(!isStackingContext()); 169 ASSERT(!isStackingContext());
170 170
171 #if ENABLE(ASSERT) 171 #if ENABLE(ASSERT)
172 updateStackingParentForZOrderLists(0); 172 updateStackingParentForZOrderLists(0);
173 #endif 173 #endif
174 174
175 m_posZOrderList.clear(); 175 m_posZOrderList.clear();
176 m_negZOrderList.clear(); 176 m_negZOrderList.clear();
177 } 177 }
178 178
179 inline void RenderLayerStackingNode::updateZOrderLists() 179 inline void LayerStackingNode::updateZOrderLists()
180 { 180 {
181 if (!m_zOrderListsDirty) 181 if (!m_zOrderListsDirty)
182 return; 182 return;
183 183
184 if (!isStackingContext()) { 184 if (!isStackingContext()) {
185 clearZOrderLists(); 185 clearZOrderLists();
186 m_zOrderListsDirty = false; 186 m_zOrderListsDirty = false;
187 return; 187 return;
188 } 188 }
189 189
190 rebuildZOrderLists(); 190 rebuildZOrderLists();
191 } 191 }
192 192
193 #if ENABLE(ASSERT) 193 #if ENABLE(ASSERT)
194 class LayerListMutationDetector { 194 class LayerListMutationDetector {
195 public: 195 public:
196 explicit LayerListMutationDetector(RenderLayerStackingNode* stackingNode) 196 explicit LayerListMutationDetector(LayerStackingNode* stackingNode)
197 : m_stackingNode(stackingNode) 197 : m_stackingNode(stackingNode)
198 , m_previousMutationAllowedState(stackingNode->layerListMutationAllowed( )) 198 , m_previousMutationAllowedState(stackingNode->layerListMutationAllowed( ))
199 { 199 {
200 m_stackingNode->setLayerListMutationAllowed(false); 200 m_stackingNode->setLayerListMutationAllowed(false);
201 } 201 }
202 202
203 ~LayerListMutationDetector() 203 ~LayerListMutationDetector()
204 { 204 {
205 m_stackingNode->setLayerListMutationAllowed(m_previousMutationAllowedSta te); 205 m_stackingNode->setLayerListMutationAllowed(m_previousMutationAllowedSta te);
206 } 206 }
207 207
208 private: 208 private:
209 RenderLayerStackingNode* m_stackingNode; 209 LayerStackingNode* m_stackingNode;
210 bool m_previousMutationAllowedState; 210 bool m_previousMutationAllowedState;
211 }; 211 };
212 #endif 212 #endif
213 213
214 } // namespace blink 214 } // namespace blink
215 215
216 #endif // RenderLayerStackingNode_h 216 #endif // LayerStackingNode_h
OLDNEW
« no previous file with comments | « Source/core/layout/LayerScrollableArea.cpp ('k') | Source/core/layout/LayerStackingNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698