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

Side by Side Diff: third_party/WebKit/Source/core/paint/GridPainter.cpp

Issue 1529083006: [css-grid] Initial support for implicit grid before explicit grid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Apply suggested changes Created 5 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/paint/GridPainter.h" 6 #include "core/paint/GridPainter.h"
7 7
8 #include "core/layout/LayoutGrid.h" 8 #include "core/layout/LayoutGrid.h"
9 #include "core/paint/BlockPainter.h" 9 #include "core/paint/BlockPainter.h"
10 #include "core/paint/PaintInfo.h" 10 #include "core/paint/PaintInfo.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 static GridSpan dirtiedGridAreas(const Vector<LayoutUnit>& coordinates, LayoutUn it start, LayoutUnit end) 14 static GridSpan dirtiedGridAreas(const Vector<LayoutUnit>& coordinates, LayoutUn it start, LayoutUnit end)
15 { 15 {
16 // This function does a binary search over the coordinates. 16 // This function does a binary search over the coordinates.
17 // This doesn't work with grid items overflowing their grid areas, but that is managed with m_gridItemsOverflowingGridArea. 17 // This doesn't work with grid items overflowing their grid areas, but that is managed with m_gridItemsOverflowingGridArea.
18 18
19 size_t startGridAreaIndex = std::upper_bound(coordinates.begin(), coordinate s.end() - 1, start) - coordinates.begin(); 19 size_t startGridAreaIndex = std::upper_bound(coordinates.begin(), coordinate s.end() - 1, start) - coordinates.begin();
20 if (startGridAreaIndex > 0) 20 if (startGridAreaIndex > 0)
21 --startGridAreaIndex; 21 --startGridAreaIndex;
22 22
23 size_t endGridAreaIndex = std::upper_bound(coordinates.begin() + startGridAr eaIndex, coordinates.end() - 1, end) - coordinates.begin(); 23 size_t endGridAreaIndex = std::upper_bound(coordinates.begin() + startGridAr eaIndex, coordinates.end() - 1, end) - coordinates.begin();
24 if (endGridAreaIndex > 0) 24 if (endGridAreaIndex > 0)
25 --endGridAreaIndex; 25 --endGridAreaIndex;
26 26
27 // GridSpan stores lines' indexes (not tracks' indexes). 27 // GridSpan stores lines' indexes (not tracks' indexes).
28 return GridSpan::definiteGridSpan(startGridAreaIndex, endGridAreaIndex + 1); 28 return GridSpan::translatedDefiniteGridSpan(startGridAreaIndex, endGridAreaI ndex + 1);
29 } 29 }
30 30
31 class GridItemsSorter { 31 class GridItemsSorter {
32 public: 32 public:
33 bool operator()(const std::pair<LayoutBox*, size_t>& firstChild, const std:: pair<LayoutBox*, size_t>& secondChild) const 33 bool operator()(const std::pair<LayoutBox*, size_t>& firstChild, const std:: pair<LayoutBox*, size_t>& secondChild) const
34 { 34 {
35 if (firstChild.first->style()->order() != secondChild.first->style()->or der()) 35 if (firstChild.first->style()->order() != secondChild.first->style()->or der())
36 return firstChild.first->style()->order() < secondChild.first->style ()->order(); 36 return firstChild.first->style()->order() < secondChild.first->style ()->order();
37 37
38 return firstChild.second < secondChild.second; 38 return firstChild.second < secondChild.second;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 LayoutBox* current = gridItemAndPaintIndex.first; 75 LayoutBox* current = gridItemAndPaintIndex.first;
76 if (current == previous) 76 if (current == previous)
77 continue; 77 continue;
78 78
79 BlockPainter(m_layoutGrid).paintChildAsInlineBlock(*current, paintInfo, paintOffset); 79 BlockPainter(m_layoutGrid).paintChildAsInlineBlock(*current, paintInfo, paintOffset);
80 previous = current; 80 previous = current;
81 } 81 }
82 } 82 }
83 83
84 } // namespace blink 84 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698