| 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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 if (logicalHeightLength.isMinContent()) | 448 if (logicalHeightLength.isMinContent()) |
| 449 return m_minContentHeight; | 449 return m_minContentHeight; |
| 450 | 450 |
| 451 if (logicalHeightLength.isMaxContent()) | 451 if (logicalHeightLength.isMaxContent()) |
| 452 return m_maxContentHeight; | 452 return m_maxContentHeight; |
| 453 | 453 |
| 454 if (logicalHeightLength.isFitContent()) { | 454 if (logicalHeightLength.isFitContent()) { |
| 455 if (m_minContentHeight == -1 || m_maxContentHeight == -1) | 455 if (m_minContentHeight == -1 || m_maxContentHeight == -1) |
| 456 return -1; | 456 return -1; |
| 457 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig
ht(ExcludeMarginBorderPadding); | 457 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig
ht(ExcludeMarginBorderPadding); |
| 458 return std::min<LayoutUnit>(m_maxContentHeight, std::max<LayoutUnit>(m_m
inContentHeight, fillAvailableExtent)); | 458 return std::min<LayoutUnit>(m_maxContentHeight, std::max(m_minContentHei
ght, fillAvailableExtent)); |
| 459 } | 459 } |
| 460 | 460 |
| 461 if (logicalHeightLength.isFillAvailable()) | 461 if (logicalHeightLength.isFillAvailable()) |
| 462 return containingBlock()->availableLogicalHeight(ExcludeMarginBorderPadd
ing) - borderAndPadding; | 462 return containingBlock()->availableLogicalHeight(ExcludeMarginBorderPadd
ing) - borderAndPadding; |
| 463 ASSERT_NOT_REACHED(); | 463 ASSERT_NOT_REACHED(); |
| 464 return 0; | 464 return 0; |
| 465 } | 465 } |
| 466 | 466 |
| 467 static inline double normalizedFlexFraction(const GridTrack& track, double flexF
actor) | 467 static inline double normalizedFlexFraction(const GridTrack& track, double flexF
actor) |
| 468 { | 468 { |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 if (trackShouldGrowBeyondGrowthLimitsForTrackSizeComputationPhase(ph
ase, trackSize)) | 1005 if (trackShouldGrowBeyondGrowthLimitsForTrackSizeComputationPhase(ph
ase, trackSize)) |
| 1006 sizingData.growBeyondGrowthLimitsTracks.append(&track); | 1006 sizingData.growBeyondGrowthLimitsTracks.append(&track); |
| 1007 } | 1007 } |
| 1008 | 1008 |
| 1009 if (sizingData.filteredTracks.isEmpty()) | 1009 if (sizingData.filteredTracks.isEmpty()) |
| 1010 continue; | 1010 continue; |
| 1011 | 1011 |
| 1012 spanningTracksSize += guttersSize(direction, itemSpan.integerSpan()); | 1012 spanningTracksSize += guttersSize(direction, itemSpan.integerSpan()); |
| 1013 | 1013 |
| 1014 LayoutUnit extraSpace = currentItemSizeForTrackSizeComputationPhase(phas
e, gridItemWithSpan.gridItem(), direction, sizingData.columnTracks) - spanningTr
acksSize; | 1014 LayoutUnit extraSpace = currentItemSizeForTrackSizeComputationPhase(phas
e, gridItemWithSpan.gridItem(), direction, sizingData.columnTracks) - spanningTr
acksSize; |
| 1015 extraSpace = std::max<LayoutUnit>(extraSpace, 0); | 1015 extraSpace = extraSpace.clampNegativeToZero(); |
| 1016 auto& tracksToGrowBeyondGrowthLimits = sizingData.growBeyondGrowthLimits
Tracks.isEmpty() ? sizingData.filteredTracks : sizingData.growBeyondGrowthLimits
Tracks; | 1016 auto& tracksToGrowBeyondGrowthLimits = sizingData.growBeyondGrowthLimits
Tracks.isEmpty() ? sizingData.filteredTracks : sizingData.growBeyondGrowthLimits
Tracks; |
| 1017 distributeSpaceToTracks<phase>(sizingData.filteredTracks, &tracksToGrowB
eyondGrowthLimits, sizingData, extraSpace); | 1017 distributeSpaceToTracks<phase>(sizingData.filteredTracks, &tracksToGrowB
eyondGrowthLimits, sizingData, extraSpace); |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 for (const auto& trackIndex : sizingData.contentSizedTracksIndex) { | 1020 for (const auto& trackIndex : sizingData.contentSizedTracksIndex) { |
| 1021 GridTrack& track = tracks[trackIndex]; | 1021 GridTrack& track = tracks[trackIndex]; |
| 1022 markAsInfinitelyGrowableForTrackSizeComputationPhase(phase, track); | 1022 markAsInfinitelyGrowableForTrackSizeComputationPhase(phase, track); |
| 1023 updateTrackSizeForTrackSizeComputationPhase(phase, track); | 1023 updateTrackSizeForTrackSizeComputationPhase(phase, track); |
| 1024 } | 1024 } |
| 1025 } | 1025 } |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1614 m_rowPositions[lastLine] = m_rowPositions[nextToLastLine] + sizingData.rowTr
acks[nextToLastLine].baseSize(); | 1614 m_rowPositions[lastLine] = m_rowPositions[nextToLastLine] + sizingData.rowTr
acks[nextToLastLine].baseSize(); |
| 1615 } | 1615 } |
| 1616 | 1616 |
| 1617 static LayoutUnit computeOverflowAlignmentOffset(OverflowAlignment overflow, Lay
outUnit trackBreadth, LayoutUnit childBreadth) | 1617 static LayoutUnit computeOverflowAlignmentOffset(OverflowAlignment overflow, Lay
outUnit trackBreadth, LayoutUnit childBreadth) |
| 1618 { | 1618 { |
| 1619 LayoutUnit offset = trackBreadth - childBreadth; | 1619 LayoutUnit offset = trackBreadth - childBreadth; |
| 1620 switch (overflow) { | 1620 switch (overflow) { |
| 1621 case OverflowAlignmentSafe: | 1621 case OverflowAlignmentSafe: |
| 1622 // If overflow is 'safe', we have to make sure we don't overflow the 'st
art' | 1622 // If overflow is 'safe', we have to make sure we don't overflow the 'st
art' |
| 1623 // edge (potentially cause some data loss as the overflow is unreachable
). | 1623 // edge (potentially cause some data loss as the overflow is unreachable
). |
| 1624 return std::max<LayoutUnit>(0, offset); | 1624 return offset.clampNegativeToZero(); |
| 1625 case OverflowAlignmentUnsafe: | 1625 case OverflowAlignmentUnsafe: |
| 1626 case OverflowAlignmentDefault: | 1626 case OverflowAlignmentDefault: |
| 1627 // If we overflow our alignment container and overflow is 'true' (defaul
t), we | 1627 // If we overflow our alignment container and overflow is 'true' (defaul
t), we |
| 1628 // ignore the overflow and just return the value regardless (which may c
ause data | 1628 // ignore the overflow and just return the value regardless (which may c
ause data |
| 1629 // loss as we overflow the 'start' edge). | 1629 // loss as we overflow the 'start' edge). |
| 1630 return offset; | 1630 return offset; |
| 1631 } | 1631 } |
| 1632 | 1632 |
| 1633 ASSERT_NOT_REACHED(); | 1633 ASSERT_NOT_REACHED(); |
| 1634 return 0; | 1634 return 0; |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2072 | 2072 |
| 2073 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child)); | 2073 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child)); |
| 2074 } | 2074 } |
| 2075 | 2075 |
| 2076 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) const | 2076 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) const |
| 2077 { | 2077 { |
| 2078 GridPainter(*this).paintChildren(paintInfo, paintOffset); | 2078 GridPainter(*this).paintChildren(paintInfo, paintOffset); |
| 2079 } | 2079 } |
| 2080 | 2080 |
| 2081 } // namespace blink | 2081 } // namespace blink |
| OLD | NEW |