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

Side by Side 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 unified diff | Download patch
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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 480
481 return availableLogicalSpaceIgnoringFractionTracks / accumulatedFractions; 481 return availableLogicalSpaceIgnoringFractionTracks / accumulatedFractions;
482 } 482 }
483 483
484 const GridTrackSize& RenderGrid::gridTrackSize(GridTrackSizingDirection directio n, size_t i) const 484 const GridTrackSize& RenderGrid::gridTrackSize(GridTrackSizingDirection directio n, size_t i) const
485 { 485 {
486 const Vector<GridTrackSize>& trackStyles = (direction == ForColumns) ? style ()->gridDefinitionColumns() : style()->gridDefinitionRows(); 486 const Vector<GridTrackSize>& trackStyles = (direction == ForColumns) ? style ()->gridDefinitionColumns() : style()->gridDefinitionRows();
487 if (i >= trackStyles.size()) 487 if (i >= trackStyles.size())
488 return (direction == ForColumns) ? style()->gridAutoColumns() : style()- >gridAutoRows(); 488 return (direction == ForColumns) ? style()->gridAutoColumns() : style()- >gridAutoRows();
489 489
490 return trackStyles[i]; 490 const GridTrackSize& trackSize = trackStyles[i];
491 // If the logical width/height of the grid container is indefinite, percenta ge values are treated as <auto>.
492 if (trackSize.isPercentage()) {
493 Length logicalSize = direction == ForColumns ? style()->logicalWidth() : style()->logicalHeight();
494 if (logicalSize.isIntrinsicOrAuto()) {
495 DEFINE_STATIC_LOCAL(GridTrackSize, autoTrackSize, (Auto));
496 return autoTrackSize;
497 }
498 }
499
500 return trackSize;
491 } 501 }
492 502
493 size_t RenderGrid::explicitGridColumnCount() const 503 size_t RenderGrid::explicitGridColumnCount() const
494 { 504 {
495 return style()->gridDefinitionColumns().size(); 505 return style()->gridDefinitionColumns().size();
496 } 506 }
497 507
498 size_t RenderGrid::explicitGridRowCount() const 508 size_t RenderGrid::explicitGridRowCount() const
499 { 509 {
500 return style()->gridDefinitionRows().size(); 510 return style()->gridDefinitionRows().size();
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 if (isOutOfFlowPositioned()) 1152 if (isOutOfFlowPositioned())
1143 return "RenderGrid (positioned)"; 1153 return "RenderGrid (positioned)";
1144 if (isAnonymous()) 1154 if (isAnonymous())
1145 return "RenderGrid (generated)"; 1155 return "RenderGrid (generated)";
1146 if (isRelPositioned()) 1156 if (isRelPositioned())
1147 return "RenderGrid (relative positioned)"; 1157 return "RenderGrid (relative positioned)";
1148 return "RenderGrid"; 1158 return "RenderGrid";
1149 } 1159 }
1150 1160
1151 } // namespace WebCore 1161 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698