| 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 2024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2035 size_t repetitions = | 2035 size_t repetitions = |
| 2036 1 + (freeSpace / (autoRepeatTracksSize + gapSize)).toInt(); | 2036 1 + (freeSpace / (autoRepeatTracksSize + gapSize)).toInt(); |
| 2037 | 2037 |
| 2038 // Provided the grid container does not have a definite size or max-size in | 2038 // Provided the grid container does not have a definite size or max-size in |
| 2039 // the relevant axis, if the min size is definite then the number of | 2039 // the relevant axis, if the min size is definite then the number of |
| 2040 // repetitions is the largest possible positive integer that fulfills that | 2040 // repetitions is the largest possible positive integer that fulfills that |
| 2041 // minimum requirement. | 2041 // minimum requirement. |
| 2042 if (needsToFulfillMinimumSize) | 2042 if (needsToFulfillMinimumSize) |
| 2043 ++repetitions; | 2043 ++repetitions; |
| 2044 | 2044 |
| 2045 // Clamp the number of repetitions so we don't end up with too many tracks. |
| 2046 if (repetitions > kGridMaxTracks) { |
| 2047 DCHECK_GT(autoRepeatTrackListLength, 0u); |
| 2048 repetitions = |
| 2049 (kGridMaxTracks - trackSizes.size()) / autoRepeatTrackListLength; |
| 2050 } |
| 2051 |
| 2045 return repetitions * autoRepeatTrackListLength; | 2052 return repetitions * autoRepeatTrackListLength; |
| 2046 } | 2053 } |
| 2047 | 2054 |
| 2048 std::unique_ptr<LayoutGrid::OrderedTrackIndexSet> | 2055 std::unique_ptr<LayoutGrid::OrderedTrackIndexSet> |
| 2049 LayoutGrid::computeEmptyTracksForAutoRepeat( | 2056 LayoutGrid::computeEmptyTracksForAutoRepeat( |
| 2050 Grid& grid, | 2057 Grid& grid, |
| 2051 GridTrackSizingDirection direction) const { | 2058 GridTrackSizingDirection direction) const { |
| 2052 bool isRowAxis = direction == ForColumns; | 2059 bool isRowAxis = direction == ForColumns; |
| 2053 if ((isRowAxis && styleRef().gridAutoRepeatColumnsType() != AutoFit) || | 2060 if ((isRowAxis && styleRef().gridAutoRepeatColumnsType() != AutoFit) || |
| 2054 (!isRowAxis && styleRef().gridAutoRepeatRowsType() != AutoFit)) | 2061 (!isRowAxis && styleRef().gridAutoRepeatRowsType() != AutoFit)) |
| (...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3621 if (direction == ForRows) | 3628 if (direction == ForRows) |
| 3622 return grid.numTracks(ForRows); | 3629 return grid.numTracks(ForRows); |
| 3623 | 3630 |
| 3624 return grid.numTracks(ForRows) | 3631 return grid.numTracks(ForRows) |
| 3625 ? grid.numTracks(ForColumns) | 3632 ? grid.numTracks(ForColumns) |
| 3626 : GridPositionsResolver::explicitGridColumnCount( | 3633 : GridPositionsResolver::explicitGridColumnCount( |
| 3627 styleRef(), grid.autoRepeatTracks(ForColumns)); | 3634 styleRef(), grid.autoRepeatTracks(ForColumns)); |
| 3628 } | 3635 } |
| 3629 | 3636 |
| 3630 } // namespace blink | 3637 } // namespace blink |
| OLD | NEW |