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

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

Issue 1125703002: [CSS Grid Layout] Refactoring of grid's alignment logic (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch rebased. Created 5 years, 6 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 25 matching lines...) Expand all
36 struct GridSpan; 36 struct GridSpan;
37 class GridTrack; 37 class GridTrack;
38 38
39 enum TrackSizeComputationPhase { 39 enum TrackSizeComputationPhase {
40 ResolveIntrinsicMinimums, 40 ResolveIntrinsicMinimums,
41 ResolveMaxContentMinimums, 41 ResolveMaxContentMinimums,
42 ResolveIntrinsicMaximums, 42 ResolveIntrinsicMaximums,
43 ResolveMaxContentMaximums, 43 ResolveMaxContentMaximums,
44 MaximizeTracks, 44 MaximizeTracks,
45 }; 45 };
46 enum GridAxisPosition {GridAxisStart, GridAxisEnd, GridAxisCenter};
46 47
47 class LayoutGrid final : public LayoutBlock { 48 class LayoutGrid final : public LayoutBlock {
48 public: 49 public:
49 explicit LayoutGrid(Element*); 50 explicit LayoutGrid(Element*);
50 virtual ~LayoutGrid(); 51 virtual ~LayoutGrid();
51 52
52 virtual const char* name() const override { return "LayoutGrid"; } 53 virtual const char* name() const override { return "LayoutGrid"; }
53 54
54 virtual void layoutBlock(bool relayoutChildren) override; 55 virtual void layoutBlock(bool relayoutChildren) override;
55 56
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 template <TrackSizeComputationPhase> void resolveContentBasedTrackSizingFunc tionsForItems(GridTrackSizingDirection, GridSizingData&, const GridItemsSpanGrou pRange&); 135 template <TrackSizeComputationPhase> void resolveContentBasedTrackSizingFunc tionsForItems(GridTrackSizingDirection, GridSizingData&, const GridItemsSpanGrou pRange&);
135 template <TrackSizeComputationPhase> void distributeSpaceToTracks(Vector<Gri dTrack*>&, const Vector<GridTrack*>* growBeyondGrowthLimitsTracks, GridSizingDat a&, LayoutUnit& availableLogicalSpace); 136 template <TrackSizeComputationPhase> void distributeSpaceToTracks(Vector<Gri dTrack*>&, const Vector<GridTrack*>* growBeyondGrowthLimitsTracks, GridSizingDat a&, LayoutUnit& availableLogicalSpace);
136 137
137 double computeNormalizedFractionBreadth(Vector<GridTrack>&, const GridSpan& tracksSpan, GridTrackSizingDirection, LayoutUnit availableLogicalSpace) const; 138 double computeNormalizedFractionBreadth(Vector<GridTrack>&, const GridSpan& tracksSpan, GridTrackSizingDirection, LayoutUnit availableLogicalSpace) const;
138 139
139 GridTrackSize gridTrackSize(GridTrackSizingDirection, size_t) const; 140 GridTrackSize gridTrackSize(GridTrackSizingDirection, size_t) const;
140 141
141 LayoutUnit logicalHeightForChild(LayoutBox&, Vector<GridTrack>&); 142 LayoutUnit logicalHeightForChild(LayoutBox&, Vector<GridTrack>&);
142 LayoutUnit minContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G ridTrack>& columnTracks); 143 LayoutUnit minContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G ridTrack>& columnTracks);
143 LayoutUnit maxContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G ridTrack>& columnTracks); 144 LayoutUnit maxContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G ridTrack>& columnTracks);
144 LayoutUnit startOfColumnForChild(const LayoutBox& child) const; 145 GridAxisPosition columnAxisPositionForChild(const LayoutBox&) const;
145 LayoutUnit endOfColumnForChild(const LayoutBox& child) const; 146 GridAxisPosition rowAxisPositionForChild(const LayoutBox&) const;
146 LayoutUnit columnPositionLeft(const LayoutBox&) const;
147 LayoutUnit columnPositionRight(const LayoutBox&) const;
148 LayoutUnit centeredColumnPositionForChild(const LayoutBox&) const;
149 LayoutUnit columnPositionForChild(const LayoutBox&) const; 147 LayoutUnit columnPositionForChild(const LayoutBox&) const;
150 LayoutUnit startOfRowForChild(const LayoutBox& child) const;
151 LayoutUnit endOfRowForChild(const LayoutBox& child) const;
152 LayoutUnit centeredRowPositionForChild(const LayoutBox&) const;
153 LayoutUnit rowPositionForChild(const LayoutBox&) const; 148 LayoutUnit rowPositionForChild(const LayoutBox&) const;
154 void computeContentPositionAndDistributionRowOffset(LayoutUnit availableFree Space, GridSizingData&) const; 149 void computeContentPositionAndDistributionRowOffset(LayoutUnit availableFree Space, GridSizingData&) const;
155 void computeContentPositionAndDistributionColumnOffset(LayoutUnit availableF reeSpace, GridSizingData&) const; 150 void computeContentPositionAndDistributionColumnOffset(LayoutUnit availableF reeSpace, GridSizingData&) const;
156 LayoutPoint findChildLogicalPosition(const LayoutBox&, GridSizingData&) cons t; 151 LayoutPoint findChildLogicalPosition(const LayoutBox&, GridSizingData&) cons t;
157 GridCoordinate cachedGridCoordinate(const LayoutBox&) const; 152 GridCoordinate cachedGridCoordinate(const LayoutBox&) const;
158 153
159 LayoutUnit gridAreaBreadthForChild(const LayoutBox& child, GridTrackSizingDi rection, const Vector<GridTrack>&) const; 154 LayoutUnit gridAreaBreadthForChild(const LayoutBox& child, GridTrackSizingDi rection, const Vector<GridTrack>&) const;
160 155
161 virtual void paintChildren(const PaintInfo&, const LayoutPoint&) override; 156 virtual void paintChildren(const PaintInfo&, const LayoutPoint&) override;
162 bool allowedToStretchLogicalHeightForChild(const LayoutBox& child) const; 157 bool allowedToStretchLogicalHeightForChild(const LayoutBox& child) const;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 OrderIterator m_orderIterator; 193 OrderIterator m_orderIterator;
199 Vector<LayoutBox*> m_gridItemsOverflowingGridArea; 194 Vector<LayoutBox*> m_gridItemsOverflowingGridArea;
200 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap; 195 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap;
201 }; 196 };
202 197
203 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); 198 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid());
204 199
205 } // namespace blink 200 } // namespace blink
206 201
207 #endif // LayoutGrid_h 202 #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