Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Unified Diff: third_party/WebKit/Source/core/paint/GridPainter.cpp

Issue 1873163002: [css-grid] Fix painting in RTL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Upload rebased version after r386952 has landed Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutGrid.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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]);
+ // 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) {
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutGrid.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698