| 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 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 continue; | 1128 continue; |
| 1129 LayoutUnit baseSize = tracks[index].baseSize(); | 1129 LayoutUnit baseSize = tracks[index].baseSize(); |
| 1130 double flexFactor = | 1130 double flexFactor = |
| 1131 gridTrackSize(direction, index, sizingData).maxTrackBreadth().flex(); | 1131 gridTrackSize(direction, index, sizingData).maxTrackBreadth().flex(); |
| 1132 // treating all such tracks as inflexible. | 1132 // treating all such tracks as inflexible. |
| 1133 if (baseSize > hypotheticalFactorUnitSize * flexFactor) { | 1133 if (baseSize > hypotheticalFactorUnitSize * flexFactor) { |
| 1134 leftOverSpace -= baseSize; | 1134 leftOverSpace -= baseSize; |
| 1135 flexFactorSum -= flexFactor; | 1135 flexFactorSum -= flexFactor; |
| 1136 if (!additionalTracksToTreatAsInflexible) | 1136 if (!additionalTracksToTreatAsInflexible) |
| 1137 additionalTracksToTreatAsInflexible = WTF::makeUnique<TrackIndexSet>(); | 1137 additionalTracksToTreatAsInflexible = WTF::makeUnique<TrackIndexSet>(); |
| 1138 additionalTracksToTreatAsInflexible->add(index); | 1138 additionalTracksToTreatAsInflexible->insert(index); |
| 1139 validFlexFactorUnit = false; | 1139 validFlexFactorUnit = false; |
| 1140 } | 1140 } |
| 1141 } | 1141 } |
| 1142 if (!validFlexFactorUnit) { | 1142 if (!validFlexFactorUnit) { |
| 1143 return computeFlexFactorUnitSize( | 1143 return computeFlexFactorUnitSize( |
| 1144 tracks, direction, flexFactorSum, leftOverSpace, flexibleTracksIndexes, | 1144 tracks, direction, flexFactorSum, leftOverSpace, flexibleTracksIndexes, |
| 1145 sizingData, std::move(additionalTracksToTreatAsInflexible)); | 1145 sizingData, std::move(additionalTracksToTreatAsInflexible)); |
| 1146 } | 1146 } |
| 1147 return hypotheticalFactorUnitSize; | 1147 return hypotheticalFactorUnitSize; |
| 1148 } | 1148 } |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1525 sizingData.itemsSortedByIncreasingSpan.shrink(0); | 1525 sizingData.itemsSortedByIncreasingSpan.shrink(0); |
| 1526 const Grid& grid = sizingData.grid(); | 1526 const Grid& grid = sizingData.grid(); |
| 1527 if (grid.hasGridItems()) { | 1527 if (grid.hasGridItems()) { |
| 1528 HashSet<LayoutBox*> itemsSet; | 1528 HashSet<LayoutBox*> itemsSet; |
| 1529 for (const auto& trackIndex : sizingData.contentSizedTracksIndex) { | 1529 for (const auto& trackIndex : sizingData.contentSizedTracksIndex) { |
| 1530 GridIterator iterator(grid, direction, trackIndex); | 1530 GridIterator iterator(grid, direction, trackIndex); |
| 1531 GridTrack& track = (direction == ForColumns) | 1531 GridTrack& track = (direction == ForColumns) |
| 1532 ? sizingData.columnTracks[trackIndex] | 1532 ? sizingData.columnTracks[trackIndex] |
| 1533 : sizingData.rowTracks[trackIndex]; | 1533 : sizingData.rowTracks[trackIndex]; |
| 1534 while (LayoutBox* gridItem = iterator.nextGridItem()) { | 1534 while (LayoutBox* gridItem = iterator.nextGridItem()) { |
| 1535 if (itemsSet.add(gridItem).isNewEntry) { | 1535 if (itemsSet.insert(gridItem).isNewEntry) { |
| 1536 const GridSpan& span = grid.gridItemSpan(*gridItem, direction); | 1536 const GridSpan& span = grid.gridItemSpan(*gridItem, direction); |
| 1537 if (span.integerSpan() == 1) { | 1537 if (span.integerSpan() == 1) { |
| 1538 resolveContentBasedTrackSizingFunctionsForNonSpanningItems( | 1538 resolveContentBasedTrackSizingFunctionsForNonSpanningItems( |
| 1539 direction, span, *gridItem, track, sizingData); | 1539 direction, span, *gridItem, track, sizingData); |
| 1540 } else if (!spanningItemCrossesFlexibleSizedTracks(span, direction, | 1540 } else if (!spanningItemCrossesFlexibleSizedTracks(span, direction, |
| 1541 sizingData)) { | 1541 sizingData)) { |
| 1542 sizingData.itemsSortedByIncreasingSpan.push_back( | 1542 sizingData.itemsSortedByIncreasingSpan.push_back( |
| 1543 GridItemWithSpan(*gridItem, span)); | 1543 GridItemWithSpan(*gridItem, span)); |
| 1544 } | 1544 } |
| 1545 } | 1545 } |
| (...skipping 2075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3621 if (direction == ForRows) | 3621 if (direction == ForRows) |
| 3622 return grid.numTracks(ForRows); | 3622 return grid.numTracks(ForRows); |
| 3623 | 3623 |
| 3624 return grid.numTracks(ForRows) | 3624 return grid.numTracks(ForRows) |
| 3625 ? grid.numTracks(ForColumns) | 3625 ? grid.numTracks(ForColumns) |
| 3626 : GridPositionsResolver::explicitGridColumnCount( | 3626 : GridPositionsResolver::explicitGridColumnCount( |
| 3627 styleRef(), grid.autoRepeatTracks(ForColumns)); | 3627 styleRef(), grid.autoRepeatTracks(ForColumns)); |
| 3628 } | 3628 } |
| 3629 | 3629 |
| 3630 } // namespace blink | 3630 } // namespace blink |
| OLD | NEW |