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