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

Unified Diff: Source/core/layout/LayoutGrid.cpp

Issue 948833002: [CSS Grid Layout] Avoid unneeded calls to hasDefiniteLogicalSize() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased patch after LayoutGrid rename Created 5 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutGrid.cpp
diff --git a/Source/core/layout/LayoutGrid.cpp b/Source/core/layout/LayoutGrid.cpp
index add685ab608673b919360b1109411e75028b78bd..b77818e37bc5d818806a7b58385a8fee5b58ed48 100644
--- a/Source/core/layout/LayoutGrid.cpp
+++ b/Source/core/layout/LayoutGrid.cpp
@@ -601,15 +601,21 @@ GridTrackSize LayoutGrid::gridTrackSize(GridTrackSizingDirection direction, size
const Vector<GridTrackSize>& trackStyles = isForColumns ? style()->gridTemplateColumns() : style()->gridTemplateRows();
const GridTrackSize& trackSize = (i >= trackStyles.size()) ? (isForColumns ? style()->gridAutoColumns() : style()->gridAutoRows()) : trackStyles[i];
+ GridLength minTrackBreadth = trackSize.minTrackBreadth();
+ GridLength maxTrackBreadth = trackSize.maxTrackBreadth();
+
// If the logical width/height of the grid container is indefinite, percentage values are treated as <auto> (or in
// the case of minmax() as min-content for the first position and max-content for the second).
- if (!hasDefiniteLogicalSize(direction)) {
- const GridLength& oldMinTrackBreadth = trackSize.minTrackBreadth();
- const GridLength& oldMaxTrackBreadth = trackSize.maxTrackBreadth();
- return GridTrackSize(oldMinTrackBreadth.isPercentage() ? Length(MinContent) : oldMinTrackBreadth, oldMaxTrackBreadth.isPercentage() ? Length(MaxContent) : oldMaxTrackBreadth);
+ if (minTrackBreadth.isPercentage() || maxTrackBreadth.isPercentage()) {
+ if (!hasDefiniteLogicalSize(direction)) {
+ if (minTrackBreadth.isPercentage())
+ minTrackBreadth = Length(MinContent);
+ if (maxTrackBreadth.isPercentage())
+ maxTrackBreadth = Length(MaxContent);
+ }
}
- return trackSize;
+ return GridTrackSize(minTrackBreadth, maxTrackBreadth);
}
LayoutUnit LayoutGrid::logicalHeightForChild(LayoutBox& child, Vector<GridTrack>& columnTracks)
« 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