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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 ResolveMaxContentMinimums, | 43 ResolveMaxContentMinimums, |
44 ResolveIntrinsicMaximums, | 44 ResolveIntrinsicMaximums, |
45 ResolveMaxContentMaximums, | 45 ResolveMaxContentMaximums, |
46 MaximizeTracks, | 46 MaximizeTracks, |
47 }; | 47 }; |
48 enum GridAxisPosition {GridAxisStart, GridAxisEnd, GridAxisCenter}; | 48 enum GridAxisPosition {GridAxisStart, GridAxisEnd, GridAxisCenter}; |
49 | 49 |
50 class LayoutGrid final : public LayoutBlock { | 50 class LayoutGrid final : public LayoutBlock { |
51 public: | 51 public: |
52 explicit LayoutGrid(Element*); | 52 explicit LayoutGrid(Element*); |
53 virtual ~LayoutGrid(); | 53 ~LayoutGrid() override; |
54 | 54 |
55 virtual const char* name() const override { return "LayoutGrid"; } | 55 const char* name() const override { return "LayoutGrid"; } |
56 | 56 |
57 virtual void layoutBlock(bool relayoutChildren) override; | 57 void layoutBlock(bool relayoutChildren) override; |
58 | 58 |
59 virtual bool canCollapseAnonymousBlockChild() const override { return false;
} | 59 bool canCollapseAnonymousBlockChild() const override { return false; } |
60 | 60 |
61 void dirtyGrid(); | 61 void dirtyGrid(); |
62 | 62 |
63 const Vector<LayoutUnit>& columnPositions() const | 63 const Vector<LayoutUnit>& columnPositions() const |
64 { | 64 { |
65 ASSERT(!m_gridIsDirty); | 65 ASSERT(!m_gridIsDirty); |
66 return m_columnPositions; | 66 return m_columnPositions; |
67 } | 67 } |
68 | 68 |
69 const Vector<LayoutUnit>& rowPositions() const | 69 const Vector<LayoutUnit>& rowPositions() const |
(...skipping 15 matching lines...) Expand all Loading... |
85 return m_gridItemsOverflowingGridArea; | 85 return m_gridItemsOverflowingGridArea; |
86 } | 86 } |
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 virtual bool isOfType(LayoutObjectType type) const override { return type ==
LayoutObjectLayoutGrid || LayoutBlock::isOfType(type); } | 95 bool isOfType(LayoutObjectType type) const override { return type == LayoutO
bjectLayoutGrid || LayoutBlock::isOfType(type); } |
96 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo
utUnit& maxLogicalWidth) const override; | 96 void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit&
maxLogicalWidth) const override; |
97 virtual void computePreferredLogicalWidths() override; | 97 void computePreferredLogicalWidths() override; |
98 | 98 |
99 virtual void addChild(LayoutObject* newChild, LayoutObject* beforeChild = nu
llptr) override; | 99 void addChild(LayoutObject* newChild, LayoutObject* beforeChild = nullptr) o
verride; |
100 virtual void removeChild(LayoutObject*) override; | 100 void removeChild(LayoutObject*) override; |
101 | 101 |
102 virtual void styleDidChange(StyleDifference, const ComputedStyle*) override; | 102 void styleDidChange(StyleDifference, const ComputedStyle*) override; |
103 | 103 |
104 bool explicitGridDidResize(const ComputedStyle&) const; | 104 bool explicitGridDidResize(const ComputedStyle&) const; |
105 bool namedGridLinesDefinitionDidChange(const ComputedStyle&) const; | 105 bool namedGridLinesDefinitionDidChange(const ComputedStyle&) const; |
106 | 106 |
107 class GridIterator; | 107 class GridIterator; |
108 struct GridSizingData; | 108 struct GridSizingData; |
109 bool gridElementIsShrinkToFit(); | 109 bool gridElementIsShrinkToFit(); |
110 void computeUsedBreadthOfGridTracks(GridTrackSizingDirection, GridSizingData
&, LayoutUnit& availableLogicalSpace); | 110 void computeUsedBreadthOfGridTracks(GridTrackSizingDirection, GridSizingData
&, LayoutUnit& availableLogicalSpace); |
111 LayoutUnit computeUsedBreadthOfMinLength(GridTrackSizingDirection, const Gri
dLength&) const; | 111 LayoutUnit computeUsedBreadthOfMinLength(GridTrackSizingDirection, const Gri
dLength&) const; |
112 LayoutUnit computeUsedBreadthOfMaxLength(GridTrackSizingDirection, const Gri
dLength&, LayoutUnit usedBreadth) const; | 112 LayoutUnit computeUsedBreadthOfMaxLength(GridTrackSizingDirection, const Gri
dLength&, LayoutUnit usedBreadth) const; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 LayoutUnit columnAxisOffsetForChild(const LayoutBox&) const; | 149 LayoutUnit columnAxisOffsetForChild(const LayoutBox&) const; |
150 ContentAlignmentData computeContentPositionAndDistributionOffset(GridTrackSi
zingDirection, LayoutUnit availableFreeSpace, unsigned numberOfGridTracks) const
; | 150 ContentAlignmentData computeContentPositionAndDistributionOffset(GridTrackSi
zingDirection, LayoutUnit availableFreeSpace, unsigned numberOfGridTracks) const
; |
151 LayoutPoint findChildLogicalPosition(const LayoutBox&, GridSizingData&) cons
t; | 151 LayoutPoint findChildLogicalPosition(const LayoutBox&, GridSizingData&) cons
t; |
152 GridCoordinate cachedGridCoordinate(const LayoutBox&) const; | 152 GridCoordinate cachedGridCoordinate(const LayoutBox&) const; |
153 | 153 |
154 LayoutUnit gridAreaBreadthForChild(const LayoutBox& child, GridTrackSizingDi
rection, const Vector<GridTrack>&) const; | 154 LayoutUnit gridAreaBreadthForChild(const LayoutBox& child, GridTrackSizingDi
rection, const Vector<GridTrack>&) const; |
155 LayoutUnit gridAreaBreadthForChildIncludingAlignmentOffsets(const LayoutBox&
, GridTrackSizingDirection, const GridSizingData&) const; | 155 LayoutUnit gridAreaBreadthForChildIncludingAlignmentOffsets(const LayoutBox&
, GridTrackSizingDirection, const GridSizingData&) const; |
156 | 156 |
157 void applyStretchAlignmentToTracksIfNeeded(GridTrackSizingDirection, GridSiz
ingData&, LayoutUnit availableSpace); | 157 void applyStretchAlignmentToTracksIfNeeded(GridTrackSizingDirection, GridSiz
ingData&, LayoutUnit availableSpace); |
158 | 158 |
159 virtual void paintChildren(const PaintInfo&, const LayoutPoint&) override; | 159 void paintChildren(const PaintInfo&, const LayoutPoint&) override; |
160 bool allowedToStretchLogicalHeightForChild(const LayoutBox& child) const; | 160 bool allowedToStretchLogicalHeightForChild(const LayoutBox& child) const; |
161 bool needToStretchChildLogicalHeight(const LayoutBox&) const; | 161 bool needToStretchChildLogicalHeight(const LayoutBox&) const; |
162 LayoutUnit childIntrinsicHeight(const LayoutBox&) const; | 162 LayoutUnit childIntrinsicHeight(const LayoutBox&) const; |
163 LayoutUnit childIntrinsicWidth(const LayoutBox&) const; | 163 LayoutUnit childIntrinsicWidth(const LayoutBox&) const; |
164 LayoutUnit intrinsicLogicalHeightForChild(const LayoutBox&) const; | 164 LayoutUnit intrinsicLogicalHeightForChild(const LayoutBox&) const; |
165 LayoutUnit marginLogicalHeightForChild(const LayoutBox&) const; | 165 LayoutUnit marginLogicalHeightForChild(const LayoutBox&) const; |
166 LayoutUnit computeMarginLogicalHeightForChild(const LayoutBox&) const; | 166 LayoutUnit computeMarginLogicalHeightForChild(const LayoutBox&) const; |
167 LayoutUnit availableAlignmentSpaceForChildBeforeStretching(LayoutUnit gridAr
eaBreadthForChild, const LayoutBox&) const; | 167 LayoutUnit availableAlignmentSpaceForChildBeforeStretching(LayoutUnit gridAr
eaBreadthForChild, const LayoutBox&) const; |
168 void applyStretchAlignmentToChildIfNeeded(LayoutBox&, LayoutUnit gridAreaBre
adthForChild); | 168 void applyStretchAlignmentToChildIfNeeded(LayoutBox&, LayoutUnit gridAreaBre
adthForChild); |
169 | 169 |
(...skipping 26 matching lines...) Expand all Loading... |
196 OrderIterator m_orderIterator; | 196 OrderIterator m_orderIterator; |
197 Vector<LayoutBox*> m_gridItemsOverflowingGridArea; | 197 Vector<LayoutBox*> m_gridItemsOverflowingGridArea; |
198 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap; | 198 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap; |
199 }; | 199 }; |
200 | 200 |
201 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); | 201 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); |
202 | 202 |
203 } // namespace blink | 203 } // namespace blink |
204 | 204 |
205 #endif // LayoutGrid_h | 205 #endif // LayoutGrid_h |
OLD | NEW |