| 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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 { | 611 { |
| 612 std::sort(tracks.begin(), tracks.end(), sortByGridTrackGrowthPotential); | 612 std::sort(tracks.begin(), tracks.end(), sortByGridTrackGrowthPotential); |
| 613 | 613 |
| 614 size_t tracksSize = tracks.size(); | 614 size_t tracksSize = tracks.size(); |
| 615 sizingData.distributeTrackVector.resize(tracksSize); | 615 sizingData.distributeTrackVector.resize(tracksSize); |
| 616 | 616 |
| 617 for (size_t i = 0; i < tracksSize; ++i) { | 617 for (size_t i = 0; i < tracksSize; ++i) { |
| 618 GridTrack& track = *tracks[i]; | 618 GridTrack& track = *tracks[i]; |
| 619 LayoutUnit availableLogicalSpaceShare = availableLogicalSpace / (tracksS
ize - i); | 619 LayoutUnit availableLogicalSpaceShare = availableLogicalSpace / (tracksS
ize - i); |
| 620 LayoutUnit trackBreadth = (tracks[i]->*trackGetter)(); | 620 LayoutUnit trackBreadth = (tracks[i]->*trackGetter)(); |
| 621 LayoutUnit growthShare = std::max(LayoutUnit(), std::min(availableLogica
lSpaceShare, track.m_maxBreadth - trackBreadth)); | 621 LayoutUnit growthShare = std::min(availableLogicalSpaceShare, track.m_ma
xBreadth - trackBreadth); |
| 622 sizingData.distributeTrackVector[i] = trackBreadth; |
| 622 // We should never shrink any grid track or else we can't guarantee we a
bide by our min-sizing function. | 623 // We should never shrink any grid track or else we can't guarantee we a
bide by our min-sizing function. |
| 623 sizingData.distributeTrackVector[i] = trackBreadth + growthShare; | 624 if (growthShare > 0) { |
| 624 availableLogicalSpace -= growthShare; | 625 sizingData.distributeTrackVector[i] += growthShare; |
| 626 availableLogicalSpace -= growthShare; |
| 627 } |
| 625 } | 628 } |
| 626 | 629 |
| 627 if (availableLogicalSpace > 0 && tracksForGrowthAboveMaxBreadth) { | 630 if (availableLogicalSpace > 0 && tracksForGrowthAboveMaxBreadth) { |
| 628 tracksSize = tracksForGrowthAboveMaxBreadth->size(); | 631 tracksSize = tracksForGrowthAboveMaxBreadth->size(); |
| 629 for (size_t i = 0; i < tracksSize; ++i) { | 632 for (size_t i = 0; i < tracksSize; ++i) { |
| 630 LayoutUnit growthShare = availableLogicalSpace / (tracksSize - i); | 633 LayoutUnit growthShare = availableLogicalSpace / (tracksSize - i); |
| 631 sizingData.distributeTrackVector[i] += growthShare; | 634 sizingData.distributeTrackVector[i] += growthShare; |
| 632 availableLogicalSpace -= growthShare; | 635 availableLogicalSpace -= growthShare; |
| 633 } | 636 } |
| 634 } | 637 } |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 if (isOutOfFlowPositioned()) | 1143 if (isOutOfFlowPositioned()) |
| 1141 return "RenderGrid (positioned)"; | 1144 return "RenderGrid (positioned)"; |
| 1142 if (isAnonymous()) | 1145 if (isAnonymous()) |
| 1143 return "RenderGrid (generated)"; | 1146 return "RenderGrid (generated)"; |
| 1144 if (isRelPositioned()) | 1147 if (isRelPositioned()) |
| 1145 return "RenderGrid (relative positioned)"; | 1148 return "RenderGrid (relative positioned)"; |
| 1146 return "RenderGrid"; | 1149 return "RenderGrid"; |
| 1147 } | 1150 } |
| 1148 | 1151 |
| 1149 } // namespace WebCore | 1152 } // namespace WebCore |
| OLD | NEW |