| 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 15 matching lines...) Expand all Loading... |
| 26 #ifndef LayoutGrid_h | 26 #ifndef LayoutGrid_h |
| 27 #define LayoutGrid_h | 27 #define LayoutGrid_h |
| 28 | 28 |
| 29 #include "core/layout/LayoutBlock.h" | 29 #include "core/layout/LayoutBlock.h" |
| 30 #include "core/layout/OrderIterator.h" | 30 #include "core/layout/OrderIterator.h" |
| 31 #include "core/style/GridPositionsResolver.h" | 31 #include "core/style/GridPositionsResolver.h" |
| 32 | 32 |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 struct ContentAlignmentData; | 35 struct ContentAlignmentData; |
| 36 struct GridCoordinate; | 36 struct GridArea; |
| 37 struct GridSpan; | 37 struct GridSpan; |
| 38 class GridTrack; | 38 class GridTrack; |
| 39 | 39 |
| 40 enum TrackSizeComputationPhase { | 40 enum TrackSizeComputationPhase { |
| 41 ResolveIntrinsicMinimums, | 41 ResolveIntrinsicMinimums, |
| 42 ResolveContentBasedMinimums, | 42 ResolveContentBasedMinimums, |
| 43 ResolveMaxContentMinimums, | 43 ResolveMaxContentMinimums, |
| 44 ResolveIntrinsicMaximums, | 44 ResolveIntrinsicMaximums, |
| 45 ResolveMaxContentMaximums, | 45 ResolveMaxContentMaximums, |
| 46 MaximizeTracks, | 46 MaximizeTracks, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 class GridIterator; | 110 class GridIterator; |
| 111 struct GridSizingData; | 111 struct GridSizingData; |
| 112 enum AvailableSpaceType {AvailableSpaceDefinite, AvailableSpaceIndefinite}; | 112 enum AvailableSpaceType {AvailableSpaceDefinite, AvailableSpaceIndefinite}; |
| 113 void computeUsedBreadthOfGridTracks(GridTrackSizingDirection, GridSizingData
&, LayoutUnit& baseSizesWithoutMaximization, LayoutUnit& growthLimitsWithoutMaxi
mization, AvailableSpaceType); | 113 void computeUsedBreadthOfGridTracks(GridTrackSizingDirection, GridSizingData
&, LayoutUnit& baseSizesWithoutMaximization, LayoutUnit& growthLimitsWithoutMaxi
mization, AvailableSpaceType); |
| 114 LayoutUnit computeUsedBreadthOfMinLength(const GridLength&, LayoutUnit maxBr
eadth) const; | 114 LayoutUnit computeUsedBreadthOfMinLength(const GridLength&, LayoutUnit maxBr
eadth) const; |
| 115 LayoutUnit computeUsedBreadthOfMaxLength(const GridLength&, LayoutUnit usedB
readth, LayoutUnit maxBreadth) const; | 115 LayoutUnit computeUsedBreadthOfMaxLength(const GridLength&, LayoutUnit usedB
readth, LayoutUnit maxBreadth) const; |
| 116 void resolveContentBasedTrackSizingFunctions(GridTrackSizingDirection, GridS
izingData&); | 116 void resolveContentBasedTrackSizingFunctions(GridTrackSizingDirection, GridS
izingData&); |
| 117 | 117 |
| 118 void ensureGridSize(size_t maximumRowSize, size_t maximumColumnSize); | 118 void ensureGridSize(size_t maximumRowSize, size_t maximumColumnSize); |
| 119 void insertItemIntoGrid(LayoutBox&, const GridCoordinate&); | 119 void insertItemIntoGrid(LayoutBox&, const GridArea&); |
| 120 void placeItemsOnGrid(); | 120 void placeItemsOnGrid(); |
| 121 void populateExplicitGridAndOrderIterator(); | 121 void populateExplicitGridAndOrderIterator(); |
| 122 PassOwnPtr<GridCoordinate> createEmptyGridAreaAtSpecifiedPositionsOutsideGri
d(const LayoutBox&, GridTrackSizingDirection, const GridSpan& specifiedPositions
) const; | 122 PassOwnPtr<GridArea> createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(cons
t LayoutBox&, GridTrackSizingDirection, const GridSpan& specifiedPositions) cons
t; |
| 123 void placeSpecifiedMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); | 123 void placeSpecifiedMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); |
| 124 void placeAutoMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); | 124 void placeAutoMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); |
| 125 void placeAutoMajorAxisItemOnGrid(LayoutBox&, std::pair<size_t, size_t>& aut
oPlacementCursor); | 125 void placeAutoMajorAxisItemOnGrid(LayoutBox&, std::pair<size_t, size_t>& aut
oPlacementCursor); |
| 126 GridTrackSizingDirection autoPlacementMajorAxisDirection() const; | 126 GridTrackSizingDirection autoPlacementMajorAxisDirection() const; |
| 127 GridTrackSizingDirection autoPlacementMinorAxisDirection() const; | 127 GridTrackSizingDirection autoPlacementMinorAxisDirection() const; |
| 128 | 128 |
| 129 void computeIntrinsicLogicalHeight(GridSizingData&); | 129 void computeIntrinsicLogicalHeight(GridSizingData&); |
| 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 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 151 LayoutUnit logicalHeightForChild(LayoutBox&, Vector<GridTrack>&); | 151 LayoutUnit logicalHeightForChild(LayoutBox&, Vector<GridTrack>&); |
| 152 LayoutUnit minSizeForChild(LayoutBox&, GridTrackSizingDirection, Vector<Grid
Track>& columnTracks); | 152 LayoutUnit minSizeForChild(LayoutBox&, GridTrackSizingDirection, Vector<Grid
Track>& columnTracks); |
| 153 LayoutUnit minContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G
ridTrack>& columnTracks); | 153 LayoutUnit minContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G
ridTrack>& columnTracks); |
| 154 LayoutUnit maxContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G
ridTrack>& columnTracks); | 154 LayoutUnit maxContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G
ridTrack>& columnTracks); |
| 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&) const; | 157 LayoutUnit rowAxisOffsetForChild(const LayoutBox&) const; |
| 158 LayoutUnit columnAxisOffsetForChild(const LayoutBox&) const; | 158 LayoutUnit columnAxisOffsetForChild(const LayoutBox&) 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 GridCoordinate cachedGridCoordinate(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 Vector<GridTrack>&) const; |
| 165 LayoutUnit gridAreaBreadthForChildIncludingAlignmentOffsets(const LayoutBox&
, GridTrackSizingDirection, const GridSizingData&) const; | 165 LayoutUnit gridAreaBreadthForChildIncludingAlignmentOffsets(const LayoutBox&
, GridTrackSizingDirection, const GridSizingData&) const; |
| 166 | 166 |
| 167 void applyStretchAlignmentToTracksIfNeeded(GridTrackSizingDirection, GridSiz
ingData&); | 167 void applyStretchAlignmentToTracksIfNeeded(GridTrackSizingDirection, GridSiz
ingData&); |
| 168 | 168 |
| 169 void paintChildren(const PaintInfo&, const LayoutPoint&) const override; | 169 void paintChildren(const PaintInfo&, const LayoutPoint&) const override; |
| 170 | 170 |
| 171 bool needToStretchChildLogicalHeight(const LayoutBox&) const; | 171 bool needToStretchChildLogicalHeight(const LayoutBox&) const; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 199 return m_grid.size(); | 199 return m_grid.size(); |
| 200 } | 200 } |
| 201 | 201 |
| 202 bool hasDefiniteLogicalSize(GridTrackSizingDirection) const; | 202 bool hasDefiniteLogicalSize(GridTrackSizingDirection) const; |
| 203 | 203 |
| 204 typedef Vector<Vector<GridCell>> GridRepresentation; | 204 typedef Vector<Vector<GridCell>> GridRepresentation; |
| 205 GridRepresentation m_grid; | 205 GridRepresentation m_grid; |
| 206 bool m_gridIsDirty; | 206 bool m_gridIsDirty; |
| 207 Vector<LayoutUnit> m_rowPositions; | 207 Vector<LayoutUnit> m_rowPositions; |
| 208 Vector<LayoutUnit> m_columnPositions; | 208 Vector<LayoutUnit> m_columnPositions; |
| 209 HashMap<const LayoutBox*, GridCoordinate> m_gridItemCoordinate; | 209 HashMap<const LayoutBox*, GridArea> m_gridItemArea; |
| 210 OrderIterator m_orderIterator; | 210 OrderIterator m_orderIterator; |
| 211 Vector<LayoutBox*> m_gridItemsOverflowingGridArea; | 211 Vector<LayoutBox*> m_gridItemsOverflowingGridArea; |
| 212 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap; | 212 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap; |
| 213 | 213 |
| 214 LayoutUnit m_minContentHeight { -1 }; | 214 LayoutUnit m_minContentHeight { -1 }; |
| 215 LayoutUnit m_maxContentHeight { -1 }; | 215 LayoutUnit m_maxContentHeight { -1 }; |
| 216 | 216 |
| 217 int m_smallestRowStart; | 217 int m_smallestRowStart; |
| 218 int m_smallestColumnStart; | 218 int m_smallestColumnStart; |
| 219 }; | 219 }; |
| 220 | 220 |
| 221 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); | 221 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); |
| 222 | 222 |
| 223 } // namespace blink | 223 } // namespace blink |
| 224 | 224 |
| 225 #endif // LayoutGrid_h | 225 #endif // LayoutGrid_h |
| OLD | NEW |