OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 size_t& varyingTrackIndex = (m_direction == ForColumns) ? m_rowIndex : m
_columnIndex; | 164 size_t& varyingTrackIndex = (m_direction == ForColumns) ? m_rowIndex : m
_columnIndex; |
165 const size_t endOfVaryingTrackIndex = (m_direction == ForColumns) ? m_gr
id.size() : m_grid[0].size(); | 165 const size_t endOfVaryingTrackIndex = (m_direction == ForColumns) ? m_gr
id.size() : m_grid[0].size(); |
166 for (; varyingTrackIndex < endOfVaryingTrackIndex; ++varyingTrackIndex)
{ | 166 for (; varyingTrackIndex < endOfVaryingTrackIndex; ++varyingTrackIndex)
{ |
167 const GridCell& children = m_grid[m_rowIndex][m_columnIndex]; | 167 const GridCell& children = m_grid[m_rowIndex][m_columnIndex]; |
168 if (m_childIndex < children.size()) | 168 if (m_childIndex < children.size()) |
169 return children[m_childIndex++]; | 169 return children[m_childIndex++]; |
170 | 170 |
171 m_childIndex = 0; | 171 m_childIndex = 0; |
172 } | 172 } |
173 return 0; | 173 return nullptr; |
174 } | 174 } |
175 | 175 |
176 bool checkEmptyCells(size_t rowSpan, size_t columnSpan) const | 176 bool checkEmptyCells(size_t rowSpan, size_t columnSpan) const |
177 { | 177 { |
178 // Ignore cells outside current grid as we will grow it later if needed. | 178 // Ignore cells outside current grid as we will grow it later if needed. |
179 size_t maxRows = std::min(m_rowIndex + rowSpan, m_grid.size()); | 179 size_t maxRows = std::min(m_rowIndex + rowSpan, m_grid.size()); |
180 size_t maxColumns = std::min(m_columnIndex + columnSpan, m_grid[0].size(
)); | 180 size_t maxColumns = std::min(m_columnIndex + columnSpan, m_grid[0].size(
)); |
181 | 181 |
182 // This adds a O(N^2) behavior that shouldn't be a big deal as we expect
spanning areas to be small. | 182 // This adds a O(N^2) behavior that shouldn't be a big deal as we expect
spanning areas to be small. |
183 for (size_t row = m_rowIndex; row < maxRows; ++row) { | 183 for (size_t row = m_rowIndex; row < maxRows; ++row) { |
(...skipping 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 | 1829 |
1830 return LayoutPoint(columnPosition, rowPositionForChild(child)); | 1830 return LayoutPoint(columnPosition, rowPositionForChild(child)); |
1831 } | 1831 } |
1832 | 1832 |
1833 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) | 1833 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) |
1834 { | 1834 { |
1835 GridPainter(*this).paintChildren(paintInfo, paintOffset); | 1835 GridPainter(*this).paintChildren(paintInfo, paintOffset); |
1836 } | 1836 } |
1837 | 1837 |
1838 } // namespace blink | 1838 } // namespace blink |
OLD | NEW |