<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[167879] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/167879">167879</a></dd>
<dt>Author</dt> <dd>rego@igalia.com</dd>
<dt>Date</dt> <dd>2014-04-28 01:27:06 -0700 (Mon, 28 Apr 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>OrderIterator refactoring to avoid extra loops
https://bugs.webkit.org/show_bug.cgi?id=119061
Reviewed by Darin Adler.
This patch removes order values Vector and use a Vector of pairs instead. The pairs are formed by a child
(RenderBox) and the index of this child. In addition, OrderIterator code is simplified.
It provides a helper class OrderIteratorPopulator, used for manipulating the Vector directly. Which allows to
consolidate the code into a single implementation across flexbox and grid. OrderIteratorPopulator part is based
on a patch from Blink <a href="http://trac.webkit.org/projects/webkit/changeset/153971">r153971</a> by <jchaffraix@chromium.org>.
Current implementation is O(number of children * number of order values). Now it will just do a sort operation
and then a regular loop. So if you have different order values in a flexbox or grid the performance will
improve.
Comparing results of perf-tests:
* Layout/auto-grid-lots-of-data: ~0.5% worse.
* Layout/fixed-grid-lots-of-data: ~0.5% worse.
* Layout/fixed-grid-lots-of-data (setting 100 different order values): ~50% better.
* Layout/flexbox-lots-of-data: ~5% better.
No new tests, already covered by current tests.
* rendering/OrderIterator.cpp:
(WebCore::OrderIterator::currentChild): Return current child according to m_childrenIndex.
(WebCore::OrderIterator::first): Initialize m_childrenIndex and return current child.
(WebCore::OrderIterator::next): Increase m_childrenIndex and return current child.
(WebCore::compareByOrderValueAndIndex): Sorts the Vector by order value and index.
(WebCore::OrderIteratorPopulator::~OrderIteratorPopulator): Calls compareByOrderValueAndIndex() if there is any
child with non default order value.
(WebCore::OrderIteratorPopulator::collectChild): Adds the child and index to the Vector. Update
m_allChildrenHaveDefaultOrderValue accordingly.
(WebCore::OrderIterator::OrderIterator): Deleted.
(WebCore::OrderIterator::setOrderValues): Deleted.
(WebCore::OrderIterator::reset): Deleted.
* rendering/OrderIterator.h:
(WebCore::OrderIteratorPopulator::OrderIteratorPopulator): New helper class to manipulate the Vector.
(WebCore::OrderIterator::currentChild): Deleted.
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::RenderFlexibleBox): Remove OrderIterator intialization.
(WebCore::RenderFlexibleBox::layoutBlock): Remove unneeded code related to old OrderValues vector.
(WebCore::RenderFlexibleBox::prepareOrderIteratorAndMargins): Populate OrderIterator using collectChild().
(WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes): Deleted.
* rendering/RenderFlexibleBox.h: Rename computeMainAxisPreferredSizes() to prepareOrderIteratorAndMargins().
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::RenderGrid): Remove OrderIterator initialization.
(WebCore::RenderGrid::populateExplicitGridAndOrderIterator): Populate OrderIterator using collectChild().</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingOrderIteratorcpp">trunk/Source/WebCore/rendering/OrderIterator.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingOrderIteratorh">trunk/Source/WebCore/rendering/OrderIterator.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderFlexibleBoxcpp">trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderFlexibleBoxh">trunk/Source/WebCore/rendering/RenderFlexibleBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderGridcpp">trunk/Source/WebCore/rendering/RenderGrid.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (167878 => 167879)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-04-28 08:16:15 UTC (rev 167878)
+++ trunk/Source/WebCore/ChangeLog        2014-04-28 08:27:06 UTC (rev 167879)
</span><span class="lines">@@ -1,3 +1,54 @@
</span><ins>+2014-04-28 Manuel Rego Casasnovas <rego@igalia.com>
+
+ OrderIterator refactoring to avoid extra loops
+ https://bugs.webkit.org/show_bug.cgi?id=119061
+
+ Reviewed by Darin Adler.
+
+ This patch removes order values Vector and use a Vector of pairs instead. The pairs are formed by a child
+ (RenderBox) and the index of this child. In addition, OrderIterator code is simplified.
+
+ It provides a helper class OrderIteratorPopulator, used for manipulating the Vector directly. Which allows to
+ consolidate the code into a single implementation across flexbox and grid. OrderIteratorPopulator part is based
+ on a patch from Blink r153971 by <jchaffraix@chromium.org>.
+
+ Current implementation is O(number of children * number of order values). Now it will just do a sort operation
+ and then a regular loop. So if you have different order values in a flexbox or grid the performance will
+ improve.
+
+ Comparing results of perf-tests:
+ * Layout/auto-grid-lots-of-data: ~0.5% worse.
+ * Layout/fixed-grid-lots-of-data: ~0.5% worse.
+ * Layout/fixed-grid-lots-of-data (setting 100 different order values): ~50% better.
+ * Layout/flexbox-lots-of-data: ~5% better.
+
+ No new tests, already covered by current tests.
+
+ * rendering/OrderIterator.cpp:
+ (WebCore::OrderIterator::currentChild): Return current child according to m_childrenIndex.
+ (WebCore::OrderIterator::first): Initialize m_childrenIndex and return current child.
+ (WebCore::OrderIterator::next): Increase m_childrenIndex and return current child.
+ (WebCore::compareByOrderValueAndIndex): Sorts the Vector by order value and index.
+ (WebCore::OrderIteratorPopulator::~OrderIteratorPopulator): Calls compareByOrderValueAndIndex() if there is any
+ child with non default order value.
+ (WebCore::OrderIteratorPopulator::collectChild): Adds the child and index to the Vector. Update
+ m_allChildrenHaveDefaultOrderValue accordingly.
+ (WebCore::OrderIterator::OrderIterator): Deleted.
+ (WebCore::OrderIterator::setOrderValues): Deleted.
+ (WebCore::OrderIterator::reset): Deleted.
+ * rendering/OrderIterator.h:
+ (WebCore::OrderIteratorPopulator::OrderIteratorPopulator): New helper class to manipulate the Vector.
+ (WebCore::OrderIterator::currentChild): Deleted.
+ * rendering/RenderFlexibleBox.cpp:
+ (WebCore::RenderFlexibleBox::RenderFlexibleBox): Remove OrderIterator intialization.
+ (WebCore::RenderFlexibleBox::layoutBlock): Remove unneeded code related to old OrderValues vector.
+ (WebCore::RenderFlexibleBox::prepareOrderIteratorAndMargins): Populate OrderIterator using collectChild().
+ (WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes): Deleted.
+ * rendering/RenderFlexibleBox.h: Rename computeMainAxisPreferredSizes() to prepareOrderIteratorAndMargins().
+ * rendering/RenderGrid.cpp:
+ (WebCore::RenderGrid::RenderGrid): Remove OrderIterator initialization.
+ (WebCore::RenderGrid::populateExplicitGridAndOrderIterator): Populate OrderIterator using collectChild().
+
</ins><span class="cx"> 2014-04-28 Zan Dobersek <zdobersek@igalia.com>
</span><span class="cx">
</span><span class="cx"> std::bitset<>::test() does unnecessary bounds checks on CSSPropertyID bitsets
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingOrderIteratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/OrderIterator.cpp (167878 => 167879)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/OrderIterator.cpp        2014-04-28 08:16:15 UTC (rev 167878)
+++ trunk/Source/WebCore/rendering/OrderIterator.cpp        2014-04-28 08:27:06 UTC (rev 167879)
</span><span class="lines">@@ -32,66 +32,51 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "OrderIterator.h"
</span><span class="cx">
</span><del>-#include "RenderFlexibleBox.h"
-#include "RenderGrid.h"
</del><ins>+#include "RenderBox.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-static const int cInvalidIndex = -1;
-
-OrderIterator::OrderIterator(RenderBox& containerBox)
- : m_containerBox(containerBox)
</del><ins>+RenderBox* OrderIterator::currentChild() const
</ins><span class="cx"> {
</span><del>- reset();
-}
</del><ins>+ if (m_childrenIndex == m_children.size())
+ return nullptr;
</ins><span class="cx">
</span><del>-void OrderIterator::setOrderValues(OrderValues&& orderValues)
-{
- reset();
- m_orderValues = std::move(orderValues);
- if (m_orderValues.size() < 2)
- return;
-
- std::sort(m_orderValues.begin(), m_orderValues.end());
- auto nextElement = std::unique(m_orderValues.begin(), m_orderValues.end());
- m_orderValues.shrinkCapacity(nextElement - m_orderValues.begin());
</del><ins>+ return m_children[m_childrenIndex].first;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RenderBox* OrderIterator::first()
</span><span class="cx"> {
</span><del>- reset();
- return next();
</del><ins>+ m_childrenIndex = 0;
+ return currentChild();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RenderBox* OrderIterator::next()
</span><span class="cx"> {
</span><del>- int endIndex = m_orderValues.size();
- do {
- if (m_currentChild) {
- m_currentChild = m_currentChild->nextSiblingBox();
- continue;
- }
</del><ins>+ ++m_childrenIndex;
+ return currentChild();
+}
</ins><span class="cx">
</span><del>- if (m_orderIndex == endIndex)
- return nullptr;
</del><ins>+static bool compareByOrderValueAndIndex(std::pair<RenderBox*, int> childAndIndex1, std::pair<RenderBox*, int> childAndIndex2)
+{
+ if (childAndIndex1.first->style().order() != childAndIndex2.first->style().order())
+ return childAndIndex1.first->style().order() < childAndIndex2.first->style().order();
+ return childAndIndex1.second < childAndIndex2.second;
+}
</ins><span class="cx">
</span><del>- if (m_orderIndex != cInvalidIndex) {
- ++m_orderIndex;
- if (m_orderIndex == endIndex)
- return nullptr;
- } else
- m_orderIndex = 0;
-
- m_currentChild = m_containerBox.firstChildBox();
- } while (!m_currentChild || m_currentChild->style().order() != m_orderValues[m_orderIndex]);
-
- return m_currentChild;
</del><ins>+OrderIteratorPopulator::~OrderIteratorPopulator()
+{
+ if (!m_allChildrenHaveDefaultOrderValue)
+ std::sort(m_iterator.m_children.begin(), m_iterator.m_children.end(), compareByOrderValueAndIndex);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void OrderIterator::reset()
</del><ins>+void OrderIteratorPopulator::collectChild(RenderBox& child)
</ins><span class="cx"> {
</span><del>- m_currentChild = nullptr;
- m_orderIndex = cInvalidIndex;
</del><ins>+ std::pair<RenderBox*, int> childAndIndex = { &child, m_childIndex++ };
+ m_iterator.m_children.append(childAndIndex);
+
+ if (m_allChildrenHaveDefaultOrderValue && child.style().order())
+ m_allChildrenHaveDefaultOrderValue = false;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingOrderIteratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/OrderIterator.h (167878 => 167879)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/OrderIterator.h        2014-04-28 08:16:15 UTC (rev 167878)
+++ trunk/Source/WebCore/rendering/OrderIterator.h        2014-04-28 08:27:06 UTC (rev 167879)
</span><span class="lines">@@ -41,24 +41,39 @@
</span><span class="cx">
</span><span class="cx"> class OrderIterator {
</span><span class="cx"> public:
</span><del>- OrderIterator(RenderBox&);
</del><ins>+ friend class OrderIteratorPopulator;
</ins><span class="cx">
</span><del>- typedef Vector<int, 1> OrderValues;
- void setOrderValues(OrderValues&&);
-
- RenderBox* currentChild() const { return m_currentChild; }
</del><ins>+ RenderBox* currentChild() const;
</ins><span class="cx"> RenderBox* first();
</span><span class="cx"> RenderBox* next();
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> void reset();
</span><span class="cx">
</span><del>- RenderBox& m_containerBox;
- RenderBox* m_currentChild;
- OrderValues m_orderValues;
- int m_orderIndex;
</del><ins>+ Vector<std::pair<RenderBox*, int>> m_children;
+ size_t m_childrenIndex;
</ins><span class="cx"> };
</span><span class="cx">
</span><ins>+class OrderIteratorPopulator {
+public:
+ OrderIteratorPopulator(OrderIterator& iterator)
+ : m_iterator(iterator)
+ , m_childIndex(0)
+ , m_allChildrenHaveDefaultOrderValue(true)
+ {
+ m_iterator.m_children.clear();
+ }
+
+ ~OrderIteratorPopulator();
+
+ void collectChild(RenderBox&);
+
+private:
+ OrderIterator& m_iterator;
+ size_t m_childIndex;
+ bool m_allChildrenHaveDefaultOrderValue;
+};
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // OrderIterator_h
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderFlexibleBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (167878 => 167879)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp        2014-04-28 08:16:15 UTC (rev 167878)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp        2014-04-28 08:27:06 UTC (rev 167879)
</span><span class="lines">@@ -68,7 +68,6 @@
</span><span class="cx">
</span><span class="cx"> RenderFlexibleBox::RenderFlexibleBox(Element& element, PassRef<RenderStyle> style)
</span><span class="cx"> : RenderBlock(element, std::move(style), 0)
</span><del>- , m_orderIterator(*this)
</del><span class="cx"> , m_numberOfInFlowChildrenOnFirstLine(-1)
</span><span class="cx"> {
</span><span class="cx"> setChildrenInline(false); // All of our children must be block-level.
</span><span class="lines">@@ -76,7 +75,6 @@
</span><span class="cx">
</span><span class="cx"> RenderFlexibleBox::RenderFlexibleBox(Document& document, PassRef<RenderStyle> style)
</span><span class="cx"> : RenderBlock(document, std::move(style), 0)
</span><del>- , m_orderIterator(*this)
</del><span class="cx"> , m_numberOfInFlowChildrenOnFirstLine(-1)
</span><span class="cx"> {
</span><span class="cx"> setChildrenInline(false); // All of our children must be block-level.
</span><span class="lines">@@ -275,13 +273,11 @@
</span><span class="cx">
</span><span class="cx"> dirtyForLayoutFromPercentageHeightDescendants();
</span><span class="cx">
</span><del>- Vector<LineContext> lineContexts;
- OrderIterator::OrderValues orderValues;
- computeMainAxisPreferredSizes(orderValues);
- m_orderIterator.setOrderValues(std::move(orderValues));
</del><ins>+ prepareOrderIteratorAndMargins();
</ins><span class="cx">
</span><span class="cx"> ChildFrameRects oldChildRects;
</span><span class="cx"> appendChildFrameRects(oldChildRects);
</span><ins>+ Vector<LineContext> lineContexts;
</ins><span class="cx"> layoutFlexItems(relayoutChildren, lineContexts);
</span><span class="cx">
</span><span class="cx"> updateLogicalHeight();
</span><span class="lines">@@ -834,16 +830,12 @@
</span><span class="cx"> return minimumValueForLength(margin, availableSize);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RenderFlexibleBox::computeMainAxisPreferredSizes(OrderIterator::OrderValues& orderValues)
</del><ins>+void RenderFlexibleBox::prepareOrderIteratorAndMargins()
</ins><span class="cx"> {
</span><del>- ASSERT(orderValues.isEmpty());
</del><ins>+ OrderIteratorPopulator populator(m_orderIterator);
</ins><span class="cx">
</span><span class="cx"> for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
</span><del>- // Avoid growing the vector for the common-case default value of 0. This optimizes the most common case which is
- // one or a few values with the default order 0
- int order = child->style().order();
- if (orderValues.isEmpty() || orderValues.last() != order)
- orderValues.append(order);
</del><ins>+ populator.collectChild(*child);
</ins><span class="cx">
</span><span class="cx"> if (child->isOutOfFlowPositioned())
</span><span class="cx"> continue;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderFlexibleBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.h (167878 => 167879)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderFlexibleBox.h        2014-04-28 08:16:15 UTC (rev 167878)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.h        2014-04-28 08:27:06 UTC (rev 167879)
</span><span class="lines">@@ -137,7 +137,7 @@
</span><span class="cx"> LayoutUnit marginBoxAscentForChild(RenderBox&);
</span><span class="cx">
</span><span class="cx"> LayoutUnit computeChildMarginValue(const Length& margin);
</span><del>- void computeMainAxisPreferredSizes(OrderIterator::OrderValues&);
</del><ins>+ void prepareOrderIteratorAndMargins();
</ins><span class="cx"> LayoutUnit adjustChildSizeForMinAndMax(RenderBox&, LayoutUnit childSize);
</span><span class="cx"> bool computeNextFlexLine(OrderedFlexItemList& orderedChildren, LayoutUnit& preferredMainAxisExtent, double& totalFlexGrow, double& totalWeightedFlexShrink, LayoutUnit& minMaxAppliedMainAxisExtent, bool& hasInfiniteLineLength);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderGridcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (167878 => 167879)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderGrid.cpp        2014-04-28 08:16:15 UTC (rev 167878)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp        2014-04-28 08:27:06 UTC (rev 167879)
</span><span class="lines">@@ -164,7 +164,6 @@
</span><span class="cx">
</span><span class="cx"> RenderGrid::RenderGrid(Element& element, PassRef<RenderStyle> style)
</span><span class="cx"> : RenderBlock(element, std::move(style), 0)
</span><del>- , m_orderIterator(*this)
</del><span class="cx"> {
</span><span class="cx"> // All of our children must be block level.
</span><span class="cx"> setChildrenInline(false);
</span><span class="lines">@@ -699,17 +698,12 @@
</span><span class="cx">
</span><span class="cx"> void RenderGrid::populateExplicitGridAndOrderIterator()
</span><span class="cx"> {
</span><del>- // FIXME: We should find a way to share OrderValues's initialization code with RenderFlexibleBox.
- OrderIterator::OrderValues orderValues;
</del><ins>+ OrderIteratorPopulator populator(m_orderIterator);
</ins><span class="cx"> size_t maximumRowIndex = std::max<size_t>(1, explicitGridRowCount());
</span><span class="cx"> size_t maximumColumnIndex = std::max<size_t>(1, explicitGridColumnCount());
</span><span class="cx">
</span><span class="cx"> for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
</span><del>- // Avoid growing the vector for the common-case default value of 0. This optimizes the most common case which is
- // one or a few values with the default order 0
- int order = child->style().order();
- if (orderValues.isEmpty() || orderValues.last() != order)
- orderValues.append(order);
</del><ins>+ populator.collectChild(*child);
</ins><span class="cx">
</span><span class="cx"> // This function bypasses the cache (cachedGridCoordinate()) as it is used to build it.
</span><span class="cx"> std::unique_ptr<GridSpan> rowPositions = resolveGridPositionsFromStyle(child, ForRows);
</span><span class="lines">@@ -726,8 +720,6 @@
</span><span class="cx"> m_grid.grow(maximumRowIndex);
</span><span class="cx"> for (size_t i = 0; i < m_grid.size(); ++i)
</span><span class="cx"> m_grid[i].grow(maximumColumnIndex);
</span><del>-
- m_orderIterator.setOrderValues(std::move(orderValues));
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderGrid::placeSpecifiedMajorAxisItemsOnGrid(const Vector<RenderBox*>& autoGridItems)
</span></span></pre>
</div>
</div>
</body>
</html>