Changeset 200427 in webkit
- Timestamp:
- May 4, 2016 1:32:06 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r200423 r200427 1 2016-05-04 Manuel Rego Casasnovas <rego@igalia.com> 2 3 [css-grid] Refactor information stored related to column positions 4 https://bugs.webkit.org/show_bug.cgi?id=157342 5 6 Reviewed by Darin Adler. 7 8 In m_columnPositions we were storing position of each column 9 including the alignment offset, always from the logical left, 10 and the border and padding, depending on the direction. 11 12 This was really confusing as in the case of RTL direction 13 we were adding the offset from the left and 14 the right border and padding. 15 16 This patches changes it to store always the info from the left, 17 so even in RTL direction we use the left border and padding. 18 19 This allows us to simplify translateRTLCoordinate() as 20 it doesn't need to care about border and padding anymore. 21 And also to refactor offsetAndBreadthForPositionedChild() 22 which became really complex after adding RTL support. 23 24 No new tests, no change of behavior. 25 26 * rendering/RenderGrid.cpp: 27 (WebCore::RenderGrid::offsetAndBreadthForPositionedChild): 28 (WebCore::RenderGrid::populateGridPositions): 29 (WebCore::RenderGrid::translateRTLCoordinate): 30 1 31 2016-05-04 Mark Lam <mark.lam@apple.com> 2 32 -
trunk/Source/WebCore/rendering/RenderGrid.cpp
r200368 r200427 1561 1561 LayoutUnit start; 1562 1562 if (!startIsAuto) { 1563 if (isRowAxis) 1564 start = m_columnPositions[startLine] - m_columnPositions[0] + paddingStart(); 1565 else 1566 start = m_rowPositions[startLine] - m_rowPositions[0] + paddingBefore(); 1563 if (isRowAxis) { 1564 if (style().isLeftToRightDirection()) 1565 start = m_columnPositions[startLine] - borderLogicalLeft(); 1566 else 1567 start = logicalWidth() - translateRTLCoordinate(m_columnPositions[startLine]) - borderLogicalRight(); 1568 } else 1569 start = m_rowPositions[startLine] - borderBefore(); 1567 1570 } 1568 1571 1569 1572 LayoutUnit end = isRowAxis ? clientLogicalWidth() : clientLogicalHeight(); 1570 1573 if (!endIsAuto) { 1571 if (isRowAxis) 1572 end = m_columnPositions[endLine] - m_columnPositions[0] + paddingStart(); 1573 else 1574 end = m_rowPositions[endLine] - m_rowPositions[0] + paddingBefore(); 1574 if (isRowAxis) { 1575 if (style().isLeftToRightDirection()) 1576 end = m_columnPositions[endLine] - borderLogicalLeft(); 1577 else 1578 end = logicalWidth() - translateRTLCoordinate(m_columnPositions[endLine]) - borderLogicalRight(); 1579 } else 1580 end = m_rowPositions[endLine] - borderBefore(); 1575 1581 1576 1582 // These vectors store line positions including gaps, but we shouldn't consider them for the edges of the grid. … … 1580 1586 } 1581 1587 } 1582 1583 LayoutUnit alignmentOffset = isRowAxis ? m_columnPositions[0] - borderAndPaddingStart() : m_rowPositions[0] - borderAndPaddingBefore();1584 if (isRowAxis && !style().isLeftToRightDirection())1585 alignmentOffset = contentLogicalWidth() - (m_columnPositions[m_columnPositions.size() - 1] - borderAndPaddingStart());1586 1587 if (!startIsAuto)1588 start += alignmentOffset;1589 if (!endIsAuto)1590 end += alignmentOffset;1591 1588 1592 1589 breadth = end - start; … … 1673 1670 LayoutUnit trackGap = guttersSize(ForColumns, 2); 1674 1671 m_columnPositions.resize(numberOfLines); 1675 m_columnPositions[0] = borderAndPadding Start() + offset.positionOffset;1672 m_columnPositions[0] = borderAndPaddingLogicalLeft() + offset.positionOffset; 1676 1673 for (unsigned i = 0; i < nextToLastLine; ++i) 1677 1674 m_columnPositions[i + 1] = m_columnPositions[i] + offset.distributionOffset + sizingData.columnTracks[i].baseSize() + trackGap; … … 2099 2096 ASSERT(!style().isLeftToRightDirection()); 2100 2097 2101 LayoutUnit alignmentOffset = m_columnPositions[0] - borderAndPaddingStart();2098 LayoutUnit alignmentOffset = m_columnPositions[0]; 2102 2099 LayoutUnit rightGridEdgePosition = m_columnPositions[m_columnPositions.size() - 1]; 2103 return borderAndPaddingLogicalLeft() +rightGridEdgePosition + alignmentOffset - coordinate;2100 return rightGridEdgePosition + alignmentOffset - coordinate; 2104 2101 } 2105 2102
Note: See TracChangeset
for help on using the changeset viewer.