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

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: Moved helpers to blink namespace Created 5 years, 7 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 19 matching lines...) Expand all
30 #include "core/layout/OrderIterator.h" 30 #include "core/layout/OrderIterator.h"
31 #include "core/style/GridResolvedPosition.h" 31 #include "core/style/GridResolvedPosition.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 struct GridCoordinate; 35 struct GridCoordinate;
36 struct GridSpan; 36 struct GridSpan;
37 class GridTrack; 37 class GridTrack;
38 class GridItemWithSpan; 38 class GridItemWithSpan;
39 39
40 enum TrackSizeComputationPhase {
41 ResolveIntrinsicMinimums,
42 ResolveMaxContentMinimums,
43 ResolveIntrinsicMaximums,
44 ResolveMaxContentMaximums,
45 MaximizeTracks,
46 };
47
40 class LayoutGrid final : public LayoutBlock { 48 class LayoutGrid final : public LayoutBlock {
41 public: 49 public:
42 LayoutGrid(Element*); 50 LayoutGrid(Element*);
43 virtual ~LayoutGrid(); 51 virtual ~LayoutGrid();
44 52
45 virtual const char* name() const override { return "LayoutGrid"; } 53 virtual const char* name() const override { return "LayoutGrid"; }
46 54
47 virtual void layoutBlock(bool relayoutChildren) override; 55 virtual void layoutBlock(bool relayoutChildren) override;
48 56
49 virtual bool canCollapseAnonymousBlockChild() const override { return false; } 57 virtual bool canCollapseAnonymousBlockChild() const override { return false; }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 void placeAutoMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); 100 void placeAutoMajorAxisItemsOnGrid(const Vector<LayoutBox*>&);
93 void placeAutoMajorAxisItemOnGrid(LayoutBox&, std::pair<size_t, size_t>& aut oPlacementCursor); 101 void placeAutoMajorAxisItemOnGrid(LayoutBox&, std::pair<size_t, size_t>& aut oPlacementCursor);
94 GridTrackSizingDirection autoPlacementMajorAxisDirection() const; 102 GridTrackSizingDirection autoPlacementMajorAxisDirection() const;
95 GridTrackSizingDirection autoPlacementMinorAxisDirection() const; 103 GridTrackSizingDirection autoPlacementMinorAxisDirection() const;
96 104
97 void layoutGridItems(); 105 void layoutGridItems();
98 void layoutPositionedObjects(bool relayoutChildren, PositionedLayoutBehavior = DefaultLayout); 106 void layoutPositionedObjects(bool relayoutChildren, PositionedLayoutBehavior = DefaultLayout);
99 void offsetAndBreadthForPositionedChild(const LayoutBox&, GridTrackSizingDir ection, bool startIsAuto, bool endIsAuto, LayoutUnit& offset, LayoutUnit& breadt h); 107 void offsetAndBreadthForPositionedChild(const LayoutBox&, GridTrackSizingDir ection, bool startIsAuto, bool endIsAuto, LayoutUnit& offset, LayoutUnit& breadt h);
100 void populateGridPositions(const GridSizingData&); 108 void populateGridPositions(const GridSizingData&);
101 109
102 typedef LayoutUnit (LayoutGrid::* SizingFunction)(LayoutBox&, GridTrackSizin gDirection, Vector<GridTrack>&);
103 typedef const LayoutUnit& (GridTrack::* AccumulatorGetter)() const;
104 typedef bool (GridTrackSize::* FilterFunction)() const;
105 typedef struct GridItemsSpanGroupRange GridItemsSpanGroupRange; 110 typedef struct GridItemsSpanGroupRange GridItemsSpanGroupRange;
111 LayoutUnit currentItemSizeForTrackSizeComputationPhase(TrackSizeComputationP hase, LayoutBox&, GridTrackSizingDirection, Vector<GridTrack>& columnTracks);
106 void resolveContentBasedTrackSizingFunctionsForNonSpanningItems(GridTrackSiz ingDirection, const GridCoordinate&, LayoutBox& gridItem, GridTrack&, Vector<Gri dTrack>& columnTracks); 112 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); 113 template <TrackSizeComputationPhase> void resolveContentBasedTrackSizingFunc tionsForItems(GridTrackSizingDirection, GridSizingData&, const GridItemsSpanGrou pRange&);
108 void distributeSpaceToTracks(Vector<GridTrack*>&, const Vector<GridTrack*>* growBeyondGrowthLimitsTracks, AccumulatorGetter, GridSizingData&, LayoutUnit& av ailableLogicalSpace); 114 template <TrackSizeComputationPhase> void distributeSpaceToTracks(Vector<Gri dTrack*>&, const Vector<GridTrack*>* growBeyondGrowthLimitsTracks, GridSizingDat a&, LayoutUnit& availableLogicalSpace);
109 115
110 double computeNormalizedFractionBreadth(Vector<GridTrack>&, const GridSpan& tracksSpan, GridTrackSizingDirection, LayoutUnit availableLogicalSpace) const; 116 double computeNormalizedFractionBreadth(Vector<GridTrack>&, const GridSpan& tracksSpan, GridTrackSizingDirection, LayoutUnit availableLogicalSpace) const;
111 117
112 GridTrackSize gridTrackSize(GridTrackSizingDirection, size_t) const; 118 GridTrackSize gridTrackSize(GridTrackSizingDirection, size_t) const;
113 119
114 LayoutUnit logicalHeightForChild(LayoutBox&, Vector<GridTrack>&); 120 LayoutUnit logicalHeightForChild(LayoutBox&, Vector<GridTrack>&);
115 LayoutUnit minContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G ridTrack>& columnTracks); 121 LayoutUnit minContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G ridTrack>& columnTracks);
116 LayoutUnit maxContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G ridTrack>& columnTracks); 122 LayoutUnit maxContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G ridTrack>& columnTracks);
117 LayoutUnit startOfColumnForChild(const LayoutBox& child) const; 123 LayoutUnit startOfColumnForChild(const LayoutBox& child) const;
118 LayoutUnit endOfColumnForChild(const LayoutBox& child) const; 124 LayoutUnit endOfColumnForChild(const LayoutBox& child) const;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 OrderIterator m_orderIterator; 177 OrderIterator m_orderIterator;
172 Vector<LayoutBox*> m_gridItemsOverflowingGridArea; 178 Vector<LayoutBox*> m_gridItemsOverflowingGridArea;
173 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap; 179 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap;
174 }; 180 };
175 181
176 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); 182 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid());
177 183
178 } // namespace blink 184 } // namespace blink
179 185
180 #endif // LayoutGrid_h 186 #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