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

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

Issue 2180153003: Revert of [css-grid] Avoid the HashMap for the override containing block size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/Source/core/layout/LayoutGrid.h ('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 1807 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
1828 void LayoutGrid::layoutGridItems(GridSizingData& sizingData) 1842 void LayoutGrid::layoutGridItems(GridSizingData& sizingData)
1829 { 1843 {
1830 populateGridPositionsForDirection(sizingData, ForColumns); 1844 populateGridPositionsForDirection(sizingData, ForColumns);
1831 populateGridPositionsForDirection(sizingData, ForRows); 1845 populateGridPositionsForDirection(sizingData, ForRows);
1832 m_gridItemsOverflowingGridArea.resize(0); 1846 m_gridItemsOverflowingGridArea.resize(0);
1833 1847
1834 for (LayoutBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) { 1848 for (LayoutBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) {
1835 if (child->isOutOfFlowPositioned()) { 1849 if (child->isOutOfFlowPositioned()) {
1836 prepareChildForPositionedLayout(*child); 1850 prepareChildForPositionedLayout(*child);
1837 continue; 1851 continue;
(...skipping 25 matching lines...) Expand all
1863 updateAutoMarginsInColumnAxisIfNeeded(*child); 1877 updateAutoMarginsInColumnAxisIfNeeded(*child);
1864 updateAutoMarginsInRowAxisIfNeeded(*child); 1878 updateAutoMarginsInRowAxisIfNeeded(*child);
1865 1879
1866 #if ENABLE(ASSERT) 1880 #if ENABLE(ASSERT)
1867 const GridArea& area = cachedGridArea(*child); 1881 const GridArea& area = cachedGridArea(*child);
1868 ASSERT(area.columns.startLine() < sizingData.columnTracks.size()); 1882 ASSERT(area.columns.startLine() < sizingData.columnTracks.size());
1869 ASSERT(area.rows.startLine() < sizingData.rowTracks.size()); 1883 ASSERT(area.rows.startLine() < sizingData.rowTracks.size());
1870 #endif 1884 #endif
1871 child->setLogicalLocation(findChildLogicalPosition(*child, sizingData)); 1885 child->setLogicalLocation(findChildLogicalPosition(*child, sizingData));
1872 1886
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. 1887 // Keep track of children overflowing their grid area as we might need t o paint them even if the grid-area is
1888 // not visible.
1874 // Using physical dimensions for simplicity, so we can forget about orth ogonalty. 1889 // Using physical dimensions for simplicity, so we can forget about orth ogonalty.
1875 // TODO (lajava): Child's margins should account when evaluating whether it overflows its grid area (http://crbug.com/628155). 1890 if (isChildOverflowingContainingBlockHeight(*child) || isChildOverflowin gContainingBlockWidth(*child))
1876 LayoutUnit childGridAreaHeight = isHorizontalWritingMode() ? overrideCon tainingBlockContentLogicalHeight : overrideContainingBlockContentLogicalWidth;
1877 LayoutUnit childGridAreaWidth = isHorizontalWritingMode() ? overrideCont ainingBlockContentLogicalWidth : overrideContainingBlockContentLogicalHeight;
1878 if (child->size().height() > childGridAreaHeight || child->size().width( ) > childGridAreaWidth)
1879 m_gridItemsOverflowingGridArea.append(child); 1891 m_gridItemsOverflowingGridArea.append(child);
1880 } 1892 }
1881 } 1893 }
1882 1894
1883 void LayoutGrid::prepareChildForPositionedLayout(LayoutBox& child) 1895 void LayoutGrid::prepareChildForPositionedLayout(LayoutBox& child)
1884 { 1896 {
1885 ASSERT(child.isOutOfFlowPositioned()); 1897 ASSERT(child.isOutOfFlowPositioned());
1886 child.containingBlock()->insertPositionedObject(&child); 1898 child.containingBlock()->insertPositionedObject(&child);
1887 1899
1888 PaintLayer* childLayer = child.layer(); 1900 PaintLayer* childLayer = child.layer();
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
2584 return isOrthogonalChild(child) ? childLocation.transposedPoint() : childLoc ation; 2596 return isOrthogonalChild(child) ? childLocation.transposedPoint() : childLoc ation;
2585 } 2597 }
2586 2598
2587 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const 2599 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const
2588 { 2600 {
2589 if (!m_gridItemArea.isEmpty()) 2601 if (!m_gridItemArea.isEmpty())
2590 GridPainter(*this).paintChildren(paintInfo, paintOffset); 2602 GridPainter(*this).paintChildren(paintInfo, paintOffset);
2591 } 2603 }
2592 2604
2593 } // namespace blink 2605 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutGrid.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698