| 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 11 matching lines...) Expand all Loading... |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 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 #include <memory> | |
| 33 | 32 |
| 34 namespace blink { | 33 namespace blink { |
| 35 | 34 |
| 36 struct ContentAlignmentData; | 35 struct ContentAlignmentData; |
| 37 struct GridArea; | 36 struct GridArea; |
| 38 struct GridSpan; | 37 struct GridSpan; |
| 39 class GridTrack; | 38 class GridTrack; |
| 40 | 39 |
| 41 enum TrackSizeComputationPhase { | 40 enum TrackSizeComputationPhase { |
| 42 ResolveIntrinsicMinimums, | 41 ResolveIntrinsicMinimums, |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 LayoutUnit computeUsedBreadthOfMaxLength(const GridLength&, LayoutUnit usedB
readth, LayoutUnit maxBreadth) const; | 125 LayoutUnit computeUsedBreadthOfMaxLength(const GridLength&, LayoutUnit usedB
readth, LayoutUnit maxBreadth) const; |
| 127 void resolveContentBasedTrackSizingFunctions(GridTrackSizingDirection, GridS
izingData&); | 126 void resolveContentBasedTrackSizingFunctions(GridTrackSizingDirection, GridS
izingData&); |
| 128 | 127 |
| 129 void ensureGridSize(size_t maximumRowSize, size_t maximumColumnSize); | 128 void ensureGridSize(size_t maximumRowSize, size_t maximumColumnSize); |
| 130 void insertItemIntoGrid(LayoutBox&, const GridArea&); | 129 void insertItemIntoGrid(LayoutBox&, const GridArea&); |
| 131 | 130 |
| 132 size_t computeAutoRepeatTracksCount(GridTrackSizingDirection) const; | 131 size_t computeAutoRepeatTracksCount(GridTrackSizingDirection) const; |
| 133 | 132 |
| 134 void placeItemsOnGrid(); | 133 void placeItemsOnGrid(); |
| 135 void populateExplicitGridAndOrderIterator(); | 134 void populateExplicitGridAndOrderIterator(); |
| 136 std::unique_ptr<GridArea> createEmptyGridAreaAtSpecifiedPositionsOutsideGrid
(const LayoutBox&, GridTrackSizingDirection, const GridSpan& specifiedPositions)
const; | 135 PassOwnPtr<GridArea> createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(cons
t LayoutBox&, GridTrackSizingDirection, const GridSpan& specifiedPositions) cons
t; |
| 137 void placeSpecifiedMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); | 136 void placeSpecifiedMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); |
| 138 void placeAutoMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); | 137 void placeAutoMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); |
| 139 void placeAutoMajorAxisItemOnGrid(LayoutBox&, std::pair<size_t, size_t>& aut
oPlacementCursor); | 138 void placeAutoMajorAxisItemOnGrid(LayoutBox&, std::pair<size_t, size_t>& aut
oPlacementCursor); |
| 140 GridTrackSizingDirection autoPlacementMajorAxisDirection() const; | 139 GridTrackSizingDirection autoPlacementMajorAxisDirection() const; |
| 141 GridTrackSizingDirection autoPlacementMinorAxisDirection() const; | 140 GridTrackSizingDirection autoPlacementMinorAxisDirection() const; |
| 142 | 141 |
| 143 void computeIntrinsicLogicalHeight(GridSizingData&); | 142 void computeIntrinsicLogicalHeight(GridSizingData&); |
| 144 LayoutUnit computeTrackBasedLogicalHeight(const GridSizingData&) const; | 143 LayoutUnit computeTrackBasedLogicalHeight(const GridSizingData&) const; |
| 145 void computeTrackSizesForDirection(GridTrackSizingDirection, GridSizingData&
, LayoutUnit freeSpace); | 144 void computeTrackSizesForDirection(GridTrackSizingDirection, GridSizingData&
, LayoutUnit freeSpace); |
| 146 | 145 |
| 147 void layoutGridItems(GridSizingData&); | 146 void layoutGridItems(GridSizingData&); |
| 148 void prepareChildForPositionedLayout(LayoutBox&); | 147 void prepareChildForPositionedLayout(LayoutBox&); |
| 149 void layoutPositionedObjects(bool relayoutChildren, PositionedLayoutBehavior
= DefaultLayout); | 148 void layoutPositionedObjects(bool relayoutChildren, PositionedLayoutBehavior
= DefaultLayout); |
| 150 void offsetAndBreadthForPositionedChild(const LayoutBox&, GridTrackSizingDir
ection, LayoutUnit& offset, LayoutUnit& breadth); | 149 void offsetAndBreadthForPositionedChild(const LayoutBox&, GridTrackSizingDir
ection, LayoutUnit& offset, LayoutUnit& breadth); |
| 151 void populateGridPositionsForDirection(GridSizingData&, GridTrackSizingDirec
tion); | 150 void populateGridPositionsForDirection(GridSizingData&, GridTrackSizingDirec
tion); |
| 152 | 151 |
| 153 typedef struct GridItemsSpanGroupRange GridItemsSpanGroupRange; | 152 typedef struct GridItemsSpanGroupRange GridItemsSpanGroupRange; |
| 154 LayoutUnit currentItemSizeForTrackSizeComputationPhase(TrackSizeComputationP
hase, LayoutBox&, GridTrackSizingDirection, GridSizingData&); | 153 LayoutUnit currentItemSizeForTrackSizeComputationPhase(TrackSizeComputationP
hase, LayoutBox&, GridTrackSizingDirection, GridSizingData&); |
| 155 void resolveContentBasedTrackSizingFunctionsForNonSpanningItems(GridTrackSiz
ingDirection, const GridSpan&, LayoutBox& gridItem, GridTrack&, GridSizingData&)
; | 154 void resolveContentBasedTrackSizingFunctionsForNonSpanningItems(GridTrackSiz
ingDirection, const GridSpan&, LayoutBox& gridItem, GridTrack&, GridSizingData&)
; |
| 156 template <TrackSizeComputationPhase> void resolveContentBasedTrackSizingFunc
tionsForItems(GridTrackSizingDirection, GridSizingData&, const GridItemsSpanGrou
pRange&); | 155 template <TrackSizeComputationPhase> void resolveContentBasedTrackSizingFunc
tionsForItems(GridTrackSizingDirection, GridSizingData&, const GridItemsSpanGrou
pRange&); |
| 157 template <TrackSizeComputationPhase> void distributeSpaceToTracks(Vector<Gri
dTrack*>&, const Vector<GridTrack*>* growBeyondGrowthLimitsTracks, GridSizingDat
a&, LayoutUnit& availableLogicalSpace); | 156 template <TrackSizeComputationPhase> void distributeSpaceToTracks(Vector<Gri
dTrack*>&, const Vector<GridTrack*>* growBeyondGrowthLimitsTracks, GridSizingDat
a&, LayoutUnit& availableLogicalSpace); |
| 158 | 157 |
| 159 typedef HashSet<size_t, DefaultHash<size_t>::Hash, WTF::UnsignedWithZeroKeyH
ashTraits<size_t>> TrackIndexSet; | 158 typedef HashSet<size_t, DefaultHash<size_t>::Hash, WTF::UnsignedWithZeroKeyH
ashTraits<size_t>> TrackIndexSet; |
| 160 double computeFlexFactorUnitSize(const Vector<GridTrack>&, GridTrackSizingDi
rection, double flexFactorSum, LayoutUnit& leftOverSpace, const Vector<size_t, 8
>& flexibleTracksIndexes, std::unique_ptr<TrackIndexSet> tracksToTreatAsInflexib
le = nullptr) const; | 159 double computeFlexFactorUnitSize(const Vector<GridTrack>&, GridTrackSizingDi
rection, double flexFactorSum, LayoutUnit& leftOverSpace, const Vector<size_t, 8
>& flexibleTracksIndexes, PassOwnPtr<TrackIndexSet> tracksToTreatAsInflexible =
nullptr) const; |
| 161 double findFlexFactorUnitSize(const Vector<GridTrack>&, const GridSpan&, Gri
dTrackSizingDirection, LayoutUnit leftOverSpace) const; | 160 double findFlexFactorUnitSize(const Vector<GridTrack>&, const GridSpan&, Gri
dTrackSizingDirection, LayoutUnit leftOverSpace) const; |
| 162 | 161 |
| 163 const GridTrackSize& rawGridTrackSize(GridTrackSizingDirection, size_t) cons
t; | 162 const GridTrackSize& rawGridTrackSize(GridTrackSizingDirection, size_t) cons
t; |
| 164 GridTrackSize gridTrackSize(GridTrackSizingDirection, size_t, SizingOperatio
n = TrackSizing) const; | 163 GridTrackSize gridTrackSize(GridTrackSizingDirection, size_t, SizingOperatio
n = TrackSizing) const; |
| 165 | 164 |
| 166 bool updateOverrideContainingBlockContentSizeForChild(LayoutBox&, GridTrackS
izingDirection, GridSizingData&); | 165 bool updateOverrideContainingBlockContentSizeForChild(LayoutBox&, GridTrackS
izingDirection, GridSizingData&); |
| 167 LayoutUnit logicalHeightForChild(LayoutBox&, GridSizingData&); | 166 LayoutUnit logicalHeightForChild(LayoutBox&, GridSizingData&); |
| 168 LayoutUnit minSizeForChild(LayoutBox&, GridTrackSizingDirection, GridSizingD
ata&); | 167 LayoutUnit minSizeForChild(LayoutBox&, GridTrackSizingDirection, GridSizingD
ata&); |
| 169 LayoutUnit minContentForChild(LayoutBox&, GridTrackSizingDirection, GridSizi
ngData&); | 168 LayoutUnit minContentForChild(LayoutBox&, GridTrackSizingDirection, GridSizi
ngData&); |
| 170 LayoutUnit maxContentForChild(LayoutBox&, GridTrackSizingDirection, GridSizi
ngData&); | 169 LayoutUnit maxContentForChild(LayoutBox&, GridTrackSizingDirection, GridSizi
ngData&); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 225 |
| 227 size_t m_autoRepeatColumns { 0 }; | 226 size_t m_autoRepeatColumns { 0 }; |
| 228 size_t m_autoRepeatRows { 0 }; | 227 size_t m_autoRepeatRows { 0 }; |
| 229 }; | 228 }; |
| 230 | 229 |
| 231 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); | 230 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); |
| 232 | 231 |
| 233 } // namespace blink | 232 } // namespace blink |
| 234 | 233 |
| 235 #endif // LayoutGrid_h | 234 #endif // LayoutGrid_h |
| OLD | NEW |