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 |