Changeset 201379 in webkit for trunk/Source/WebCore/rendering/RenderGrid.cpp
- Timestamp:
- May 25, 2016, 4:32:30 AM (10 years ago)
- File:
-
- 1 edited
-
trunk/Source/WebCore/rendering/RenderGrid.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/rendering/RenderGrid.cpp
r201325 r201379 1550 1550 void RenderGrid::layoutGridItems(GridSizingData& sizingData) 1551 1551 { 1552 populateGridPositions(sizingData); 1552 populateGridPositionsForDirection(sizingData, ForColumns); 1553 populateGridPositionsForDirection(sizingData, ForRows); 1553 1554 1554 1555 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { … … 1752 1753 } 1753 1754 1754 void RenderGrid::populateGridPositions (GridSizingData& sizingData)1755 void RenderGrid::populateGridPositionsForDirection(GridSizingData& sizingData, GridTrackSizingDirection direction) 1755 1756 { 1756 1757 // Since we add alignment offsets and track gutters, grid lines are not always adjacent. Hence we will have to … … 1761 1762 // inline-axis flow direction. However, column lines positions are 'direction' unaware. This simplification 1762 1763 // allows us to use the same indexes to identify the columns independently on the inline-axis direction. 1763 unsigned numberOfTracks = sizingData.columnTracks.size(); 1764 bool isRowAxis = direction == ForColumns; 1765 auto& tracks = isRowAxis ? sizingData.columnTracks : sizingData.rowTracks; 1766 unsigned numberOfTracks = tracks.size(); 1764 1767 unsigned numberOfLines = numberOfTracks + 1; 1765 1768 unsigned lastLine = numberOfLines - 1; 1766 1769 unsigned nextToLastLine = numberOfLines - 2; 1767 ContentAlignmentData offset = computeContentPositionAndDistributionOffset(ForColumns, sizingData.freeSpaceForDirection(ForColumns).value(), numberOfTracks); 1768 LayoutUnit trackGap = guttersSize(ForColumns, 2); 1769 m_columnPositions.resize(numberOfLines); 1770 m_columnPositions[0] = borderAndPaddingLogicalLeft() + offset.positionOffset; 1770 ContentAlignmentData offset = computeContentPositionAndDistributionOffset(direction, sizingData.freeSpaceForDirection(direction).value(), numberOfTracks); 1771 LayoutUnit trackGap = guttersSize(direction, 2); 1772 auto& positions = isRowAxis ? m_columnPositions : m_rowPositions; 1773 positions.resize(numberOfLines); 1774 auto borderAndPadding = isRowAxis ? borderAndPaddingLogicalLeft() : borderAndPaddingBefore(); 1775 positions[0] = borderAndPadding + offset.positionOffset; 1771 1776 for (unsigned i = 0; i < nextToLastLine; ++i) 1772 m_columnPositions[i + 1] = m_columnPositions[i] + offset.distributionOffset + sizingData.columnTracks[i].baseSize() + trackGap; 1773 m_columnPositions[lastLine] = m_columnPositions[nextToLastLine] + sizingData.columnTracks[nextToLastLine].baseSize(); 1774 m_offsetBetweenColumns = offset.distributionOffset; 1775 1776 numberOfTracks = sizingData.rowTracks.size(); 1777 numberOfLines = numberOfTracks + 1; 1778 lastLine = numberOfLines - 1; 1779 nextToLastLine = numberOfLines - 2; 1780 offset = computeContentPositionAndDistributionOffset(ForRows, sizingData.freeSpaceForDirection(ForRows).value(), numberOfTracks); 1781 trackGap = guttersSize(ForRows, 2); 1782 m_rowPositions.resize(numberOfLines); 1783 m_rowPositions[0] = borderAndPaddingBefore() + offset.positionOffset; 1784 for (unsigned i = 0; i < nextToLastLine; ++i) 1785 m_rowPositions[i + 1] = m_rowPositions[i] + offset.distributionOffset + sizingData.rowTracks[i].baseSize() + trackGap; 1786 m_rowPositions[lastLine] = m_rowPositions[nextToLastLine] + sizingData.rowTracks[nextToLastLine].baseSize(); 1787 m_offsetBetweenRows = offset.distributionOffset; 1777 positions[i + 1] = positions[i] + offset.distributionOffset + tracks[i].baseSize() + trackGap; 1778 positions[lastLine] = positions[nextToLastLine] + tracks[nextToLastLine].baseSize(); 1779 auto& offsetBetweenTracks = isRowAxis ? m_offsetBetweenColumns : m_offsetBetweenRows; 1780 offsetBetweenTracks = offset.distributionOffset; 1788 1781 } 1789 1782
Note:
See TracChangeset
for help on using the changeset viewer.