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

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: 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 // We should never shrink any grid track or else we can't guarantee we a bide by our min-sizing function. 622 sizingData.distributeTrackVector[i] = trackBreadth;
623 sizingData.distributeTrackVector[i] = trackBreadth + growthShare; 623 // We should never shrink any grid track or else we can't guarantee we abide by our min-sizing function.
Julien - ping for review 2013/11/05 16:16:43 Unneeded space
624 availableLogicalSpace -= growthShare; 624 if (growthShare > 0) {
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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 if (isOutOfFlowPositioned()) 1198 if (isOutOfFlowPositioned())
1196 return "RenderGrid (positioned)"; 1199 return "RenderGrid (positioned)";
1197 if (isAnonymous()) 1200 if (isAnonymous())
1198 return "RenderGrid (generated)"; 1201 return "RenderGrid (generated)";
1199 if (isRelPositioned()) 1202 if (isRelPositioned())
1200 return "RenderGrid (relative positioned)"; 1203 return "RenderGrid (relative positioned)";
1201 return "RenderGrid"; 1204 return "RenderGrid";
1202 } 1205 }
1203 1206
1204 } // namespace WebCore 1207 } // 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