Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: Source/core/layout/LayoutGrid.h

Issue 1125703002: [CSS Grid Layout] Refactoring of grid's alignment logic (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/layout/LayoutGrid.cpp » ('j') | Source/core/layout/LayoutGrid.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 19 matching lines...) Expand all
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 GridCoordinate; 35 struct GridCoordinate;
36 struct GridSpan; 36 struct GridSpan;
37 class GridTrack; 37 class GridTrack;
38 class GridItemWithSpan; 38 class GridItemWithSpan;
39 39
40 enum GridAxisPosition {GridAxisStart, GridAxisEnd, GridAxisCenter};
41
40 class LayoutGrid final : public LayoutBlock { 42 class LayoutGrid final : public LayoutBlock {
41 public: 43 public:
42 LayoutGrid(Element*); 44 LayoutGrid(Element*);
43 virtual ~LayoutGrid(); 45 virtual ~LayoutGrid();
44 46
45 virtual const char* name() const override { return "LayoutGrid"; } 47 virtual const char* name() const override { return "LayoutGrid"; }
46 48
47 virtual void layoutBlock(bool relayoutChildren) override; 49 virtual void layoutBlock(bool relayoutChildren) override;
48 50
49 virtual bool canCollapseAnonymousBlockChild() const override { return false; } 51 virtual bool canCollapseAnonymousBlockChild() const override { return false; }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 void resolveContentBasedTrackSizingFunctionsForItems(GridTrackSizingDirectio n, GridSizingData&, const GridItemsSpanGroupRange&, FilterFunction, SizingFuncti on, AccumulatorGetter, AccumulatorGrowFunction, FilterFunction growAboveMaxBread thFilterFunction = nullptr); 109 void resolveContentBasedTrackSizingFunctionsForItems(GridTrackSizingDirectio n, GridSizingData&, const GridItemsSpanGroupRange&, FilterFunction, SizingFuncti on, AccumulatorGetter, AccumulatorGrowFunction, FilterFunction growAboveMaxBread thFilterFunction = nullptr);
108 void distributeSpaceToTracks(Vector<GridTrack*>&, const Vector<GridTrack*>* growBeyondGrowthLimitsTracks, AccumulatorGetter, GridSizingData&, LayoutUnit& av ailableLogicalSpace); 110 void distributeSpaceToTracks(Vector<GridTrack*>&, const Vector<GridTrack*>* growBeyondGrowthLimitsTracks, AccumulatorGetter, GridSizingData&, LayoutUnit& av ailableLogicalSpace);
109 111
110 double computeNormalizedFractionBreadth(Vector<GridTrack>&, const GridSpan& tracksSpan, GridTrackSizingDirection, LayoutUnit availableLogicalSpace) const; 112 double computeNormalizedFractionBreadth(Vector<GridTrack>&, const GridSpan& tracksSpan, GridTrackSizingDirection, LayoutUnit availableLogicalSpace) const;
111 113
112 GridTrackSize gridTrackSize(GridTrackSizingDirection, size_t) const; 114 GridTrackSize gridTrackSize(GridTrackSizingDirection, size_t) const;
113 115
114 LayoutUnit logicalHeightForChild(LayoutBox&, Vector<GridTrack>&); 116 LayoutUnit logicalHeightForChild(LayoutBox&, Vector<GridTrack>&);
115 LayoutUnit minContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G ridTrack>& columnTracks); 117 LayoutUnit minContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G ridTrack>& columnTracks);
116 LayoutUnit maxContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G ridTrack>& columnTracks); 118 LayoutUnit maxContentForChild(LayoutBox&, GridTrackSizingDirection, Vector<G ridTrack>& columnTracks);
117 LayoutUnit startOfColumnForChild(const LayoutBox& child) const; 119 GridAxisPosition columnAxisPositionForChild(const LayoutBox&) const;
118 LayoutUnit endOfColumnForChild(const LayoutBox& child) const; 120 GridAxisPosition rowAxisPositionForChild(const LayoutBox&) const;
119 LayoutUnit columnPositionLeft(const LayoutBox&) const;
120 LayoutUnit columnPositionRight(const LayoutBox&) const;
121 LayoutUnit centeredColumnPositionForChild(const LayoutBox&) const;
122 LayoutUnit columnPositionForChild(const LayoutBox&) const; 121 LayoutUnit columnPositionForChild(const LayoutBox&) const;
123 LayoutUnit startOfRowForChild(const LayoutBox& child) const;
124 LayoutUnit endOfRowForChild(const LayoutBox& child) const;
125 LayoutUnit centeredRowPositionForChild(const LayoutBox&) const;
126 LayoutUnit rowPositionForChild(const LayoutBox&) const; 122 LayoutUnit rowPositionForChild(const LayoutBox&) const;
127 void computeContentPositionAndDistributionRowOffset(LayoutUnit availableFree Space, GridSizingData&) const; 123 void computeContentPositionAndDistributionRowOffset(LayoutUnit availableFree Space, GridSizingData&) const;
128 void computeContentPositionAndDistributionColumnOffset(LayoutUnit availableF reeSpace, GridSizingData&) const; 124 void computeContentPositionAndDistributionColumnOffset(LayoutUnit availableF reeSpace, GridSizingData&) const;
129 LayoutPoint findChildLogicalPosition(const LayoutBox&, GridSizingData&) cons t; 125 LayoutPoint findChildLogicalPosition(const LayoutBox&, GridSizingData&) cons t;
130 GridCoordinate cachedGridCoordinate(const LayoutBox&) const; 126 GridCoordinate cachedGridCoordinate(const LayoutBox&) const;
131 127
132 LayoutUnit gridAreaBreadthForChild(const LayoutBox& child, GridTrackSizingDi rection, const Vector<GridTrack>&) const; 128 LayoutUnit gridAreaBreadthForChild(const LayoutBox& child, GridTrackSizingDi rection, const Vector<GridTrack>&) const;
133 129
134 virtual void paintChildren(const PaintInfo&, const LayoutPoint&) override; 130 virtual void paintChildren(const PaintInfo&, const LayoutPoint&) override;
135 bool allowedToStretchLogicalHeightForChild(const LayoutBox& child) const; 131 bool allowedToStretchLogicalHeightForChild(const LayoutBox& child) const;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 OrderIterator m_orderIterator; 167 OrderIterator m_orderIterator;
172 Vector<LayoutBox*> m_gridItemsOverflowingGridArea; 168 Vector<LayoutBox*> m_gridItemsOverflowingGridArea;
173 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap; 169 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap;
174 }; 170 };
175 171
176 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); 172 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid());
177 173
178 } // namespace blink 174 } // namespace blink
179 175
180 #endif // LayoutGrid_h 176 #endif // LayoutGrid_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/layout/LayoutGrid.cpp » ('j') | Source/core/layout/LayoutGrid.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698