Index: Source/core/rendering/OrderIterator.cpp |
diff --git a/Source/core/rendering/OrderIterator.cpp b/Source/core/rendering/OrderIterator.cpp |
index d55779cc4cf8de6523a7a428241a3f9b5530328a..1cda9c59b3cf665bb4564d99961a9afc49272de3 100644 |
--- a/Source/core/rendering/OrderIterator.cpp |
+++ b/Source/core/rendering/OrderIterator.cpp |
@@ -62,9 +62,9 @@ RenderBox* OrderIterator::next() |
m_orderValuesIterator = m_orderValues.begin(); |
} |
- m_currentChild = m_containerBox->firstChildBox(); |
+ m_currentChild = firstChildBox(); |
} else { |
- m_currentChild = m_currentChild->nextSiblingBox(); |
+ m_currentChild = nextSiblingBox(); |
} |
} while (!m_currentChild || m_currentChild->style()->order() != *m_orderValuesIterator); |
@@ -77,6 +77,26 @@ void OrderIterator::reset() |
m_orderValuesIterator = 0; |
} |
+RenderBox* OrderIterator::firstChildBox() |
+{ |
+ if (m_children.isEmpty()) |
+ return m_containerBox->firstChildBox(); |
+ |
+ m_childIndex = 0; |
+ return m_children[0]; |
+} |
+ |
+RenderBox* OrderIterator::nextSiblingBox() |
+{ |
+ if (m_children.isEmpty()) |
+ return m_currentChild->nextSiblingBox(); |
+ |
+ if (m_childIndex >= m_children.size() - 1) |
+ return 0; |
+ |
+ return m_children[++m_childIndex]; |
+} |
+ |
OrderIteratorPopulator::~OrderIteratorPopulator() |
{ |
m_iterator.reset(); |
@@ -110,6 +130,13 @@ void OrderIteratorPopulator::removeDuplicatedOrderValues() |
orderValues.shrink(uniqueItemIndex + 1); |
} |
+void OrderIteratorPopulator::storeChild(RenderBox* child) |
+{ |
+ m_iterator.m_children.append(child); |
+ |
+ collectChild(child); |
+} |
+ |
void OrderIteratorPopulator::collectChild(const RenderBox* child) |
{ |
// Avoid growing the vector for the common-case default value of 0. |