Chromium Code Reviews| Index: third_party/WebKit/Source/core/paint/GridPainter.cpp |
| diff --git a/third_party/WebKit/Source/core/paint/GridPainter.cpp b/third_party/WebKit/Source/core/paint/GridPainter.cpp |
| index 299e603a4b8777827661fa081b084b95af6cc753..61e1098ca9f37a7cb3f234c7416e18b8ea409e8e 100644 |
| --- a/third_party/WebKit/Source/core/paint/GridPainter.cpp |
| +++ b/third_party/WebKit/Source/core/paint/GridPainter.cpp |
| @@ -46,9 +46,24 @@ void GridPainter::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& p |
| LayoutRect localPaintInvalidationRect = LayoutRect(paintInfo.cullRect().m_rect); |
| localPaintInvalidationRect.moveBy(-paintOffset); |
| - GridSpan dirtiedColumns = dirtiedGridAreas(m_layoutGrid.columnPositions(), localPaintInvalidationRect.x(), localPaintInvalidationRect.maxX()); |
| + Vector<LayoutUnit> columnPositions = m_layoutGrid.columnPositions(); |
| + if (!m_layoutGrid.styleRef().isLeftToRightDirection()) { |
| + // Translate columnPositions in RTL as we need the physical coordinates of the columns in order to call dirtiedGridAreas(). |
| + for (size_t i = 0; i < columnPositions.size(); i++) |
| + columnPositions[i] = m_layoutGrid.translateRTLCoordinate(columnPositions[i]); |
|
cbiesinger
2016/04/12 20:07:51
Why not make this translation inside of dirtiedGri
Manuel Rego
2016/04/13 08:42:55
Because we only need to do it for columns, not for
|
| + // We change the order of tracks in columnPositions, as in RTL the leftmost track will be the last one. |
| + std::sort(columnPositions.begin(), columnPositions.end()); |
| + } |
| + |
| + GridSpan dirtiedColumns = dirtiedGridAreas(columnPositions, localPaintInvalidationRect.x(), localPaintInvalidationRect.maxX()); |
| GridSpan dirtiedRows = dirtiedGridAreas(m_layoutGrid.rowPositions(), localPaintInvalidationRect.y(), localPaintInvalidationRect.maxY()); |
| + if (!m_layoutGrid.styleRef().isLeftToRightDirection()) { |
| + // As we changed the order of tracks previously, we need to swap the dirtied columns in RTL. |
| + size_t lastLine = columnPositions.size() - 1; |
| + dirtiedColumns = GridSpan::translatedDefiniteGridSpan(lastLine - dirtiedColumns.endLine(), lastLine - dirtiedColumns.startLine()); |
| + } |
| + |
| Vector<std::pair<LayoutBox*, size_t>> gridItemsToBePainted; |
| for (const auto& row : dirtiedRows) { |