OLD | NEW |
---|---|
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 , distributionOffset(distribution) | 135 , distributionOffset(distribution) |
136 { | 136 { |
137 } | 137 } |
138 | 138 |
139 bool isValid() { return positionOffset >= 0 && distributionOffset >= 0; } | 139 bool isValid() { return positionOffset >= 0 && distributionOffset >= 0; } |
140 | 140 |
141 LayoutUnit positionOffset = -1; | 141 LayoutUnit positionOffset = -1; |
142 LayoutUnit distributionOffset = -1; | 142 LayoutUnit distributionOffset = -1; |
143 }; | 143 }; |
144 | 144 |
145 class BaselineGroup { | |
cbiesinger
2015/10/26 22:07:16
For this class and BaselineContext, can you add a
jfernandez
2015/10/27 09:47:56
Done.
| |
146 public: | |
147 BaselineGroup(LayoutBox* child, LayoutUnit childAscent, ItemPosition prefere nce) | |
148 { | |
149 ASSERT(preference == ItemPositionBaseline || preference == ItemPositionL astBaseline); | |
150 add(child, childAscent); | |
151 groupPreference = preference; | |
152 groupWritingMode = child->styleRef().writingMode(); | |
153 } | |
154 | |
155 static bool oppositeBlockDirection(WritingMode childBlockDirection, WritingM ode groupBlockDirection) | |
156 { | |
157 return (childBlockDirection == TopToBottomWritingMode && groupBlockDirec tion == BottomToTopWritingMode) | |
158 || (childBlockDirection == BottomToTopWritingMode && groupBlockDirec tion == TopToBottomWritingMode) | |
159 || (childBlockDirection == LeftToRightWritingMode && groupBlockDirec tion == RightToLeftWritingMode) | |
160 || (childBlockDirection == RightToLeftWritingMode && groupBlockDirec tion == LeftToRightWritingMode); | |
161 } | |
162 | |
163 bool isCompatibleChild(LayoutBox* child, ItemPosition preference) | |
164 { | |
165 return (child->styleRef().writingMode() == groupWritingMode && preferenc e == groupPreference) | |
166 || (oppositeBlockDirection(child->styleRef().writingMode(), groupWri tingMode) && preference != groupPreference); | |
cbiesinger
2015/10/26 22:07:16
I don't think I fully understand what this is nece
jfernandez
2015/10/27 09:47:56
The CSS Box Alignment spec defines when a group of
cbiesinger
2015/10/27 21:52:30
Oh, thanks for the explanation. I should have chec
| |
167 } | |
168 | |
169 void add(LayoutBox* child, LayoutUnit childAscent) | |
170 { | |
171 ASSERT(child); | |
172 children.append(child); | |
173 groupMaxAscent = std::max(groupMaxAscent, childAscent); | |
174 } | |
175 | |
176 Vector<LayoutBox*> children; | |
cbiesinger
2015/10/26 22:07:17
Why not the m_children style for member variables?
jfernandez
2015/10/27 09:47:56
Acknowledged.
| |
177 ItemPosition groupPreference; | |
178 WritingMode groupWritingMode; | |
179 LayoutUnit groupMaxAscent; | |
180 }; | |
181 | |
182 class BaselineContext { | |
183 public: | |
184 BaselineContext() { } | |
185 | |
186 BaselineContext(LayoutBox* child, LayoutUnit maxAscent, ItemPosition prefere nce) | |
187 { | |
188 sharedGroups.append(BaselineGroup(child, maxAscent, preference)); | |
189 } | |
190 | |
191 void addGroupMember(LayoutBox* child, LayoutUnit childAscent, ItemPosition p reference) | |
192 { | |
193 bool compatibleGroupFound = false; | |
194 for (auto& group : sharedGroups) { | |
195 if ((compatibleGroupFound = group.isCompatibleChild(child, preferenc e))) { | |
196 group.add(child, childAscent); | |
197 break; | |
198 } | |
199 } | |
200 if (!compatibleGroupFound) | |
201 sharedGroups.append(BaselineGroup(child, childAscent, preference)); | |
202 } | |
203 | |
204 Vector<BaselineGroup> sharedGroups; | |
205 }; | |
206 | |
145 enum TrackSizeRestriction { | 207 enum TrackSizeRestriction { |
146 AllowInfinity, | 208 AllowInfinity, |
147 ForbidInfinity, | 209 ForbidInfinity, |
148 }; | 210 }; |
149 | 211 |
150 class LayoutGrid::GridIterator { | 212 class LayoutGrid::GridIterator { |
151 WTF_MAKE_NONCOPYABLE(GridIterator); | 213 WTF_MAKE_NONCOPYABLE(GridIterator); |
152 public: | 214 public: |
153 // |direction| is the direction that is fixed to |fixedTrackIndex| so e.g | 215 // |direction| is the direction that is fixed to |fixedTrackIndex| so e.g |
154 // GridIterator(m_grid, ForColumns, 1) will walk over the rows of the 2nd co lumn. | 216 // GridIterator(m_grid, ForColumns, 1) will walk over the rows of the 2nd co lumn. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 } | 281 } |
220 | 282 |
221 private: | 283 private: |
222 const GridRepresentation& m_grid; | 284 const GridRepresentation& m_grid; |
223 GridTrackSizingDirection m_direction; | 285 GridTrackSizingDirection m_direction; |
224 size_t m_rowIndex; | 286 size_t m_rowIndex; |
225 size_t m_columnIndex; | 287 size_t m_columnIndex; |
226 size_t m_childIndex; | 288 size_t m_childIndex; |
227 }; | 289 }; |
228 | 290 |
291 typedef HashMap<unsigned, BaselineContext, DefaultHash<unsigned>::Hash, WTF::Uns ignedWithZeroKeyHashTraits<unsigned>> BaselineContextsMap; | |
292 | |
229 struct LayoutGrid::GridSizingData { | 293 struct LayoutGrid::GridSizingData { |
230 WTF_MAKE_NONCOPYABLE(GridSizingData); | 294 WTF_MAKE_NONCOPYABLE(GridSizingData); |
231 STACK_ALLOCATED(); | 295 STACK_ALLOCATED(); |
232 public: | 296 public: |
233 GridSizingData(size_t gridColumnCount, size_t gridRowCount) | 297 GridSizingData(size_t gridColumnCount, size_t gridRowCount) |
234 : columnTracks(gridColumnCount) | 298 : columnTracks(gridColumnCount) |
235 , rowTracks(gridRowCount) | 299 , rowTracks(gridRowCount) |
236 { | 300 { |
237 } | 301 } |
238 | 302 |
239 Vector<GridTrack> columnTracks; | 303 Vector<GridTrack> columnTracks; |
240 Vector<GridTrack> rowTracks; | 304 Vector<GridTrack> rowTracks; |
241 Vector<size_t> contentSizedTracksIndex; | 305 Vector<size_t> contentSizedTracksIndex; |
242 | 306 |
307 BaselineContextsMap rowAxisAlignmentContext; | |
308 | |
243 // Performance optimization: hold onto these Vectors until the end of Layout to avoid repeated malloc / free. | 309 // Performance optimization: hold onto these Vectors until the end of Layout to avoid repeated malloc / free. |
244 Vector<GridTrack*> filteredTracks; | 310 Vector<GridTrack*> filteredTracks; |
245 Vector<GridItemWithSpan> itemsSortedByIncreasingSpan; | 311 Vector<GridItemWithSpan> itemsSortedByIncreasingSpan; |
246 Vector<GridTrack*> growBeyondGrowthLimitsTracks; | 312 Vector<GridTrack*> growBeyondGrowthLimitsTracks; |
247 }; | 313 }; |
248 | 314 |
249 struct GridItemsSpanGroupRange { | 315 struct GridItemsSpanGroupRange { |
250 Vector<GridItemWithSpan>::iterator rangeStart; | 316 Vector<GridItemWithSpan>::iterator rangeStart; |
251 Vector<GridItemWithSpan>::iterator rangeEnd; | 317 Vector<GridItemWithSpan>::iterator rangeEnd; |
252 }; | 318 }; |
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1327 child->setOverrideContainingBlockContentLogicalWidth(overrideContainingB lockContentLogicalWidth); | 1393 child->setOverrideContainingBlockContentLogicalWidth(overrideContainingB lockContentLogicalWidth); |
1328 child->setOverrideContainingBlockContentLogicalHeight(overrideContaining BlockContentLogicalHeight); | 1394 child->setOverrideContainingBlockContentLogicalHeight(overrideContaining BlockContentLogicalHeight); |
1329 | 1395 |
1330 // Stretching logic might force a child layout, so we need to run it bef ore the layoutIfNeeded | 1396 // Stretching logic might force a child layout, so we need to run it bef ore the layoutIfNeeded |
1331 // call to avoid unnecessary relayouts. This might imply that child marg ins, needed to correctly | 1397 // call to avoid unnecessary relayouts. This might imply that child marg ins, needed to correctly |
1332 // determine the available space before stretching, are not set yet. | 1398 // determine the available space before stretching, are not set yet. |
1333 applyStretchAlignmentToChildIfNeeded(*child); | 1399 applyStretchAlignmentToChildIfNeeded(*child); |
1334 | 1400 |
1335 child->layoutIfNeeded(); | 1401 child->layoutIfNeeded(); |
1336 | 1402 |
1403 updateBaselineAlignmentContextInRowAxisIfNeeded(child, sizingData); | |
1404 | |
1337 // We need pending layouts to be done in order to compute auto-margins p roperly. | 1405 // We need pending layouts to be done in order to compute auto-margins p roperly. |
1338 updateAutoMarginsInColumnAxisIfNeeded(*child); | 1406 updateAutoMarginsInColumnAxisIfNeeded(*child); |
1339 updateAutoMarginsInRowAxisIfNeeded(*child); | 1407 updateAutoMarginsInRowAxisIfNeeded(*child); |
1340 | 1408 |
1341 #if ENABLE(ASSERT) | 1409 #if ENABLE(ASSERT) |
1342 const GridCoordinate& coordinate = cachedGridCoordinate(*child); | 1410 const GridCoordinate& coordinate = cachedGridCoordinate(*child); |
1343 ASSERT(coordinate.columns.resolvedInitialPosition.toInt() < sizingData.c olumnTracks.size()); | 1411 ASSERT(coordinate.columns.resolvedInitialPosition.toInt() < sizingData.c olumnTracks.size()); |
1344 ASSERT(coordinate.rows.resolvedInitialPosition.toInt() < sizingData.rowT racks.size()); | 1412 ASSERT(coordinate.rows.resolvedInitialPosition.toInt() < sizingData.rowT racks.size()); |
1345 #endif | 1413 #endif |
1346 child->setLogicalLocation(findChildLogicalPosition(*child, sizingData)); | 1414 child->setLogicalLocation(findChildLogicalPosition(*child, sizingData)); |
1347 | 1415 |
1348 // Keep track of children overflowing their grid area as we might need t o paint them even if the grid-area is | 1416 // Keep track of children overflowing their grid area as we might need t o paint them even if the grid-area is |
1349 // not visible | 1417 // not visible |
1350 if (child->logicalHeight() > overrideContainingBlockContentLogicalHeight | 1418 if (child->logicalHeight() > overrideContainingBlockContentLogicalHeight |
1351 || child->logicalWidth() > overrideContainingBlockContentLogicalWidt h) | 1419 || child->logicalWidth() > overrideContainingBlockContentLogicalWidt h) |
1352 m_gridItemsOverflowingGridArea.append(child); | 1420 m_gridItemsOverflowingGridArea.append(child); |
1353 } | 1421 } |
1354 | 1422 |
1423 applyBaselineAlignmentIfNeeded(sizingData); | |
1424 | |
1355 for (const auto& row : sizingData.rowTracks) | 1425 for (const auto& row : sizingData.rowTracks) |
1356 setLogicalHeight(logicalHeight() + row.baseSize()); | 1426 setLogicalHeight(logicalHeight() + row.baseSize()); |
1357 | 1427 |
1358 LayoutUnit height = logicalHeight() + borderAndPaddingLogicalHeight() + scro llbarLogicalHeight(); | 1428 LayoutUnit height = logicalHeight() + borderAndPaddingLogicalHeight() + scro llbarLogicalHeight(); |
1359 if (hasLineIfEmpty()) | 1429 if (hasLineIfEmpty()) |
1360 height = std::max(height, minimumLogicalHeightForEmptyLine()); | 1430 height = std::max(height, minimumLogicalHeightForEmptyLine()); |
1361 | 1431 |
1362 // Min / max logical height is handled by the call to updateLogicalHeight in layoutBlock. | 1432 // Min / max logical height is handled by the call to updateLogicalHeight in layoutBlock. |
1363 setLogicalHeight(height); | 1433 setLogicalHeight(height); |
1364 } | 1434 } |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1702 if (marginBefore.isAuto() && marginAfter.isAuto()) { | 1772 if (marginBefore.isAuto() && marginAfter.isAuto()) { |
1703 child.setMarginBefore(availableAlignmentSpace / 2, style()); | 1773 child.setMarginBefore(availableAlignmentSpace / 2, style()); |
1704 child.setMarginAfter(availableAlignmentSpace / 2, style()); | 1774 child.setMarginAfter(availableAlignmentSpace / 2, style()); |
1705 } else if (marginBefore.isAuto()) { | 1775 } else if (marginBefore.isAuto()) { |
1706 child.setMarginBefore(availableAlignmentSpace, style()); | 1776 child.setMarginBefore(availableAlignmentSpace, style()); |
1707 } else if (marginAfter.isAuto()) { | 1777 } else if (marginAfter.isAuto()) { |
1708 child.setMarginAfter(availableAlignmentSpace, style()); | 1778 child.setMarginAfter(availableAlignmentSpace, style()); |
1709 } | 1779 } |
1710 } | 1780 } |
1711 | 1781 |
1782 void LayoutGrid::updateBaselineAlignmentContextInRowAxisIfNeeded(LayoutBox* chil d, GridSizingData& sizingData) const | |
1783 { | |
1784 ItemPosition align = ComputedStyle::resolveAlignment(styleRef(), child->styl eRef(), ItemPositionStretch); | |
1785 if ((align != ItemPositionBaseline && align != ItemPositionLastBaseline) || hasAutoMarginsInColumnAxis(*child)) | |
1786 return; | |
1787 | |
1788 const GridCoordinate& coordinate = cachedGridCoordinate(*child); | |
1789 unsigned lineNumber = coordinate.rows.resolvedInitialPosition.toInt(); | |
1790 LayoutUnit ascent = marginBoxAscentFromBaselineForChild(*child); | |
1791 bool contextExists = sizingData.rowAxisAlignmentContext.contains(lineNumber) ; | |
1792 BaselineContext context = contextExists ? sizingData.rowAxisAlignmentContext .get(lineNumber) : BaselineContext(child, ascent, align); | |
1793 if (contextExists) | |
1794 context.addGroupMember(child, ascent, align); | |
1795 sizingData.rowAxisAlignmentContext.set(lineNumber, context); | |
1796 } | |
1797 | |
1798 // FIXME: This logic is shared by LayoutFlexibleBox, so it should be moved to La youtBox. | |
1799 LayoutUnit LayoutGrid::marginBoxAscentFromBaselineForChild(const LayoutBox& chil d) const | |
1800 { | |
1801 LayoutUnit baseline = child.firstLineBoxBaseline(); | |
1802 // We take content-box's bottom if no valid baseline. | |
1803 if (baseline == -1) | |
1804 baseline = LayoutBlock::logicalHeightForChild(child); | |
1805 return baseline + marginBeforeForChild(child); | |
1806 } | |
1807 | |
1808 void LayoutGrid::applyBaselineAlignmentIfNeeded(const GridSizingData& sizingData ) | |
1809 { | |
1810 for (auto& contexts : sizingData.rowAxisAlignmentContext.values()) { | |
1811 for (auto& group : contexts.sharedGroups) { | |
1812 for (LayoutBox* child : group.children) { | |
1813 ItemPosition align = ComputedStyle::resolveAlignment(styleRef(), child->styleRef(), ItemPositionStretch); | |
1814 // TODO (lajava): implement last-baseline logic here. | |
1815 if (align == ItemPositionBaseline) { | |
1816 LayoutUnit ascent = marginBoxAscentFromBaselineForChild(*chi ld); | |
1817 LayoutUnit startOffset = group.groupMaxAscent - ascent; | |
1818 LayoutPoint location(isHorizontalWritingMode() ? child->loca tion() : child->location().transposedPoint()); | |
1819 child->setLogicalLocation(location + LayoutSize(0, startOffs et)); | |
1820 } | |
1821 } | |
1822 } | |
1823 } | |
1824 } | |
1825 | |
1826 static int synthesizedBaselineFromContentBox(const LayoutBox& box, LineDirection Mode direction) | |
1827 { | |
1828 if (direction == HorizontalLine) | |
1829 return box.size().height() - box.borderBottom() - box.paddingBottom() - box.verticalScrollbarWidth(); | |
1830 return box.size().width() - box.borderLeft() - box.paddingLeft() - box.horiz ontalScrollbarHeight(); | |
1831 } | |
1832 | |
1833 int LayoutGrid::baselinePosition(FontBaseline, bool, LineDirectionMode direction , LinePositionMode mode) const | |
1834 { | |
1835 ASSERT(mode == PositionOnContainingLine); | |
1836 int baseline = firstLineBoxBaseline(); | |
1837 // We take content-box's bottom if no valid baseline. | |
1838 if (baseline == -1) | |
1839 baseline = synthesizedBaselineFromContentBox(*this, direction); | |
1840 | |
1841 return baseline + beforeMarginInLineDirection(direction); | |
1842 } | |
1843 | |
1844 int LayoutGrid::firstLineBoxBaseline() const | |
1845 { | |
1846 if (isWritingModeRoot()) | |
1847 return -1; | |
1848 LayoutBox* baselineChild = nullptr; | |
1849 for (LayoutBox* child = m_orderIterator.first(); child; child = m_orderItera tor.next()) { | |
1850 if (child->isOutOfFlowPositioned()) | |
1851 continue; | |
1852 const GridCoordinate& coordinate = cachedGridCoordinate(*child); | |
1853 // TODO (lajava): propertly identifying grid items whose areas intersect the grid container's first row/column. | |
1854 if (coordinate.rows.resolvedInitialPosition.toInt() > 0 && coordinate.co lumns.resolvedInitialPosition.toInt() > 0) | |
1855 break; | |
1856 ItemPosition align = ComputedStyle::resolveAlignment(styleRef(), child-> styleRef(), ItemPositionStretch); | |
1857 // Orthogonal children don't participate in baseline alignment. | |
1858 bool isOrthogonal = child->isHorizontalWritingMode() != isHorizontalWrit ingMode(); | |
1859 if (align == ItemPositionBaseline && !isOrthogonal && !hasAutoMarginsInC olumnAxis(*child)) { | |
1860 baselineChild = child; | |
1861 break; | |
1862 } | |
1863 if (!baselineChild) | |
1864 baselineChild = child; | |
1865 } | |
1866 | |
1867 if (!baselineChild) | |
1868 return -1; | |
1869 | |
1870 // Using a synthesized baseline (content-box's bottom) if baselineChild has an orthogonal writing mode. | |
1871 // TODO (lajava) We still don't support orthogonal modes in grid. | |
1872 if (baselineChild->isHorizontalWritingMode() != isHorizontalWritingMode()) | |
1873 return -1; | |
1874 | |
1875 int baseline = baselineChild->firstLineBoxBaseline(); | |
1876 if (baseline == -1) { | |
1877 // TODO (lajava): We should pass |direction| into firstLineBoxBaseline a nd stop bailing out if we're a writing mode root. | |
1878 // This would also fix some cases where the grid is orthogonal to its co ntainer. | |
1879 LineDirectionMode direction = isHorizontalWritingMode() ? HorizontalLine : VerticalLine; | |
1880 return synthesizedBaselineFromContentBox(*baselineChild, direction) + ba selineChild->logicalTop(); | |
1881 } | |
1882 | |
1883 return baseline + baselineChild->logicalTop(); | |
1884 } | |
1885 | |
1886 int LayoutGrid::inlineBlockBaseline(LineDirectionMode direction) const | |
1887 { | |
1888 int baseline = firstLineBoxBaseline(); | |
1889 if (baseline != -1) | |
1890 return baseline; | |
1891 | |
1892 int marginHeight = direction == HorizontalLine ? marginTop() : marginRight() ; | |
1893 return synthesizedBaselineFromContentBox(*this, direction) + marginHeight; | |
1894 } | |
1895 | |
1712 GridAxisPosition LayoutGrid::columnAxisPositionForChild(const LayoutBox& child) const | 1896 GridAxisPosition LayoutGrid::columnAxisPositionForChild(const LayoutBox& child) const |
1713 { | 1897 { |
1714 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); | 1898 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); |
1715 bool hasSameWritingMode = child.styleRef().writingMode() == styleRef().writi ngMode(); | 1899 bool hasSameWritingMode = child.styleRef().writingMode() == styleRef().writi ngMode(); |
1716 | 1900 |
1717 switch (ComputedStyle::resolveAlignment(styleRef(), child.styleRef(), ItemPo sitionStretch)) { | 1901 switch (ComputedStyle::resolveAlignment(styleRef(), child.styleRef(), ItemPo sitionStretch)) { |
1718 case ItemPositionSelfStart: | 1902 case ItemPositionSelfStart: |
1719 // If orthogonal writing-modes, this computes to 'start'. | 1903 // If orthogonal writing-modes, this computes to 'start'. |
1720 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet. | 1904 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet. |
1721 // self-start is based on the child's block axis direction. That's why w e need to check against the grid container's block flow. | 1905 // self-start is based on the child's block axis direction. That's why w e need to check against the grid container's block flow. |
(...skipping 18 matching lines...) Expand all Loading... | |
1740 case ItemPositionFlexStart: // Only used in flex layout, otherwise equivalen t to 'start'. | 1924 case ItemPositionFlexStart: // Only used in flex layout, otherwise equivalen t to 'start'. |
1741 case ItemPositionStart: | 1925 case ItemPositionStart: |
1742 return GridAxisStart; | 1926 return GridAxisStart; |
1743 case ItemPositionFlexEnd: // Only used in flex layout, otherwise equivalent to 'end'. | 1927 case ItemPositionFlexEnd: // Only used in flex layout, otherwise equivalent to 'end'. |
1744 case ItemPositionEnd: | 1928 case ItemPositionEnd: |
1745 return GridAxisEnd; | 1929 return GridAxisEnd; |
1746 case ItemPositionStretch: | 1930 case ItemPositionStretch: |
1747 return GridAxisStart; | 1931 return GridAxisStart; |
1748 case ItemPositionBaseline: | 1932 case ItemPositionBaseline: |
1749 case ItemPositionLastBaseline: | 1933 case ItemPositionLastBaseline: |
1750 // FIXME: These two require implementing Baseline Alignment. For now, we always 'start' align the child. | |
1751 // crbug.com/234191 | |
1752 return GridAxisStart; | 1934 return GridAxisStart; |
1753 case ItemPositionAuto: | 1935 case ItemPositionAuto: |
1754 break; | 1936 break; |
1755 } | 1937 } |
1756 | 1938 |
1757 ASSERT_NOT_REACHED(); | 1939 ASSERT_NOT_REACHED(); |
1758 return GridAxisStart; | 1940 return GridAxisStart; |
1759 } | 1941 } |
1760 | 1942 |
1761 GridAxisPosition LayoutGrid::rowAxisPositionForChild(const LayoutBox& child) con st | 1943 GridAxisPosition LayoutGrid::rowAxisPositionForChild(const LayoutBox& child) con st |
(...skipping 21 matching lines...) Expand all Loading... | |
1783 case ItemPositionFlexStart: // Only used in flex layout, otherwise equivalen t to 'start'. | 1965 case ItemPositionFlexStart: // Only used in flex layout, otherwise equivalen t to 'start'. |
1784 case ItemPositionStart: | 1966 case ItemPositionStart: |
1785 return GridAxisStart; | 1967 return GridAxisStart; |
1786 case ItemPositionFlexEnd: // Only used in flex layout, otherwise equivalent to 'end'. | 1968 case ItemPositionFlexEnd: // Only used in flex layout, otherwise equivalent to 'end'. |
1787 case ItemPositionEnd: | 1969 case ItemPositionEnd: |
1788 return GridAxisEnd; | 1970 return GridAxisEnd; |
1789 case ItemPositionStretch: | 1971 case ItemPositionStretch: |
1790 return GridAxisStart; | 1972 return GridAxisStart; |
1791 case ItemPositionBaseline: | 1973 case ItemPositionBaseline: |
1792 case ItemPositionLastBaseline: | 1974 case ItemPositionLastBaseline: |
1793 // FIXME: These two require implementing Baseline Alignment. For now, we always 'start' align the child. | |
1794 // crbug.com/234191 | |
1795 return GridAxisStart; | 1975 return GridAxisStart; |
1796 case ItemPositionAuto: | 1976 case ItemPositionAuto: |
1797 break; | 1977 break; |
1798 } | 1978 } |
1799 | 1979 |
1800 ASSERT_NOT_REACHED(); | 1980 ASSERT_NOT_REACHED(); |
1801 return GridAxisStart; | 1981 return GridAxisStart; |
1802 } | 1982 } |
1803 | 1983 |
1804 static inline LayoutUnit offsetBetweenTracks(ContentDistributionType distributio n, const Vector<LayoutUnit>& trackPositions, const LayoutUnit& childBreadth) | 1984 static inline LayoutUnit offsetBetweenTracks(ContentDistributionType distributio n, const Vector<LayoutUnit>& trackPositions, const LayoutUnit& childBreadth) |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1989 | 2169 |
1990 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child)); | 2170 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child)); |
1991 } | 2171 } |
1992 | 2172 |
1993 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const | 2173 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const |
1994 { | 2174 { |
1995 GridPainter(*this).paintChildren(paintInfo, paintOffset); | 2175 GridPainter(*this).paintChildren(paintInfo, paintOffset); |
1996 } | 2176 } |
1997 | 2177 |
1998 } // namespace blink | 2178 } // namespace blink |
OLD | NEW |