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

Side by Side Diff: Source/core/layout/LayoutGrid.cpp

Issue 1136283006: [CSS Grid Layout] Avoid using StyleAdjuster to resolve 'auto' values. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed some layout tests failures. Created 5 years, 7 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/layout/LayoutFlexibleBox.cpp ('k') | Source/core/style/ComputedStyle.h » ('j') | 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 const bool hasUndefinedRemainingSpace = (direction == ForRows) ? style()->lo gicalHeight().isAuto() : gridElementIsShrinkToFit(); 437 const bool hasUndefinedRemainingSpace = (direction == ForRows) ? style()->lo gicalHeight().isAuto() : gridElementIsShrinkToFit();
438 438
439 if (!hasUndefinedRemainingSpace && freeSpace <= 0) 439 if (!hasUndefinedRemainingSpace && freeSpace <= 0)
440 return; 440 return;
441 441
442 // 3. Grow all Grid tracks in GridTracks from their baseSize up to their gro wthLimit value until freeSpace is exhausted. 442 // 3. Grow all Grid tracks in GridTracks from their baseSize up to their gro wthLimit value until freeSpace is exhausted.
443 // Any 'auto-sized' (content based) track will be 'stretched' over their Max Breadth if required 443 // Any 'auto-sized' (content based) track will be 'stretched' over their Max Breadth if required
444 // and there is space available, except if there are flexible track, which w ill occupy the whole 444 // and there is space available, except if there are flexible track, which w ill occupy the whole
445 // available space. 445 // available space.
446 bool needToStretch = flexibleSizedTracksIndex.isEmpty() && !sizingData.conte ntSizedTracksIndex.isEmpty() 446 bool needToStretch = flexibleSizedTracksIndex.isEmpty() && !sizingData.conte ntSizedTracksIndex.isEmpty()
447 && ((direction == ForColumns && style()->justifyContentDistribution() == ContentDistributionStretch) 447 && ((direction == ForColumns && style()->resolvedJustifyContentDistribut ion() == ContentDistributionStretch)
448 || (direction == ForRows && style()->alignContentDistribution() == C ontentDistributionStretch)); 448 || (direction == ForRows && style()->resolvedAlignContentDistributio n() == ContentDistributionStretch));
449 const size_t tracksSize = tracks.size(); 449 const size_t tracksSize = tracks.size();
450 if (!hasUndefinedRemainingSpace) { 450 if (!hasUndefinedRemainingSpace) {
451 Vector<GridTrack*> tracksForDistribution(tracksSize); 451 Vector<GridTrack*> tracksForDistribution(tracksSize);
452 for (size_t i = 0; i < tracksSize; ++i) { 452 for (size_t i = 0; i < tracksSize; ++i) {
453 tracksForDistribution[i] = tracks.data() + i; 453 tracksForDistribution[i] = tracks.data() + i;
454 tracksForDistribution[i]->m_plannedIncrease = 0; 454 tracksForDistribution[i]->m_plannedIncrease = 0;
455 } 455 }
456 456
457 Vector<GridTrack*> tracksToStretch(sizingData.contentSizedTracksIndex.si ze()); 457 Vector<GridTrack*> tracksToStretch(sizingData.contentSizedTracksIndex.si ze());
458 if (needToStretch) { 458 if (needToStretch) {
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 1356
1357 LayoutUnit LayoutGrid::endOfColumnForChild(const LayoutBox& child) const 1357 LayoutUnit LayoutGrid::endOfColumnForChild(const LayoutBox& child) const
1358 { 1358 {
1359 const GridCoordinate& coordinate = cachedGridCoordinate(child); 1359 const GridCoordinate& coordinate = cachedGridCoordinate(child);
1360 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.resolvedInit ialPosition.toInt()]; 1360 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.resolvedInit ialPosition.toInt()];
1361 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted. 1361 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted.
1362 LayoutUnit columnPosition = startOfColumn + marginStartForChild(child); 1362 LayoutUnit columnPosition = startOfColumn + marginStartForChild(child);
1363 1363
1364 LayoutUnit endOfColumn = m_columnPositions[coordinate.columns.resolvedFinalP osition.next().toInt()]; 1364 LayoutUnit endOfColumn = m_columnPositions[coordinate.columns.resolvedFinalP osition.next().toInt()];
1365 // FIXME: This might not work as expected with orthogonal writing-modes. 1365 // FIXME: This might not work as expected with orthogonal writing-modes.
1366 LayoutUnit offsetFromColumnPosition = computeOverflowAlignmentOffset(child.s tyle()->justifySelfOverflowAlignment(), startOfColumn, endOfColumn, child.logica lWidth() + child.marginLogicalWidth()); 1366 OverflowAlignment overflow = ComputedStyle::resolvedJustifySelfOverflow(styl eRef(), child.styleRef());
1367 LayoutUnit offsetFromColumnPosition = computeOverflowAlignmentOffset(overflo w, startOfColumn, endOfColumn, child.logicalWidth() + child.marginLogicalWidth() );
1367 1368
1368 return columnPosition + offsetFromColumnPosition; 1369 return columnPosition + offsetFromColumnPosition;
1369 } 1370 }
1370 1371
1371 LayoutUnit LayoutGrid::columnPositionLeft(const LayoutBox& child) const 1372 LayoutUnit LayoutGrid::columnPositionLeft(const LayoutBox& child) const
1372 { 1373 {
1373 if (style()->isLeftToRightDirection()) 1374 if (style()->isLeftToRightDirection())
1374 return startOfColumnForChild(child); 1375 return startOfColumnForChild(child);
1375 1376
1376 return endOfColumnForChild(child); 1377 return endOfColumnForChild(child);
1377 } 1378 }
1378 1379
1379 LayoutUnit LayoutGrid::columnPositionRight(const LayoutBox& child) const 1380 LayoutUnit LayoutGrid::columnPositionRight(const LayoutBox& child) const
1380 { 1381 {
1381 if (!style()->isLeftToRightDirection()) 1382 if (!style()->isLeftToRightDirection())
1382 return startOfColumnForChild(child); 1383 return startOfColumnForChild(child);
1383 1384
1384 return endOfColumnForChild(child); 1385 return endOfColumnForChild(child);
1385 } 1386 }
1386 1387
1387 LayoutUnit LayoutGrid::centeredColumnPositionForChild(const LayoutBox& child) co nst 1388 LayoutUnit LayoutGrid::centeredColumnPositionForChild(const LayoutBox& child) co nst
1388 { 1389 {
1389 const GridCoordinate& coordinate = cachedGridCoordinate(child); 1390 const GridCoordinate& coordinate = cachedGridCoordinate(child);
1390 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.resolvedInit ialPosition.toInt()]; 1391 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.resolvedInit ialPosition.toInt()];
1391 LayoutUnit endOfColumn = m_columnPositions[coordinate.columns.resolvedFinalP osition.next().toInt()]; 1392 LayoutUnit endOfColumn = m_columnPositions[coordinate.columns.resolvedFinalP osition.next().toInt()];
1392 LayoutUnit columnPosition = startOfColumn + marginStartForChild(child); 1393 LayoutUnit columnPosition = startOfColumn + marginStartForChild(child);
1393 // FIXME: This might not work as expected with orthogonal writing-modes. 1394 // FIXME: This might not work as expected with orthogonal writing-modes.
1394 LayoutUnit offsetFromColumnPosition = computeOverflowAlignmentOffset(child.s tyle()->justifySelfOverflowAlignment(), startOfColumn, endOfColumn, child.logica lWidth() + child.marginLogicalWidth()); 1395 OverflowAlignment overflow = ComputedStyle::resolvedJustifySelfOverflow(styl eRef(), child.styleRef());
1396 LayoutUnit offsetFromColumnPosition = computeOverflowAlignmentOffset(overflo w, startOfColumn, endOfColumn, child.logicalWidth() + child.marginLogicalWidth() );
1395 1397
1396 return columnPosition + offsetFromColumnPosition / 2; 1398 return columnPosition + offsetFromColumnPosition / 2;
1397 } 1399 }
1398 1400
1399 LayoutUnit LayoutGrid::columnPositionForChild(const LayoutBox& child) const 1401 LayoutUnit LayoutGrid::columnPositionForChild(const LayoutBox& child) const
1400 { 1402 {
1401 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); 1403 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode();
1402 1404
1403 switch (ComputedStyle::resolveJustification(styleRef(), child.styleRef(), It emPositionStretch)) { 1405 switch (ComputedStyle::resolvedJustifySelfPosition(styleRef(), child.styleRe f(), ItemPositionStretch)) {
1404 case ItemPositionSelfStart: 1406 case ItemPositionSelfStart:
1405 // For orthogonal writing-modes, this computes to 'start' 1407 // For orthogonal writing-modes, this computes to 'start'
1406 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet. 1408 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet.
1407 if (hasOrthogonalWritingMode) 1409 if (hasOrthogonalWritingMode)
1408 return startOfColumnForChild(child); 1410 return startOfColumnForChild(child);
1409 1411
1410 // self-start is based on the child's direction. That's why we need to c heck against the grid container's direction. 1412 // self-start is based on the child's direction. That's why we need to c heck against the grid container's direction.
1411 if (child.style()->direction() != style()->direction()) 1413 if (child.style()->direction() != style()->direction())
1412 return endOfColumnForChild(child); 1414 return endOfColumnForChild(child);
1413 1415
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 1457
1456 LayoutUnit LayoutGrid::endOfRowForChild(const LayoutBox& child) const 1458 LayoutUnit LayoutGrid::endOfRowForChild(const LayoutBox& child) const
1457 { 1459 {
1458 const GridCoordinate& coordinate = cachedGridCoordinate(child); 1460 const GridCoordinate& coordinate = cachedGridCoordinate(child);
1459 1461
1460 LayoutUnit startOfRow = m_rowPositions[coordinate.rows.resolvedInitialPositi on.toInt()]; 1462 LayoutUnit startOfRow = m_rowPositions[coordinate.rows.resolvedInitialPositi on.toInt()];
1461 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted. 1463 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted.
1462 LayoutUnit rowPosition = startOfRow + marginBeforeForChild(child); 1464 LayoutUnit rowPosition = startOfRow + marginBeforeForChild(child);
1463 1465
1464 LayoutUnit endOfRow = m_rowPositions[coordinate.rows.resolvedFinalPosition.n ext().toInt()]; 1466 LayoutUnit endOfRow = m_rowPositions[coordinate.rows.resolvedFinalPosition.n ext().toInt()];
1465 LayoutUnit offsetFromRowPosition = computeOverflowAlignmentOffset(child.styl e()->alignSelfOverflowAlignment(), startOfRow, endOfRow, child.logicalHeight() + child.marginLogicalHeight()); 1467 OverflowAlignment overflow = ComputedStyle::resolvedAlignSelfOverflow(styleR ef(), child.styleRef());
1468 LayoutUnit offsetFromRowPosition = computeOverflowAlignmentOffset(overflow, startOfRow, endOfRow, child.logicalHeight() + child.marginLogicalHeight());
1466 1469
1467 return rowPosition + offsetFromRowPosition; 1470 return rowPosition + offsetFromRowPosition;
1468 } 1471 }
1469 1472
1470 LayoutUnit LayoutGrid::startOfRowForChild(const LayoutBox& child) const 1473 LayoutUnit LayoutGrid::startOfRowForChild(const LayoutBox& child) const
1471 { 1474 {
1472 const GridCoordinate& coordinate = cachedGridCoordinate(child); 1475 const GridCoordinate& coordinate = cachedGridCoordinate(child);
1473 1476
1474 LayoutUnit startOfRow = m_rowPositions[coordinate.rows.resolvedInitialPositi on.toInt()]; 1477 LayoutUnit startOfRow = m_rowPositions[coordinate.rows.resolvedInitialPositi on.toInt()];
1475 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted. 1478 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted.
1476 LayoutUnit rowPosition = startOfRow + marginBeforeForChild(child); 1479 LayoutUnit rowPosition = startOfRow + marginBeforeForChild(child);
1477 1480
1478 return rowPosition; 1481 return rowPosition;
1479 } 1482 }
1480 1483
1481 LayoutUnit LayoutGrid::centeredRowPositionForChild(const LayoutBox& child) const 1484 LayoutUnit LayoutGrid::centeredRowPositionForChild(const LayoutBox& child) const
1482 { 1485 {
1483 const GridCoordinate& coordinate = cachedGridCoordinate(child); 1486 const GridCoordinate& coordinate = cachedGridCoordinate(child);
1484 1487
1485 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted. 1488 // The grid items should be inside the grid container's border box, that's w hy they need to be shifted.
1486 LayoutUnit startOfRow = m_rowPositions[coordinate.rows.resolvedInitialPositi on.toInt()]; 1489 LayoutUnit startOfRow = m_rowPositions[coordinate.rows.resolvedInitialPositi on.toInt()];
1487 LayoutUnit endOfRow = m_rowPositions[coordinate.rows.resolvedFinalPosition.n ext().toInt()]; 1490 LayoutUnit endOfRow = m_rowPositions[coordinate.rows.resolvedFinalPosition.n ext().toInt()];
1488 LayoutUnit rowPosition = startOfRow + marginBeforeForChild(child); 1491 LayoutUnit rowPosition = startOfRow + marginBeforeForChild(child);
1489 LayoutUnit offsetFromRowPosition = computeOverflowAlignmentOffset(child.styl e()->alignSelfOverflowAlignment(), startOfRow, endOfRow, child.logicalHeight() + child.marginLogicalHeight()); 1492 OverflowAlignment overflow = ComputedStyle::resolvedAlignSelfOverflow(styleR ef(), child.styleRef());
1493 LayoutUnit offsetFromRowPosition = computeOverflowAlignmentOffset(overflow, startOfRow, endOfRow, child.logicalHeight() + child.marginLogicalHeight());
1490 1494
1491 return rowPosition + offsetFromRowPosition / 2; 1495 return rowPosition + offsetFromRowPosition / 2;
1492 } 1496 }
1493 1497
1494 static inline LayoutUnit constrainedChildIntrinsicContentLogicalHeight(const Lay outBox& child) 1498 static inline LayoutUnit constrainedChildIntrinsicContentLogicalHeight(const Lay outBox& child)
1495 { 1499 {
1496 LayoutUnit childIntrinsicContentLogicalHeight = child.intrinsicContentLogica lHeight(); 1500 LayoutUnit childIntrinsicContentLogicalHeight = child.intrinsicContentLogica lHeight();
1497 return child.constrainLogicalHeightByMinMax(childIntrinsicContentLogicalHeig ht + child.borderAndPaddingLogicalHeight(), childIntrinsicContentLogicalHeight); 1501 return child.constrainLogicalHeightByMinMax(childIntrinsicContentLogicalHeig ht + child.borderAndPaddingLogicalHeight(), childIntrinsicContentLogicalHeight);
1498 } 1502 }
1499 1503
1500 bool LayoutGrid::allowedToStretchLogicalHeightForChild(const LayoutBox& child) c onst 1504 bool LayoutGrid::allowedToStretchLogicalHeightForChild(const LayoutBox& child) c onst
1501 { 1505 {
1502 return child.style()->logicalHeight().isAuto() && !child.style()->marginBefo reUsing(style()).isAuto() && !child.style()->marginAfterUsing(style()).isAuto(); 1506 return child.style()->logicalHeight().isAuto() && !child.style()->marginBefo reUsing(style()).isAuto() && !child.style()->marginAfterUsing(style()).isAuto();
1503 } 1507 }
1504 1508
1505 // FIXME: This logic is shared by LayoutFlexibleBox, so it should be moved to La youtBox. 1509 // FIXME: This logic is shared by LayoutFlexibleBox, so it should be moved to La youtBox.
1506 bool LayoutGrid::needToStretchChildLogicalHeight(const LayoutBox& child) const 1510 bool LayoutGrid::needToStretchChildLogicalHeight(const LayoutBox& child) const
1507 { 1511 {
1508 if (ComputedStyle::resolveAlignment(styleRef(), child.styleRef(), ItemPositi onStretch) != ItemPositionStretch) 1512 if (ComputedStyle::resolvedAlignSelfPosition(styleRef(), child.styleRef(), I temPositionStretch) != ItemPositionStretch)
1509 return false; 1513 return false;
1510 1514
1511 return isHorizontalWritingMode() && child.style()->height().isAuto(); 1515 return isHorizontalWritingMode() && child.style()->height().isAuto();
1512 } 1516 }
1513 1517
1514 // FIXME: This logic is shared by LayoutFlexibleBox, so it should be moved to La youtBox. 1518 // FIXME: This logic is shared by LayoutFlexibleBox, so it should be moved to La youtBox.
1515 LayoutUnit LayoutGrid::childIntrinsicHeight(const LayoutBox& child) const 1519 LayoutUnit LayoutGrid::childIntrinsicHeight(const LayoutBox& child) const
1516 { 1520 {
1517 if (child.isHorizontalWritingMode() && needToStretchChildLogicalHeight(child )) 1521 if (child.isHorizontalWritingMode() && needToStretchChildLogicalHeight(child ))
1518 return constrainedChildIntrinsicContentLogicalHeight(child); 1522 return constrainedChildIntrinsicContentLogicalHeight(child);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 // compute margins in order to determine the available height before stretch ing. 1566 // compute margins in order to determine the available height before stretch ing.
1563 if (childMarginLogicalHeight == 0) 1567 if (childMarginLogicalHeight == 0)
1564 childMarginLogicalHeight = computeMarginLogicalHeightForChild(child); 1568 childMarginLogicalHeight = computeMarginLogicalHeightForChild(child);
1565 1569
1566 return gridAreaBreadthForChild - childMarginLogicalHeight; 1570 return gridAreaBreadthForChild - childMarginLogicalHeight;
1567 } 1571 }
1568 1572
1569 // FIXME: This logic is shared by LayoutFlexibleBox, so it should be moved to La youtBox. 1573 // FIXME: This logic is shared by LayoutFlexibleBox, so it should be moved to La youtBox.
1570 void LayoutGrid::applyStretchAlignmentToChildIfNeeded(LayoutBox& child, LayoutUn it gridAreaBreadthForChild) 1574 void LayoutGrid::applyStretchAlignmentToChildIfNeeded(LayoutBox& child, LayoutUn it gridAreaBreadthForChild)
1571 { 1575 {
1572 if (ComputedStyle::resolveAlignment(styleRef(), child.styleRef(), ItemPositi onStretch) != ItemPositionStretch) 1576 if (ComputedStyle::resolvedAlignSelfPosition(styleRef(), child.styleRef(), I temPositionStretch) != ItemPositionStretch)
1573 return; 1577 return;
1574 1578
1575 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); 1579 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode();
1576 if (allowedToStretchLogicalHeightForChild(child)) { 1580 if (allowedToStretchLogicalHeightForChild(child)) {
1577 // FIXME: If the child has orthogonal flow, then it already has an overr ide height set, so use it. 1581 // FIXME: If the child has orthogonal flow, then it already has an overr ide height set, so use it.
1578 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet. 1582 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet.
1579 if (!hasOrthogonalWritingMode) { 1583 if (!hasOrthogonalWritingMode) {
1580 LayoutUnit stretchedLogicalHeight = availableAlignmentSpaceForChildB eforeStretching(gridAreaBreadthForChild, child); 1584 LayoutUnit stretchedLogicalHeight = availableAlignmentSpaceForChildB eforeStretching(gridAreaBreadthForChild, child);
1581 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinM ax(stretchedLogicalHeight, -1); 1585 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinM ax(stretchedLogicalHeight, -1);
1582 1586
1583 // FIXME: Can avoid laying out here in some cases. See https://webki t.org/b/87905. 1587 // FIXME: Can avoid laying out here in some cases. See https://webki t.org/b/87905.
1584 bool childNeedsRelayout = desiredLogicalHeight != child.logicalHeigh t(); 1588 bool childNeedsRelayout = desiredLogicalHeight != child.logicalHeigh t();
1585 if (childNeedsRelayout || !child.hasOverrideLogicalContentHeight()) 1589 if (childNeedsRelayout || !child.hasOverrideLogicalContentHeight())
1586 child.setOverrideLogicalContentHeight(desiredLogicalHeight - chi ld.borderAndPaddingLogicalHeight()); 1590 child.setOverrideLogicalContentHeight(desiredLogicalHeight - chi ld.borderAndPaddingLogicalHeight());
1587 if (childNeedsRelayout) { 1591 if (childNeedsRelayout) {
1588 child.setLogicalHeight(0); 1592 child.setLogicalHeight(0);
1589 child.setNeedsLayout(LayoutInvalidationReason::GridChanged); 1593 child.setNeedsLayout(LayoutInvalidationReason::GridChanged);
1590 } 1594 }
1591 } 1595 }
1592 } 1596 }
1593 } 1597 }
1594 1598
1595 LayoutUnit LayoutGrid::rowPositionForChild(const LayoutBox& child) const 1599 LayoutUnit LayoutGrid::rowPositionForChild(const LayoutBox& child) const
1596 { 1600 {
1597 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); 1601 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode();
1598 switch (ComputedStyle::resolveAlignment(styleRef(), child.styleRef(), ItemPo sitionStretch)) { 1602 switch (ComputedStyle::resolvedAlignSelfPosition(styleRef(), child.styleRef( ), ItemPositionStretch)) {
1599 case ItemPositionSelfStart: 1603 case ItemPositionSelfStart:
1600 // If orthogonal writing-modes, this computes to 'start'. 1604 // If orthogonal writing-modes, this computes to 'start'.
1601 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet. 1605 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet.
1602 if (hasOrthogonalWritingMode) 1606 if (hasOrthogonalWritingMode)
1603 return startOfRowForChild(child); 1607 return startOfRowForChild(child);
1604 1608
1605 // 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. 1609 // 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.
1606 if (child.style()->writingMode() != style()->writingMode()) 1610 if (child.style()->writingMode() != style()->writingMode())
1607 return endOfRowForChild(child); 1611 return endOfRowForChild(child);
1608 1612
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1724 positionOffset = 0; 1728 positionOffset = 0;
1725 return false; 1729 return false;
1726 } 1730 }
1727 1731
1728 ASSERT_NOT_REACHED(); 1732 ASSERT_NOT_REACHED();
1729 return false; 1733 return false;
1730 } 1734 }
1731 1735
1732 void LayoutGrid::computeContentPositionAndDistributionColumnOffset(LayoutUnit av ailableFreeSpace, GridSizingData& sizingData) const 1736 void LayoutGrid::computeContentPositionAndDistributionColumnOffset(LayoutUnit av ailableFreeSpace, GridSizingData& sizingData) const
1733 { 1737 {
1734 ContentPosition position = styleRef().justifyContentPosition(); 1738 ContentPosition position = styleRef().resolvedJustifyContentPosition();
1735 ContentDistributionType distribution = styleRef().justifyContentDistribution (); 1739 ContentDistributionType distribution = styleRef().resolvedJustifyContentDist ribution();
1736 // If <content-distribution> value can't be applied, 'position' will become the associated 1740 // If <content-distribution> value can't be applied, 'position' will become the associated
1737 // <content-position> fallback value. 1741 // <content-position> fallback value.
1738 if (contentDistributionOffset(availableFreeSpace, position, distribution, si zingData.columnTracks.size(), sizingData.columnsPositionOffset, sizingData.colum nsDistributionOffset)) 1742 if (contentDistributionOffset(availableFreeSpace, position, distribution, si zingData.columnTracks.size(), sizingData.columnsPositionOffset, sizingData.colum nsDistributionOffset))
1739 return; 1743 return;
1740 1744
1741 OverflowAlignment overflow = styleRef().justifyContentOverflowAlignment(); 1745 OverflowAlignment overflow = styleRef().justifyContentOverflowAlignment();
1742 if (overflow == OverflowAlignmentSafe && availableFreeSpace <= 0) 1746 if (overflow == OverflowAlignmentSafe && availableFreeSpace <= 0)
1743 return; 1747 return;
1744 1748
1745 switch (position) { 1749 switch (position) {
(...skipping 24 matching lines...) Expand all
1770 return; 1774 return;
1771 case ContentPositionAuto: 1775 case ContentPositionAuto:
1772 break; 1776 break;
1773 } 1777 }
1774 1778
1775 ASSERT_NOT_REACHED(); 1779 ASSERT_NOT_REACHED();
1776 } 1780 }
1777 1781
1778 void LayoutGrid::computeContentPositionAndDistributionRowOffset(LayoutUnit avail ableFreeSpace, GridSizingData& sizingData) const 1782 void LayoutGrid::computeContentPositionAndDistributionRowOffset(LayoutUnit avail ableFreeSpace, GridSizingData& sizingData) const
1779 { 1783 {
1780 ContentPosition position = styleRef().alignContentPosition(); 1784 ContentPosition position = styleRef().resolvedAlignContentPosition();
1781 ContentDistributionType distribution = styleRef().alignContentDistribution() ; 1785 ContentDistributionType distribution = styleRef().resolvedAlignContentDistri bution();
1782 // If <content-distribution> value can't be applied, 'position' will become the associated 1786 // If <content-distribution> value can't be applied, 'position' will become the associated
1783 // <content-position> fallback value. 1787 // <content-position> fallback value.
1784 if (contentDistributionOffset(availableFreeSpace, position, distribution, si zingData.rowTracks.size(), sizingData.rowsPositionOffset, sizingData.rowsDistrib utionOffset)) 1788 if (contentDistributionOffset(availableFreeSpace, position, distribution, si zingData.rowTracks.size(), sizingData.rowsPositionOffset, sizingData.rowsDistrib utionOffset))
1785 return; 1789 return;
1786 1790
1787 OverflowAlignment overflow = styleRef().alignContentOverflowAlignment(); 1791 OverflowAlignment overflow = styleRef().alignContentOverflowAlignment();
1788 if (overflow == OverflowAlignmentSafe && availableFreeSpace <= 0) 1792 if (overflow == OverflowAlignmentSafe && availableFreeSpace <= 0)
1789 return; 1793 return;
1790 1794
1791 switch (position) { 1795 switch (position) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1833 1837
1834 return LayoutPoint(columnPosition, rowPositionForChild(child)); 1838 return LayoutPoint(columnPosition, rowPositionForChild(child));
1835 } 1839 }
1836 1840
1837 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) 1841 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset)
1838 { 1842 {
1839 GridPainter(*this).paintChildren(paintInfo, paintOffset); 1843 GridPainter(*this).paintChildren(paintInfo, paintOffset);
1840 } 1844 }
1841 1845
1842 } // namespace blink 1846 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutFlexibleBox.cpp ('k') | Source/core/style/ComputedStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698