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

Side by Side Diff: Source/core/paint/DeprecatedPaintLayerStackingNode.h

Issue 1199413006: Switch DPLStackingNode to use LayoutBoxModelObject (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 namespace blink { 54 namespace blink {
55 55
56 class DeprecatedPaintLayer; 56 class DeprecatedPaintLayer;
57 class DeprecatedPaintLayerCompositor; 57 class DeprecatedPaintLayerCompositor;
58 class ComputedStyle; 58 class ComputedStyle;
59 class LayoutBoxModelObject; 59 class LayoutBoxModelObject;
60 60
61 class CORE_EXPORT DeprecatedPaintLayerStackingNode { 61 class CORE_EXPORT DeprecatedPaintLayerStackingNode {
62 WTF_MAKE_NONCOPYABLE(DeprecatedPaintLayerStackingNode); 62 WTF_MAKE_NONCOPYABLE(DeprecatedPaintLayerStackingNode);
63 public: 63 public:
64 explicit DeprecatedPaintLayerStackingNode(DeprecatedPaintLayer*); 64 explicit DeprecatedPaintLayerStackingNode(LayoutBoxModelObject&);
65 ~DeprecatedPaintLayerStackingNode(); 65 ~DeprecatedPaintLayerStackingNode();
66 66
67 int zIndex() const { return layoutObject()->style()->zIndex(); } 67 int zIndex() const { return layoutObject().style()->zIndex(); }
68 68
69 bool isStackingContext() const { return layoutObject()->style()->isStackingC ontext(); } 69 bool isStackingContext() const { return layoutObject().style()->isStackingCo ntext(); }
70 70
71 // Update our normal and z-index lists. 71 // Update our normal and z-index lists.
72 void updateLayerListsIfNeeded(); 72 void updateLayerListsIfNeeded();
73 73
74 bool zOrderListsDirty() const { return m_zOrderListsDirty; } 74 bool zOrderListsDirty() const { return m_zOrderListsDirty; }
75 void dirtyZOrderLists(); 75 void dirtyZOrderLists();
76 void updateZOrderLists(); 76 void updateZOrderLists();
77 void clearZOrderLists(); 77 void clearZOrderLists();
78 void dirtyStackingContextZOrderLists(); 78 void dirtyStackingContextZOrderLists();
79 79
80 bool hasPositiveZOrderList() const { return posZOrderList() && posZOrderList ()->size(); } 80 bool hasPositiveZOrderList() const { return posZOrderList() && posZOrderList ()->size(); }
81 bool hasNegativeZOrderList() const { return negZOrderList() && negZOrderList ()->size(); } 81 bool hasNegativeZOrderList() const { return negZOrderList() && negZOrderList ()->size(); }
82 82
83 // FIXME: should check for dirtiness here? 83 // FIXME: should check for dirtiness here?
84 bool isNormalFlowOnly() const { return !isTreatedAsStackingContextForPaintin g(); } 84 bool isNormalFlowOnly() const { return !isTreatedAsStackingContextForPaintin g(); }
85 bool isTreatedAsStackingContextForPainting() const { return m_isTreatedAsSta ckingContextForPainting; } 85 bool isTreatedAsStackingContextForPainting() const { return m_isTreatedAsSta ckingContextForPainting; }
86 void updateIsTreatedAsStackingContextForPainting(); 86 void updateIsTreatedAsStackingContextForPainting();
87 bool normalFlowListDirty() const { return m_normalFlowListDirty; } 87 bool normalFlowListDirty() const { return m_normalFlowListDirty; }
88 void dirtyNormalFlowList(); 88 void dirtyNormalFlowList();
89 89
90 void updateStackingNodesAfterStyleChange(const ComputedStyle* oldStyle); 90 void updateStackingNodesAfterStyleChange(const ComputedStyle* oldStyle);
91 91
92 DeprecatedPaintLayerStackingNode* ancestorStackingContextNode() const; 92 DeprecatedPaintLayerStackingNode* ancestorStackingContextNode() const;
93 93
94 DeprecatedPaintLayer* layer() const { return m_layer; } 94 // FIXME: A lot of code depends on this function but shouldn't. We should
95 // build our code on top of LayoutBoxModelObject, not DeprecatedPaintLayer.
96 DeprecatedPaintLayer* layer() const;
dsinclair 2015/06/24 19:40:50 Should we consider adding an ASSERT in here and a
Julien - ping for review 2015/06/24 21:40:00 We could make it private and whitelist the classes
95 97
96 #if ENABLE(ASSERT) 98 #if ENABLE(ASSERT)
97 bool layerListMutationAllowed() const { return m_layerListMutationAllowed; } 99 bool layerListMutationAllowed() const { return m_layerListMutationAllowed; }
98 void setLayerListMutationAllowed(bool flag) { m_layerListMutationAllowed = f lag; } 100 void setLayerListMutationAllowed(bool flag) { m_layerListMutationAllowed = f lag; }
99 #endif 101 #endif
100 102
101 private: 103 private:
102 friend class DeprecatedPaintLayerStackingNodeIterator; 104 friend class DeprecatedPaintLayerStackingNodeIterator;
103 friend class DeprecatedPaintLayerStackingNodeReverseIterator; 105 friend class DeprecatedPaintLayerStackingNodeReverseIterator;
104 friend class LayoutTreeAsText; 106 friend class LayoutTreeAsText;
(...skipping 12 matching lines...) Expand all
117 } 119 }
118 120
119 Vector<DeprecatedPaintLayerStackingNode*>* negZOrderList() const 121 Vector<DeprecatedPaintLayerStackingNode*>* negZOrderList() const
120 { 122 {
121 ASSERT(!m_zOrderListsDirty); 123 ASSERT(!m_zOrderListsDirty);
122 ASSERT(isStackingContext() || !m_negZOrderList); 124 ASSERT(isStackingContext() || !m_negZOrderList);
123 return m_negZOrderList.get(); 125 return m_negZOrderList.get();
124 } 126 }
125 127
126 void rebuildZOrderLists(); 128 void rebuildZOrderLists();
127 void collectLayers(OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>>& posZOr derList, OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>>& negZOrderList);
128 129
129 #if ENABLE(ASSERT) 130 #if ENABLE(ASSERT)
130 bool isInStackingParentZOrderLists() const; 131 bool isInStackingParentZOrderLists() const;
131 bool isInStackingParentNormalFlowList() const; 132 bool isInStackingParentNormalFlowList() const;
132 void updateStackingParentForZOrderLists(DeprecatedPaintLayerStackingNode* st ackingParent); 133 void updateStackingParentForZOrderLists(DeprecatedPaintLayerStackingNode* st ackingParent);
133 void updateStackingParentForNormalFlowList(DeprecatedPaintLayerStackingNode* stackingParent); 134 void updateStackingParentForNormalFlowList(DeprecatedPaintLayerStackingNode* stackingParent);
134 void setStackingParent(DeprecatedPaintLayerStackingNode* stackingParent) { m _stackingParent = stackingParent; } 135 void setStackingParent(DeprecatedPaintLayerStackingNode* stackingParent) { m _stackingParent = stackingParent; }
135 #endif 136 #endif
136 137
137 bool shouldBeTreatedAsStackingContextForPainting() const { return layoutObje ct()->style()->isTreatedAsStackingContextForPainting(); } 138 bool shouldBeTreatedAsStackingContextForPainting() const { return layoutObje ct().style()->isTreatedAsStackingContextForPainting(); }
138 139
139 void updateNormalFlowList(); 140 void updateNormalFlowList();
140 141
141 bool isDirtyStackingContext() const { return m_zOrderListsDirty && isStackin gContext(); } 142 bool isDirtyStackingContext() const { return m_zOrderListsDirty && isStackin gContext(); }
142 143
143 DeprecatedPaintLayerCompositor* compositor() const; 144 DeprecatedPaintLayerCompositor* compositor() const;
144 // We can't return a LayoutBox as LayoutInline can be a stacking context. 145 // We can't return a LayoutBox as LayoutInline can be a stacking context.
145 LayoutBoxModelObject* layoutObject() const; 146 LayoutBoxModelObject& layoutObject() const { return m_layoutObject; }
146 147
147 DeprecatedPaintLayer* m_layer; 148 LayoutBoxModelObject& m_layoutObject;
148 149
149 // m_posZOrderList holds a sorted list of all the descendant nodes within 150 // m_posZOrderList holds a sorted list of all the descendant nodes within
150 // that have z-indices of 0 or greater (auto will count as 0). 151 // that have z-indices of 0 or greater (auto will count as 0).
151 // m_negZOrderList holds descendants within our stacking context with 152 // m_negZOrderList holds descendants within our stacking context with
152 // negative z-indices. 153 // negative z-indices.
153 OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>> m_posZOrderList; 154 OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>> m_posZOrderList;
154 OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>> m_negZOrderList; 155 OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>> m_negZOrderList;
155 156
156 // This list contains child nodes that cannot create stacking contexts. 157 // This list contains child nodes that cannot create stacking contexts.
157 OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>> m_normalFlowList; 158 OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>> m_normalFlowList;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 210
210 private: 211 private:
211 DeprecatedPaintLayerStackingNode* m_stackingNode; 212 DeprecatedPaintLayerStackingNode* m_stackingNode;
212 bool m_previousMutationAllowedState; 213 bool m_previousMutationAllowedState;
213 }; 214 };
214 #endif 215 #endif
215 216
216 } // namespace blink 217 } // namespace blink
217 218
218 #endif // DeprecatedPaintLayerStackingNode_h 219 #endif // DeprecatedPaintLayerStackingNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698