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

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

Issue 614263005: [CSS Grid Layout] overflow-position keyword for align and justify properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « Source/core/rendering/RenderGrid.h ('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 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 1128
1129 LayoutUnit RenderGrid::startOfColumnForChild(const RenderBox& child) const 1129 LayoutUnit RenderGrid::startOfColumnForChild(const RenderBox& child) const
1130 { 1130 {
1131 const GridCoordinate& coordinate = cachedGridCoordinate(child); 1131 const GridCoordinate& coordinate = cachedGridCoordinate(child);
1132 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.resolvedInit ialPosition.toInt()]; 1132 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.resolvedInit ialPosition.toInt()];
1133 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted. 1133 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted.
1134 // FIXME: This should account for the grid item's <overflow-position>. 1134 // FIXME: This should account for the grid item's <overflow-position>.
1135 return startOfColumn + marginStartForChild(&child); 1135 return startOfColumn + marginStartForChild(&child);
1136 } 1136 }
1137 1137
1138 LayoutUnit RenderGrid::endOfColumnForChild(const RenderBox& child) const 1138 LayoutUnit RenderGrid::endOfColumnForChild(const RenderBox& child, OverflowAlign ment overflow) const
1139 { 1139 {
1140 const GridCoordinate& coordinate = cachedGridCoordinate(child); 1140 const GridCoordinate& coordinate = cachedGridCoordinate(child);
1141 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.resolvedInit ialPosition.toInt()]; 1141 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.resolvedInit ialPosition.toInt()];
1142 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted. 1142 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted.
1143 LayoutUnit columnPosition = startOfColumn + marginStartForChild(&child); 1143 LayoutUnit columnPosition = startOfColumn + marginStartForChild(&child);
1144 1144
1145 LayoutUnit endOfColumn = m_columnPositions[coordinate.columns.resolvedFinalP osition.next().toInt()]; 1145 LayoutUnit endOfColumn = m_columnPositions[coordinate.columns.resolvedFinalP osition.next().toInt()];
1146 // FIXME: This should account for the grid item's <overflow-position>. 1146 LayoutUnit childLogicalWidth = child.logicalWidth();
1147 return columnPosition + std::max<LayoutUnit>(0, endOfColumn - m_columnPositi ons[coordinate.columns.resolvedInitialPosition.toInt()] - child.logicalWidth()); 1147 LayoutUnit columnWidth = endOfColumn - startOfColumn;
1148 if ((childLogicalWidth > columnWidth) && (overflow == OverflowAlignmentTrue || overflow == OverflowAlignmentDefault))
1149 return columnPosition + columnWidth - childLogicalWidth;
1150 return columnPosition + std::max<LayoutUnit>(0, columnWidth - childLogicalWi dth);
1148 } 1151 }
1149 1152
1150 LayoutUnit RenderGrid::columnPositionAlignedWithGridContainerStart(const RenderB ox& child) const 1153 LayoutUnit RenderGrid::columnPositionAlignedWithGridContainerStart(const RenderB ox& child, OverflowAlignment overflow) const
1151 { 1154 {
1152 if (style()->isLeftToRightDirection()) 1155 if (style()->isLeftToRightDirection())
1153 return startOfColumnForChild(child); 1156 return startOfColumnForChild(child);
1154 1157
1155 return endOfColumnForChild(child); 1158 return endOfColumnForChild(child, overflow);
1156 } 1159 }
1157 1160
1158 LayoutUnit RenderGrid::columnPositionAlignedWithGridContainerEnd(const RenderBox & child) const 1161 LayoutUnit RenderGrid::columnPositionAlignedWithGridContainerEnd(const RenderBox & child, OverflowAlignment overflow) const
1159 { 1162 {
1160 if (!style()->isLeftToRightDirection()) 1163 if (!style()->isLeftToRightDirection())
1161 return startOfColumnForChild(child); 1164 return startOfColumnForChild(child);
1162 1165
1163 return endOfColumnForChild(child); 1166 return endOfColumnForChild(child, overflow);
1164 } 1167 }
1165 1168
1166 LayoutUnit RenderGrid::centeredColumnPositionForChild(const RenderBox& child) co nst 1169 LayoutUnit RenderGrid::centeredColumnPositionForChild(const RenderBox& child, Ov erflowAlignment overflow) const
1167 { 1170 {
1168 const GridCoordinate& coordinate = cachedGridCoordinate(child); 1171 const GridCoordinate& coordinate = cachedGridCoordinate(child);
1169 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.resolvedInit ialPosition.toInt()]; 1172 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.resolvedInit ialPosition.toInt()];
1170 LayoutUnit endOfColumn = m_columnPositions[coordinate.columns.resolvedFinalP osition.next().toInt()]; 1173 LayoutUnit endOfColumn = m_columnPositions[coordinate.columns.resolvedFinalP osition.next().toInt()];
1171 LayoutUnit columnPosition = startOfColumn + marginStartForChild(&child); 1174 LayoutUnit columnPosition = startOfColumn + marginStartForChild(&child);
1172 // FIXME: This should account for the grid item's <overflow-position>. 1175 LayoutUnit childLogicalWidth = child.logicalWidth();
1173 return columnPosition + std::max<LayoutUnit>(0, endOfColumn - startOfColumn - child.logicalWidth()) / 2; 1176 LayoutUnit columnWidth = endOfColumn - startOfColumn;
1177 if ((childLogicalWidth > columnWidth) && (overflow == OverflowAlignmentTrue || overflow == OverflowAlignmentDefault))
1178 return columnPosition + (columnWidth - childLogicalWidth) / 2;
1179 return columnPosition + std::max<LayoutUnit>(0, columnWidth - childLogicalWi dth) / 2;
1174 } 1180 }
1175 1181
1176 static ItemPosition resolveJustification(const RenderStyle* parentStyle, const R enderStyle* childStyle) 1182 static void resolveJustification(const RenderStyle* parentStyle, const RenderSty le* childStyle, ItemPosition& justify, OverflowAlignment &overflow)
Julien - ping for review 2014/10/20 16:59:11 Style: The & should be next to the enum => Overflo
jfernandez 2014/10/22 21:38:10 Done.
1177 { 1183 {
1178 ItemPosition justify = childStyle->justifySelf(); 1184 justify = childStyle->justifySelf();
1179 if (justify == ItemPositionAuto) 1185 overflow = childStyle->justifySelfOverflowAlignment();
1180 justify = (parentStyle->justifyItems() == ItemPositionAuto) ? ItemPositi onStretch : parentStyle->justifyItems(); 1186 // The auto keyword computes to the parent's justify-items computed value, o r to "stretch", if not set or "auto".
1181 1187 if (justify == ItemPositionAuto) {
1182 return justify; 1188 if (parentStyle->justifyItems() == ItemPositionAuto) {
1189 justify = ItemPositionStretch;
1190 } else {
1191 justify = parentStyle->justifyItems();
1192 overflow = parentStyle->justifyItemsOverflowAlignment();
1193 }
1194 }
1195 // The default overflow alignment is 'true' for Grid Items.
1196 if (overflow == OverflowAlignmentDefault)
Julien - ping for review 2014/10/20 16:59:10 It's super weird to have to do this conversion her
jfernandez 2014/10/22 21:38:10 Yes, I agree. I fact, the same happens with the al
1197 overflow = OverflowAlignmentTrue;
1183 } 1198 }
1184 1199
1185 LayoutUnit RenderGrid::columnPositionForChild(const RenderBox& child) const 1200 LayoutUnit RenderGrid::columnPositionForChild(const RenderBox& child) const
1186 { 1201 {
1187 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); 1202 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode();
1203 ItemPosition justifySelf;
1204 OverflowAlignment overflow;
1205 resolveJustification(style(), child.style(), justifySelf, overflow);
1188 1206
1189 switch (resolveJustification(style(), child.style())) { 1207 switch (justifySelf) {
1190 case ItemPositionSelfStart: 1208 case ItemPositionSelfStart:
1191 // For orthogonal writing-modes, this computes to 'start' 1209 // For orthogonal writing-modes, this computes to 'start'
1192 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet. 1210 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet.
1193 if (hasOrthogonalWritingMode) 1211 if (hasOrthogonalWritingMode)
1194 return columnPositionAlignedWithGridContainerStart(child); 1212 return columnPositionAlignedWithGridContainerStart(child, overflow);
1195 1213
1196 // self-start is based on the child's direction. That's why we need to c heck against the grid container's direction. 1214 // self-start is based on the child's direction. That's why we need to c heck against the grid container's direction.
1197 if (child.style()->direction() != style()->direction()) 1215 if (child.style()->direction() != style()->direction())
1198 return columnPositionAlignedWithGridContainerEnd(child); 1216 return columnPositionAlignedWithGridContainerEnd(child, overflow);
1199 1217
1200 return columnPositionAlignedWithGridContainerStart(child); 1218 return columnPositionAlignedWithGridContainerStart(child, overflow);
1201 case ItemPositionSelfEnd: 1219 case ItemPositionSelfEnd:
1202 // For orthogonal writing-modes, this computes to 'start' 1220 // For orthogonal writing-modes, this computes to 'start'
1203 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet. 1221 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet.
1204 if (hasOrthogonalWritingMode) 1222 if (hasOrthogonalWritingMode)
1205 return columnPositionAlignedWithGridContainerEnd(child); 1223 return columnPositionAlignedWithGridContainerEnd(child, overflow);
1206 1224
1207 // self-end is based on the child's direction. That's why we need to che ck against the grid container's direction. 1225 // self-end is based on the child's direction. That's why we need to che ck against the grid container's direction.
1208 if (child.style()->direction() != style()->direction()) 1226 if (child.style()->direction() != style()->direction())
1209 return columnPositionAlignedWithGridContainerStart(child); 1227 return columnPositionAlignedWithGridContainerStart(child, overflow);
1210 1228
1211 return columnPositionAlignedWithGridContainerEnd(child); 1229 return columnPositionAlignedWithGridContainerEnd(child, overflow);
1212 1230
1213 case ItemPositionFlexStart: 1231 case ItemPositionFlexStart:
1214 // Only used in flex layout, for other layout, it's equivalent to 'start '. 1232 // Only used in flex layout, for other layout, it's equivalent to 'start '.
1215 return columnPositionAlignedWithGridContainerStart(child); 1233 return columnPositionAlignedWithGridContainerStart(child, overflow);
1216 case ItemPositionFlexEnd: 1234 case ItemPositionFlexEnd:
1217 // Only used in flex layout, for other layout, it's equivalent to 'start '. 1235 // Only used in flex layout, for other layout, it's equivalent to 'start '.
1218 return columnPositionAlignedWithGridContainerEnd(child); 1236 return columnPositionAlignedWithGridContainerEnd(child, overflow);
1219 1237
1220 case ItemPositionLeft: 1238 case ItemPositionLeft:
1221 // If the property's axis is not parallel with the inline axis, this is equivalent to ‘start’. 1239 // If the property's axis is not parallel with the inline axis, this is equivalent to ‘start’.
1222 if (!isHorizontalWritingMode()) 1240 if (!isHorizontalWritingMode())
1223 return columnPositionAlignedWithGridContainerStart(child); 1241 return columnPositionAlignedWithGridContainerStart(child, overflow);
1224 1242
1225 if (style()->isLeftToRightDirection()) 1243 if (style()->isLeftToRightDirection())
1226 return columnPositionAlignedWithGridContainerStart(child); 1244 return columnPositionAlignedWithGridContainerStart(child, overflow);
1227 1245
1228 return columnPositionAlignedWithGridContainerEnd(child); 1246 return columnPositionAlignedWithGridContainerEnd(child, overflow);
1229 case ItemPositionRight: 1247 case ItemPositionRight:
1230 // If the property's axis is not parallel with the inline axis, this is equivalent to ‘start’. 1248 // If the property's axis is not parallel with the inline axis, this is equivalent to ‘start’.
1231 if (!isHorizontalWritingMode()) 1249 if (!isHorizontalWritingMode())
1232 return columnPositionAlignedWithGridContainerStart(child); 1250 return columnPositionAlignedWithGridContainerStart(child, overflow);
1233 1251
1234 if (style()->isLeftToRightDirection()) 1252 if (style()->isLeftToRightDirection())
1235 return columnPositionAlignedWithGridContainerEnd(child); 1253 return columnPositionAlignedWithGridContainerEnd(child, overflow);
1236 1254
1237 return columnPositionAlignedWithGridContainerStart(child); 1255 return columnPositionAlignedWithGridContainerStart(child, overflow);
1238 1256
1239 case ItemPositionCenter: 1257 case ItemPositionCenter:
1240 return centeredColumnPositionForChild(child); 1258 return centeredColumnPositionForChild(child, overflow);
1241 case ItemPositionStart: 1259 case ItemPositionStart:
1242 return columnPositionAlignedWithGridContainerStart(child); 1260 return columnPositionAlignedWithGridContainerStart(child, overflow);
1243 case ItemPositionEnd: 1261 case ItemPositionEnd:
1244 return columnPositionAlignedWithGridContainerEnd(child); 1262 return columnPositionAlignedWithGridContainerEnd(child, overflow);
1245 1263
1246 case ItemPositionAuto: 1264 case ItemPositionAuto:
1247 break; 1265 break;
1248 case ItemPositionStretch: 1266 case ItemPositionStretch:
1249 case ItemPositionBaseline: 1267 case ItemPositionBaseline:
1250 case ItemPositionLastBaseline: 1268 case ItemPositionLastBaseline:
1251 // FIXME: Implement the previous values. For now, we always start align the child. 1269 // FIXME: Implement the previous values. For now, we always start align the child.
1252 return startOfColumnForChild(child); 1270 return startOfColumnForChild(child);
1253 } 1271 }
1254 1272
1255 ASSERT_NOT_REACHED(); 1273 ASSERT_NOT_REACHED();
1256 return 0; 1274 return 0;
1257 } 1275 }
1258 1276
1259 LayoutUnit RenderGrid::endOfRowForChild(const RenderBox& child) const 1277 LayoutUnit RenderGrid::endOfRowForChild(const RenderBox& child, OverflowAlignmen t overflow) const
1260 { 1278 {
1261 const GridCoordinate& coordinate = cachedGridCoordinate(child); 1279 const GridCoordinate& coordinate = cachedGridCoordinate(child);
1262 1280
1263 LayoutUnit startOfRow = m_rowPositions[coordinate.rows.resolvedInitialPositi on.toInt()]; 1281 LayoutUnit startOfRow = m_rowPositions[coordinate.rows.resolvedInitialPositi on.toInt()];
1264 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted. 1282 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted.
1265 LayoutUnit rowPosition = startOfRow + marginBeforeForChild(&child); 1283 LayoutUnit rowPosition = startOfRow + marginBeforeForChild(&child);
1266 1284
1267 LayoutUnit endOfRow = m_rowPositions[coordinate.rows.resolvedFinalPosition.n ext().toInt()]; 1285 LayoutUnit endOfRow = m_rowPositions[coordinate.rows.resolvedFinalPosition.n ext().toInt()];
1268 // FIXME: This should account for the grid item's <overflow-position>. 1286 LayoutUnit childLogicalHeight = child.logicalHeight();
1269 return rowPosition + std::max<LayoutUnit>(0, endOfRow - startOfRow - child.l ogicalHeight()); 1287 LayoutUnit rowHeight = endOfRow - startOfRow;
1288 if ((childLogicalHeight > rowHeight) && (overflow == OverflowAlignmentTrue | | overflow == OverflowAlignmentDefault))
Julien - ping for review 2014/10/20 16:59:11 Can we really get overflow == OverflowAlignmentDef
jfernandez 2014/10/22 21:38:10 I was thinking on other calls to this method which
1289 return rowPosition + rowHeight - childLogicalHeight;
1290 return rowPosition + std::max<LayoutUnit>(0, rowHeight - childLogicalHeight) ;
Julien - ping for review 2014/10/20 16:59:11 I think this needs a comment why it's correct (it
jfernandez 2014/10/22 21:38:10 Done.
1270 } 1291 }
1271 1292
1272 LayoutUnit RenderGrid::startOfRowForChild(const RenderBox& child) const 1293 LayoutUnit RenderGrid::startOfRowForChild(const RenderBox& child) const
1273 { 1294 {
1274 const GridCoordinate& coordinate = cachedGridCoordinate(child); 1295 const GridCoordinate& coordinate = cachedGridCoordinate(child);
1275 1296
1276 LayoutUnit startOfRow = m_rowPositions[coordinate.rows.resolvedInitialPositi on.toInt()]; 1297 LayoutUnit startOfRow = m_rowPositions[coordinate.rows.resolvedInitialPositi on.toInt()];
1277 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted. 1298 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted.
1278 // FIXME: This should account for the grid item's <overflow-position>. 1299 // FIXME: This should account for the grid item's <overflow-position>.
Julien - ping for review 2014/10/20 16:59:11 We should remove this FIXME as it doesn't apply to
jfernandez 2014/10/22 21:38:10 Acknowledged.
1279 LayoutUnit rowPosition = startOfRow + marginBeforeForChild(&child); 1300 LayoutUnit rowPosition = startOfRow + marginBeforeForChild(&child);
1280 1301
1281 return rowPosition; 1302 return rowPosition;
1282 } 1303 }
1283 1304
1284 LayoutUnit RenderGrid::centeredRowPositionForChild(const RenderBox& child) const 1305 LayoutUnit RenderGrid::centeredRowPositionForChild(const RenderBox& child, Overf lowAlignment overflow) const
1285 { 1306 {
1286 const GridCoordinate& coordinate = cachedGridCoordinate(child); 1307 const GridCoordinate& coordinate = cachedGridCoordinate(child);
1287 1308
1288 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted. 1309 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted.
1289 LayoutUnit startOfRow = m_rowPositions[coordinate.rows.resolvedInitialPositi on.toInt()] + marginBeforeForChild(&child); 1310 LayoutUnit startOfRow = m_rowPositions[coordinate.rows.resolvedInitialPositi on.toInt()] + marginBeforeForChild(&child);
1290 LayoutUnit endOfRow = m_rowPositions[coordinate.rows.resolvedFinalPosition.n ext().toInt()]; 1311 LayoutUnit endOfRow = m_rowPositions[coordinate.rows.resolvedFinalPosition.n ext().toInt()];
1291 1312 LayoutUnit rowPosition = startOfRow + marginBeforeForChild(&child);
1292 // FIXME: This should account for the grid item's <overflow-position>. 1313 LayoutUnit childLogicalHeight = child.logicalHeight();
1293 return startOfRow + std::max<LayoutUnit>(0, endOfRow - startOfRow - child.lo gicalHeight()) / 2; 1314 LayoutUnit rowHeight = endOfRow - startOfRow;
1315 if ((childLogicalHeight > rowHeight) && (overflow == OverflowAlignmentTrue | | overflow == OverflowAlignmentDefault))
Julien - ping for review 2014/10/20 16:59:11 Unneeded parenthesis around the first clause (it a
jfernandez 2014/10/22 21:38:10 Done.
1316 return rowPosition + (rowHeight - childLogicalHeight) / 2;
1317 return rowPosition + std::max<LayoutUnit>(0, rowHeight - childLogicalHeight) / 2;
1294 } 1318 }
1295 1319
1296 // FIXME: We should move this logic to the StyleAdjuster or the StyleBuilder. 1320 // FIXME: We should move this logic to the StyleAdjuster or the StyleBuilder.
1297 static ItemPosition resolveAlignment(const RenderStyle* parentStyle, const Rende rStyle* childStyle) 1321 static void resolveAlignment(const RenderStyle* parentStyle, const RenderStyle* childStyle, ItemPosition& align, OverflowAlignment &overflow)
1298 { 1322 {
1299 ItemPosition align = childStyle->alignSelf(); 1323 align = childStyle->alignSelf();
1324 overflow = childStyle->alignSelfOverflowAlignment();
1300 // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto". 1325 // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto".
1301 if (align == ItemPositionAuto) 1326 if (align == ItemPositionAuto) {
1302 align = (parentStyle->alignItems() == ItemPositionAuto) ? ItemPositionSt retch : parentStyle->alignItems(); 1327 if (parentStyle->alignItems() == ItemPositionAuto) {
1303 return align; 1328 align = ItemPositionStretch;
1329 } else {
1330 align = parentStyle->alignItems();
1331 overflow = parentStyle->alignItemsOverflowAlignment();
1332 }
1333 }
1334 // The default overflow alignment is 'true' for Grid Items.
1335 if (overflow == OverflowAlignmentDefault)
1336 overflow = OverflowAlignmentTrue;
1304 } 1337 }
1305 1338
1306 LayoutUnit RenderGrid::rowPositionForChild(const RenderBox& child) const 1339 LayoutUnit RenderGrid::rowPositionForChild(const RenderBox& child) const
1307 { 1340 {
1308 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); 1341 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode();
1309 ItemPosition alignSelf = resolveAlignment(style(), child.style()); 1342 ItemPosition alignSelf;
1343 OverflowAlignment overflow;
1344 resolveAlignment(style(), child.style(), alignSelf, overflow);
1310 1345
1311 switch (alignSelf) { 1346 switch (alignSelf) {
1312 case ItemPositionSelfStart: 1347 case ItemPositionSelfStart:
1313 // If orthogonal writing-modes, this computes to 'Start'. 1348 // If orthogonal writing-modes, this computes to 'Start'.
1314 // FIXME: grid track sizing and positioning does not support orthogonal modes yet. 1349 // FIXME: grid track sizing and positioning does not support orthogonal modes yet.
1315 if (hasOrthogonalWritingMode) 1350 if (hasOrthogonalWritingMode)
1316 return startOfRowForChild(child); 1351 return startOfRowForChild(child);
1317 1352
1318 // self-start is based on the child's block axis direction. That's why w e need to check against the grid container's block flow. 1353 // self-start is based on the child's block axis direction. That's why w e need to check against the grid container's block flow.
1319 if (child.style()->writingMode() != style()->writingMode()) 1354 if (child.style()->writingMode() != style()->writingMode())
1320 return endOfRowForChild(child); 1355 return endOfRowForChild(child, overflow);
1321 1356
1322 return startOfRowForChild(child); 1357 return startOfRowForChild(child);
1323 case ItemPositionSelfEnd: 1358 case ItemPositionSelfEnd:
1324 // If orthogonal writing-modes, this computes to 'End'. 1359 // If orthogonal writing-modes, this computes to 'End'.
1325 // FIXME: grid track sizing and positioning does not support orthogonal modes yet. 1360 // FIXME: grid track sizing and positioning does not support orthogonal modes yet.
1326 if (hasOrthogonalWritingMode) 1361 if (hasOrthogonalWritingMode)
1327 return endOfRowForChild(child); 1362 return endOfRowForChild(child, overflow);
1328 1363
1329 // self-end is based on the child's block axis direction. That's why we need to check against the grid container's block flow. 1364 // self-end is based on the child's block axis direction. That's why we need to check against the grid container's block flow.
1330 if (child.style()->writingMode() != style()->writingMode()) 1365 if (child.style()->writingMode() != style()->writingMode())
1331 return startOfRowForChild(child); 1366 return startOfRowForChild(child);
1332 1367
1333 return endOfRowForChild(child); 1368 return endOfRowForChild(child, overflow);
1334 1369
1335 case ItemPositionLeft: 1370 case ItemPositionLeft:
1336 // orthogonal modes make property and inline axes to be parallel, but in any case 1371 // orthogonal modes make property and inline axes to be parallel, but in any case
1337 // this is always equivalent to 'Start'. 1372 // this is always equivalent to 'Start'.
1338 // 1373 //
1339 // self-align's axis is never parallel to the inline axis, except in ort hogonal 1374 // self-align's axis is never parallel to the inline axis, except in ort hogonal
1340 // writing-mode, so this is equivalent to 'Start’. 1375 // writing-mode, so this is equivalent to 'Start’.
1341 return startOfRowForChild(child); 1376 return startOfRowForChild(child);
1342 1377
1343 case ItemPositionRight: 1378 case ItemPositionRight:
1344 // orthogonal modes make property and inline axes to be parallel. 1379 // orthogonal modes make property and inline axes to be parallel.
1345 // FIXME: grid track sizing and positioning does not support orthogonal modes yet. 1380 // FIXME: grid track sizing and positioning does not support orthogonal modes yet.
1346 if (hasOrthogonalWritingMode) 1381 if (hasOrthogonalWritingMode)
1347 return endOfRowForChild(child); 1382 return endOfRowForChild(child, overflow);
1348 1383
1349 // self-align's axis is never parallel to the inline axis, except in ort hogonal 1384 // self-align's axis is never parallel to the inline axis, except in ort hogonal
1350 // writing-mode, so this is equivalent to 'Start'. 1385 // writing-mode, so this is equivalent to 'Start'.
1351 return startOfRowForChild(child); 1386 return startOfRowForChild(child);
1352 1387
1353 case ItemPositionCenter: 1388 case ItemPositionCenter:
1354 return centeredRowPositionForChild(child); 1389 return centeredRowPositionForChild(child, overflow);
1355 // Only used in flex layout, for other layout, it's equivalent to 'Start '. 1390 // Only used in flex layout, for other layout, it's equivalent to 'Start '.
1356 case ItemPositionFlexStart: 1391 case ItemPositionFlexStart:
1357 case ItemPositionStart: 1392 case ItemPositionStart:
1358 return startOfRowForChild(child); 1393 return startOfRowForChild(child);
1359 // Only used in flex layout, for other layout, it's equivalent to 'End'. 1394 // Only used in flex layout, for other layout, it's equivalent to 'End'.
1360 case ItemPositionFlexEnd: 1395 case ItemPositionFlexEnd:
1361 case ItemPositionEnd: 1396 case ItemPositionEnd:
1362 return endOfRowForChild(child); 1397 return endOfRowForChild(child, overflow);
1363 case ItemPositionStretch: 1398 case ItemPositionStretch:
1364 // FIXME: Implement the Stretch value. For now, we always start align th e child. 1399 // FIXME: Implement the Stretch value. For now, we always start align th e child.
1365 return startOfRowForChild(child); 1400 return startOfRowForChild(child);
1366 case ItemPositionBaseline: 1401 case ItemPositionBaseline:
1367 case ItemPositionLastBaseline: 1402 case ItemPositionLastBaseline:
1368 // FIXME: Implement the ItemPositionBaseline value. For now, we always s tart align the child. 1403 // FIXME: Implement the ItemPositionBaseline value. For now, we always s tart align the child.
1369 return startOfRowForChild(child); 1404 return startOfRowForChild(child);
1370 case ItemPositionAuto: 1405 case ItemPositionAuto:
1371 break; 1406 break;
1372 } 1407 }
(...skipping 19 matching lines...) Expand all
1392 if (isOutOfFlowPositioned()) 1427 if (isOutOfFlowPositioned())
1393 return "RenderGrid (positioned)"; 1428 return "RenderGrid (positioned)";
1394 if (isAnonymous()) 1429 if (isAnonymous())
1395 return "RenderGrid (generated)"; 1430 return "RenderGrid (generated)";
1396 if (isRelPositioned()) 1431 if (isRelPositioned())
1397 return "RenderGrid (relative positioned)"; 1432 return "RenderGrid (relative positioned)";
1398 return "RenderGrid"; 1433 return "RenderGrid";
1399 } 1434 }
1400 1435
1401 } // namespace blink 1436 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderGrid.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698