Chromium Code Reviews| Index: Source/core/rendering/RenderGrid.cpp |
| diff --git a/Source/core/rendering/RenderGrid.cpp b/Source/core/rendering/RenderGrid.cpp |
| index f58fb1c46d4fdbebf7c5c97d0b7f853f663a2288..9d8c2be583bb75382e28a4cf63de4ac629d017bf 100644 |
| --- a/Source/core/rendering/RenderGrid.cpp |
| +++ b/Source/core/rendering/RenderGrid.cpp |
| @@ -1118,28 +1118,44 @@ LayoutUnit RenderGrid::centeredColumnPositionForChild(const RenderBox* child) co |
| return columnPosition + std::max<LayoutUnit>(0, endOfColumn - startOfColumn - child->logicalWidth()) / 2; |
| } |
| +static ItemPosition resolveJustification(const RenderStyle* parentStyle, const RenderStyle* childStyle) |
| +{ |
| + ItemPosition justify = childStyle->justifySelf(); |
| + if (justify == ItemPositionAuto) |
| + justify = (parentStyle->justifyItems() == ItemPositionAuto) ? ItemPositionStretch : parentStyle->justifyItems(); |
| + |
| + return justify; |
| +} |
| + |
| LayoutUnit RenderGrid::columnPositionForChild(const RenderBox* child) const |
| { |
| - ItemPosition childJustifySelf = child->style()->justifySelf(); |
| - switch (childJustifySelf) { |
| + bool hasOrthogonalWritingMode = child->isHorizontalWritingMode() != isHorizontalWritingMode(); |
| + ItemPosition justifySelf = resolveJustification(style(), child->style()); |
| + |
| + switch (justifySelf) { |
|
Julien - ping for review
2014/08/22 21:22:14
Unneeded variable:
switch(resolveJustification(st
jfernandez
2014/08/26 11:23:13
Done.
|
| case ItemPositionSelfStart: |
| + // If orthogonal writing-modes, this computes to 'Start'. |
|
Julien - ping for review
2014/08/22 21:22:14
'start' (lowercase s) to match the specification.
jfernandez
2014/08/26 11:23:13
Done.
|
| + // FIXME: grid track sizing and positioning does not support orthogonal modes yet. |
|
Julien - ping for review
2014/08/22 21:22:14
grid track sizing and position *do* not support (i
jfernandez
2014/08/26 11:23:13
Done.
|
| + if (hasOrthogonalWritingMode) |
| + return columnPositionAlignedWithGridContainerStart(child); |
| + |
| // self-start is based on the child's direction. That's why we need to check against the grid container's direction. |
| if (child->style()->direction() != style()->direction()) |
| return columnPositionAlignedWithGridContainerEnd(child); |
| return columnPositionAlignedWithGridContainerStart(child); |
| case ItemPositionSelfEnd: |
| + // If orthogonal writing-modes, this computes to 'Start'. |
| + // FIXME: grid track sizing and positioning does not support orthogonal modes yet. |
|
Julien - ping for review
2014/08/22 21:22:14
Same comments.
jfernandez
2014/08/26 11:23:13
Done.
|
| + if (hasOrthogonalWritingMode) |
| + return columnPositionAlignedWithGridContainerEnd(child); |
| + |
| // self-end is based on the child's direction. That's why we need to check against the grid container's direction. |
| if (child->style()->direction() != style()->direction()) |
| return columnPositionAlignedWithGridContainerStart(child); |
| return columnPositionAlignedWithGridContainerEnd(child); |
| - case ItemPositionFlexStart: |
| - case ItemPositionFlexEnd: |
| - // Only used in flex layout, for other layout, it's equivalent to 'start'. |
| - return columnPositionAlignedWithGridContainerStart(child); |
|
Julien - ping for review
2014/08/22 21:22:14
Unneeded change. We can agree / disagree over whic
jfernandez
2014/08/26 11:23:13
Acknowledged.
|
| - |
| case ItemPositionLeft: |
| // If the property's axis is not parallel with the inline axis, this is equivalent to ‘start’. |
| if (!isHorizontalWritingMode()) |
| @@ -1161,12 +1177,17 @@ LayoutUnit RenderGrid::columnPositionForChild(const RenderBox* child) const |
| case ItemPositionCenter: |
| return centeredColumnPositionForChild(child); |
| + // Only used in flex layout, for other layout, it's equivalent to 'start'. |
| + case ItemPositionFlexStart: |
| case ItemPositionStart: |
| return columnPositionAlignedWithGridContainerStart(child); |
| + // Only used in flex layout, for other layout, it's equivalent to 'start'. |
| + case ItemPositionFlexEnd: |
| case ItemPositionEnd: |
| return columnPositionAlignedWithGridContainerEnd(child); |
| case ItemPositionAuto: |
| + break; |
|
Julien - ping for review
2014/08/22 21:22:14
ASSERT_NOT_REACHED();
jfernandez
2014/08/26 11:23:13
There is such ASSERT at the end of the function, w
|
| case ItemPositionStretch: |
| case ItemPositionBaseline: |
| case ItemPositionLastBaseline: |