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

Unified Diff: third_party/WebKit/Source/core/paint/GridPainter.cpp

Issue 2438253003: [css-grid] Use order-modified document order for m_gridItemsIndexesMap (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutGrid.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutGrid.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698