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

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

Issue 2080643002: [css-grid] Implement repeat(auto-fit) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing v3 Created 4 years, 5 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 public: 52 public:
53 explicit LayoutGrid(Element*); 53 explicit LayoutGrid(Element*);
54 ~LayoutGrid() override; 54 ~LayoutGrid() override;
55 55
56 const char* name() const override { return "LayoutGrid"; } 56 const char* name() const override { return "LayoutGrid"; }
57 57
58 void layoutBlock(bool relayoutChildren) override; 58 void layoutBlock(bool relayoutChildren) override;
59 59
60 void dirtyGrid(); 60 void dirtyGrid();
61 61
62 Vector<LayoutUnit> trackSizesForComputedStyle(GridTrackSizingDirection) cons t;
63
62 const Vector<LayoutUnit>& columnPositions() const 64 const Vector<LayoutUnit>& columnPositions() const
63 { 65 {
64 ASSERT(!m_gridIsDirty); 66 ASSERT(!m_gridIsDirty);
65 return m_columnPositions; 67 return m_columnPositions;
66 } 68 }
67 69
68 const Vector<LayoutUnit>& rowPositions() const 70 const Vector<LayoutUnit>& rowPositions() const
69 { 71 {
70 ASSERT(!m_gridIsDirty); 72 ASSERT(!m_gridIsDirty);
71 return m_rowPositions; 73 return m_rowPositions;
72 } 74 }
73 75
74 LayoutUnit guttersSize(GridTrackSizingDirection, size_t span) const;
75
76 LayoutUnit offsetBetweenTracks(GridTrackSizingDirection direction) const
77 {
78 return direction == ForColumns ? m_offsetBetweenColumns : m_offsetBetwee nRows;
79 }
80
81 typedef Vector<LayoutBox*, 1> GridCell; 76 typedef Vector<LayoutBox*, 1> GridCell;
82 const GridCell& gridCell(int row, int column) const 77 const GridCell& gridCell(int row, int column) const
83 { 78 {
84 ASSERT_WITH_SECURITY_IMPLICATION(!m_gridIsDirty); 79 ASSERT_WITH_SECURITY_IMPLICATION(!m_gridIsDirty);
85 return m_grid[row][column]; 80 return m_grid[row][column];
86 } 81 }
87 82
88 const Vector<LayoutBox*>& itemsOverflowingGridArea() const 83 const Vector<LayoutBox*>& itemsOverflowingGridArea() const
89 { 84 {
90 ASSERT_WITH_SECURITY_IMPLICATION(!m_gridIsDirty); 85 ASSERT_WITH_SECURITY_IMPLICATION(!m_gridIsDirty);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 void computeUsedBreadthOfGridTracks(GridTrackSizingDirection, GridSizingData &, LayoutUnit& baseSizesWithoutMaximization, LayoutUnit& growthLimitsWithoutMaxi mization) const; 119 void computeUsedBreadthOfGridTracks(GridTrackSizingDirection, GridSizingData &, LayoutUnit& baseSizesWithoutMaximization, LayoutUnit& growthLimitsWithoutMaxi mization) const;
125 LayoutUnit computeUsedBreadthOfMinLength(const GridLength&, LayoutUnit maxBr eadth) const; 120 LayoutUnit computeUsedBreadthOfMinLength(const GridLength&, LayoutUnit maxBr eadth) const;
126 LayoutUnit computeUsedBreadthOfMaxLength(const GridLength&, LayoutUnit usedB readth, LayoutUnit maxBreadth) const; 121 LayoutUnit computeUsedBreadthOfMaxLength(const GridLength&, LayoutUnit usedB readth, LayoutUnit maxBreadth) const;
127 void resolveContentBasedTrackSizingFunctions(GridTrackSizingDirection, GridS izingData&) const; 122 void resolveContentBasedTrackSizingFunctions(GridTrackSizingDirection, GridS izingData&) const;
128 123
129 void ensureGridSize(size_t maximumRowSize, size_t maximumColumnSize); 124 void ensureGridSize(size_t maximumRowSize, size_t maximumColumnSize);
130 void insertItemIntoGrid(LayoutBox&, const GridArea&); 125 void insertItemIntoGrid(LayoutBox&, const GridArea&);
131 126
132 size_t computeAutoRepeatTracksCount(GridTrackSizingDirection) const; 127 size_t computeAutoRepeatTracksCount(GridTrackSizingDirection) const;
133 128
129 typedef ListHashSet<size_t> OrderedTrackIndexSet;
130 std::unique_ptr<OrderedTrackIndexSet> computeEmptyTracksForAutoRepeat(GridTr ackSizingDirection) const;
131
132 bool hasAutoRepeatEmptyTracks(GridTrackSizingDirection) const;
133 bool isEmptyAutoRepeatTrack(GridTrackSizingDirection, size_t lineNumber) con st;
134
134 void placeItemsOnGrid(SizingOperation); 135 void placeItemsOnGrid(SizingOperation);
135 void populateExplicitGridAndOrderIterator(); 136 void populateExplicitGridAndOrderIterator();
136 std::unique_ptr<GridArea> createEmptyGridAreaAtSpecifiedPositionsOutsideGrid (const LayoutBox&, GridTrackSizingDirection, const GridSpan& specifiedPositions) const; 137 std::unique_ptr<GridArea> createEmptyGridAreaAtSpecifiedPositionsOutsideGrid (const LayoutBox&, GridTrackSizingDirection, const GridSpan& specifiedPositions) const;
137 void placeSpecifiedMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); 138 void placeSpecifiedMajorAxisItemsOnGrid(const Vector<LayoutBox*>&);
138 void placeAutoMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); 139 void placeAutoMajorAxisItemsOnGrid(const Vector<LayoutBox*>&);
139 void placeAutoMajorAxisItemOnGrid(LayoutBox&, std::pair<size_t, size_t>& aut oPlacementCursor); 140 void placeAutoMajorAxisItemOnGrid(LayoutBox&, std::pair<size_t, size_t>& aut oPlacementCursor);
140 GridTrackSizingDirection autoPlacementMajorAxisDirection() const; 141 GridTrackSizingDirection autoPlacementMajorAxisDirection() const;
141 GridTrackSizingDirection autoPlacementMinorAxisDirection() const; 142 GridTrackSizingDirection autoPlacementMinorAxisDirection() const;
142 143
143 void computeIntrinsicLogicalHeight(GridSizingData&); 144 void computeIntrinsicLogicalHeight(GridSizingData&);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 void applyStretchAlignmentToChildIfNeeded(LayoutBox&); 194 void applyStretchAlignmentToChildIfNeeded(LayoutBox&);
194 bool hasAutoMarginsInColumnAxis(const LayoutBox&) const; 195 bool hasAutoMarginsInColumnAxis(const LayoutBox&) const;
195 bool hasAutoMarginsInRowAxis(const LayoutBox&) const; 196 bool hasAutoMarginsInRowAxis(const LayoutBox&) const;
196 void updateAutoMarginsInColumnAxisIfNeeded(LayoutBox&); 197 void updateAutoMarginsInColumnAxisIfNeeded(LayoutBox&);
197 void updateAutoMarginsInRowAxisIfNeeded(LayoutBox&); 198 void updateAutoMarginsInRowAxisIfNeeded(LayoutBox&);
198 199
199 #if ENABLE(ASSERT) 200 #if ENABLE(ASSERT)
200 bool tracksAreWiderThanMinTrackBreadth(GridTrackSizingDirection, GridSizingD ata&); 201 bool tracksAreWiderThanMinTrackBreadth(GridTrackSizingDirection, GridSizingD ata&);
201 #endif 202 #endif
202 203
204 LayoutUnit gridGapForDirection(GridTrackSizingDirection) const;
205 LayoutUnit guttersSize(GridTrackSizingDirection, size_t startLine, size_t sp an) const;
206
203 size_t gridItemSpan(const LayoutBox&, GridTrackSizingDirection); 207 size_t gridItemSpan(const LayoutBox&, GridTrackSizingDirection);
204 bool spanningItemCrossesFlexibleSizedTracks(const GridSpan&, GridTrackSizing Direction, SizingOperation) const; 208 bool spanningItemCrossesFlexibleSizedTracks(const GridSpan&, GridTrackSizing Direction, SizingOperation) const;
205 209
206 size_t gridColumnCount() const; 210 size_t gridColumnCount() const;
207 size_t gridRowCount() const; 211 size_t gridRowCount() const;
208 212
209 bool isOrthogonalChild(const LayoutBox&) const; 213 bool isOrthogonalChild(const LayoutBox&) const;
210 GridTrackSizingDirection flowAwareDirectionForChild(const LayoutBox&, GridTr ackSizingDirection) const; 214 GridTrackSizingDirection flowAwareDirectionForChild(const LayoutBox&, GridTr ackSizingDirection) const;
211 215
212 typedef Vector<Vector<GridCell>> GridRepresentation; 216 typedef Vector<Vector<GridCell>> GridRepresentation;
(...skipping 11 matching lines...) Expand all
224 LayoutUnit m_minContentHeight { -1 }; 228 LayoutUnit m_minContentHeight { -1 };
225 LayoutUnit m_maxContentHeight { -1 }; 229 LayoutUnit m_maxContentHeight { -1 };
226 230
227 int m_smallestRowStart; 231 int m_smallestRowStart;
228 int m_smallestColumnStart; 232 int m_smallestColumnStart;
229 233
230 size_t m_autoRepeatColumns { 0 }; 234 size_t m_autoRepeatColumns { 0 };
231 size_t m_autoRepeatRows { 0 }; 235 size_t m_autoRepeatRows { 0 };
232 236
233 bool m_hasAnyOrthogonalChild; 237 bool m_hasAnyOrthogonalChild;
238
239 std::unique_ptr<OrderedTrackIndexSet> m_autoRepeatEmptyColumns { nullptr };
240 std::unique_ptr<OrderedTrackIndexSet> m_autoRepeatEmptyRows { nullptr };
234 }; 241 };
235 242
236 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); 243 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid());
237 244
238 } // namespace blink 245 } // namespace blink
239 246
240 #endif // LayoutGrid_h 247 #endif // LayoutGrid_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698