| OLD | NEW |
| 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 // GridSpan stores lines' indexes (not tracks' indexes). |
| 28 return GridSpan(startGridAreaIndex, endGridAreaIndex + 1); |
| 28 } | 29 } |
| 29 | 30 |
| 30 class GridItemsSorter { | 31 class GridItemsSorter { |
| 31 public: | 32 public: |
| 32 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 |
| 33 { | 34 { |
| 34 if (firstChild.first->style()->order() != secondChild.first->style()->or
der()) | 35 if (firstChild.first->style()->order() != secondChild.first->style()->or
der()) |
| 35 return firstChild.first->style()->order() < secondChild.first->style
()->order(); | 36 return firstChild.first->style()->order() < secondChild.first->style
()->order(); |
| 36 | 37 |
| 37 return firstChild.second < secondChild.second; | 38 return firstChild.second < secondChild.second; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 LayoutBox* current = gridItemAndPaintIndex.first; | 75 LayoutBox* current = gridItemAndPaintIndex.first; |
| 75 if (current == previous) | 76 if (current == previous) |
| 76 continue; | 77 continue; |
| 77 | 78 |
| 78 BlockPainter(m_layoutGrid).paintChildAsInlineBlock(*current, paintInfo,
paintOffset); | 79 BlockPainter(m_layoutGrid).paintChildAsInlineBlock(*current, paintInfo,
paintOffset); |
| 79 previous = current; | 80 previous = current; |
| 80 } | 81 } |
| 81 } | 82 } |
| 82 | 83 |
| 83 } // namespace blink | 84 } // namespace blink |
| OLD | NEW |