| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 int paintIndexForGridItem(const LayoutBox* layoutBox) | 88 int paintIndexForGridItem(const LayoutBox* layoutBox) |
| 89 { | 89 { |
| 90 ASSERT_WITH_SECURITY_IMPLICATION(!m_gridIsDirty); | 90 ASSERT_WITH_SECURITY_IMPLICATION(!m_gridIsDirty); |
| 91 return m_gridItemsIndexesMap.get(layoutBox); | 91 return m_gridItemsIndexesMap.get(layoutBox); |
| 92 } | 92 } |
| 93 | 93 |
| 94 private: | 94 private: |
| 95 bool isOfType(LayoutObjectType type) const override { return type == LayoutO
bjectLayoutGrid || LayoutBlock::isOfType(type); } | 95 bool isOfType(LayoutObjectType type) const override { return type == LayoutO
bjectLayoutGrid || LayoutBlock::isOfType(type); } |
| 96 void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit&
maxLogicalWidth) const override; | 96 void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit&
maxLogicalWidth) const override; |
| 97 LayoutUnit computeContentAndScrollbarLogicalHeightUsing(SizeType, const Leng
th& height, LayoutUnit intrinsicContentHeight) const override; |
| 98 LayoutUnit computeIntrinsicLogicalContentHeightUsing(const Length& logicalHe
ightLength, LayoutUnit intrinsicContentHeight, LayoutUnit borderAndPadding) cons
t override; |
| 97 | 99 |
| 98 void addChild(LayoutObject* newChild, LayoutObject* beforeChild = nullptr) o
verride; | 100 void addChild(LayoutObject* newChild, LayoutObject* beforeChild = nullptr) o
verride; |
| 99 void removeChild(LayoutObject*) override; | 101 void removeChild(LayoutObject*) override; |
| 100 | 102 |
| 101 void styleDidChange(StyleDifference, const ComputedStyle*) override; | 103 void styleDidChange(StyleDifference, const ComputedStyle*) override; |
| 102 | 104 |
| 103 bool explicitGridDidResize(const ComputedStyle&) const; | 105 bool explicitGridDidResize(const ComputedStyle&) const; |
| 104 bool namedGridLinesDefinitionDidChange(const ComputedStyle&) const; | 106 bool namedGridLinesDefinitionDidChange(const ComputedStyle&) const; |
| 105 | 107 |
| 106 class GridIterator; | 108 class GridIterator; |
| 107 struct GridSizingData; | 109 struct GridSizingData; |
| 108 bool gridElementIsShrinkToFit(); | 110 bool gridElementIsShrinkToFit(); |
| 109 void computeUsedBreadthOfGridTracks(GridTrackSizingDirection, GridSizingData
&, LayoutUnit& availableLogicalSpace); | 111 void computeUsedBreadthOfGridTracks(GridTrackSizingDirection, GridSizingData
&, LayoutUnit& availableLogicalSpace); |
| 110 LayoutUnit computeUsedBreadthOfMinLength(GridTrackSizingDirection, const Gri
dLength&) const; | 112 LayoutUnit computeUsedBreadthOfMinLength(GridTrackSizingDirection, const Gri
dLength&) const; |
| 111 LayoutUnit computeUsedBreadthOfMaxLength(GridTrackSizingDirection, const Gri
dLength&, LayoutUnit usedBreadth) const; | 113 LayoutUnit computeUsedBreadthOfMaxLength(GridTrackSizingDirection, const Gri
dLength&, LayoutUnit usedBreadth) const; |
| 112 LayoutUnit computeUsedBreadthOfSpecifiedLength(GridTrackSizingDirection, con
st Length&) const; | 114 LayoutUnit computeUsedBreadthOfSpecifiedLength(GridTrackSizingDirection, con
st Length&) const; |
| 113 void resolveContentBasedTrackSizingFunctions(GridTrackSizingDirection, GridS
izingData&); | 115 void resolveContentBasedTrackSizingFunctions(GridTrackSizingDirection, GridS
izingData&); |
| 114 | 116 |
| 115 void ensureGridSize(size_t maximumRowIndex, size_t maximumColumnIndex); | 117 void ensureGridSize(size_t maximumRowIndex, size_t maximumColumnIndex); |
| 116 void insertItemIntoGrid(LayoutBox&, const GridCoordinate&); | 118 void insertItemIntoGrid(LayoutBox&, const GridCoordinate&); |
| 117 void placeItemsOnGrid(); | 119 void placeItemsOnGrid(); |
| 118 void populateExplicitGridAndOrderIterator(); | 120 void populateExplicitGridAndOrderIterator(); |
| 119 PassOwnPtr<GridCoordinate> createEmptyGridAreaAtSpecifiedPositionsOutsideGri
d(const LayoutBox&, GridTrackSizingDirection, const GridSpan& specifiedPositions
) const; | 121 PassOwnPtr<GridCoordinate> createEmptyGridAreaAtSpecifiedPositionsOutsideGri
d(const LayoutBox&, GridTrackSizingDirection, const GridSpan& specifiedPositions
) const; |
| 120 void placeSpecifiedMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); | 122 void placeSpecifiedMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); |
| 121 void placeAutoMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); | 123 void placeAutoMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); |
| 122 void placeAutoMajorAxisItemOnGrid(LayoutBox&, std::pair<size_t, size_t>& aut
oPlacementCursor); | 124 void placeAutoMajorAxisItemOnGrid(LayoutBox&, std::pair<size_t, size_t>& aut
oPlacementCursor); |
| 123 GridTrackSizingDirection autoPlacementMajorAxisDirection() const; | 125 GridTrackSizingDirection autoPlacementMajorAxisDirection() const; |
| 124 GridTrackSizingDirection autoPlacementMinorAxisDirection() const; | 126 GridTrackSizingDirection autoPlacementMinorAxisDirection() const; |
| 125 | 127 |
| 126 void layoutGridItems(); | 128 void computeGridTrackSizes(GridSizingData&, LayoutUnit& freeSpaceForColumns,
LayoutUnit& freeSpaceForRows); |
| 129 LayoutUnit computeTrackBasedLogicalHeight(const GridSizingData&) const; |
| 130 void updateLogicalHeightDependentGridTracks(const LayoutUnit& trackBasedLogi
calHeight, GridSizingData&, LayoutUnit& availableSpaceForRows); |
| 131 |
| 132 void layoutGridItems(GridSizingData&, LayoutUnit& freeSpaceForColumns, Layou
tUnit& freeSpaceForRows); |
| 127 void prepareChildForPositionedLayout(LayoutBox&); | 133 void prepareChildForPositionedLayout(LayoutBox&); |
| 128 void layoutPositionedObjects(bool relayoutChildren, PositionedLayoutBehavior
= DefaultLayout); | 134 void layoutPositionedObjects(bool relayoutChildren, PositionedLayoutBehavior
= DefaultLayout); |
| 129 void offsetAndBreadthForPositionedChild(const LayoutBox&, GridTrackSizingDir
ection, LayoutUnit& offset, LayoutUnit& breadth); | 135 void offsetAndBreadthForPositionedChild(const LayoutBox&, GridTrackSizingDir
ection, LayoutUnit& offset, LayoutUnit& breadth); |
| 130 void populateGridPositions(GridSizingData&, LayoutUnit availableSpaceForColu
mns, LayoutUnit availableSpaceForRows); | 136 void populateGridPositions(GridSizingData&, LayoutUnit availableSpaceForColu
mns, LayoutUnit availableSpaceForRows); |
| 131 | 137 |
| 132 typedef struct GridItemsSpanGroupRange GridItemsSpanGroupRange; | 138 typedef struct GridItemsSpanGroupRange GridItemsSpanGroupRange; |
| 133 LayoutUnit currentItemSizeForTrackSizeComputationPhase(TrackSizeComputationP
hase, LayoutBox&, GridTrackSizingDirection, Vector<GridTrack>& columnTracks); | 139 LayoutUnit currentItemSizeForTrackSizeComputationPhase(TrackSizeComputationP
hase, LayoutBox&, GridTrackSizingDirection, Vector<GridTrack>& columnTracks); |
| 134 void resolveContentBasedTrackSizingFunctionsForNonSpanningItems(GridTrackSiz
ingDirection, const GridCoordinate&, LayoutBox& gridItem, GridTrack&, Vector<Gri
dTrack>& columnTracks); | 140 void resolveContentBasedTrackSizingFunctionsForNonSpanningItems(GridTrackSiz
ingDirection, const GridCoordinate&, LayoutBox& gridItem, GridTrack&, Vector<Gri
dTrack>& columnTracks); |
| 135 template <TrackSizeComputationPhase> void resolveContentBasedTrackSizingFunc
tionsForItems(GridTrackSizingDirection, GridSizingData&, const GridItemsSpanGrou
pRange&); | 141 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); | 142 template <TrackSizeComputationPhase> void distributeSpaceToTracks(Vector<Gri
dTrack*>&, const Vector<GridTrack*>* growBeyondGrowthLimitsTracks, GridSizingDat
a&, LayoutUnit& availableLogicalSpace); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 197 |
| 192 typedef Vector<Vector<GridCell>> GridRepresentation; | 198 typedef Vector<Vector<GridCell>> GridRepresentation; |
| 193 GridRepresentation m_grid; | 199 GridRepresentation m_grid; |
| 194 bool m_gridIsDirty; | 200 bool m_gridIsDirty; |
| 195 Vector<LayoutUnit> m_rowPositions; | 201 Vector<LayoutUnit> m_rowPositions; |
| 196 Vector<LayoutUnit> m_columnPositions; | 202 Vector<LayoutUnit> m_columnPositions; |
| 197 HashMap<const LayoutBox*, GridCoordinate> m_gridItemCoordinate; | 203 HashMap<const LayoutBox*, GridCoordinate> m_gridItemCoordinate; |
| 198 OrderIterator m_orderIterator; | 204 OrderIterator m_orderIterator; |
| 199 Vector<LayoutBox*> m_gridItemsOverflowingGridArea; | 205 Vector<LayoutBox*> m_gridItemsOverflowingGridArea; |
| 200 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap; | 206 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap; |
| 207 |
| 208 LayoutUnit m_minContentHeight; |
| 209 LayoutUnit m_maxContentHeight; |
| 201 }; | 210 }; |
| 202 | 211 |
| 203 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); | 212 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); |
| 204 | 213 |
| 205 } // namespace blink | 214 } // namespace blink |
| 206 | 215 |
| 207 #endif // LayoutGrid_h | 216 #endif // LayoutGrid_h |
| OLD | NEW |