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

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

Issue 769683004: [CSS Grid Layout] Fix crash in positioned items placed on implicit grid (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added comment Created 6 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
« no previous file with comments | « LayoutTests/fast/css-grid-layout/grid-positioned-items-implicit-grid-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 offset = LayoutUnit(0); 1222 offset = LayoutUnit(0);
1223 breadth = (direction == ForColumns) ? clientLogicalWidth() : clientLogic alHeight(); 1223 breadth = (direction == ForColumns) ? clientLogicalWidth() : clientLogic alHeight();
1224 return; 1224 return;
1225 } 1225 }
1226 1226
1227 GridResolvedPosition firstPosition = GridResolvedPosition(0); 1227 GridResolvedPosition firstPosition = GridResolvedPosition(0);
1228 GridResolvedPosition initialPosition = startIsAuto ? firstPosition : positio ns->resolvedInitialPosition; 1228 GridResolvedPosition initialPosition = startIsAuto ? firstPosition : positio ns->resolvedInitialPosition;
1229 GridResolvedPosition lastPosition = GridResolvedPosition((direction == ForCo lumns ? gridColumnCount() : gridRowCount()) - 1); 1229 GridResolvedPosition lastPosition = GridResolvedPosition((direction == ForCo lumns ? gridColumnCount() : gridRowCount()) - 1);
1230 GridResolvedPosition finalPosition = endIsAuto ? lastPosition : positions->r esolvedFinalPosition; 1230 GridResolvedPosition finalPosition = endIsAuto ? lastPosition : positions->r esolvedFinalPosition;
1231 1231
1232 // Positioned children do not grow the grid, so we need to clamp the positio ns to avoid ending up outside of it.
1233 initialPosition = std::min<GridResolvedPosition>(initialPosition, lastPositi on);
1234 finalPosition = std::min<GridResolvedPosition>(finalPosition, lastPosition);
1235
1232 LayoutUnit start = startIsAuto ? LayoutUnit(0) : (direction == ForColumns) ? m_columnPositions[initialPosition.toInt()] : m_rowPositions[initialPosition.to Int()]; 1236 LayoutUnit start = startIsAuto ? LayoutUnit(0) : (direction == ForColumns) ? m_columnPositions[initialPosition.toInt()] : m_rowPositions[initialPosition.to Int()];
1233 LayoutUnit end = endIsAuto ? (direction == ForColumns) ? logicalWidth() : lo gicalHeight() : (direction == ForColumns) ? m_columnPositions[finalPosition.nex t().toInt()] : m_rowPositions[finalPosition.next().toInt()]; 1237 LayoutUnit end = endIsAuto ? (direction == ForColumns) ? logicalWidth() : lo gicalHeight() : (direction == ForColumns) ? m_columnPositions[finalPosition.nex t().toInt()] : m_rowPositions[finalPosition.next().toInt()];
1234 1238
1235 breadth = end - start; 1239 breadth = end - start;
1236 1240
1237 if (startIsAuto) 1241 if (startIsAuto)
1238 breadth -= (direction == ForColumns) ? borderStart() : borderBefore(); 1242 breadth -= (direction == ForColumns) ? borderStart() : borderBefore();
1239 else 1243 else
1240 start -= ((direction == ForColumns) ? borderStart() : borderBefore()); 1244 start -= ((direction == ForColumns) ? borderStart() : borderBefore());
1241 1245
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1693 if (isOutOfFlowPositioned()) 1697 if (isOutOfFlowPositioned())
1694 return "RenderGrid (positioned)"; 1698 return "RenderGrid (positioned)";
1695 if (isAnonymous()) 1699 if (isAnonymous())
1696 return "RenderGrid (generated)"; 1700 return "RenderGrid (generated)";
1697 if (isRelPositioned()) 1701 if (isRelPositioned())
1698 return "RenderGrid (relative positioned)"; 1702 return "RenderGrid (relative positioned)";
1699 return "RenderGrid"; 1703 return "RenderGrid";
1700 } 1704 }
1701 1705
1702 } // namespace blink 1706 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/css-grid-layout/grid-positioned-items-implicit-grid-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698