Changeset 199657 in webkit
- Timestamp:
- Apr 18, 2016 1:20:08 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r199654 r199657 1 2016-04-18 Manuel Rego Casasnovas <rego@igalia.com> 2 3 [css-grid] Fix positioned items with content alignment 4 https://bugs.webkit.org/show_bug.cgi?id=156597 5 6 Reviewed by Darin Adler. 7 8 * fast/css-grid-layout/grid-positioned-items-content-alignment-expected.txt: Added. 9 * fast/css-grid-layout/grid-positioned-items-content-alignment-rtl-expected.txt: Added. 10 * fast/css-grid-layout/grid-positioned-items-content-alignment-rtl.html: Added. 11 * fast/css-grid-layout/grid-positioned-items-content-alignment.html: Added. 12 1 13 2016-04-18 Yusuke Suzuki <utatane.tea@gmail.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r199655 r199657 1 2016-04-18 Manuel Rego Casasnovas <rego@igalia.com> 2 3 [css-grid] Fix positioned items with content alignment 4 https://bugs.webkit.org/show_bug.cgi?id=156597 5 6 Reviewed by Darin Adler. 7 8 Like for the case of gaps we need to take into account 9 the content alignment in order to properly place and size 10 the positioned items. 11 12 Regarding content alignment we need to care about 2 values: 13 the position offset and the distribution offset. 14 The position offset can be extracted from m_column|rowPositions, 15 but the distribution offset is stored in 2 new variables called 16 m_offsetBetweenColumns|Rows. 17 18 Tests: fast/css-grid-layout/grid-positioned-items-content-alignment.html 19 fast/css-grid-layout/grid-positioned-items-content-alignment-rtl.html 20 21 * rendering/RenderGrid.cpp: 22 (WebCore::RenderGrid::offsetAndBreadthForPositionedChild): 23 (WebCore::RenderGrid::populateGridPositions): 24 (WebCore::RenderGrid::columnAxisOffsetForChild): 25 (WebCore::RenderGrid::rowAxisOffsetForChild): 26 (WebCore::RenderGrid::rowAxisPositionForChild): Deleted. 27 * rendering/RenderGrid.h: 28 1 29 2016-04-18 Manuel Rego Casasnovas <rego@igalia.com> 2 30 -
trunk/Source/WebCore/rendering/RenderGrid.cpp
r199655 r199657 1535 1535 1536 1536 // These vectors store line positions including gaps, but we shouldn't consider them for the edges of the grid. 1537 if (endLine > firstExplicitLine && endLine < lastExplicitLine) 1537 if (endLine > firstExplicitLine && endLine < lastExplicitLine) { 1538 1538 end -= guttersSize(direction, 2); 1539 } 1539 end -= isRowAxis ? m_offsetBetweenColumns : m_offsetBetweenRows; 1540 } 1541 } 1542 1543 LayoutUnit alignmentOffset = isRowAxis ? m_columnPositions[0] - borderAndPaddingStart() : m_rowPositions[0] - borderAndPaddingBefore(); 1544 if (isRowAxis && !style().isLeftToRightDirection()) 1545 alignmentOffset = contentLogicalWidth() - (m_columnPositions[m_columnPositions.size() - 1] - borderAndPaddingStart()); 1546 1547 if (!startIsAuto) 1548 start += alignmentOffset; 1549 if (!endIsAuto) 1550 end += alignmentOffset; 1540 1551 1541 1552 breadth = end - start; … … 1550 1561 offset = translateRTLCoordinate(m_columnPositions[endLine]) - borderLeft(); 1551 1562 1552 if (endLine > firstExplicitLine && endLine < lastExplicitLine) 1563 if (endLine > firstExplicitLine && endLine < lastExplicitLine) { 1553 1564 offset += guttersSize(direction, 2); 1565 offset += isRowAxis ? m_offsetBetweenColumns : m_offsetBetweenRows; 1566 } 1554 1567 } 1555 1568 } … … 1626 1639 m_columnPositions[i + 1] = m_columnPositions[i] + offset.distributionOffset + sizingData.columnTracks[i].baseSize() + trackGap; 1627 1640 m_columnPositions[lastLine] = m_columnPositions[nextToLastLine] + sizingData.columnTracks[nextToLastLine].baseSize(); 1641 m_offsetBetweenColumns = offset.distributionOffset; 1628 1642 1629 1643 numberOfTracks = sizingData.rowTracks.size(); … … 1638 1652 m_rowPositions[i + 1] = m_rowPositions[i] + offset.distributionOffset + sizingData.rowTracks[i].baseSize() + trackGap; 1639 1653 m_rowPositions[lastLine] = m_rowPositions[nextToLastLine] + sizingData.rowTracks[nextToLastLine].baseSize(); 1654 m_offsetBetweenRows = offset.distributionOffset; 1640 1655 } 1641 1656 … … 1875 1890 } 1876 1891 1877 static inline LayoutUnit offsetBetweenTracks(ContentDistributionType distribution, const Vector<LayoutUnit>& trackPositions, const LayoutUnit& childBreadth)1878 {1879 return (distribution == ContentDistributionStretch || ContentDistributionStretch == ContentDistributionDefault) ? LayoutUnit() : trackPositions[1] - trackPositions[0] - childBreadth;1880 }1881 1882 1892 LayoutUnit RenderGrid::columnAxisOffsetForChild(const RenderBox& child) const 1883 1893 { … … 1903 1913 // In order to properly adjust the Self Alignment values we need to consider the offset between tracks. 1904 1914 if (childEndLine - childStartLine > 1 && childEndLine < m_rowPositions.size() - 1) 1905 endOfRow -= offsetBetweenTracks(style().resolvedAlignContentDistribution(normalValueBehaviorGrid()), m_rowPositions, childBreadth);1915 endOfRow -= m_offsetBetweenRows; 1906 1916 LayoutUnit offsetFromStartPosition = computeOverflowAlignmentOffset(RenderStyle::resolveAlignmentOverflow(style(), child.style()), endOfRow - startOfRow, childBreadth); 1907 1917 return startPosition + (axisPosition == GridAxisEnd ? offsetFromStartPosition : offsetFromStartPosition / 2); … … 1937 1947 // In order to properly adjust the Self Alignment values we need to consider the offset between tracks. 1938 1948 if (childEndLine - childStartLine > 1 && childEndLine < m_columnPositions.size() - 1) 1939 endOfColumn -= offsetBetweenTracks(style().resolvedJustifyContentDistribution(normalValueBehaviorGrid()), m_columnPositions, childBreadth);1949 endOfColumn -= m_offsetBetweenColumns; 1940 1950 LayoutUnit offsetFromStartPosition = computeOverflowAlignmentOffset(RenderStyle::resolveJustificationOverflow(style(), child.style()), endOfColumn - startOfColumn, childBreadth); 1941 1951 return startPosition + (axisPosition == GridAxisEnd ? offsetFromStartPosition : offsetFromStartPosition / 2); -
trunk/Source/WebCore/rendering/RenderGrid.h
r199655 r199657 187 187 Vector<LayoutUnit> m_columnPositions; 188 188 Vector<LayoutUnit> m_rowPositions; 189 LayoutUnit m_offsetBetweenColumns; 190 LayoutUnit m_offsetBetweenRows; 189 191 HashMap<const RenderBox*, GridArea> m_gridItemArea; 190 192 OrderIterator m_orderIterator;
Note: See TracChangeset
for help on using the changeset viewer.