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

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

Issue 2287533002: [css-grid] Remove a duplicated auto repeat computation for intrinsic sizes (Closed)
Patch Set: Patch Created 4 years, 2 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 class LayoutGrid final : public LayoutBlock { 51 class LayoutGrid final : public LayoutBlock {
52 public: 52 public:
53 explicit LayoutGrid(Element*); 53 explicit LayoutGrid(Element*);
54 ~LayoutGrid() override; 54 ~LayoutGrid() override;
55 55
56 static LayoutGrid* createAnonymous(Document*); 56 static LayoutGrid* createAnonymous(Document*);
57 const char* name() const override { return "LayoutGrid"; } 57 const char* name() const override { return "LayoutGrid"; }
58 58
59 void layoutBlock(bool relayoutChildren) override; 59 void layoutBlock(bool relayoutChildren) override;
60 60
61 void dirtyGrid(); 61 void dirtyGrid() const;
Manuel Rego 2016/10/06 12:31:30 I still don't get why we want to make this method
svillar 2016/10/06 13:14:33 Because we want to use it in the intrinsic size co
62 62
63 Vector<LayoutUnit> trackSizesForComputedStyle(GridTrackSizingDirection) cons t; 63 Vector<LayoutUnit> trackSizesForComputedStyle(GridTrackSizingDirection) cons t;
64 64
65 const Vector<LayoutUnit>& columnPositions() const 65 const Vector<LayoutUnit>& columnPositions() const
66 { 66 {
67 ASSERT(!m_gridIsDirty); 67 ASSERT(!m_gridIsDirty);
68 return m_columnPositions; 68 return m_columnPositions;
69 } 69 }
70 70
71 const Vector<LayoutUnit>& rowPositions() const 71 const Vector<LayoutUnit>& rowPositions() const
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 struct GridSizingData; 118 struct GridSizingData;
119 enum SizingOperation { TrackSizing, IntrinsicSizeComputation }; 119 enum SizingOperation { TrackSizing, IntrinsicSizeComputation };
120 void computeUsedBreadthOfGridTracks(GridTrackSizingDirection, GridSizingData &, LayoutUnit& baseSizesWithoutMaximization, LayoutUnit& growthLimitsWithoutMaxi mization) const; 120 void computeUsedBreadthOfGridTracks(GridTrackSizingDirection, GridSizingData &, LayoutUnit& baseSizesWithoutMaximization, LayoutUnit& growthLimitsWithoutMaxi mization) const;
121 LayoutUnit computeUsedBreadthOfMinLength(const GridTrackSize&, LayoutUnit ma xBreadth) const; 121 LayoutUnit computeUsedBreadthOfMinLength(const GridTrackSize&, LayoutUnit ma xBreadth) const;
122 LayoutUnit computeUsedBreadthOfMaxLength(const GridTrackSize&, LayoutUnit us edBreadth, LayoutUnit maxBreadth) const; 122 LayoutUnit computeUsedBreadthOfMaxLength(const GridTrackSize&, LayoutUnit us edBreadth, LayoutUnit maxBreadth) const;
123 void resolveContentBasedTrackSizingFunctions(GridTrackSizingDirection, GridS izingData&) const; 123 void resolveContentBasedTrackSizingFunctions(GridTrackSizingDirection, GridS izingData&) const;
124 124
125 void ensureGridSize(size_t maximumRowSize, size_t maximumColumnSize); 125 void ensureGridSize(size_t maximumRowSize, size_t maximumColumnSize);
126 void insertItemIntoGrid(LayoutBox&, const GridArea&); 126 void insertItemIntoGrid(LayoutBox&, const GridArea&);
127 127
128 void updateAutoRepeatTracksAndSetDirtyIfNeeded(SizingOperation) const;
128 size_t computeAutoRepeatTracksCount(GridTrackSizingDirection, SizingOperatio n) const; 129 size_t computeAutoRepeatTracksCount(GridTrackSizingDirection, SizingOperatio n) const;
129 130
130 typedef ListHashSet<size_t> OrderedTrackIndexSet; 131 typedef ListHashSet<size_t> OrderedTrackIndexSet;
131 std::unique_ptr<OrderedTrackIndexSet> computeEmptyTracksForAutoRepeat(GridTr ackSizingDirection) const; 132 std::unique_ptr<OrderedTrackIndexSet> computeEmptyTracksForAutoRepeat(GridTr ackSizingDirection) const;
132 133
133 bool hasAutoRepeatEmptyTracks(GridTrackSizingDirection) const; 134 bool hasAutoRepeatEmptyTracks(GridTrackSizingDirection) const;
134 bool isEmptyAutoRepeatTrack(GridTrackSizingDirection, size_t lineNumber) con st; 135 bool isEmptyAutoRepeatTrack(GridTrackSizingDirection, size_t lineNumber) con st;
135 136
136 void placeItemsOnGrid(SizingOperation); 137 void placeItemsOnGrid();
137 void populateExplicitGridAndOrderIterator(); 138 void populateExplicitGridAndOrderIterator();
138 std::unique_ptr<GridArea> createEmptyGridAreaAtSpecifiedPositionsOutsideGrid (const LayoutBox&, GridTrackSizingDirection, const GridSpan& specifiedPositions) const; 139 std::unique_ptr<GridArea> createEmptyGridAreaAtSpecifiedPositionsOutsideGrid (const LayoutBox&, GridTrackSizingDirection, const GridSpan& specifiedPositions) const;
139 void placeSpecifiedMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); 140 void placeSpecifiedMajorAxisItemsOnGrid(const Vector<LayoutBox*>&);
140 void placeAutoMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); 141 void placeAutoMajorAxisItemsOnGrid(const Vector<LayoutBox*>&);
141 void placeAutoMajorAxisItemOnGrid(LayoutBox&, std::pair<size_t, size_t>& aut oPlacementCursor); 142 void placeAutoMajorAxisItemOnGrid(LayoutBox&, std::pair<size_t, size_t>& aut oPlacementCursor);
142 GridTrackSizingDirection autoPlacementMajorAxisDirection() const; 143 GridTrackSizingDirection autoPlacementMajorAxisDirection() const;
143 GridTrackSizingDirection autoPlacementMinorAxisDirection() const; 144 GridTrackSizingDirection autoPlacementMinorAxisDirection() const;
144 145
145 void computeTrackSizesForIndefiniteSize(GridTrackSizingDirection, GridSizing Data&, LayoutUnit& minIntrinsicSize, LayoutUnit& maxIntrinsicSize) const; 146 void computeTrackSizesForIndefiniteSize(GridTrackSizingDirection, GridSizing Data&, LayoutUnit& minIntrinsicSize, LayoutUnit& maxIntrinsicSize) const;
146 LayoutUnit computeTrackBasedLogicalHeight(const GridSizingData&) const; 147 LayoutUnit computeTrackBasedLogicalHeight(const GridSizingData&) const;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 218
218 size_t gridColumnCount() const; 219 size_t gridColumnCount() const;
219 size_t gridRowCount() const; 220 size_t gridRowCount() const;
220 221
221 bool isOrthogonalChild(const LayoutBox&) const; 222 bool isOrthogonalChild(const LayoutBox&) const;
222 GridTrackSizingDirection flowAwareDirectionForChild(const LayoutBox&, GridTr ackSizingDirection) const; 223 GridTrackSizingDirection flowAwareDirectionForChild(const LayoutBox&, GridTr ackSizingDirection) const;
223 224
224 bool cachedHasDefiniteLogicalHeight() const; 225 bool cachedHasDefiniteLogicalHeight() const;
225 226
226 typedef Vector<Vector<GridCell>> GridRepresentation; 227 typedef Vector<Vector<GridCell>> GridRepresentation;
227 GridRepresentation m_grid; 228 mutable GridRepresentation m_grid;
228 bool m_gridIsDirty; 229 mutable bool m_gridIsDirty;
229 Vector<LayoutUnit> m_rowPositions; 230 Vector<LayoutUnit> m_rowPositions;
Manuel Rego 2016/10/06 12:31:30 Why some attributes are mutables and other don't?
svillar 2016/10/06 13:14:33 Why do you want to make them all mutable or none?
230 Vector<LayoutUnit> m_columnPositions; 231 Vector<LayoutUnit> m_columnPositions;
231 LayoutUnit m_offsetBetweenColumns; 232 LayoutUnit m_offsetBetweenColumns;
232 LayoutUnit m_offsetBetweenRows; 233 LayoutUnit m_offsetBetweenRows;
233 HashMap<const LayoutBox*, GridArea> m_gridItemArea; 234 mutable HashMap<const LayoutBox*, GridArea> m_gridItemArea;
234 OrderIterator m_orderIterator; 235 OrderIterator m_orderIterator;
235 Vector<LayoutBox*> m_gridItemsOverflowingGridArea; 236 mutable Vector<LayoutBox*> m_gridItemsOverflowingGridArea;
236 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap; 237 mutable HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap;
237 238
238 LayoutUnit m_minContentHeight { -1 }; 239 LayoutUnit m_minContentHeight { -1 };
239 LayoutUnit m_maxContentHeight { -1 }; 240 LayoutUnit m_maxContentHeight { -1 };
240 241
241 int m_smallestRowStart; 242 int m_smallestRowStart;
242 int m_smallestColumnStart; 243 int m_smallestColumnStart;
243 244
244 size_t m_autoRepeatColumns { 0 }; 245 mutable size_t m_autoRepeatColumns { 0 };
245 size_t m_autoRepeatRows { 0 }; 246 mutable size_t m_autoRepeatRows { 0 };
246 247
247 bool m_hasAnyOrthogonalChild; 248 bool m_hasAnyOrthogonalChild;
248 249
249 std::unique_ptr<OrderedTrackIndexSet> m_autoRepeatEmptyColumns { nullptr }; 250 mutable std::unique_ptr<OrderedTrackIndexSet> m_autoRepeatEmptyColumns { nul lptr };
250 std::unique_ptr<OrderedTrackIndexSet> m_autoRepeatEmptyRows { nullptr }; 251 mutable std::unique_ptr<OrderedTrackIndexSet> m_autoRepeatEmptyRows { nullpt r };
251 252
252 Optional<bool> m_hasDefiniteLogicalHeight; 253 Optional<bool> m_hasDefiniteLogicalHeight;
253 }; 254 };
254 255
255 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); 256 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid());
256 257
257 } // namespace blink 258 } // namespace blink
258 259
259 #endif // LayoutGrid_h 260 #endif // LayoutGrid_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698