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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutGrid.cpp

Issue 1929483002: [css-grid] Fix static position for positioned grid items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-sizing-positioned-items.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 LayoutUnit columnBreadth = LayoutUnit(); 1547 LayoutUnit columnBreadth = LayoutUnit();
1548 offsetAndBreadthForPositionedChild(*child, ForColumns, columnOffset, col umnBreadth); 1548 offsetAndBreadthForPositionedChild(*child, ForColumns, columnOffset, col umnBreadth);
1549 LayoutUnit rowOffset = LayoutUnit(); 1549 LayoutUnit rowOffset = LayoutUnit();
1550 LayoutUnit rowBreadth = LayoutUnit(); 1550 LayoutUnit rowBreadth = LayoutUnit();
1551 offsetAndBreadthForPositionedChild(*child, ForRows, rowOffset, rowBreadt h); 1551 offsetAndBreadthForPositionedChild(*child, ForRows, rowOffset, rowBreadt h);
1552 1552
1553 child->setOverrideContainingBlockContentLogicalWidth(columnBreadth); 1553 child->setOverrideContainingBlockContentLogicalWidth(columnBreadth);
1554 child->setOverrideContainingBlockContentLogicalHeight(rowBreadth); 1554 child->setOverrideContainingBlockContentLogicalHeight(rowBreadth);
1555 child->setExtraInlineOffset(columnOffset); 1555 child->setExtraInlineOffset(columnOffset);
1556 child->setExtraBlockOffset(rowOffset); 1556 child->setExtraBlockOffset(rowOffset);
1557
1558 if (child->parent() == this) {
1559 PaintLayer* childLayer = child->layer();
1560 childLayer->setStaticInlinePosition(borderStart() + columnOffset);
1561 childLayer->setStaticBlockPosition(borderBefore() + rowOffset);
1562 }
1557 } 1563 }
1558 1564
1559 LayoutBlock::layoutPositionedObjects(relayoutChildren, info); 1565 LayoutBlock::layoutPositionedObjects(relayoutChildren, info);
1560 } 1566 }
1561 1567
1562 void LayoutGrid::offsetAndBreadthForPositionedChild(const LayoutBox& child, Grid TrackSizingDirection direction, LayoutUnit& offset, LayoutUnit& breadth) 1568 void LayoutGrid::offsetAndBreadthForPositionedChild(const LayoutBox& child, Grid TrackSizingDirection direction, LayoutUnit& offset, LayoutUnit& breadth)
1563 { 1569 {
1564 ASSERT(!isOrthogonalChild(child)); 1570 ASSERT(!isOrthogonalChild(child));
1565 bool isForColumns = direction == ForColumns; 1571 bool isForColumns = direction == ForColumns;
1566 1572
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1634 } else { 1640 } else {
1635 offset = translateRTLCoordinate(m_columnPositions[endLine]) - border LogicalLeft(); 1641 offset = translateRTLCoordinate(m_columnPositions[endLine]) - border LogicalLeft();
1636 1642
1637 if (endLine > firstExplicitLine && endLine < lastExplicitLine) { 1643 if (endLine > firstExplicitLine && endLine < lastExplicitLine) {
1638 offset += guttersSize(direction, 2); 1644 offset += guttersSize(direction, 2);
1639 offset += isForColumns ? m_offsetBetweenColumns : m_offsetBetwee nRows; 1645 offset += isForColumns ? m_offsetBetweenColumns : m_offsetBetwee nRows;
1640 } 1646 }
1641 } 1647 }
1642 } 1648 }
1643 1649
1644 if (child.parent() == this && !startIsAuto) {
1645 // If column/row start is "auto" the static position has been already se t in prepareChildForPositionedLayout().
1646 PaintLayer* childLayer = child.layer();
1647 if (isForColumns)
1648 childLayer->setStaticInlinePosition(borderStart() + offset);
1649 else
1650 childLayer->setStaticBlockPosition(borderBefore() + offset);
1651 }
1652 } 1650 }
1653 1651
1654 GridArea LayoutGrid::cachedGridArea(const LayoutBox& gridItem) const 1652 GridArea LayoutGrid::cachedGridArea(const LayoutBox& gridItem) const
1655 { 1653 {
1656 ASSERT(m_gridItemArea.contains(&gridItem)); 1654 ASSERT(m_gridItemArea.contains(&gridItem));
1657 return m_gridItemArea.get(&gridItem); 1655 return m_gridItemArea.get(&gridItem);
1658 } 1656 }
1659 1657
1660 GridSpan LayoutGrid::cachedGridSpan(const LayoutBox& gridItem, GridTrackSizingDi rection direction) const 1658 GridSpan LayoutGrid::cachedGridSpan(const LayoutBox& gridItem, GridTrackSizingDi rection direction) const
1661 { 1659 {
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
2140 2138
2141 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child, sizingData )); 2139 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child, sizingData ));
2142 } 2140 }
2143 2141
2144 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const 2142 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const
2145 { 2143 {
2146 GridPainter(*this).paintChildren(paintInfo, paintOffset); 2144 GridPainter(*this).paintChildren(paintInfo, paintOffset);
2147 } 2145 }
2148 2146
2149 } // namespace blink 2147 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-sizing-positioned-items.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698