| 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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 // 1. Initialize per Grid track variables. | 665 // 1. Initialize per Grid track variables. |
| 666 for (size_t i = 0; i < tracks.size(); ++i) { | 666 for (size_t i = 0; i < tracks.size(); ++i) { |
| 667 GridTrack& track = tracks[i]; | 667 GridTrack& track = tracks[i]; |
| 668 GridTrackSize trackSize = gridTrackSize(direction, i, sizingData.sizingO
peration); | 668 GridTrackSize trackSize = gridTrackSize(direction, i, sizingData.sizingO
peration); |
| 669 | 669 |
| 670 track.setBaseSize(computeUsedBreadthOfMinLength(trackSize, maxSize)); | 670 track.setBaseSize(computeUsedBreadthOfMinLength(trackSize, maxSize)); |
| 671 track.setGrowthLimit(computeUsedBreadthOfMaxLength(trackSize, track.base
Size(), maxSize)); | 671 track.setGrowthLimit(computeUsedBreadthOfMaxLength(trackSize, track.base
Size(), maxSize)); |
| 672 track.setInfinitelyGrowable(false); | 672 track.setInfinitelyGrowable(false); |
| 673 | 673 |
| 674 if (trackSize.isFitContent()) { | 674 if (trackSize.isFitContent()) { |
| 675 GridLength gridLength = trackSize.length(); | 675 GridLength gridLength = trackSize.fitContentTrackBreadth(); |
| 676 if (!gridLength.hasPercentage() || hasDefiniteFreeSpace) | 676 if (!gridLength.hasPercentage() || hasDefiniteFreeSpace) |
| 677 track.setGrowthLimitCap(valueForLength(gridLength.length(), maxS
ize)); | 677 track.setGrowthLimitCap(valueForLength(gridLength.length(), maxS
ize)); |
| 678 } | 678 } |
| 679 | 679 |
| 680 if (trackSize.isContentSized()) | 680 if (trackSize.isContentSized()) |
| 681 sizingData.contentSizedTracksIndex.append(i); | 681 sizingData.contentSizedTracksIndex.append(i); |
| 682 if (trackSize.maxTrackBreadth().isFlex()) | 682 if (trackSize.maxTrackBreadth().isFlex()) |
| 683 flexibleSizedTracksIndex.append(i); | 683 flexibleSizedTracksIndex.append(i); |
| 684 } | 684 } |
| 685 | 685 |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1136 track.setBaseSize(std::max(track.baseSize(), minContentForChild(gridItem
, direction, sizingData))); | 1136 track.setBaseSize(std::max(track.baseSize(), minContentForChild(gridItem
, direction, sizingData))); |
| 1137 else if (trackSize.hasMaxContentMinTrackBreadth()) | 1137 else if (trackSize.hasMaxContentMinTrackBreadth()) |
| 1138 track.setBaseSize(std::max(track.baseSize(), maxContentForChild(gridItem
, direction, sizingData))); | 1138 track.setBaseSize(std::max(track.baseSize(), maxContentForChild(gridItem
, direction, sizingData))); |
| 1139 else if (trackSize.hasAutoMinTrackBreadth()) | 1139 else if (trackSize.hasAutoMinTrackBreadth()) |
| 1140 track.setBaseSize(std::max(track.baseSize(), minSizeForChild(gridItem, d
irection, sizingData))); | 1140 track.setBaseSize(std::max(track.baseSize(), minSizeForChild(gridItem, d
irection, sizingData))); |
| 1141 | 1141 |
| 1142 if (trackSize.hasMinContentMaxTrackBreadth()) { | 1142 if (trackSize.hasMinContentMaxTrackBreadth()) { |
| 1143 track.setGrowthLimit(std::max(track.growthLimit(), minContentForChild(gr
idItem, direction, sizingData))); | 1143 track.setGrowthLimit(std::max(track.growthLimit(), minContentForChild(gr
idItem, direction, sizingData))); |
| 1144 } else if (trackSize.hasMaxContentOrAutoMaxTrackBreadth()) { | 1144 } else if (trackSize.hasMaxContentOrAutoMaxTrackBreadth()) { |
| 1145 LayoutUnit growthLimit = maxContentForChild(gridItem, direction, sizingD
ata); | 1145 LayoutUnit growthLimit = maxContentForChild(gridItem, direction, sizingD
ata); |
| 1146 if (trackSize.isFitContent()) { | 1146 if (trackSize.isFitContent()) |
| 1147 DCHECK(trackSize.length().isLength()); | 1147 growthLimit = std::min(growthLimit, valueForLength(trackSize.fitCont
entTrackBreadth().length(), sizingData.availableSpace())); |
| 1148 growthLimit = std::min(growthLimit, valueForLength(trackSize.length(
).length(), sizingData.availableSpace())); | |
| 1149 } | |
| 1150 track.setGrowthLimit(std::max(track.growthLimit(), growthLimit)); | 1148 track.setGrowthLimit(std::max(track.growthLimit(), growthLimit)); |
| 1151 } | 1149 } |
| 1152 } | 1150 } |
| 1153 | 1151 |
| 1154 static LayoutUnit trackSizeForTrackSizeComputationPhase(TrackSizeComputationPhas
e phase, const GridTrack& track, TrackSizeRestriction restriction) | 1152 static LayoutUnit trackSizeForTrackSizeComputationPhase(TrackSizeComputationPhas
e phase, const GridTrack& track, TrackSizeRestriction restriction) |
| 1155 { | 1153 { |
| 1156 switch (phase) { | 1154 switch (phase) { |
| 1157 case ResolveIntrinsicMinimums: | 1155 case ResolveIntrinsicMinimums: |
| 1158 case ResolveContentBasedMinimums: | 1156 case ResolveContentBasedMinimums: |
| 1159 case ResolveMaxContentMinimums: | 1157 case ResolveMaxContentMinimums: |
| (...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2658 return isOrthogonalChild(child) ? childLocation.transposedPoint() : childLoc
ation; | 2656 return isOrthogonalChild(child) ? childLocation.transposedPoint() : childLoc
ation; |
| 2659 } | 2657 } |
| 2660 | 2658 |
| 2661 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) const | 2659 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) const |
| 2662 { | 2660 { |
| 2663 if (!m_gridItemArea.isEmpty()) | 2661 if (!m_gridItemArea.isEmpty()) |
| 2664 GridPainter(*this).paintChildren(paintInfo, paintOffset); | 2662 GridPainter(*this).paintChildren(paintInfo, paintOffset); |
| 2665 } | 2663 } |
| 2666 | 2664 |
| 2667 } // namespace blink | 2665 } // namespace blink |
| OLD | NEW |