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

Unified Diff: Source/core/rendering/RenderGrid.cpp

Issue 23463036: Positioning should account for the grid items' margins (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 | « LayoutTests/fast/css-grid-layout/grid-item-margin-resolution-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderGrid.cpp
diff --git a/Source/core/rendering/RenderGrid.cpp b/Source/core/rendering/RenderGrid.cpp
index 4744fa6a09d03a0eb06c0912c190b6ff700f4960..20183d4dfbcff6f4b490374b0e1ab6faa268153e 100644
--- a/Source/core/rendering/RenderGrid.cpp
+++ b/Source/core/rendering/RenderGrid.cpp
@@ -857,15 +857,11 @@ void RenderGrid::layoutGridItems()
ASSERT(tracksAreWiderThanMinTrackBreadth(ForRows, rowTracks));
for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
- LayoutPoint childPosition = findChildLogicalPosition(child, columnTracks, rowTracks);
-
// Because the grid area cannot be styled, we don't need to adjust
// the grid breadth to account for 'box-sizing'.
LayoutUnit oldOverrideContainingBlockContentLogicalWidth = child->hasOverrideContainingBlockLogicalWidth() ? child->overrideContainingBlockContentLogicalWidth() : LayoutUnit();
LayoutUnit oldOverrideContainingBlockContentLogicalHeight = child->hasOverrideContainingBlockLogicalHeight() ? child->overrideContainingBlockContentLogicalHeight() : LayoutUnit();
- // FIXME: For children in a content sized track, we clear the overrideContainingBlockContentLogicalHeight
- // in minContentForChild / maxContentForChild which means that we will always relayout the child.
LayoutUnit overrideContainingBlockContentLogicalWidth = gridAreaBreadthForChild(child, ForColumns, columnTracks);
LayoutUnit overrideContainingBlockContentLogicalHeight = gridAreaBreadthForChild(child, ForRows, rowTracks);
@@ -883,8 +879,7 @@ void RenderGrid::layoutGridItems()
// now, just size as if we were a regular child.
child->layoutIfNeeded();
- // FIXME: Handle border & padding on the grid element.
- child->setLogicalLocation(childPosition);
+ child->setLogicalLocation(findChildLogicalPosition(child, columnTracks, rowTracks));
// If the child moved, we have to repaint it as well as any floating/positioned
// descendants. An exception is if we need a layout. In this case, we know we're going to
@@ -1128,14 +1123,13 @@ LayoutPoint RenderGrid::findChildLogicalPosition(RenderBox* child, const Vector<
const GridCoordinate& coordinate = cachedGridCoordinate(child);
// The grid items should be inside the grid container's border box, that's why they need to be shifted.
- LayoutPoint offset(borderAndPaddingStart(), borderAndPaddingBefore());
+ LayoutPoint offset(borderAndPaddingStart() + marginStartForChild(child), borderAndPaddingBefore() + marginBeforeForChild(child));
// FIXME: |columnTrack| and |rowTrack| should be smaller than our column / row count.
for (size_t i = 0; i < coordinate.columns.initialPositionIndex && i < columnTracks.size(); ++i)
offset.setX(offset.x() + columnTracks[i].m_usedBreadth);
for (size_t i = 0; i < coordinate.rows.initialPositionIndex && i < rowTracks.size(); ++i)
offset.setY(offset.y() + rowTracks[i].m_usedBreadth);
- // FIXME: Handle margins on the grid item.
return offset;
}
« no previous file with comments | « LayoutTests/fast/css-grid-layout/grid-item-margin-resolution-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698