Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1279 LayoutUnit RenderGrid::startOfColumnForChild(const RenderBox& child) const | 1279 LayoutUnit RenderGrid::startOfColumnForChild(const RenderBox& child) const |
| 1280 { | 1280 { |
| 1281 const GridCoordinate& coordinate = cachedGridCoordinate(child); | 1281 const GridCoordinate& coordinate = cachedGridCoordinate(child); |
| 1282 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.resolvedInit ialPosition.toInt()]; | 1282 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.resolvedInit ialPosition.toInt()]; |
| 1283 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted. | 1283 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted. |
| 1284 return startOfColumn + marginStartForChild(child); | 1284 return startOfColumn + marginStartForChild(child); |
| 1285 } | 1285 } |
| 1286 | 1286 |
| 1287 LayoutUnit RenderGrid::endOfColumnForChild(const RenderBox& child) const | 1287 LayoutUnit RenderGrid::endOfColumnForChild(const RenderBox& child) const |
| 1288 { | 1288 { |
| 1289 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); | |
| 1289 const GridCoordinate& coordinate = cachedGridCoordinate(child); | 1290 const GridCoordinate& coordinate = cachedGridCoordinate(child); |
| 1290 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.resolvedInit ialPosition.toInt()]; | 1291 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.resolvedInit ialPosition.toInt()]; |
| 1291 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted. | 1292 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted. |
| 1292 LayoutUnit columnPosition = startOfColumn + marginStartForChild(child); | 1293 LayoutUnit columnPosition = startOfColumn + marginStartForChild(child); |
| 1293 | 1294 |
| 1294 LayoutUnit endOfColumn = m_columnPositions[coordinate.columns.resolvedFinalP osition.next().toInt()]; | 1295 LayoutUnit endOfColumn = m_columnPositions[coordinate.columns.resolvedFinalP osition.next().toInt()]; |
| 1295 // FIXME: This might not work as expected with orthogonal writing-modes. | 1296 LayoutUnit childBreadth = hasOrthogonalWritingMode ? child.logicalHeight() + child.marginLogicalHeight() : child.logicalWidth() + child.marginLogicalWidth() ; |
| 1296 LayoutUnit offsetFromColumnPosition = computeOverflowAlignmentOffset(child.s tyle()->justifySelfOverflowAlignment(), startOfColumn, endOfColumn, child.logica lWidth() + child.marginLogicalWidth()); | 1297 LayoutUnit offsetFromColumnPosition = computeOverflowAlignmentOffset(child.s tyle()->justifySelfOverflowAlignment(), startOfColumn, endOfColumn, childBreadth ); |
| 1297 | 1298 |
| 1298 return columnPosition + offsetFromColumnPosition; | 1299 return columnPosition + offsetFromColumnPosition; |
| 1299 } | 1300 } |
| 1300 | 1301 |
| 1301 LayoutUnit RenderGrid::columnPositionLeft(const RenderBox& child) const | 1302 LayoutUnit RenderGrid::columnPositionLeft(const RenderBox& child) const |
| 1302 { | 1303 { |
| 1303 if (style()->isLeftToRightDirection()) | 1304 if (style()->isLeftToRightDirection()) |
| 1304 return startOfColumnForChild(child); | 1305 return startOfColumnForChild(child); |
| 1305 | 1306 |
| 1306 return endOfColumnForChild(child); | 1307 return endOfColumnForChild(child); |
| 1307 } | 1308 } |
| 1308 | 1309 |
| 1309 LayoutUnit RenderGrid::columnPositionRight(const RenderBox& child) const | 1310 LayoutUnit RenderGrid::columnPositionRight(const RenderBox& child) const |
| 1310 { | 1311 { |
| 1311 if (!style()->isLeftToRightDirection()) | 1312 if (!style()->isLeftToRightDirection()) |
| 1312 return startOfColumnForChild(child); | 1313 return startOfColumnForChild(child); |
| 1313 | 1314 |
| 1314 return endOfColumnForChild(child); | 1315 return endOfColumnForChild(child); |
| 1315 } | 1316 } |
| 1316 | 1317 |
| 1317 LayoutUnit RenderGrid::centeredColumnPositionForChild(const RenderBox& child) co nst | 1318 LayoutUnit RenderGrid::centeredColumnPositionForChild(const RenderBox& child) co nst |
| 1318 { | 1319 { |
| 1320 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); | |
| 1319 const GridCoordinate& coordinate = cachedGridCoordinate(child); | 1321 const GridCoordinate& coordinate = cachedGridCoordinate(child); |
| 1320 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.resolvedInit ialPosition.toInt()]; | 1322 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.resolvedInit ialPosition.toInt()]; |
| 1321 LayoutUnit endOfColumn = m_columnPositions[coordinate.columns.resolvedFinalP osition.next().toInt()]; | 1323 LayoutUnit endOfColumn = m_columnPositions[coordinate.columns.resolvedFinalP osition.next().toInt()]; |
| 1322 LayoutUnit columnPosition = startOfColumn + marginStartForChild(child); | 1324 LayoutUnit columnPosition = startOfColumn + marginStartForChild(child); |
| 1323 // FIXME: This might not work as expected with orthogonal writing-modes. | 1325 LayoutUnit childBreadth = hasOrthogonalWritingMode ? child.logicalHeight() + child.marginLogicalHeight() : child.logicalWidth() + child.marginLogicalWidth() ; |
| 1324 LayoutUnit offsetFromColumnPosition = computeOverflowAlignmentOffset(child.s tyle()->justifySelfOverflowAlignment(), startOfColumn, endOfColumn, child.logica lWidth() + child.marginLogicalWidth()); | 1326 LayoutUnit offsetFromColumnPosition = computeOverflowAlignmentOffset(child.s tyle()->justifySelfOverflowAlignment(), startOfColumn, endOfColumn, childBreadth ); |
| 1325 | 1327 |
| 1326 return columnPosition + offsetFromColumnPosition / 2; | 1328 return columnPosition + offsetFromColumnPosition / 2; |
| 1327 } | 1329 } |
| 1328 | 1330 |
| 1329 LayoutUnit RenderGrid::columnPositionForChild(const RenderBox& child) const | 1331 LayoutUnit RenderGrid::columnPositionForChild(const RenderBox& child) const |
| 1330 { | 1332 { |
| 1331 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); | 1333 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); |
| 1332 | 1334 |
| 1333 switch (RenderStyle::resolveJustification(style(), child.style(), ItemPositi onStretch)) { | 1335 switch (RenderStyle::resolveJustification(style(), child.style(), ItemPositi onStretch)) { |
| 1334 case ItemPositionSelfStart: | 1336 case ItemPositionSelfStart: |
| 1335 // For orthogonal writing-modes, this computes to 'start' | 1337 // If orthogonal writing-modes, self-start will be based on the child's block-axis |
| 1336 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet. | 1338 // direction, because it's the one parallel to the alignment property's axis. |
| 1337 if (hasOrthogonalWritingMode) | 1339 if (hasOrthogonalWritingMode) { |
| 1338 return startOfColumnForChild(child); | 1340 switch (child.style()->writingMode()) { |
| 1341 case TopToBottomWritingMode: | |
| 1342 return style()->isLeftToRightDirection() ? startOfColumnForChild (child) : endOfColumnForChild(child); | |
| 1343 case BottomToTopWritingMode: | |
| 1344 return style()->isLeftToRightDirection() ? endOfColumnForChild(c hild) : startOfColumnForChild(child); | |
| 1345 case LeftToRightWritingMode: | |
| 1346 return style()->isLeftToRightDirection() ? startOfColumnForChild (child) : endOfColumnForChild(child); | |
| 1347 case RightToLeftWritingMode: | |
|
Julien - ping for review
2015/01/26 10:42:07
Seems like we could think of it in terms of isFlip
jfernandez
2015/02/06 23:54:19
Acknowledged.
| |
| 1348 return style()->isLeftToRightDirection() ? endOfColumnForChild(c hild) : startOfColumnForChild(child); | |
| 1349 } | |
| 1350 } | |
| 1339 | 1351 |
| 1340 // self-start is based on the child's direction. That's why we need to c heck against the grid container's direction. | 1352 // self-start is based on the child's direction. That's why we need to c heck against the grid container's direction. |
| 1341 if (child.style()->direction() != style()->direction()) | 1353 if (child.style()->direction() != style()->direction()) |
| 1342 return endOfColumnForChild(child); | 1354 return endOfColumnForChild(child); |
| 1343 | 1355 |
| 1344 return startOfColumnForChild(child); | 1356 return startOfColumnForChild(child); |
| 1345 case ItemPositionSelfEnd: | 1357 case ItemPositionSelfEnd: |
| 1346 // For orthogonal writing-modes, this computes to 'start' | 1358 if (hasOrthogonalWritingMode) { |
|
Julien - ping for review
2015/01/26 10:42:07
// See comment above about the block-axis?
jfernandez
2015/02/06 23:54:19
Done.
| |
| 1347 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet. | 1359 switch (child.style()->writingMode()) { |
| 1348 if (hasOrthogonalWritingMode) | 1360 case TopToBottomWritingMode: |
| 1349 return endOfColumnForChild(child); | 1361 return style()->isLeftToRightDirection() ? endOfColumnForChild(c hild) : startOfColumnForChild(child); |
| 1362 case BottomToTopWritingMode: | |
| 1363 return style()->isLeftToRightDirection() ? startOfColumnForChild (child) : endOfColumnForChild(child); | |
| 1364 case LeftToRightWritingMode: | |
| 1365 return style()->isLeftToRightDirection() ? endOfColumnForChild(c hild) : startOfColumnForChild(child); | |
| 1366 case RightToLeftWritingMode: | |
| 1367 return style()->isLeftToRightDirection() ? startOfColumnForChild (child) : endOfColumnForChild(child); | |
| 1368 } | |
| 1369 } | |
| 1350 | 1370 |
| 1351 // self-end is based on the child's direction. That's why we need to che ck against the grid container's direction. | 1371 // self-end is based on the child's direction. That's why we need to che ck against the grid container's direction. |
| 1352 if (child.style()->direction() != style()->direction()) | 1372 if (child.style()->direction() != style()->direction()) |
| 1353 return startOfColumnForChild(child); | 1373 return startOfColumnForChild(child); |
| 1354 | 1374 |
| 1355 return endOfColumnForChild(child); | 1375 return endOfColumnForChild(child); |
| 1356 case ItemPositionFlexStart: | 1376 case ItemPositionFlexStart: |
| 1357 // Only used in flex layout, for other layout, it's equivalent to 'start '. | 1377 // Only used in flex layout, for other layout, it's equivalent to 'start '. |
| 1358 return startOfColumnForChild(child); | 1378 return startOfColumnForChild(child); |
| 1359 case ItemPositionFlexEnd: | 1379 case ItemPositionFlexEnd: |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1378 // FIXME: Implement the previous values. For now, we always 'start' alig n the child. | 1398 // FIXME: Implement the previous values. For now, we always 'start' alig n the child. |
| 1379 return startOfColumnForChild(child); | 1399 return startOfColumnForChild(child); |
| 1380 } | 1400 } |
| 1381 | 1401 |
| 1382 ASSERT_NOT_REACHED(); | 1402 ASSERT_NOT_REACHED(); |
| 1383 return 0; | 1403 return 0; |
| 1384 } | 1404 } |
| 1385 | 1405 |
| 1386 LayoutUnit RenderGrid::endOfRowForChild(const RenderBox& child) const | 1406 LayoutUnit RenderGrid::endOfRowForChild(const RenderBox& child) const |
| 1387 { | 1407 { |
| 1408 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); | |
| 1388 const GridCoordinate& coordinate = cachedGridCoordinate(child); | 1409 const GridCoordinate& coordinate = cachedGridCoordinate(child); |
| 1389 | 1410 |
| 1390 LayoutUnit startOfRow = m_rowPositions[coordinate.rows.resolvedInitialPositi on.toInt()]; | 1411 LayoutUnit startOfRow = m_rowPositions[coordinate.rows.resolvedInitialPositi on.toInt()]; |
| 1391 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted. | 1412 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted. |
| 1392 LayoutUnit rowPosition = startOfRow + marginBeforeForChild(child); | 1413 LayoutUnit rowPosition = startOfRow + marginBeforeForChild(child); |
| 1393 | 1414 |
| 1394 LayoutUnit endOfRow = m_rowPositions[coordinate.rows.resolvedFinalPosition.n ext().toInt()]; | 1415 LayoutUnit endOfRow = m_rowPositions[coordinate.rows.resolvedFinalPosition.n ext().toInt()]; |
| 1395 LayoutUnit offsetFromRowPosition = computeOverflowAlignmentOffset(child.styl e()->alignSelfOverflowAlignment(), startOfRow, endOfRow, child.logicalHeight() + child.marginLogicalHeight()); | 1416 LayoutUnit childBreadth = hasOrthogonalWritingMode ? child.logicalWidth() + child.marginLogicalWidth() : child.logicalHeight() + child.marginLogicalHeight() ; |
| 1417 LayoutUnit offsetFromRowPosition = computeOverflowAlignmentOffset(child.styl e()->alignSelfOverflowAlignment(), startOfRow, endOfRow, childBreadth); | |
| 1396 | 1418 |
| 1397 return rowPosition + offsetFromRowPosition; | 1419 return rowPosition + offsetFromRowPosition; |
| 1398 } | 1420 } |
| 1399 | 1421 |
| 1400 LayoutUnit RenderGrid::startOfRowForChild(const RenderBox& child) const | 1422 LayoutUnit RenderGrid::startOfRowForChild(const RenderBox& child) const |
| 1401 { | 1423 { |
| 1402 const GridCoordinate& coordinate = cachedGridCoordinate(child); | 1424 const GridCoordinate& coordinate = cachedGridCoordinate(child); |
| 1403 | 1425 |
| 1404 LayoutUnit startOfRow = m_rowPositions[coordinate.rows.resolvedInitialPositi on.toInt()]; | 1426 LayoutUnit startOfRow = m_rowPositions[coordinate.rows.resolvedInitialPositi on.toInt()]; |
| 1405 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted. | 1427 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted. |
| 1406 LayoutUnit rowPosition = startOfRow + marginBeforeForChild(child); | 1428 LayoutUnit rowPosition = startOfRow + marginBeforeForChild(child); |
| 1407 | 1429 |
| 1408 return rowPosition; | 1430 return rowPosition; |
| 1409 } | 1431 } |
| 1410 | 1432 |
| 1411 LayoutUnit RenderGrid::centeredRowPositionForChild(const RenderBox& child) const | 1433 LayoutUnit RenderGrid::centeredRowPositionForChild(const RenderBox& child) const |
| 1412 { | 1434 { |
| 1435 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); | |
| 1413 const GridCoordinate& coordinate = cachedGridCoordinate(child); | 1436 const GridCoordinate& coordinate = cachedGridCoordinate(child); |
| 1414 | 1437 |
| 1415 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted. | 1438 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted. |
| 1416 LayoutUnit startOfRow = m_rowPositions[coordinate.rows.resolvedInitialPositi on.toInt()]; | 1439 LayoutUnit startOfRow = m_rowPositions[coordinate.rows.resolvedInitialPositi on.toInt()]; |
| 1417 LayoutUnit endOfRow = m_rowPositions[coordinate.rows.resolvedFinalPosition.n ext().toInt()]; | 1440 LayoutUnit endOfRow = m_rowPositions[coordinate.rows.resolvedFinalPosition.n ext().toInt()]; |
| 1418 LayoutUnit rowPosition = startOfRow + marginBeforeForChild(child); | 1441 LayoutUnit rowPosition = startOfRow + marginBeforeForChild(child); |
| 1419 LayoutUnit offsetFromRowPosition = computeOverflowAlignmentOffset(child.styl e()->alignSelfOverflowAlignment(), startOfRow, endOfRow, child.logicalHeight() + child.marginLogicalHeight()); | 1442 LayoutUnit childBreadth = hasOrthogonalWritingMode ? child.logicalWidth() + child.marginLogicalWidth() : child.logicalHeight() + child.marginLogicalHeight() ; |
| 1443 LayoutUnit offsetFromRowPosition = computeOverflowAlignmentOffset(child.styl e()->alignSelfOverflowAlignment(), startOfRow, endOfRow, childBreadth); | |
| 1420 | 1444 |
| 1421 return rowPosition + offsetFromRowPosition / 2; | 1445 return rowPosition + offsetFromRowPosition / 2; |
| 1422 } | 1446 } |
| 1423 | 1447 |
| 1424 static inline LayoutUnit constrainedChildIntrinsicContentLogicalHeight(const Ren derBox& child) | 1448 static inline LayoutUnit constrainedChildIntrinsicContentLogicalHeight(const Ren derBox& child) |
| 1425 { | 1449 { |
| 1426 LayoutUnit childIntrinsicContentLogicalHeight = child.intrinsicContentLogica lHeight(); | 1450 LayoutUnit childIntrinsicContentLogicalHeight = child.intrinsicContentLogica lHeight(); |
| 1427 return child.constrainLogicalHeightByMinMax(childIntrinsicContentLogicalHeig ht + child.borderAndPaddingLogicalHeight(), childIntrinsicContentLogicalHeight); | 1451 return child.constrainLogicalHeightByMinMax(childIntrinsicContentLogicalHeig ht + child.borderAndPaddingLogicalHeight(), childIntrinsicContentLogicalHeight); |
| 1428 } | 1452 } |
| 1429 | 1453 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1500 } | 1524 } |
| 1501 } | 1525 } |
| 1502 } | 1526 } |
| 1503 } | 1527 } |
| 1504 | 1528 |
| 1505 LayoutUnit RenderGrid::rowPositionForChild(const RenderBox& child) const | 1529 LayoutUnit RenderGrid::rowPositionForChild(const RenderBox& child) const |
| 1506 { | 1530 { |
| 1507 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); | 1531 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); |
| 1508 switch (RenderStyle::resolveAlignment(style(), child.style(), ItemPositionSt retch)) { | 1532 switch (RenderStyle::resolveAlignment(style(), child.style(), ItemPositionSt retch)) { |
| 1509 case ItemPositionSelfStart: | 1533 case ItemPositionSelfStart: |
| 1510 // If orthogonal writing-modes, this computes to 'start'. | 1534 // If orthogonal writing-modes, self-start will be based on the child's inline-axis |
| 1511 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet. | 1535 // direction, because it's the one parallel to the alignment property's axis. |
| 1512 if (hasOrthogonalWritingMode) | 1536 if (hasOrthogonalWritingMode) { |
| 1513 return startOfRowForChild(child); | 1537 switch (style()->writingMode()) { |
| 1538 case TopToBottomWritingMode: | |
| 1539 return child.style()->isLeftToRightDirection() ? startOfRowForCh ild(child) : endOfRowForChild(child); | |
| 1540 case BottomToTopWritingMode: | |
| 1541 return child.style()->isLeftToRightDirection() ? endOfRowForChil d(child) : startOfRowForChild(child); | |
| 1542 case LeftToRightWritingMode: | |
| 1543 return child.style()->isLeftToRightDirection() ? startOfRowForCh ild(child) : endOfRowForChild(child); | |
| 1544 case RightToLeftWritingMode: | |
| 1545 return child.style()->isLeftToRightDirection() ? endOfRowForChil d(child) : startOfRowForChild(child); | |
| 1546 } | |
| 1547 } | |
| 1514 | 1548 |
| 1515 // 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. | 1549 // 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. |
| 1516 if (child.style()->writingMode() != style()->writingMode()) | 1550 if (child.style()->writingMode() != style()->writingMode()) |
| 1517 return endOfRowForChild(child); | 1551 return endOfRowForChild(child); |
| 1518 | 1552 |
| 1519 return startOfRowForChild(child); | 1553 return startOfRowForChild(child); |
| 1520 case ItemPositionSelfEnd: | 1554 case ItemPositionSelfEnd: |
| 1521 // If orthogonal writing-modes, this computes to 'end'. | 1555 // If orthogonal writing-modes, self-end will be based on the child's in line-axis |
| 1522 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet. | 1556 // direction, because it's the one parallel to the alignment property's axis. |
| 1523 if (hasOrthogonalWritingMode) | 1557 if (hasOrthogonalWritingMode) { |
| 1524 return endOfRowForChild(child); | 1558 switch (style()->writingMode()) { |
| 1559 case TopToBottomWritingMode: | |
| 1560 return child.style()->isLeftToRightDirection() ? endOfRowForChil d(child) : startOfRowForChild(child); | |
| 1561 case BottomToTopWritingMode: | |
| 1562 return child.style()->isLeftToRightDirection() ? startOfRowForCh ild(child) : endOfRowForChild(child); | |
| 1563 case LeftToRightWritingMode: | |
| 1564 return child.style()->isLeftToRightDirection() ? endOfRowForChil d(child) : startOfRowForChild(child); | |
| 1565 case RightToLeftWritingMode: | |
| 1566 return child.style()->isLeftToRightDirection() ? startOfRowForCh ild(child) : endOfRowForChild(child); | |
| 1567 } | |
| 1568 } | |
| 1525 | 1569 |
| 1526 // 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. | 1570 // 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. |
| 1527 if (child.style()->writingMode() != style()->writingMode()) | 1571 if (child.style()->writingMode() != style()->writingMode()) |
| 1528 return startOfRowForChild(child); | 1572 return startOfRowForChild(child); |
| 1529 | 1573 |
| 1530 return endOfRowForChild(child); | 1574 return endOfRowForChild(child); |
| 1531 case ItemPositionLeft: | 1575 case ItemPositionLeft: |
| 1532 // The alignment axis (column axis) and the inline axis are parallell in | 1576 // The alignment axis (column axis) is orthogonal to the inline axis so this is |
| 1533 // orthogonal writing mode. | 1577 // equivalent to 'start'. |
| 1534 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet. | |
| 1535 if (hasOrthogonalWritingMode) | |
| 1536 return startOfRowForChild(child); | |
| 1537 | |
| 1538 // Otherwise this this is equivalent to 'start’. | |
| 1539 return startOfRowForChild(child); | 1578 return startOfRowForChild(child); |
| 1540 case ItemPositionRight: | 1579 case ItemPositionRight: |
| 1541 // The alignment axis (column axis) and the inline axis are parallell in | 1580 // The alignment axis (column axis) is orthogonal to the inline axis so this is |
| 1542 // orthogonal writing mode. | 1581 // equivalent to 'start'. |
| 1543 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet. | |
| 1544 if (hasOrthogonalWritingMode) | |
| 1545 return endOfRowForChild(child); | |
| 1546 | |
| 1547 // Otherwise this this is equivalent to 'start’. | |
| 1548 return startOfRowForChild(child); | 1582 return startOfRowForChild(child); |
| 1549 case ItemPositionCenter: | 1583 case ItemPositionCenter: |
| 1550 return centeredRowPositionForChild(child); | 1584 return centeredRowPositionForChild(child); |
| 1551 // Only used in flex layout, for other layout, it's equivalent to 'start '. | 1585 // Only used in flex layout, for other layout, it's equivalent to 'start '. |
| 1552 case ItemPositionFlexStart: | 1586 case ItemPositionFlexStart: |
| 1553 case ItemPositionStart: | 1587 case ItemPositionStart: |
| 1554 return startOfRowForChild(child); | 1588 return startOfRowForChild(child); |
| 1555 // Only used in flex layout, for other layout, it's equivalent to 'end'. | 1589 // Only used in flex layout, for other layout, it's equivalent to 'end'. |
| 1556 case ItemPositionFlexEnd: | 1590 case ItemPositionFlexEnd: |
| 1557 case ItemPositionEnd: | 1591 case ItemPositionEnd: |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1681 return 0; | 1715 return 0; |
| 1682 } | 1716 } |
| 1683 | 1717 |
| 1684 LayoutPoint RenderGrid::findChildLogicalPosition(const RenderBox& child, LayoutS ize contentAlignmentOffset) const | 1718 LayoutPoint RenderGrid::findChildLogicalPosition(const RenderBox& child, LayoutS ize contentAlignmentOffset) const |
| 1685 { | 1719 { |
| 1686 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); | 1720 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); |
| 1687 LayoutUnit rowPosition = rowPositionForChild(child); | 1721 LayoutUnit rowPosition = rowPositionForChild(child); |
| 1688 LayoutUnit columnPosition = columnPositionForChild(child); | 1722 LayoutUnit columnPosition = columnPositionForChild(child); |
| 1689 // We stored m_columnPositions's data ignoring the direction, hence we might need now | 1723 // We stored m_columnPositions's data ignoring the direction, hence we might need now |
| 1690 // to translate positions from RTL to LTR, as it's more convenient for paint ing. | 1724 // to translate positions from RTL to LTR, as it's more convenient for paint ing. |
| 1691 if (!style()->isLeftToRightDirection()) | 1725 if (!style()->isLeftToRightDirection()) { |
| 1692 columnPosition = (m_columnPositions[m_columnPositions.size() - 1] + bord erAndPaddingLogicalLeft()) - columnPosition - child.logicalWidth(); | 1726 LayoutUnit childBreadth = hasOrthogonalWritingMode ? child.logicalHeight (): child.logicalWidth(); |
|
Julien - ping for review
2015/01/26 10:42:06
Style: Space before and after ':'.
jfernandez
2015/02/06 23:54:19
Done.
| |
| 1727 columnPosition = (m_columnPositions[m_columnPositions.size() - 1] + bord erAndPaddingLogicalLeft()) - columnPosition - childBreadth; | |
| 1728 } | |
| 1693 | 1729 |
| 1694 // We stored column's and row's positions without considering orthogonal flo ws, so now we | 1730 // We stored column's and row's positions without considering orthogonal flo ws, so now we |
| 1695 // need to flip the final LayoutPoint coordinates if that's the case. | 1731 // need to flip the final LayoutPoint coordinates if that's the case. |
| 1696 LayoutPoint childLocation = hasOrthogonalWritingMode ? LayoutPoint(rowPositi on, columnPosition) : LayoutPoint(columnPosition, rowPosition); | 1732 LayoutPoint childLocation = hasOrthogonalWritingMode ? LayoutPoint(rowPositi on, columnPosition) : LayoutPoint(columnPosition, rowPosition); |
| 1697 | 1733 |
| 1698 // The Content Alignment offset accounts for the RTL to LTR flip. | 1734 // The Content Alignment offset accounts for the RTL to LTR flip. |
| 1699 childLocation.move(contentAlignmentOffset); | 1735 childLocation.move(contentAlignmentOffset); |
| 1700 | 1736 |
| 1701 return childLocation; | 1737 return childLocation; |
| 1702 } | 1738 } |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 1713 if (isOutOfFlowPositioned()) | 1749 if (isOutOfFlowPositioned()) |
| 1714 return "RenderGrid (positioned)"; | 1750 return "RenderGrid (positioned)"; |
| 1715 if (isAnonymous()) | 1751 if (isAnonymous()) |
| 1716 return "RenderGrid (generated)"; | 1752 return "RenderGrid (generated)"; |
| 1717 if (isRelPositioned()) | 1753 if (isRelPositioned()) |
| 1718 return "RenderGrid (relative positioned)"; | 1754 return "RenderGrid (relative positioned)"; |
| 1719 return "RenderGrid"; | 1755 return "RenderGrid"; |
| 1720 } | 1756 } |
| 1721 | 1757 |
| 1722 } // namespace blink | 1758 } // namespace blink |
| OLD | NEW |