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

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

Issue 2334133002: [css-grid] Cache definite height detection (Closed)
Patch Set: Created 4 years, 3 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 void offsetAndBreadthForPositionedChild(const LayoutBox&, GridTrackSizingDir ection, LayoutUnit& offset, LayoutUnit& breadth); 154 void offsetAndBreadthForPositionedChild(const LayoutBox&, GridTrackSizingDir ection, LayoutUnit& offset, LayoutUnit& breadth);
155 void populateGridPositionsForDirection(GridSizingData&, GridTrackSizingDirec tion); 155 void populateGridPositionsForDirection(GridSizingData&, GridTrackSizingDirec tion);
156 156
157 typedef struct GridItemsSpanGroupRange GridItemsSpanGroupRange; 157 typedef struct GridItemsSpanGroupRange GridItemsSpanGroupRange;
158 LayoutUnit currentItemSizeForTrackSizeComputationPhase(TrackSizeComputationP hase, LayoutBox&, GridTrackSizingDirection, GridSizingData&) const; 158 LayoutUnit currentItemSizeForTrackSizeComputationPhase(TrackSizeComputationP hase, LayoutBox&, GridTrackSizingDirection, GridSizingData&) const;
159 void resolveContentBasedTrackSizingFunctionsForNonSpanningItems(GridTrackSiz ingDirection, const GridSpan&, LayoutBox& gridItem, GridTrack&, GridSizingData&) const; 159 void resolveContentBasedTrackSizingFunctionsForNonSpanningItems(GridTrackSiz ingDirection, const GridSpan&, LayoutBox& gridItem, GridTrack&, GridSizingData&) const;
160 template <TrackSizeComputationPhase> void resolveContentBasedTrackSizingFunc tionsForItems(GridTrackSizingDirection, GridSizingData&, const GridItemsSpanGrou pRange&) const; 160 template <TrackSizeComputationPhase> void resolveContentBasedTrackSizingFunc tionsForItems(GridTrackSizingDirection, GridSizingData&, const GridItemsSpanGrou pRange&) const;
161 template <TrackSizeComputationPhase> void distributeSpaceToTracks(Vector<Gri dTrack*>&, Vector<GridTrack*>* growBeyondGrowthLimitsTracks, GridSizingData&, La youtUnit& availableLogicalSpace) const; 161 template <TrackSizeComputationPhase> void distributeSpaceToTracks(Vector<Gri dTrack*>&, Vector<GridTrack*>* growBeyondGrowthLimitsTracks, GridSizingData&, La youtUnit& availableLogicalSpace) const;
162 162
163 typedef HashSet<size_t, DefaultHash<size_t>::Hash, WTF::UnsignedWithZeroKeyH ashTraits<size_t>> TrackIndexSet; 163 typedef HashSet<size_t, DefaultHash<size_t>::Hash, WTF::UnsignedWithZeroKeyH ashTraits<size_t>> TrackIndexSet;
164 double computeFlexFactorUnitSize(const Vector<GridTrack>&, GridTrackSizingDi rection, double flexFactorSum, LayoutUnit& leftOverSpace, const Vector<size_t, 8 >& flexibleTracksIndexes, std::unique_ptr<TrackIndexSet> tracksToTreatAsInflexib le = nullptr) const; 164 double computeFlexFactorUnitSize(const Vector<GridTrack>&, GridTrackSizingDi rection, const GridSizingData&, double flexFactorSum, LayoutUnit& leftOverSpace, const Vector<size_t, 8>& flexibleTracksIndexes, std::unique_ptr<TrackIndexSet> tracksToTreatAsInflexible = nullptr) const;
165 double findFlexFactorUnitSize(const Vector<GridTrack>&, const GridSpan&, Gri dTrackSizingDirection, LayoutUnit leftOverSpace) const; 165 double findFlexFactorUnitSize(const Vector<GridTrack>&, const GridSpan&, Gri dTrackSizingDirection, const GridSizingData&, LayoutUnit leftOverSpace) const;
166 166
167 const GridTrackSize& rawGridTrackSize(GridTrackSizingDirection, size_t) cons t; 167 const GridTrackSize& rawGridTrackSize(GridTrackSizingDirection, size_t) cons t;
168 GridTrackSize gridTrackSize(GridTrackSizingDirection, size_t, SizingOperatio n = TrackSizing) const; 168 GridTrackSize gridTrackSize(GridTrackSizingDirection, size_t, const GridSizi ngData&) const;
169 169
170 bool updateOverrideContainingBlockContentSizeForChild(LayoutBox&, GridTrackS izingDirection, GridSizingData&) const; 170 bool updateOverrideContainingBlockContentSizeForChild(LayoutBox&, GridTrackS izingDirection, GridSizingData&) const;
171 LayoutUnit logicalHeightForChild(LayoutBox&, GridSizingData&) const; 171 LayoutUnit logicalHeightForChild(LayoutBox&, GridSizingData&) const;
172 LayoutUnit minSizeForChild(LayoutBox&, GridTrackSizingDirection, GridSizingD ata&) const; 172 LayoutUnit minSizeForChild(LayoutBox&, GridTrackSizingDirection, GridSizingD ata&) const;
173 LayoutUnit minContentForChild(LayoutBox&, GridTrackSizingDirection, GridSizi ngData&) const; 173 LayoutUnit minContentForChild(LayoutBox&, GridTrackSizingDirection, GridSizi ngData&) const;
174 LayoutUnit maxContentForChild(LayoutBox&, GridTrackSizingDirection, GridSizi ngData&) const; 174 LayoutUnit maxContentForChild(LayoutBox&, GridTrackSizingDirection, GridSizi ngData&) const;
175 GridAxisPosition columnAxisPositionForChild(const LayoutBox&) const; 175 GridAxisPosition columnAxisPositionForChild(const LayoutBox&) const;
176 GridAxisPosition rowAxisPositionForChild(const LayoutBox&) const; 176 GridAxisPosition rowAxisPositionForChild(const LayoutBox&) const;
177 LayoutUnit rowAxisOffsetForChild(const LayoutBox&, GridSizingData&) const; 177 LayoutUnit rowAxisOffsetForChild(const LayoutBox&, GridSizingData&) const;
178 LayoutUnit columnAxisOffsetForChild(const LayoutBox&, GridSizingData&) const ; 178 LayoutUnit columnAxisOffsetForChild(const LayoutBox&, GridSizingData&) const ;
179 ContentAlignmentData computeContentPositionAndDistributionOffset(GridTrackSi zingDirection, const LayoutUnit& availableFreeSpace, unsigned numberOfGridTracks ) const; 179 ContentAlignmentData computeContentPositionAndDistributionOffset(GridTrackSi zingDirection, const LayoutUnit& availableFreeSpace, unsigned numberOfGridTracks ) const;
180 LayoutPoint findChildLogicalPosition(const LayoutBox&, GridSizingData&) cons t; 180 LayoutPoint findChildLogicalPosition(const LayoutBox&, GridSizingData&) cons t;
181 GridArea cachedGridArea(const LayoutBox&) const; 181 GridArea cachedGridArea(const LayoutBox&) const;
182 GridSpan cachedGridSpan(const LayoutBox&, GridTrackSizingDirection) const; 182 GridSpan cachedGridSpan(const LayoutBox&, GridTrackSizingDirection) const;
183 183
184 LayoutUnit gridAreaBreadthForChild(const LayoutBox& child, GridTrackSizingDi rection, const GridSizingData&) const; 184 LayoutUnit gridAreaBreadthForChild(const LayoutBox& child, GridTrackSizingDi rection, const GridSizingData&) const;
185 LayoutUnit gridAreaBreadthForChildIncludingAlignmentOffsets(const LayoutBox& , GridTrackSizingDirection, const GridSizingData&) const; 185 LayoutUnit gridAreaBreadthForChildIncludingAlignmentOffsets(const LayoutBox& , GridTrackSizingDirection, const GridSizingData&) const;
186 LayoutUnit assumedRowsSizeForOrthogonalChild(const LayoutBox&, SizingOperati on) const; 186 LayoutUnit assumedRowsSizeForOrthogonalChild(const LayoutBox&, const GridSiz ingData&) const;
187 187
188 void applyStretchAlignmentToTracksIfNeeded(GridTrackSizingDirection, GridSiz ingData&); 188 void applyStretchAlignmentToTracksIfNeeded(GridTrackSizingDirection, GridSiz ingData&);
189 189
190 void paintChildren(const PaintInfo&, const LayoutPoint&) const override; 190 void paintChildren(const PaintInfo&, const LayoutPoint&) const override;
191 191
192 LayoutUnit marginLogicalHeightForChild(const LayoutBox&) const; 192 LayoutUnit marginLogicalHeightForChild(const LayoutBox&) const;
193 LayoutUnit computeMarginLogicalSizeForChild(MarginDirection, const LayoutBox &) const; 193 LayoutUnit computeMarginLogicalSizeForChild(MarginDirection, const LayoutBox &) const;
194 LayoutUnit availableAlignmentSpaceForChildBeforeStretching(LayoutUnit gridAr eaBreadthForChild, const LayoutBox&) const; 194 LayoutUnit availableAlignmentSpaceForChildBeforeStretching(LayoutUnit gridAr eaBreadthForChild, const LayoutBox&) const;
195 StyleSelfAlignmentData justifySelfForChild(const LayoutBox&) const; 195 StyleSelfAlignmentData justifySelfForChild(const LayoutBox&) const;
196 StyleSelfAlignmentData alignSelfForChild(const LayoutBox&) const; 196 StyleSelfAlignmentData alignSelfForChild(const LayoutBox&) const;
197 void applyStretchAlignmentToChildIfNeeded(LayoutBox&); 197 void applyStretchAlignmentToChildIfNeeded(LayoutBox&);
198 bool hasAutoSizeInColumnAxis(const LayoutBox& child) const { return isHorizo ntalWritingMode() ? child.styleRef().height().isAuto() : child.styleRef().width( ).isAuto(); } 198 bool hasAutoSizeInColumnAxis(const LayoutBox& child) const { return isHorizo ntalWritingMode() ? child.styleRef().height().isAuto() : child.styleRef().width( ).isAuto(); }
199 bool hasAutoSizeInRowAxis(const LayoutBox& child) const { return isHorizonta lWritingMode() ? child.styleRef().width().isAuto() : child.styleRef().height().i sAuto(); } 199 bool hasAutoSizeInRowAxis(const LayoutBox& child) const { return isHorizonta lWritingMode() ? child.styleRef().width().isAuto() : child.styleRef().height().i sAuto(); }
200 bool allowedToStretchChildAlongColumnAxis(const LayoutBox& child) const { re turn alignSelfForChild(child).position() == ItemPositionStretch && hasAutoSizeIn ColumnAxis(child) && !hasAutoMarginsInColumnAxis(child); } 200 bool allowedToStretchChildAlongColumnAxis(const LayoutBox& child) const { re turn alignSelfForChild(child).position() == ItemPositionStretch && hasAutoSizeIn ColumnAxis(child) && !hasAutoMarginsInColumnAxis(child); }
201 bool allowedToStretchChildAlongRowAxis(const LayoutBox& child) const { retur n justifySelfForChild(child).position() == ItemPositionStretch && hasAutoSizeInR owAxis(child) && !hasAutoMarginsInRowAxis(child); } 201 bool allowedToStretchChildAlongRowAxis(const LayoutBox& child) const { retur n justifySelfForChild(child).position() == ItemPositionStretch && hasAutoSizeInR owAxis(child) && !hasAutoMarginsInRowAxis(child); }
202 bool hasAutoMarginsInColumnAxis(const LayoutBox&) const; 202 bool hasAutoMarginsInColumnAxis(const LayoutBox&) const;
203 bool hasAutoMarginsInRowAxis(const LayoutBox&) const; 203 bool hasAutoMarginsInRowAxis(const LayoutBox&) const;
204 void updateAutoMarginsInColumnAxisIfNeeded(LayoutBox&); 204 void updateAutoMarginsInColumnAxisIfNeeded(LayoutBox&);
205 void updateAutoMarginsInRowAxisIfNeeded(LayoutBox&); 205 void updateAutoMarginsInRowAxisIfNeeded(LayoutBox&);
206 206
207 #if ENABLE(ASSERT) 207 #if ENABLE(ASSERT)
208 bool tracksAreWiderThanMinTrackBreadth(GridTrackSizingDirection, GridSizingD ata&); 208 bool tracksAreWiderThanMinTrackBreadth(GridTrackSizingDirection, GridSizingD ata&);
209 #endif 209 #endif
210 210
211 LayoutUnit gridGapForDirection(GridTrackSizingDirection, SizingOperation) co nst; 211 LayoutUnit gridGapForDirection(GridTrackSizingDirection, SizingOperation) co nst;
212 LayoutUnit guttersSize(GridTrackSizingDirection, size_t startLine, size_t sp an, SizingOperation) const; 212 LayoutUnit guttersSize(GridTrackSizingDirection, size_t startLine, size_t sp an, SizingOperation) const;
213 213
214 size_t gridItemSpan(const LayoutBox&, GridTrackSizingDirection); 214 size_t gridItemSpan(const LayoutBox&, GridTrackSizingDirection);
215 bool spanningItemCrossesFlexibleSizedTracks(const GridSpan&, GridTrackSizing Direction, SizingOperation) const; 215 bool spanningItemCrossesFlexibleSizedTracks(const GridSpan&, GridTrackSizing Direction, const GridSizingData&) const;
216 216
217 size_t gridColumnCount() const; 217 size_t gridColumnCount() const;
218 size_t gridRowCount() const; 218 size_t gridRowCount() const;
219 219
220 bool isOrthogonalChild(const LayoutBox&) const; 220 bool isOrthogonalChild(const LayoutBox&) const;
221 GridTrackSizingDirection flowAwareDirectionForChild(const LayoutBox&, GridTr ackSizingDirection) const; 221 GridTrackSizingDirection flowAwareDirectionForChild(const LayoutBox&, GridTr ackSizingDirection) const;
222 222
223 typedef Vector<Vector<GridCell>> GridRepresentation; 223 typedef Vector<Vector<GridCell>> GridRepresentation;
224 GridRepresentation m_grid; 224 GridRepresentation m_grid;
225 bool m_gridIsDirty; 225 bool m_gridIsDirty;
(...skipping 19 matching lines...) Expand all
245 245
246 std::unique_ptr<OrderedTrackIndexSet> m_autoRepeatEmptyColumns { nullptr }; 246 std::unique_ptr<OrderedTrackIndexSet> m_autoRepeatEmptyColumns { nullptr };
247 std::unique_ptr<OrderedTrackIndexSet> m_autoRepeatEmptyRows { nullptr }; 247 std::unique_ptr<OrderedTrackIndexSet> m_autoRepeatEmptyRows { nullptr };
248 }; 248 };
249 249
250 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); 250 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid());
251 251
252 } // namespace blink 252 } // namespace blink
253 253
254 #endif // LayoutGrid_h 254 #endif // LayoutGrid_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698