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

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

Issue 815833005: [css-grid] Handle min-content/max-content with orthogonal flows (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch rebased and applied the suggested changes. Created 4 years, 8 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
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 void placeSpecifiedMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); 123 void placeSpecifiedMajorAxisItemsOnGrid(const Vector<LayoutBox*>&);
124 void placeAutoMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); 124 void placeAutoMajorAxisItemsOnGrid(const Vector<LayoutBox*>&);
125 void placeAutoMajorAxisItemOnGrid(LayoutBox&, std::pair<size_t, size_t>& aut oPlacementCursor); 125 void placeAutoMajorAxisItemOnGrid(LayoutBox&, std::pair<size_t, size_t>& aut oPlacementCursor);
126 GridTrackSizingDirection autoPlacementMajorAxisDirection() const; 126 GridTrackSizingDirection autoPlacementMajorAxisDirection() const;
127 GridTrackSizingDirection autoPlacementMinorAxisDirection() const; 127 GridTrackSizingDirection autoPlacementMinorAxisDirection() const;
128 128
129 void computeIntrinsicLogicalHeight(GridSizingData&); 129 void computeIntrinsicLogicalHeight(GridSizingData&);
130 LayoutUnit computeTrackBasedLogicalHeight(const GridSizingData&) const; 130 LayoutUnit computeTrackBasedLogicalHeight(const GridSizingData&) const;
131 void computeTrackSizesForDirection(GridTrackSizingDirection, GridSizingData& , LayoutUnit freeSpace); 131 void computeTrackSizesForDirection(GridTrackSizingDirection, GridSizingData& , LayoutUnit freeSpace);
132 132
133 void repeatTracksSizingIfNeeded(GridSizingData&, LayoutUnit availableSpaceFo rColumns, LayoutUnit availableSpaceForRows);
134
133 void layoutGridItems(GridSizingData&); 135 void layoutGridItems(GridSizingData&);
134 void prepareChildForPositionedLayout(LayoutBox&); 136 void prepareChildForPositionedLayout(LayoutBox&);
135 void layoutPositionedObjects(bool relayoutChildren, PositionedLayoutBehavior = DefaultLayout); 137 void layoutPositionedObjects(bool relayoutChildren, PositionedLayoutBehavior = DefaultLayout);
136 void offsetAndBreadthForPositionedChild(const LayoutBox&, GridTrackSizingDir ection, LayoutUnit& offset, LayoutUnit& breadth); 138 void offsetAndBreadthForPositionedChild(const LayoutBox&, GridTrackSizingDir ection, LayoutUnit& offset, LayoutUnit& breadth);
137 void populateGridPositions(GridSizingData&); 139 void populateGridPositions(GridSizingData&);
138 140
139 typedef struct GridItemsSpanGroupRange GridItemsSpanGroupRange; 141 typedef struct GridItemsSpanGroupRange GridItemsSpanGroupRange;
140 LayoutUnit currentItemSizeForTrackSizeComputationPhase(TrackSizeComputationP hase, LayoutBox&, GridTrackSizingDirection, GridSizingData&); 142 LayoutUnit currentItemSizeForTrackSizeComputationPhase(TrackSizeComputationP hase, LayoutBox&, GridTrackSizingDirection, GridSizingData&);
141 void resolveContentBasedTrackSizingFunctionsForNonSpanningItems(GridTrackSiz ingDirection, const GridSpan&, LayoutBox& gridItem, GridTrack&, GridSizingData&) ; 143 void resolveContentBasedTrackSizingFunctionsForNonSpanningItems(GridTrackSiz ingDirection, const GridSpan&, LayoutBox& gridItem, GridTrack&, GridSizingData&) ;
142 template <TrackSizeComputationPhase> void resolveContentBasedTrackSizingFunc tionsForItems(GridTrackSizingDirection, GridSizingData&, const GridItemsSpanGrou pRange&); 144 template <TrackSizeComputationPhase> void resolveContentBasedTrackSizingFunc tionsForItems(GridTrackSizingDirection, GridSizingData&, const GridItemsSpanGrou pRange&);
(...skipping 14 matching lines...) Expand all
157 GridAxisPosition rowAxisPositionForChild(const LayoutBox&) const; 159 GridAxisPosition rowAxisPositionForChild(const LayoutBox&) const;
158 LayoutUnit rowAxisOffsetForChild(const LayoutBox&, GridSizingData&) const; 160 LayoutUnit rowAxisOffsetForChild(const LayoutBox&, GridSizingData&) const;
159 LayoutUnit columnAxisOffsetForChild(const LayoutBox&, GridSizingData&) const ; 161 LayoutUnit columnAxisOffsetForChild(const LayoutBox&, GridSizingData&) const ;
160 ContentAlignmentData computeContentPositionAndDistributionOffset(GridTrackSi zingDirection, const LayoutUnit& availableFreeSpace, unsigned numberOfGridTracks ) const; 162 ContentAlignmentData computeContentPositionAndDistributionOffset(GridTrackSi zingDirection, const LayoutUnit& availableFreeSpace, unsigned numberOfGridTracks ) const;
161 LayoutPoint findChildLogicalPosition(const LayoutBox&, GridSizingData&) cons t; 163 LayoutPoint findChildLogicalPosition(const LayoutBox&, GridSizingData&) cons t;
162 GridArea cachedGridArea(const LayoutBox&) const; 164 GridArea cachedGridArea(const LayoutBox&) const;
163 GridSpan cachedGridSpan(const LayoutBox&, GridTrackSizingDirection) const; 165 GridSpan cachedGridSpan(const LayoutBox&, GridTrackSizingDirection) const;
164 166
165 LayoutUnit gridAreaBreadthForChild(const LayoutBox& child, GridTrackSizingDi rection, const GridSizingData&) const; 167 LayoutUnit gridAreaBreadthForChild(const LayoutBox& child, GridTrackSizingDi rection, const GridSizingData&) const;
166 LayoutUnit gridAreaBreadthForChildIncludingAlignmentOffsets(const LayoutBox& , GridTrackSizingDirection, const GridSizingData&) const; 168 LayoutUnit gridAreaBreadthForChildIncludingAlignmentOffsets(const LayoutBox& , GridTrackSizingDirection, const GridSizingData&) const;
169 LayoutUnit assumedRowsBreadthForOrthogonalChild(const LayoutBox&) const;
167 170
168 void applyStretchAlignmentToTracksIfNeeded(GridTrackSizingDirection, GridSiz ingData&); 171 void applyStretchAlignmentToTracksIfNeeded(GridTrackSizingDirection, GridSiz ingData&);
169 172
170 void paintChildren(const PaintInfo&, const LayoutPoint&) const override; 173 void paintChildren(const PaintInfo&, const LayoutPoint&) const override;
171 174
172 LayoutUnit marginLogicalHeightForChild(const LayoutBox&) const; 175 LayoutUnit marginLogicalHeightForChild(const LayoutBox&) const;
173 LayoutUnit computeMarginLogicalSizeForChild(MarginDirection, const LayoutBox &) const; 176 LayoutUnit computeMarginLogicalSizeForChild(MarginDirection, const LayoutBox &) const;
174 LayoutUnit availableAlignmentSpaceForChildBeforeStretching(LayoutUnit gridAr eaBreadthForChild, const LayoutBox&) const; 177 LayoutUnit availableAlignmentSpaceForChildBeforeStretching(LayoutUnit gridAr eaBreadthForChild, const LayoutBox&) const;
175 void applyStretchAlignmentToChildIfNeeded(LayoutBox&); 178 void applyStretchAlignmentToChildIfNeeded(LayoutBox&);
176 bool hasAutoMarginsInColumnAxis(const LayoutBox&) const; 179 bool hasAutoMarginsInColumnAxis(const LayoutBox&) const;
(...skipping 13 matching lines...) Expand all
190 ASSERT(!m_gridIsDirty); 193 ASSERT(!m_gridIsDirty);
191 return m_grid[0].size(); 194 return m_grid[0].size();
192 } 195 }
193 size_t gridRowCount() const 196 size_t gridRowCount() const
194 { 197 {
195 ASSERT(!m_gridIsDirty); 198 ASSERT(!m_gridIsDirty);
196 return m_grid.size(); 199 return m_grid.size();
197 } 200 }
198 201
199 bool hasDefiniteLogicalSize(GridTrackSizingDirection) const; 202 bool hasDefiniteLogicalSize(GridTrackSizingDirection) const;
203 bool gridLengthIsIndefinite(const GridLength&, GridTrackSizingDirection) con st;
200 204
201 bool isOrthogonalChild(const LayoutBox&) const; 205 bool isOrthogonalChild(const LayoutBox&) const;
202 GridTrackSizingDirection flowAwareDirectionForChild(const LayoutBox&, GridTr ackSizingDirection) const; 206 GridTrackSizingDirection flowAwareDirectionForChild(const LayoutBox&, GridTr ackSizingDirection) const;
203 207
204 typedef Vector<Vector<GridCell>> GridRepresentation; 208 typedef Vector<Vector<GridCell>> GridRepresentation;
205 GridRepresentation m_grid; 209 GridRepresentation m_grid;
206 bool m_gridIsDirty; 210 bool m_gridIsDirty;
207 Vector<LayoutUnit> m_rowPositions; 211 Vector<LayoutUnit> m_rowPositions;
208 Vector<LayoutUnit> m_columnPositions; 212 Vector<LayoutUnit> m_columnPositions;
209 HashMap<const LayoutBox*, GridArea> m_gridItemArea; 213 HashMap<const LayoutBox*, GridArea> m_gridItemArea;
210 OrderIterator m_orderIterator; 214 OrderIterator m_orderIterator;
211 Vector<LayoutBox*> m_gridItemsOverflowingGridArea; 215 Vector<LayoutBox*> m_gridItemsOverflowingGridArea;
212 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap; 216 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap;
213 217
214 LayoutUnit m_minContentHeight { -1 }; 218 LayoutUnit m_minContentHeight { -1 };
215 LayoutUnit m_maxContentHeight { -1 }; 219 LayoutUnit m_maxContentHeight { -1 };
216 220
217 int m_smallestRowStart; 221 int m_smallestRowStart;
218 int m_smallestColumnStart; 222 int m_smallestColumnStart;
223 bool m_hasAnyOrthogonalChild;
219 }; 224 };
220 225
221 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); 226 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid());
222 227
223 } // namespace blink 228 } // namespace blink
224 229
225 #endif // LayoutGrid_h 230 #endif // LayoutGrid_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698