Index: third_party/WebKit/Source/core/paint/GridPainter.cpp |
diff --git a/third_party/WebKit/Source/core/paint/GridPainter.cpp b/third_party/WebKit/Source/core/paint/GridPainter.cpp |
index a5bc679deb796aa8c847effa46cf3f1aaa5a6f86..066b901e33083de3ba4111804c5872735d21cdf7 100644 |
--- a/third_party/WebKit/Source/core/paint/GridPainter.cpp |
+++ b/third_party/WebKit/Source/core/paint/GridPainter.cpp |
@@ -36,18 +36,13 @@ static GridSpan dirtiedGridAreas(const Vector<LayoutUnit>& coordinates, |
endGridAreaIndex + 1); |
} |
-class GridItemsSorter { |
- public: |
- bool operator()(const std::pair<LayoutBox*, size_t>& firstChild, |
- const std::pair<LayoutBox*, size_t>& secondChild) const { |
- if (firstChild.first->style()->order() != |
- secondChild.first->style()->order()) |
- return firstChild.first->style()->order() < |
- secondChild.first->style()->order(); |
- |
- return firstChild.second < secondChild.second; |
- } |
-}; |
+// Helper for the sorting of grid items following order-modified document order. |
+// See http://www.w3.org/TR/css-flexbox/#order-modified-document-order |
+static inline bool compareOrderModifiedDocumentOrder( |
+ const std::pair<LayoutBox*, size_t>& firstItem, |
+ const std::pair<LayoutBox*, size_t>& secondItem) { |
+ return firstItem.second < secondItem.second; |
+} |
void GridPainter::paintChildren(const PaintInfo& paintInfo, |
const LayoutPoint& paintOffset) { |
@@ -103,10 +98,8 @@ void GridPainter::paintChildren(const PaintInfo& paintInfo, |
std::make_pair(item, m_layoutGrid.paintIndexForGridItem(item))); |
} |
- // Sort grid items following order-modified document order. |
- // See http://www.w3.org/TR/css-flexbox/#order-modified-document-order |
std::stable_sort(gridItemsToBePainted.begin(), gridItemsToBePainted.end(), |
- GridItemsSorter()); |
+ compareOrderModifiedDocumentOrder); |
LayoutBox* previous = 0; |
for (const auto& gridItemAndPaintIndex : gridItemsToBePainted) { |