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

Side by Side Diff: Source/core/rendering/RenderGrid.cpp

Issue 314993002: [CSS Grid Layout] Fix auto-placement algorithm (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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 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 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 // This will happen when we have "span <custom-indent>", which has a different resolution based on the position. 925 // This will happen when we have "span <custom-indent>", which has a different resolution based on the position.
926 GridSpan majorAxisPositions = GridResolvedPosition::resolveGridPosit ionsFromAutoPlacementPosition(*style(), *gridItem, autoPlacementMajorAxisDirecti on(), majorAxisIndex); 926 GridSpan majorAxisPositions = GridResolvedPosition::resolveGridPosit ionsFromAutoPlacementPosition(*style(), *gridItem, autoPlacementMajorAxisDirecti on(), majorAxisIndex);
927 emptyGridArea = findEmptyGridAreaAtSpecifiedPositionsInsideGrid(grid Item, autoPlacementMajorAxisDirection(), majorAxisPositions); 927 emptyGridArea = findEmptyGridAreaAtSpecifiedPositionsInsideGrid(grid Item, autoPlacementMajorAxisDirection(), majorAxisPositions);
928 928
929 if (emptyGridArea) { 929 if (emptyGridArea) {
930 // Check that it fits in the minor axis direction, as we shouldn 't grow in that direction here (it was already managed in populateExplicitGridAn dOrderIterator()). 930 // Check that it fits in the minor axis direction, as we shouldn 't grow in that direction here (it was already managed in populateExplicitGridAn dOrderIterator()).
931 GridResolvedPosition minorAxisFinalPositionIndex = autoPlacement MinorAxisDirection() == ForColumns ? emptyGridArea->columns.resolvedFinalPositio n : emptyGridArea->rows.resolvedFinalPosition; 931 GridResolvedPosition minorAxisFinalPositionIndex = autoPlacement MinorAxisDirection() == ForColumns ? emptyGridArea->columns.resolvedFinalPositio n : emptyGridArea->rows.resolvedFinalPosition;
932 const size_t endOfMinorAxis = autoPlacementMinorAxisDirection() == ForColumns ? gridColumnCount() : gridRowCount(); 932 const size_t endOfMinorAxis = autoPlacementMinorAxisDirection() == ForColumns ? gridColumnCount() : gridRowCount();
933 if (minorAxisFinalPositionIndex.toInt() < endOfMinorAxis) 933 if (minorAxisFinalPositionIndex.toInt() < endOfMinorAxis)
934 break; 934 break;
935
936 // Discard empty grid area as it does not fit in the minor axis direction.
937 emptyGridArea = nullptr;
svillar 2014/06/04 09:48:22 Wouldn't it be possible to call here createEmptyGr
Manuel Rego 2014/06/04 10:02:51 We're looping over the major axis, as you can read
Julien - ping for review 2014/06/10 00:08:05 It would be good to add such a test case, that wou
Manuel Rego 2014/06/10 09:49:02 That was what I was doing in the modification of t
935 } 938 }
936 } 939 }
937 940
938 if (!emptyGridArea) { 941 if (!emptyGridArea) {
939 GridSpan minorAxisPositions = GridResolvedPosition::resolveGridPosit ionsFromAutoPlacementPosition(*style(), *gridItem, autoPlacementMinorAxisDirecti on(), GridResolvedPosition(0)); 942 GridSpan minorAxisPositions = GridResolvedPosition::resolveGridPosit ionsFromAutoPlacementPosition(*style(), *gridItem, autoPlacementMinorAxisDirecti on(), GridResolvedPosition(0));
940 emptyGridArea = createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(g ridItem, autoPlacementMinorAxisDirection(), minorAxisPositions); 943 emptyGridArea = createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(g ridItem, autoPlacementMinorAxisDirection(), minorAxisPositions);
941 } 944 }
942 } 945 }
943 946
944 insertItemIntoGrid(gridItem, *emptyGridArea); 947 insertItemIntoGrid(gridItem, *emptyGridArea);
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 if (isOutOfFlowPositioned()) 1262 if (isOutOfFlowPositioned())
1260 return "RenderGrid (positioned)"; 1263 return "RenderGrid (positioned)";
1261 if (isAnonymous()) 1264 if (isAnonymous())
1262 return "RenderGrid (generated)"; 1265 return "RenderGrid (generated)";
1263 if (isRelPositioned()) 1266 if (isRelPositioned())
1264 return "RenderGrid (relative positioned)"; 1267 return "RenderGrid (relative positioned)";
1265 return "RenderGrid"; 1268 return "RenderGrid";
1266 } 1269 }
1267 1270
1268 } // namespace WebCore 1271 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698