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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutGrid.cpp

Issue 2353513003: [css-grid] Use grid area position to determine overflowing items (Closed)
Patch Set: Patch Created 4 years, 3 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.h ('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/layout/LayoutGrid.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
index ec13d1934a0da3df498bbfaa44792491e7bfb277..5214d40b955dbb3aa9f9469ad5c6e99f9f707fbc 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -1922,8 +1922,8 @@ void LayoutGrid::layoutGridItems(GridSizingData& sizingData)
updateAutoMarginsInColumnAxisIfNeeded(*child);
updateAutoMarginsInRowAxisIfNeeded(*child);
-#if ENABLE(ASSERT)
const GridArea& area = cachedGridArea(*child);
+#if ENABLE(ASSERT)
ASSERT(area.columns.startLine() < sizingData.columnTracks.size());
ASSERT(area.rows.startLine() < sizingData.rowTracks.size());
#endif
@@ -1931,10 +1931,10 @@ void LayoutGrid::layoutGridItems(GridSizingData& sizingData)
// Keep track of children overflowing their grid area as we might need to paint them even if the grid-area is not visible.
// Using physical dimensions for simplicity, so we can forget about orthogonalty.
- // TODO (lajava): Child's margins should account when evaluating whether it overflows its grid area (http://crbug.com/628155).
LayoutUnit childGridAreaHeight = isHorizontalWritingMode() ? overrideContainingBlockContentLogicalHeight : overrideContainingBlockContentLogicalWidth;
LayoutUnit childGridAreaWidth = isHorizontalWritingMode() ? overrideContainingBlockContentLogicalWidth : overrideContainingBlockContentLogicalHeight;
- if (child->size().height() > childGridAreaHeight || child->size().width() > childGridAreaWidth)
+ LayoutRect gridAreaRect(gridAreaLogicalPosition(area), LayoutSize(childGridAreaWidth, childGridAreaHeight));
+ if (!gridAreaRect.contains(child->frameRect()))
m_gridItemsOverflowingGridArea.append(child);
}
}
@@ -2661,6 +2661,16 @@ LayoutPoint LayoutGrid::findChildLogicalPosition(const LayoutBox& child, GridSiz
return isOrthogonalChild(child) ? childLocation.transposedPoint() : childLocation;
}
+LayoutPoint LayoutGrid::gridAreaLogicalPosition(const GridArea& area) const
+{
+ LayoutUnit columnAxisOffset = m_rowPositions[area.rows.startLine()];
+ LayoutUnit rowAxisOffset = m_columnPositions[area.columns.startLine()];
+
+ // See comment in findChildLogicalPosition() about why we need sometimes to translate from RTL
+ // to LTR the rowAxisOffset coordinate.
+ return LayoutPoint(style()->isLeftToRightDirection() ? rowAxisOffset : translateRTLCoordinate(rowAxisOffset), columnAxisOffset);
+}
+
void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) const
{
if (!m_gridItemArea.isEmpty())
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutGrid.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698