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

Side by Side Diff: Source/core/rendering/OrderIterator.cpp

Issue 18516007: Add support for 'order' on grid items (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 14 matching lines...) Expand all
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/rendering/OrderIterator.h" 32 #include "core/rendering/OrderIterator.h"
33 33
34 #include "core/rendering/RenderFlexibleBox.h" 34 #include "core/rendering/RenderFlexibleBox.h"
35 #include "core/rendering/RenderGrid.h"
35 36
36 namespace WebCore { 37 namespace WebCore {
37 38
38 OrderIterator::OrderIterator(const RenderFlexibleBox* flexibleBox) 39 OrderIterator::OrderIterator(const RenderFlexibleBox* flexibleBox)
39 : m_flexibleBox(flexibleBox) 40 : m_containerBox(flexibleBox)
40 , m_currentChild(0) 41 , m_currentChild(0)
41 , m_orderValuesIterator(0) 42 , m_orderValuesIterator(0)
42 { 43 {
44 }
45
46 OrderIterator::OrderIterator(const RenderGrid* gridContainerBox)
47 : m_containerBox(gridContainerBox)
48 , m_currentChild(0)
49 , m_orderValuesIterator(0)
50 {
43 } 51 }
44 52
45 void OrderIterator::setOrderValues(Vector<int>& orderValues) 53 void OrderIterator::setOrderValues(Vector<int>& orderValues)
46 { 54 {
47 reset(); 55 reset();
48 m_orderValues.clear(); 56 m_orderValues.clear();
49 57
50 if (orderValues.isEmpty()) 58 if (orderValues.isEmpty())
51 return; 59 return;
52 60
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 if (m_orderValuesIterator == m_orderValues.end()) 92 if (m_orderValuesIterator == m_orderValues.end())
85 return 0; 93 return 0;
86 if (m_orderValuesIterator) { 94 if (m_orderValuesIterator) {
87 ++m_orderValuesIterator; 95 ++m_orderValuesIterator;
88 if (m_orderValuesIterator == m_orderValues.end()) 96 if (m_orderValuesIterator == m_orderValues.end())
89 return 0; 97 return 0;
90 } else { 98 } else {
91 m_orderValuesIterator = m_orderValues.begin(); 99 m_orderValuesIterator = m_orderValues.begin();
92 } 100 }
93 101
94 m_currentChild = m_flexibleBox->firstChildBox(); 102 m_currentChild = m_containerBox->firstChildBox();
95 } else { 103 } else {
96 m_currentChild = m_currentChild->nextSiblingBox(); 104 m_currentChild = m_currentChild->nextSiblingBox();
97 } 105 }
98 } while (!m_currentChild || m_currentChild->style()->order() != *m_orderValu esIterator); 106 } while (!m_currentChild || m_currentChild->style()->order() != *m_orderValu esIterator);
99 107
100 return m_currentChild; 108 return m_currentChild;
101 } 109 }
102 110
103 void OrderIterator::reset() 111 void OrderIterator::reset()
104 { 112 {
105 m_currentChild = 0; 113 m_currentChild = 0;
106 m_orderValuesIterator = 0; 114 m_orderValuesIterator = 0;
107 } 115 }
108 116
109 } // namespace WebCore 117 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698