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

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

Issue 1451883002: [css-grid] Store lines instead of tracks in GridResolvedPosition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 return GridSpan(startGridAreaIndex, endGridAreaIndex); 27 return GridSpan(startGridAreaIndex, endGridAreaIndex + 1);
svillar 2015/11/17 11:37:05 I guess this deserves a comment explaining that Gr
Manuel Rego 2015/11/17 14:30:49 Done.
28 } 28 }
29 29
30 class GridItemsSorter { 30 class GridItemsSorter {
31 public: 31 public:
32 bool operator()(const std::pair<LayoutBox*, size_t>& firstChild, const std:: pair<LayoutBox*, size_t>& secondChild) const 32 bool operator()(const std::pair<LayoutBox*, size_t>& firstChild, const std:: pair<LayoutBox*, size_t>& secondChild) const
33 { 33 {
34 if (firstChild.first->style()->order() != secondChild.first->style()->or der()) 34 if (firstChild.first->style()->order() != secondChild.first->style()->or der())
35 return firstChild.first->style()->order() < secondChild.first->style ()->order(); 35 return firstChild.first->style()->order() < secondChild.first->style ()->order();
36 36
37 return firstChild.second < secondChild.second; 37 return firstChild.second < secondChild.second;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 LayoutBox* current = gridItemAndPaintIndex.first; 74 LayoutBox* current = gridItemAndPaintIndex.first;
75 if (current == previous) 75 if (current == previous)
76 continue; 76 continue;
77 77
78 BlockPainter(m_layoutGrid).paintChildAsInlineBlock(*current, paintInfo, paintOffset); 78 BlockPainter(m_layoutGrid).paintChildAsInlineBlock(*current, paintInfo, paintOffset);
79 previous = current; 79 previous = current;
80 } 80 }
81 } 81 }
82 82
83 } // namespace blink 83 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698