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

Unified Diff: Source/core/rendering/RenderGrid.cpp

Issue 60633008: [CSS Grid Layout] Percentages of indefinite sizes should compute to "auto" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use isIntrinsicOrAuto() + tests updated Created 7 years 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
Index: Source/core/rendering/RenderGrid.cpp
diff --git a/Source/core/rendering/RenderGrid.cpp b/Source/core/rendering/RenderGrid.cpp
index 38c296ac8669087e5dab75dedb5c0781630c582d..6b542c10bb3ba5171e4f98e077efdc5dfb5c68c8 100644
--- a/Source/core/rendering/RenderGrid.cpp
+++ b/Source/core/rendering/RenderGrid.cpp
@@ -487,7 +487,17 @@ const GridTrackSize& RenderGrid::gridTrackSize(GridTrackSizingDirection directio
if (i >= trackStyles.size())
return (direction == ForColumns) ? style()->gridAutoColumns() : style()->gridAutoRows();
- return trackStyles[i];
+ const GridTrackSize& trackSize = trackStyles[i];
+ // If the logical width/height of the grid container is indefinite, percentage values are treated as <auto>.
+ if (trackSize.isPercentage()) {
+ Length logicalSize = direction == ForColumns ? style()->logicalWidth() : style()->logicalHeight();
+ if (logicalSize.isIntrinsicOrAuto()) {
+ DEFINE_STATIC_LOCAL(GridTrackSize, autoTrackSize, (Auto));
+ return autoTrackSize;
+ }
+ }
+
+ return trackSize;
}
size_t RenderGrid::explicitGridColumnCount() const

Powered by Google App Engine
This is Rietveld 408576698