| 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 1807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1818 | 1818 |
| 1819 LayoutUnit sizeToIncrease = availableSpace / numberOfAutoSizedTracks; | 1819 LayoutUnit sizeToIncrease = availableSpace / numberOfAutoSizedTracks; |
| 1820 for (const auto& trackIndex : autoSizedTracksIndex) { | 1820 for (const auto& trackIndex : autoSizedTracksIndex) { |
| 1821 GridTrack* track = tracks.data() + trackIndex; | 1821 GridTrack* track = tracks.data() + trackIndex; |
| 1822 LayoutUnit baseSize = track->baseSize() + sizeToIncrease; | 1822 LayoutUnit baseSize = track->baseSize() + sizeToIncrease; |
| 1823 track->setBaseSize(baseSize); | 1823 track->setBaseSize(baseSize); |
| 1824 } | 1824 } |
| 1825 availableSpace = LayoutUnit(); | 1825 availableSpace = LayoutUnit(); |
| 1826 } | 1826 } |
| 1827 | 1827 |
| 1828 bool LayoutGrid::isChildOverflowingContainingBlockHeight(const LayoutBox& child)
const | |
| 1829 { | |
| 1830 // TODO (lajava) We must consider margins to determine whether it overflows
or not (see https://crbug/628155) | |
| 1831 LayoutUnit containingBlockContentHeight = child.hasOverrideContainingBlockHe
ight() ? child.overrideContainingBlockContentHeight() : LayoutUnit(); | |
| 1832 return child.size().height() > containingBlockContentHeight; | |
| 1833 } | |
| 1834 | |
| 1835 bool LayoutGrid::isChildOverflowingContainingBlockWidth(const LayoutBox& child)
const | |
| 1836 { | |
| 1837 // TODO (lajava) We must consider margins to determine whether it overflows
or not (see https://crbug/628155) | |
| 1838 LayoutUnit containingBlockContentWidth = child.hasOverrideContainingBlockWid
th() ? child.overrideContainingBlockContentWidth() : LayoutUnit(); | |
| 1839 return child.size().width() > containingBlockContentWidth; | |
| 1840 } | |
| 1841 | |
| 1842 void LayoutGrid::layoutGridItems(GridSizingData& sizingData) | 1828 void LayoutGrid::layoutGridItems(GridSizingData& sizingData) |
| 1843 { | 1829 { |
| 1844 populateGridPositionsForDirection(sizingData, ForColumns); | 1830 populateGridPositionsForDirection(sizingData, ForColumns); |
| 1845 populateGridPositionsForDirection(sizingData, ForRows); | 1831 populateGridPositionsForDirection(sizingData, ForRows); |
| 1846 m_gridItemsOverflowingGridArea.resize(0); | 1832 m_gridItemsOverflowingGridArea.resize(0); |
| 1847 | 1833 |
| 1848 for (LayoutBox* child = firstChildBox(); child; child = child->nextSiblingBo
x()) { | 1834 for (LayoutBox* child = firstChildBox(); child; child = child->nextSiblingBo
x()) { |
| 1849 if (child->isOutOfFlowPositioned()) { | 1835 if (child->isOutOfFlowPositioned()) { |
| 1850 prepareChildForPositionedLayout(*child); | 1836 prepareChildForPositionedLayout(*child); |
| 1851 continue; | 1837 continue; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1877 updateAutoMarginsInColumnAxisIfNeeded(*child); | 1863 updateAutoMarginsInColumnAxisIfNeeded(*child); |
| 1878 updateAutoMarginsInRowAxisIfNeeded(*child); | 1864 updateAutoMarginsInRowAxisIfNeeded(*child); |
| 1879 | 1865 |
| 1880 #if ENABLE(ASSERT) | 1866 #if ENABLE(ASSERT) |
| 1881 const GridArea& area = cachedGridArea(*child); | 1867 const GridArea& area = cachedGridArea(*child); |
| 1882 ASSERT(area.columns.startLine() < sizingData.columnTracks.size()); | 1868 ASSERT(area.columns.startLine() < sizingData.columnTracks.size()); |
| 1883 ASSERT(area.rows.startLine() < sizingData.rowTracks.size()); | 1869 ASSERT(area.rows.startLine() < sizingData.rowTracks.size()); |
| 1884 #endif | 1870 #endif |
| 1885 child->setLogicalLocation(findChildLogicalPosition(*child, sizingData)); | 1871 child->setLogicalLocation(findChildLogicalPosition(*child, sizingData)); |
| 1886 | 1872 |
| 1887 // Keep track of children overflowing their grid area as we might need t
o paint them even if the grid-area is | 1873 // Keep track of children overflowing their grid area as we might need t
o paint them even if the grid-area is not visible. |
| 1888 // not visible. | |
| 1889 // Using physical dimensions for simplicity, so we can forget about orth
ogonalty. | 1874 // Using physical dimensions for simplicity, so we can forget about orth
ogonalty. |
| 1890 if (isChildOverflowingContainingBlockHeight(*child) || isChildOverflowin
gContainingBlockWidth(*child)) | 1875 // TODO (lajava): Child's margins should account when evaluating whether
it overflows its grid area (http://crbug.com/628155). |
| 1876 LayoutUnit childGridAreaHeight = isHorizontalWritingMode() ? overrideCon
tainingBlockContentLogicalHeight : overrideContainingBlockContentLogicalWidth; |
| 1877 LayoutUnit childGridAreaWidth = isHorizontalWritingMode() ? overrideCont
ainingBlockContentLogicalWidth : overrideContainingBlockContentLogicalHeight; |
| 1878 if (child->size().height() > childGridAreaHeight || child->size().width(
) > childGridAreaWidth) |
| 1891 m_gridItemsOverflowingGridArea.append(child); | 1879 m_gridItemsOverflowingGridArea.append(child); |
| 1892 } | 1880 } |
| 1893 } | 1881 } |
| 1894 | 1882 |
| 1895 void LayoutGrid::prepareChildForPositionedLayout(LayoutBox& child) | 1883 void LayoutGrid::prepareChildForPositionedLayout(LayoutBox& child) |
| 1896 { | 1884 { |
| 1897 ASSERT(child.isOutOfFlowPositioned()); | 1885 ASSERT(child.isOutOfFlowPositioned()); |
| 1898 child.containingBlock()->insertPositionedObject(&child); | 1886 child.containingBlock()->insertPositionedObject(&child); |
| 1899 | 1887 |
| 1900 PaintLayer* childLayer = child.layer(); | 1888 PaintLayer* childLayer = child.layer(); |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2596 return isOrthogonalChild(child) ? childLocation.transposedPoint() : childLoc
ation; | 2584 return isOrthogonalChild(child) ? childLocation.transposedPoint() : childLoc
ation; |
| 2597 } | 2585 } |
| 2598 | 2586 |
| 2599 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) const | 2587 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) const |
| 2600 { | 2588 { |
| 2601 if (!m_gridItemArea.isEmpty()) | 2589 if (!m_gridItemArea.isEmpty()) |
| 2602 GridPainter(*this).paintChildren(paintInfo, paintOffset); | 2590 GridPainter(*this).paintChildren(paintInfo, paintOffset); |
| 2603 } | 2591 } |
| 2604 | 2592 |
| 2605 } // namespace blink | 2593 } // namespace blink |
| OLD | NEW |