Chromium Code Reviews| 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 14 matching lines...) Expand all Loading... | |
| 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/GridResolvedPosition.h" | 31 #include "core/style/GridResolvedPosition.h" |
| 32 | 32 |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 struct ContentAlignmentData; | |
| 35 struct GridCoordinate; | 36 struct GridCoordinate; |
| 36 struct GridSpan; | 37 struct GridSpan; |
| 37 class GridTrack; | 38 class GridTrack; |
| 38 | 39 |
| 40 | |
|
svillar
2015/07/08 07:14:08
Careful, extra line.
jfernandez
2015/07/08 11:16:00
Done.
| |
| 39 enum TrackSizeComputationPhase { | 41 enum TrackSizeComputationPhase { |
| 40 ResolveIntrinsicMinimums, | 42 ResolveIntrinsicMinimums, |
| 41 ResolveMaxContentMinimums, | 43 ResolveMaxContentMinimums, |
| 42 ResolveIntrinsicMaximums, | 44 ResolveIntrinsicMaximums, |
| 43 ResolveMaxContentMaximums, | 45 ResolveMaxContentMaximums, |
| 44 MaximizeTracks, | 46 MaximizeTracks, |
| 45 }; | 47 }; |
| 46 enum GridAxisPosition {GridAxisStart, GridAxisEnd, GridAxisCenter}; | 48 enum GridAxisPosition {GridAxisStart, GridAxisEnd, GridAxisCenter}; |
| 47 | 49 |
| 48 class LayoutGrid final : public LayoutBlock { | 50 class LayoutGrid final : public LayoutBlock { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 PassOwnPtr<GridCoordinate> createEmptyGridAreaAtSpecifiedPositionsOutsideGri d(const LayoutBox&, GridTrackSizingDirection, const GridSpan& specifiedPositions ) const; | 122 PassOwnPtr<GridCoordinate> createEmptyGridAreaAtSpecifiedPositionsOutsideGri d(const LayoutBox&, GridTrackSizingDirection, const GridSpan& specifiedPositions ) const; |
| 121 void placeSpecifiedMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); | 123 void placeSpecifiedMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); |
| 122 void placeAutoMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); | 124 void placeAutoMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); |
| 123 void placeAutoMajorAxisItemOnGrid(LayoutBox&, std::pair<size_t, size_t>& aut oPlacementCursor); | 125 void placeAutoMajorAxisItemOnGrid(LayoutBox&, std::pair<size_t, size_t>& aut oPlacementCursor); |
| 124 GridTrackSizingDirection autoPlacementMajorAxisDirection() const; | 126 GridTrackSizingDirection autoPlacementMajorAxisDirection() const; |
| 125 GridTrackSizingDirection autoPlacementMinorAxisDirection() const; | 127 GridTrackSizingDirection autoPlacementMinorAxisDirection() const; |
| 126 | 128 |
| 127 void layoutGridItems(); | 129 void layoutGridItems(); |
| 128 void layoutPositionedObjects(bool relayoutChildren, PositionedLayoutBehavior = DefaultLayout); | 130 void layoutPositionedObjects(bool relayoutChildren, PositionedLayoutBehavior = DefaultLayout); |
| 129 void offsetAndBreadthForPositionedChild(const LayoutBox&, GridTrackSizingDir ection, bool startIsAuto, bool endIsAuto, LayoutUnit& offset, LayoutUnit& breadt h); | 131 void offsetAndBreadthForPositionedChild(const LayoutBox&, GridTrackSizingDir ection, bool startIsAuto, bool endIsAuto, LayoutUnit& offset, LayoutUnit& breadt h); |
| 130 void populateGridPositions(const GridSizingData&); | 132 void populateGridPositions(GridSizingData&, LayoutUnit availableSpaceForColu mns, LayoutUnit availableSpaceForRows); |
| 131 | 133 |
| 132 typedef struct GridItemsSpanGroupRange GridItemsSpanGroupRange; | 134 typedef struct GridItemsSpanGroupRange GridItemsSpanGroupRange; |
| 133 LayoutUnit currentItemSizeForTrackSizeComputationPhase(TrackSizeComputationP hase, LayoutBox&, GridTrackSizingDirection, Vector<GridTrack>& columnTracks); | 135 LayoutUnit currentItemSizeForTrackSizeComputationPhase(TrackSizeComputationP hase, LayoutBox&, GridTrackSizingDirection, Vector<GridTrack>& columnTracks); |
| 134 void resolveContentBasedTrackSizingFunctionsForNonSpanningItems(GridTrackSiz ingDirection, const GridCoordinate&, LayoutBox& gridItem, GridTrack&, Vector<Gri dTrack>& columnTracks); | 136 void resolveContentBasedTrackSizingFunctionsForNonSpanningItems(GridTrackSiz ingDirection, const GridCoordinate&, LayoutBox& gridItem, GridTrack&, Vector<Gri dTrack>& columnTracks); |
| 135 template <TrackSizeComputationPhase> void resolveContentBasedTrackSizingFunc tionsForItems(GridTrackSizingDirection, GridSizingData&, const GridItemsSpanGrou pRange&); | 137 template <TrackSizeComputationPhase> void resolveContentBasedTrackSizingFunc tionsForItems(GridTrackSizingDirection, GridSizingData&, const GridItemsSpanGrou pRange&); |
| 136 template <TrackSizeComputationPhase> void distributeSpaceToTracks(Vector<Gri dTrack*>&, const Vector<GridTrack*>* growBeyondGrowthLimitsTracks, GridSizingDat a&, LayoutUnit& availableLogicalSpace); | 138 template <TrackSizeComputationPhase> void distributeSpaceToTracks(Vector<Gri dTrack*>&, const Vector<GridTrack*>* growBeyondGrowthLimitsTracks, GridSizingDat a&, LayoutUnit& availableLogicalSpace); |
| 137 | 139 |
| 138 double computeNormalizedFractionBreadth(Vector<GridTrack>&, const GridSpan& tracksSpan, GridTrackSizingDirection, LayoutUnit availableLogicalSpace) const; | 140 double computeNormalizedFractionBreadth(Vector<GridTrack>&, const GridSpan& tracksSpan, GridTrackSizingDirection, LayoutUnit availableLogicalSpace) const; |
| 139 | 141 |
| 140 GridTrackSize gridTrackSize(GridTrackSizingDirection, size_t) const; | 142 GridTrackSize gridTrackSize(GridTrackSizingDirection, size_t) const; |
| 141 | 143 |
| 142 LayoutUnit logicalHeightForChild(LayoutBox&, Vector<GridTrack>&); | 144 LayoutUnit logicalHeightForChild(LayoutBox&, Vector<GridTrack>&); |
| 143 LayoutUnit minContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G ridTrack>& columnTracks); | 145 LayoutUnit minContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G ridTrack>& columnTracks); |
| 144 LayoutUnit maxContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G ridTrack>& columnTracks); | 146 LayoutUnit maxContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G ridTrack>& columnTracks); |
| 145 GridAxisPosition columnAxisPositionForChild(const LayoutBox&) const; | 147 GridAxisPosition columnAxisPositionForChild(const LayoutBox&) const; |
| 146 GridAxisPosition rowAxisPositionForChild(const LayoutBox&) const; | 148 GridAxisPosition rowAxisPositionForChild(const LayoutBox&) const; |
| 147 LayoutUnit columnPositionForChild(const LayoutBox&) const; | 149 LayoutUnit columnPositionForChild(const LayoutBox&) const; |
| 148 LayoutUnit rowPositionForChild(const LayoutBox&) const; | 150 LayoutUnit rowPositionForChild(const LayoutBox&) const; |
| 149 void computeContentPositionAndDistributionRowOffset(LayoutUnit availableFree Space, GridSizingData&) const; | 151 ContentAlignmentData computeContentPositionAndDistributionRowOffset(LayoutUn it availableFreeSpace, unsigned numberOfGridTracks) const; |
| 150 void computeContentPositionAndDistributionColumnOffset(LayoutUnit availableF reeSpace, GridSizingData&) const; | 152 ContentAlignmentData computeContentPositionAndDistributionColumnOffset(Layou tUnit availableFreeSpace, unsigned numberOfGridTracks) const; |
| 151 LayoutPoint findChildLogicalPosition(const LayoutBox&, GridSizingData&) cons t; | 153 LayoutPoint findChildLogicalPosition(const LayoutBox&, GridSizingData&) cons t; |
| 152 GridCoordinate cachedGridCoordinate(const LayoutBox&) const; | 154 GridCoordinate cachedGridCoordinate(const LayoutBox&) const; |
| 153 | 155 |
| 154 LayoutUnit gridAreaBreadthForChild(const LayoutBox& child, GridTrackSizingDi rection, const Vector<GridTrack>&) const; | 156 LayoutUnit gridAreaBreadthForChild(const LayoutBox& child, GridTrackSizingDi rection, const Vector<GridTrack>&) const; |
| 157 LayoutUnit gridAreaBreadthForChildIncludingAlignmentOffsets(const LayoutBox& , GridTrackSizingDirection, const GridSizingData&) const; | |
| 158 | |
| 159 void applyStretchAlignmentToTracksIfNeeded(GridTrackSizingDirection, GridSiz ingData&, LayoutUnit availableSpace); | |
| 155 | 160 |
| 156 virtual void paintChildren(const PaintInfo&, const LayoutPoint&) override; | 161 virtual void paintChildren(const PaintInfo&, const LayoutPoint&) override; |
| 157 bool allowedToStretchLogicalHeightForChild(const LayoutBox& child) const; | 162 bool allowedToStretchLogicalHeightForChild(const LayoutBox& child) const; |
| 158 bool needToStretchChildLogicalHeight(const LayoutBox&) const; | 163 bool needToStretchChildLogicalHeight(const LayoutBox&) const; |
| 159 LayoutUnit childIntrinsicHeight(const LayoutBox&) const; | 164 LayoutUnit childIntrinsicHeight(const LayoutBox&) const; |
| 160 LayoutUnit childIntrinsicWidth(const LayoutBox&) const; | 165 LayoutUnit childIntrinsicWidth(const LayoutBox&) const; |
| 161 LayoutUnit intrinsicLogicalHeightForChild(const LayoutBox&) const; | 166 LayoutUnit intrinsicLogicalHeightForChild(const LayoutBox&) const; |
| 162 LayoutUnit marginLogicalHeightForChild(const LayoutBox&) const; | 167 LayoutUnit marginLogicalHeightForChild(const LayoutBox&) const; |
| 163 LayoutUnit computeMarginLogicalHeightForChild(const LayoutBox&) const; | 168 LayoutUnit computeMarginLogicalHeightForChild(const LayoutBox&) const; |
| 164 LayoutUnit availableAlignmentSpaceForChildBeforeStretching(LayoutUnit gridAr eaBreadthForChild, const LayoutBox&) const; | 169 LayoutUnit availableAlignmentSpaceForChildBeforeStretching(LayoutUnit gridAr eaBreadthForChild, const LayoutBox&) const; |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 193 OrderIterator m_orderIterator; | 198 OrderIterator m_orderIterator; |
| 194 Vector<LayoutBox*> m_gridItemsOverflowingGridArea; | 199 Vector<LayoutBox*> m_gridItemsOverflowingGridArea; |
| 195 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap; | 200 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap; |
| 196 }; | 201 }; |
| 197 | 202 |
| 198 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); | 203 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); |
| 199 | 204 |
| 200 } // namespace blink | 205 } // namespace blink |
| 201 | 206 |
| 202 #endif // LayoutGrid_h | 207 #endif // LayoutGrid_h |
| OLD | NEW |