OLD | NEW |
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 LayoutUnit computeTrackBasedLogicalHeight(const GridSizingData&) const; | 130 LayoutUnit computeTrackBasedLogicalHeight(const GridSizingData&) const; |
131 void computeTrackSizesForDirection(GridTrackSizingDirection, GridSizingData&
, LayoutUnit freeSpace); | 131 void computeTrackSizesForDirection(GridTrackSizingDirection, GridSizingData&
, LayoutUnit freeSpace); |
132 | 132 |
133 void layoutGridItems(GridSizingData&); | 133 void layoutGridItems(GridSizingData&); |
134 void prepareChildForPositionedLayout(LayoutBox&); | 134 void prepareChildForPositionedLayout(LayoutBox&); |
135 void layoutPositionedObjects(bool relayoutChildren, PositionedLayoutBehavior
= DefaultLayout); | 135 void layoutPositionedObjects(bool relayoutChildren, PositionedLayoutBehavior
= DefaultLayout); |
136 void offsetAndBreadthForPositionedChild(const LayoutBox&, GridTrackSizingDir
ection, LayoutUnit& offset, LayoutUnit& breadth); | 136 void offsetAndBreadthForPositionedChild(const LayoutBox&, GridTrackSizingDir
ection, LayoutUnit& offset, LayoutUnit& breadth); |
137 void populateGridPositions(GridSizingData&); | 137 void populateGridPositions(GridSizingData&); |
138 | 138 |
139 typedef struct GridItemsSpanGroupRange GridItemsSpanGroupRange; | 139 typedef struct GridItemsSpanGroupRange GridItemsSpanGroupRange; |
140 LayoutUnit currentItemSizeForTrackSizeComputationPhase(TrackSizeComputationP
hase, LayoutBox&, GridTrackSizingDirection, Vector<GridTrack>& columnTracks); | 140 LayoutUnit currentItemSizeForTrackSizeComputationPhase(TrackSizeComputationP
hase, LayoutBox&, GridTrackSizingDirection, const GridSizingData&); |
141 void resolveContentBasedTrackSizingFunctionsForNonSpanningItems(GridTrackSiz
ingDirection, const GridSpan&, LayoutBox& gridItem, GridTrack&, Vector<GridTrack
>& columnTracks); | 141 void resolveContentBasedTrackSizingFunctionsForNonSpanningItems(GridTrackSiz
ingDirection, const GridSpan&, LayoutBox& gridItem, GridTrack&, const GridSizing
Data&); |
142 template <TrackSizeComputationPhase> void resolveContentBasedTrackSizingFunc
tionsForItems(GridTrackSizingDirection, GridSizingData&, const GridItemsSpanGrou
pRange&); | 142 template <TrackSizeComputationPhase> void resolveContentBasedTrackSizingFunc
tionsForItems(GridTrackSizingDirection, GridSizingData&, const GridItemsSpanGrou
pRange&); |
143 template <TrackSizeComputationPhase> void distributeSpaceToTracks(Vector<Gri
dTrack*>&, const Vector<GridTrack*>* growBeyondGrowthLimitsTracks, GridSizingDat
a&, LayoutUnit& availableLogicalSpace); | 143 template <TrackSizeComputationPhase> void distributeSpaceToTracks(Vector<Gri
dTrack*>&, const Vector<GridTrack*>* growBeyondGrowthLimitsTracks, GridSizingDat
a&, LayoutUnit& availableLogicalSpace); |
144 | 144 |
145 typedef HashSet<size_t, DefaultHash<size_t>::Hash, WTF::UnsignedWithZeroKeyH
ashTraits<size_t>> TrackIndexSet; | 145 typedef HashSet<size_t, DefaultHash<size_t>::Hash, WTF::UnsignedWithZeroKeyH
ashTraits<size_t>> TrackIndexSet; |
146 double computeFlexFactorUnitSize(const Vector<GridTrack>&, GridTrackSizingDi
rection, double flexFactorSum, LayoutUnit& leftOverSpace, const Vector<size_t, 8
>& flexibleTracksIndexes, PassOwnPtr<TrackIndexSet> tracksToTreatAsInflexible =
nullptr) const; | 146 double computeFlexFactorUnitSize(const Vector<GridTrack>&, GridTrackSizingDi
rection, double flexFactorSum, LayoutUnit& leftOverSpace, const Vector<size_t, 8
>& flexibleTracksIndexes, PassOwnPtr<TrackIndexSet> tracksToTreatAsInflexible =
nullptr) const; |
147 double findFlexFactorUnitSize(const Vector<GridTrack>&, const GridSpan&, Gri
dTrackSizingDirection, LayoutUnit leftOverSpace) const; | 147 double findFlexFactorUnitSize(const Vector<GridTrack>&, const GridSpan&, Gri
dTrackSizingDirection, LayoutUnit leftOverSpace) const; |
148 | 148 |
149 GridTrackSize gridTrackSize(GridTrackSizingDirection, size_t) const; | 149 GridTrackSize gridTrackSize(GridTrackSizingDirection, size_t) const; |
150 | 150 |
151 LayoutUnit logicalHeightForChild(LayoutBox&, Vector<GridTrack>&); | 151 LayoutUnit logicalHeightForChild(LayoutBox&, const GridSizingData&); |
152 LayoutUnit minSizeForChild(LayoutBox&, GridTrackSizingDirection, Vector<Grid
Track>& columnTracks); | 152 LayoutUnit minSizeForChild(LayoutBox&, GridTrackSizingDirection, const GridS
izingData&); |
153 LayoutUnit minContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G
ridTrack>& columnTracks); | 153 LayoutUnit minContentForChild(LayoutBox&, GridTrackSizingDirection, const Gr
idSizingData&); |
154 LayoutUnit maxContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G
ridTrack>& columnTracks); | 154 LayoutUnit maxContentForChild(LayoutBox&, GridTrackSizingDirection, const Gr
idSizingData&); |
155 GridAxisPosition columnAxisPositionForChild(const LayoutBox&) const; | 155 GridAxisPosition columnAxisPositionForChild(const LayoutBox&) const; |
156 GridAxisPosition rowAxisPositionForChild(const LayoutBox&) const; | 156 GridAxisPosition rowAxisPositionForChild(const LayoutBox&) const; |
157 LayoutUnit rowAxisOffsetForChild(const LayoutBox&, GridSizingData&) const; | 157 LayoutUnit rowAxisOffsetForChild(const LayoutBox&, GridSizingData&) const; |
158 LayoutUnit columnAxisOffsetForChild(const LayoutBox&, GridSizingData&) const
; | 158 LayoutUnit columnAxisOffsetForChild(const LayoutBox&, GridSizingData&) const
; |
159 ContentAlignmentData computeContentPositionAndDistributionOffset(GridTrackSi
zingDirection, const LayoutUnit& availableFreeSpace, unsigned numberOfGridTracks
) const; | 159 ContentAlignmentData computeContentPositionAndDistributionOffset(GridTrackSi
zingDirection, const LayoutUnit& availableFreeSpace, unsigned numberOfGridTracks
) const; |
160 LayoutPoint findChildLogicalPosition(const LayoutBox&, GridSizingData&) cons
t; | 160 LayoutPoint findChildLogicalPosition(const LayoutBox&, GridSizingData&) cons
t; |
161 GridArea cachedGridArea(const LayoutBox&) const; | 161 GridArea cachedGridArea(const LayoutBox&) const; |
162 GridSpan cachedGridSpan(const LayoutBox&, GridTrackSizingDirection) const; | 162 GridSpan cachedGridSpan(const LayoutBox&, GridTrackSizingDirection) const; |
163 | 163 |
164 LayoutUnit gridAreaBreadthForChild(const LayoutBox& child, GridTrackSizingDi
rection, const Vector<GridTrack>&) const; | 164 LayoutUnit gridAreaBreadthForChild(const LayoutBox& child, GridTrackSizingDi
rection, const GridSizingData&) const; |
165 LayoutUnit gridAreaBreadthForChildIncludingAlignmentOffsets(const LayoutBox&
, GridTrackSizingDirection, const GridSizingData&) const; | 165 LayoutUnit gridAreaBreadthForChildIncludingAlignmentOffsets(const LayoutBox&
, GridTrackSizingDirection, const GridSizingData&) const; |
| 166 LayoutUnit assumedRowsBreadthForOrthogonalChild(const LayoutBox&) const; |
166 | 167 |
167 void applyStretchAlignmentToTracksIfNeeded(GridTrackSizingDirection, GridSiz
ingData&); | 168 void applyStretchAlignmentToTracksIfNeeded(GridTrackSizingDirection, GridSiz
ingData&); |
168 | 169 |
169 void paintChildren(const PaintInfo&, const LayoutPoint&) const override; | 170 void paintChildren(const PaintInfo&, const LayoutPoint&) const override; |
170 | 171 |
171 bool needToStretchChildLogicalHeight(const LayoutBox&) const; | 172 bool needToStretchChildLogicalHeight(const LayoutBox&) const; |
172 LayoutUnit childIntrinsicHeight(const LayoutBox&) const; | 173 LayoutUnit childIntrinsicHeight(const LayoutBox&) const; |
173 LayoutUnit childIntrinsicWidth(const LayoutBox&) const; | 174 LayoutUnit childIntrinsicWidth(const LayoutBox&) const; |
174 LayoutUnit intrinsicLogicalHeightForChild(const LayoutBox&) const; | 175 LayoutUnit intrinsicLogicalHeightForChild(const LayoutBox&) const; |
175 LayoutUnit marginLogicalHeightForChild(const LayoutBox&) const; | 176 LayoutUnit marginLogicalHeightForChild(const LayoutBox&) const; |
(...skipping 17 matching lines...) Expand all Loading... |
193 ASSERT(!m_gridIsDirty); | 194 ASSERT(!m_gridIsDirty); |
194 return m_grid[0].size(); | 195 return m_grid[0].size(); |
195 } | 196 } |
196 size_t gridRowCount() const | 197 size_t gridRowCount() const |
197 { | 198 { |
198 ASSERT(!m_gridIsDirty); | 199 ASSERT(!m_gridIsDirty); |
199 return m_grid.size(); | 200 return m_grid.size(); |
200 } | 201 } |
201 | 202 |
202 bool hasDefiniteLogicalSize(GridTrackSizingDirection) const; | 203 bool hasDefiniteLogicalSize(GridTrackSizingDirection) const; |
| 204 bool hasAnyOrthogonalChild() const; |
| 205 bool gridLengthIsIndefinite(const GridLength&, GridTrackSizingDirection) con
st; |
| 206 LayoutUnit overrideContainingBlockBreadthForChild(const LayoutBox&, GridTrac
kSizingDirection); |
| 207 void setOverrideContainingBlockBreadthForChild(LayoutBox&, GridTrackSizingDi
rection, LayoutUnit breadth); |
| 208 |
| 209 bool isOrthogonalChild(const LayoutBox&) const; |
| 210 GridTrackSizingDirection flowAwareDirectionForChild(const LayoutBox&, GridTr
ackSizingDirection) const; |
203 | 211 |
204 typedef Vector<Vector<GridCell>> GridRepresentation; | 212 typedef Vector<Vector<GridCell>> GridRepresentation; |
205 GridRepresentation m_grid; | 213 GridRepresentation m_grid; |
206 bool m_gridIsDirty; | 214 bool m_gridIsDirty; |
207 Vector<LayoutUnit> m_rowPositions; | 215 Vector<LayoutUnit> m_rowPositions; |
208 Vector<LayoutUnit> m_columnPositions; | 216 Vector<LayoutUnit> m_columnPositions; |
209 HashMap<const LayoutBox*, GridArea> m_gridItemArea; | 217 HashMap<const LayoutBox*, GridArea> m_gridItemArea; |
210 OrderIterator m_orderIterator; | 218 OrderIterator m_orderIterator; |
211 Vector<LayoutBox*> m_gridItemsOverflowingGridArea; | 219 Vector<LayoutBox*> m_gridItemsOverflowingGridArea; |
212 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap; | 220 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap; |
213 | 221 |
214 LayoutUnit m_minContentHeight { -1 }; | 222 LayoutUnit m_minContentHeight { -1 }; |
215 LayoutUnit m_maxContentHeight { -1 }; | 223 LayoutUnit m_maxContentHeight { -1 }; |
216 | 224 |
217 int m_smallestRowStart; | 225 int m_smallestRowStart; |
218 int m_smallestColumnStart; | 226 int m_smallestColumnStart; |
219 }; | 227 }; |
220 | 228 |
221 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); | 229 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); |
222 | 230 |
223 } // namespace blink | 231 } // namespace blink |
224 | 232 |
225 #endif // LayoutGrid_h | 233 #endif // LayoutGrid_h |
OLD | NEW |