Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: Source/core/rendering/RenderGrid.cpp

Issue 48573002: [CSS Grid] Do not grow grid tracks when the growth factor has 0 length (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cachetypes
Patch Set: Remove extra space. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698