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

Side by Side Diff: Source/core/paint/DeprecatedPaintLayerStackingNodeIterator.cpp

Issue 1188363002: Compute the normal flow list on the fly (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Reviewnated patch! 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
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayerStackingNodeIterator.h ('k') | no next file » | 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/paint/DeprecatedPaintLayerStackingNodeIterator.h" 32 #include "core/paint/DeprecatedPaintLayerStackingNodeIterator.h"
33 33
34 // FIXME: We should build our primitive on top of
35 // DeprecatedLayerStackingNode and remove this include.
36 #include "core/paint/DeprecatedPaintLayer.h"
34 #include "core/paint/DeprecatedPaintLayerStackingNode.h" 37 #include "core/paint/DeprecatedPaintLayerStackingNode.h"
35 38
36 namespace blink { 39 namespace blink {
37 40
41 DeprecatedPaintLayerStackingNodeIterator::DeprecatedPaintLayerStackingNodeIterat or(const DeprecatedPaintLayerStackingNode& root, unsigned whichChildren)
42 : m_root(root)
43 , m_remainingChildren(whichChildren)
44 , m_index(0)
45 {
46 m_currentNormalFlowChild = root.layer()->firstChild();
47 }
48
38 DeprecatedPaintLayerStackingNode* DeprecatedPaintLayerStackingNodeIterator::next () 49 DeprecatedPaintLayerStackingNode* DeprecatedPaintLayerStackingNodeIterator::next ()
39 { 50 {
40 if (m_remainingChildren & NegativeZOrderChildren) { 51 if (m_remainingChildren & NegativeZOrderChildren) {
41 Vector<DeprecatedPaintLayerStackingNode*>* negZOrderList = m_root.negZOr derList(); 52 Vector<DeprecatedPaintLayerStackingNode*>* negZOrderList = m_root.negZOr derList();
42 if (negZOrderList && m_index < negZOrderList->size()) 53 if (negZOrderList && m_index < negZOrderList->size())
43 return negZOrderList->at(m_index++); 54 return negZOrderList->at(m_index++);
44 55
45 m_index = 0; 56 m_index = 0;
46 m_remainingChildren &= ~NegativeZOrderChildren; 57 m_remainingChildren &= ~NegativeZOrderChildren;
47 } 58 }
48 59
49 if (m_remainingChildren & NormalFlowChildren) { 60 if (m_remainingChildren & NormalFlowChildren) {
50 Vector<DeprecatedPaintLayerStackingNode*>* normalFlowList = m_root.norma lFlowList(); 61 for (; m_currentNormalFlowChild; m_currentNormalFlowChild = m_currentNor malFlowChild->nextSibling()) {
51 if (normalFlowList && m_index < normalFlowList->size()) 62 if (!m_currentNormalFlowChild->stackingNode()->isTreatedAsStackingCo ntextForPainting() && !m_currentNormalFlowChild->isReflection()) {
52 return normalFlowList->at(m_index++); 63 DeprecatedPaintLayer* normalFlowChild = m_currentNormalFlowChild ;
64 m_currentNormalFlowChild = m_currentNormalFlowChild->nextSibling ();
65 return normalFlowChild->stackingNode();
66 }
67 }
53 68
54 m_index = 0; 69 // We reset the iterator in case we reuse it.
70 m_currentNormalFlowChild = m_root.layer()->firstChild();
chrishtr 2015/06/24 23:07:55 Is this functionality actually used? I don't think
Julien - ping for review 2015/06/24 23:13:57 It's not used no. For consistency with the other c
chrishtr 2015/06/24 23:36:30 It seems weird as written. Because you can call ne
Julien - ping for review 2015/06/25 17:16:24 It won't loop around as we remove normal flow chil
chrishtr 2015/06/25 17:20:49 If you call next() and it's already at the end, th
chrishtr 2015/06/25 20:38:19 I see now. (Julien explained offline). LGTM
55 m_remainingChildren &= ~NormalFlowChildren; 71 m_remainingChildren &= ~NormalFlowChildren;
56 } 72 }
57 73
58 if (m_remainingChildren & PositiveZOrderChildren) { 74 if (m_remainingChildren & PositiveZOrderChildren) {
59 Vector<DeprecatedPaintLayerStackingNode*>* posZOrderList = m_root.posZOr derList(); 75 Vector<DeprecatedPaintLayerStackingNode*>* posZOrderList = m_root.posZOr derList();
60 if (posZOrderList && m_index < posZOrderList->size()) 76 if (posZOrderList && m_index < posZOrderList->size())
61 return posZOrderList->at(m_index++); 77 return posZOrderList->at(m_index++);
62 78
63 m_index = 0; 79 m_index = 0;
64 m_remainingChildren &= ~PositiveZOrderChildren; 80 m_remainingChildren &= ~PositiveZOrderChildren;
65 } 81 }
66 82
67 return 0; 83 return 0;
68 } 84 }
69 85
70 DeprecatedPaintLayerStackingNode* DeprecatedPaintLayerStackingNodeReverseIterato r::next() 86 DeprecatedPaintLayerStackingNode* DeprecatedPaintLayerStackingNodeReverseIterato r::next()
71 { 87 {
72 if (m_remainingChildren & NegativeZOrderChildren) { 88 if (m_remainingChildren & NegativeZOrderChildren) {
73 Vector<DeprecatedPaintLayerStackingNode*>* negZOrderList = m_root.negZOr derList(); 89 Vector<DeprecatedPaintLayerStackingNode*>* negZOrderList = m_root.negZOr derList();
74 if (negZOrderList && m_index >= 0) 90 if (negZOrderList && m_index >= 0)
75 return negZOrderList->at(m_index--); 91 return negZOrderList->at(m_index--);
76 92
77 m_remainingChildren &= ~NegativeZOrderChildren; 93 m_remainingChildren &= ~NegativeZOrderChildren;
78 setIndexToLastItem(); 94 setIndexToLastItem();
79 } 95 }
80 96
81 if (m_remainingChildren & NormalFlowChildren) { 97 if (m_remainingChildren & NormalFlowChildren) {
82 Vector<DeprecatedPaintLayerStackingNode*>* normalFlowList = m_root.norma lFlowList(); 98 for (; m_currentNormalFlowChild; m_currentNormalFlowChild = m_currentNor malFlowChild->previousSibling()) {
83 if (normalFlowList && m_index >= 0) 99 if (!m_currentNormalFlowChild->stackingNode()->isTreatedAsStackingCo ntextForPainting() && !m_currentNormalFlowChild->isReflection()) {
84 return normalFlowList->at(m_index--); 100 DeprecatedPaintLayer* normalFlowChild = m_currentNormalFlowChild ;
101 m_currentNormalFlowChild = m_currentNormalFlowChild->previousSib ling();
102 return normalFlowChild->stackingNode();
103 }
104 }
85 105
86 m_remainingChildren &= ~NormalFlowChildren; 106 m_remainingChildren &= ~NormalFlowChildren;
87 setIndexToLastItem(); 107 setIndexToLastItem();
88 } 108 }
89 109
90 if (m_remainingChildren & PositiveZOrderChildren) { 110 if (m_remainingChildren & PositiveZOrderChildren) {
91 Vector<DeprecatedPaintLayerStackingNode*>* posZOrderList = m_root.posZOr derList(); 111 Vector<DeprecatedPaintLayerStackingNode*>* posZOrderList = m_root.posZOr derList();
92 if (posZOrderList && m_index >= 0) 112 if (posZOrderList && m_index >= 0)
93 return posZOrderList->at(m_index--); 113 return posZOrderList->at(m_index--);
94 114
(...skipping 10 matching lines...) Expand all
105 Vector<DeprecatedPaintLayerStackingNode*>* negZOrderList = m_root.negZOr derList(); 125 Vector<DeprecatedPaintLayerStackingNode*>* negZOrderList = m_root.negZOr derList();
106 if (negZOrderList) { 126 if (negZOrderList) {
107 m_index = negZOrderList->size() - 1; 127 m_index = negZOrderList->size() - 1;
108 return; 128 return;
109 } 129 }
110 130
111 m_remainingChildren &= ~NegativeZOrderChildren; 131 m_remainingChildren &= ~NegativeZOrderChildren;
112 } 132 }
113 133
114 if (m_remainingChildren & NormalFlowChildren) { 134 if (m_remainingChildren & NormalFlowChildren) {
115 Vector<DeprecatedPaintLayerStackingNode*>* normalFlowList = m_root.norma lFlowList(); 135 m_currentNormalFlowChild = m_root.layer()->lastChild();
116 if (normalFlowList) { 136 return;
117 m_index = normalFlowList->size() - 1;
118 return;
119 }
120
121 m_remainingChildren &= ~NormalFlowChildren;
122 } 137 }
123 138
124 if (m_remainingChildren & PositiveZOrderChildren) { 139 if (m_remainingChildren & PositiveZOrderChildren) {
125 Vector<DeprecatedPaintLayerStackingNode*>* posZOrderList = m_root.posZOr derList(); 140 Vector<DeprecatedPaintLayerStackingNode*>* posZOrderList = m_root.posZOr derList();
126 if (posZOrderList) { 141 if (posZOrderList) {
127 m_index = posZOrderList->size() - 1; 142 m_index = posZOrderList->size() - 1;
128 return; 143 return;
129 } 144 }
130 145
131 m_remainingChildren &= ~PositiveZOrderChildren; 146 m_remainingChildren &= ~PositiveZOrderChildren;
132 } 147 }
133 148
134 // No more list to visit. 149 // No more list to visit.
135 ASSERT(!m_remainingChildren); 150 ASSERT(!m_remainingChildren);
136 m_index = -1; 151 m_index = -1;
137 } 152 }
138 153
139 } // namespace blink 154 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayerStackingNodeIterator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698