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

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

Issue 1079563002: [CSS Grid Layout] Replace the usage of pointers to functions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | Source/core/layout/LayoutGrid.cpp » ('j') | 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 void placeAutoMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); 92 void placeAutoMajorAxisItemsOnGrid(const Vector<LayoutBox*>&);
93 void placeAutoMajorAxisItemOnGrid(LayoutBox&, std::pair<size_t, size_t>& aut oPlacementCursor); 93 void placeAutoMajorAxisItemOnGrid(LayoutBox&, std::pair<size_t, size_t>& aut oPlacementCursor);
94 GridTrackSizingDirection autoPlacementMajorAxisDirection() const; 94 GridTrackSizingDirection autoPlacementMajorAxisDirection() const;
95 GridTrackSizingDirection autoPlacementMinorAxisDirection() const; 95 GridTrackSizingDirection autoPlacementMinorAxisDirection() const;
96 96
97 void layoutGridItems(); 97 void layoutGridItems();
98 void layoutPositionedObjects(bool relayoutChildren, PositionedLayoutBehavior = DefaultLayout); 98 void layoutPositionedObjects(bool relayoutChildren, PositionedLayoutBehavior = DefaultLayout);
99 void offsetAndBreadthForPositionedChild(const LayoutBox&, GridTrackSizingDir ection, bool startIsAuto, bool endIsAuto, LayoutUnit& offset, LayoutUnit& breadt h); 99 void offsetAndBreadthForPositionedChild(const LayoutBox&, GridTrackSizingDir ection, bool startIsAuto, bool endIsAuto, LayoutUnit& offset, LayoutUnit& breadt h);
100 void populateGridPositions(const GridSizingData&); 100 void populateGridPositions(const GridSizingData&);
101 101
102 typedef LayoutUnit (LayoutGrid::* SizingFunction)(LayoutBox&, GridTrackSizin gDirection, Vector<GridTrack>&); 102 enum TrackSizeRestriction {
103 typedef const LayoutUnit& (GridTrack::* AccumulatorGetter)() const; 103 AllowInfinity,
104 typedef bool (GridTrackSize::* FilterFunction)() const; 104 ForbidInfinity,
105 };
106 enum TrackSizeComputationPhase {
107 ResolveIntrinsicMinimums,
108 ResolveMaxContentMinimums,
109 ResolveIntrinsicMaximums,
110 ResolveMaxContentMaximums,
111 MaximizeTracks,
112 };
113 static const LayoutUnit& trackSizeForTrackSizeComputationPhase(TrackSizeComp utationPhase, GridTrack&, TrackSizeRestriction);
cbiesinger 2015/04/30 23:33:01 So the patch looks good except that I don't see an
dsinclair 2015/05/08 15:50:28 Can GridTrack be const?
svillar 2015/05/11 07:11:45 Acknowledged.
114 static bool shouldProcessTrackForTrackSizeComputationPhase(TrackSizeComputat ionPhase, const GridTrackSize&);
dsinclair 2015/05/08 15:50:27 These are only called in this class, and don't see
svillar 2015/05/11 07:11:45 Sure.
115 static bool trackShouldGrowBeyondGrowthLimitsForTrackSizeComputationPhase(Tr ackSizeComputationPhase, const GridTrackSize&);
116 static void updateTrackSizeForTrackSizeComputationPhase(TrackSizeComputation Phase, GridTrack&);
dsinclair 2015/05/08 15:50:28 Can GridTrack be const?
svillar 2015/05/11 07:11:45 Acknowledged.
105 typedef struct GridItemsSpanGroupRange GridItemsSpanGroupRange; 117 typedef struct GridItemsSpanGroupRange GridItemsSpanGroupRange;
118 LayoutUnit currentItemSizeForTrackSizeComputationPhase(TrackSizeComputationP hase, LayoutBox&, GridTrackSizingDirection, Vector<GridTrack>& columnTracks);
106 void resolveContentBasedTrackSizingFunctionsForNonSpanningItems(GridTrackSiz ingDirection, const GridCoordinate&, LayoutBox& gridItem, GridTrack&, Vector<Gri dTrack>& columnTracks); 119 void resolveContentBasedTrackSizingFunctionsForNonSpanningItems(GridTrackSiz ingDirection, const GridCoordinate&, LayoutBox& gridItem, GridTrack&, Vector<Gri dTrack>& columnTracks);
107 void resolveContentBasedTrackSizingFunctionsForItems(GridTrackSizingDirectio n, GridSizingData&, const GridItemsSpanGroupRange&, FilterFunction, SizingFuncti on, AccumulatorGetter, AccumulatorGrowFunction, FilterFunction growAboveMaxBread thFilterFunction = nullptr); 120 template <TrackSizeComputationPhase> void resolveContentBasedTrackSizingFunc tionsForItems(GridTrackSizingDirection, GridSizingData&, const GridItemsSpanGrou pRange&);
108 void distributeSpaceToTracks(Vector<GridTrack*>&, const Vector<GridTrack*>* growBeyondGrowthLimitsTracks, AccumulatorGetter, GridSizingData&, LayoutUnit& av ailableLogicalSpace); 121 template <TrackSizeComputationPhase> void distributeSpaceToTracks(Vector<Gri dTrack*>&, const Vector<GridTrack*>* growBeyondGrowthLimitsTracks, GridSizingDat a&, LayoutUnit& availableLogicalSpace);
dsinclair 2015/05/08 15:50:27 Why template these and not just pass in TrackSizeC
svillar 2015/05/11 07:11:45 The reason why I used templates is because we alwa
109 122
110 double computeNormalizedFractionBreadth(Vector<GridTrack>&, const GridSpan& tracksSpan, GridTrackSizingDirection, LayoutUnit availableLogicalSpace) const; 123 double computeNormalizedFractionBreadth(Vector<GridTrack>&, const GridSpan& tracksSpan, GridTrackSizingDirection, LayoutUnit availableLogicalSpace) const;
111 124
112 GridTrackSize gridTrackSize(GridTrackSizingDirection, size_t) const; 125 GridTrackSize gridTrackSize(GridTrackSizingDirection, size_t) const;
113 126
114 LayoutUnit logicalHeightForChild(LayoutBox&, Vector<GridTrack>&); 127 LayoutUnit logicalHeightForChild(LayoutBox&, Vector<GridTrack>&);
115 LayoutUnit minContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G ridTrack>& columnTracks); 128 LayoutUnit minContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G ridTrack>& columnTracks);
116 LayoutUnit maxContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G ridTrack>& columnTracks); 129 LayoutUnit maxContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G ridTrack>& columnTracks);
117 LayoutUnit startOfColumnForChild(const LayoutBox& child) const; 130 LayoutUnit startOfColumnForChild(const LayoutBox& child) const;
118 LayoutUnit endOfColumnForChild(const LayoutBox& child) const; 131 LayoutUnit endOfColumnForChild(const LayoutBox& child) const;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 OrderIterator m_orderIterator; 184 OrderIterator m_orderIterator;
172 Vector<LayoutBox*> m_gridItemsOverflowingGridArea; 185 Vector<LayoutBox*> m_gridItemsOverflowingGridArea;
173 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap; 186 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap;
174 }; 187 };
175 188
176 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); 189 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid());
177 190
178 } // namespace blink 191 } // namespace blink
179 192
180 #endif // LayoutGrid_h 193 #endif // LayoutGrid_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/layout/LayoutGrid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698