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

Side by Side Diff: third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.h

Issue 2842413003: [css-grid] Wipe SizingOperation out (Closed)
Patch Set: Fix w/o refactoring Created 3 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 | third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef GridTrackSizingAlgorithm_h 5 #ifndef GridTrackSizingAlgorithm_h
6 #define GridTrackSizingAlgorithm_h 6 #define GridTrackSizingAlgorithm_h
7 7
8 #include <memory> 8 #include <memory>
9 #include "core/layout/LayoutBox.h" 9 #include "core/layout/LayoutBox.h"
10 #include "core/style/GridPositionsResolver.h" 10 #include "core/style/GridPositionsResolver.h"
11 #include "core/style/GridTrackSize.h" 11 #include "core/style/GridTrackSize.h"
12 #include "platform/LayoutUnit.h" 12 #include "platform/LayoutUnit.h"
13 #include "platform/wtf/HashSet.h" 13 #include "platform/wtf/HashSet.h"
14 #include "platform/wtf/Optional.h" 14 #include "platform/wtf/Optional.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 static const int kInfinity = -1; 18 static const int kInfinity = -1;
19 19
20 class Grid; 20 class Grid;
21 class GridTrackSizingAlgorithmStrategy; 21 class GridTrackSizingAlgorithmStrategy;
22 class LayoutGrid; 22 class LayoutGrid;
23 23
24 enum SizingOperation { kTrackSizing, kIntrinsicSizeComputation };
25
26 enum TrackSizeComputationPhase { 24 enum TrackSizeComputationPhase {
27 kResolveIntrinsicMinimums, 25 kResolveIntrinsicMinimums,
28 kResolveContentBasedMinimums, 26 kResolveContentBasedMinimums,
29 kResolveMaxContentMinimums, 27 kResolveMaxContentMinimums,
30 kResolveIntrinsicMaximums, 28 kResolveIntrinsicMaximums,
31 kResolveMaxContentMaximums, 29 kResolveMaxContentMaximums,
32 kMaximizeTracks, 30 kMaximizeTracks,
33 }; 31 };
34 32
35 class GridTrack { 33 class GridTrack {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 public: 77 public:
80 GridTrackSizingAlgorithm(const LayoutGrid* layout_grid, Grid& grid) 78 GridTrackSizingAlgorithm(const LayoutGrid* layout_grid, Grid& grid)
81 : grid_(grid), 79 : grid_(grid),
82 layout_grid_(layout_grid), 80 layout_grid_(layout_grid),
83 sizing_state_(kColumnSizingFirstIteration) {} 81 sizing_state_(kColumnSizingFirstIteration) {}
84 82
85 // setup() must be run before calling run() as it configures the behaviour of 83 // setup() must be run before calling run() as it configures the behaviour of
86 // the algorithm. 84 // the algorithm.
87 void Setup(GridTrackSizingDirection, 85 void Setup(GridTrackSizingDirection,
88 size_t num_tracks, 86 size_t num_tracks,
89 SizingOperation,
90 Optional<LayoutUnit> available_space, 87 Optional<LayoutUnit> available_space,
91 Optional<LayoutUnit> free_space); 88 Optional<LayoutUnit> free_space);
92 void Run(); 89 void Run();
93 void Reset(); 90 void Reset();
94 91
95 // Required by LayoutGrid. Try to minimize the exposed surface. 92 // Required by LayoutGrid. Try to minimize the exposed surface.
96 const Grid& GetGrid() const { return grid_; } 93 const Grid& GetGrid() const { return grid_; }
97 GridTrackSize GetGridTrackSize(GridTrackSizingDirection, 94 GridTrackSize GetGridTrackSize(GridTrackSizingDirection,
98 size_t translated_index) const; 95 size_t translated_index) const;
99 LayoutUnit MinContentSize() const { return min_content_size_; }; 96 LayoutUnit MinContentSize() const { return min_content_size_; };
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 Optional<LayoutUnit> free_space_rows_; 180 Optional<LayoutUnit> free_space_rows_;
184 181
185 // We need to keep both alive in order to properly size grids with orthogonal 182 // We need to keep both alive in order to properly size grids with orthogonal
186 // writing modes. 183 // writing modes.
187 Vector<GridTrack> columns_; 184 Vector<GridTrack> columns_;
188 Vector<GridTrack> rows_; 185 Vector<GridTrack> rows_;
189 Vector<size_t> content_sized_tracks_index_; 186 Vector<size_t> content_sized_tracks_index_;
190 Vector<size_t> flexible_sized_tracks_index_; 187 Vector<size_t> flexible_sized_tracks_index_;
191 188
192 GridTrackSizingDirection direction_; 189 GridTrackSizingDirection direction_;
193 SizingOperation sizing_operation_;
194 190
195 Grid& grid_; 191 Grid& grid_;
196 192
197 const LayoutGrid* layout_grid_; 193 const LayoutGrid* layout_grid_;
198 std::unique_ptr<GridTrackSizingAlgorithmStrategy> strategy_; 194 std::unique_ptr<GridTrackSizingAlgorithmStrategy> strategy_;
199 195
200 // The track sizing algorithm is used for both layout and intrinsic size 196 // The track sizing algorithm is used for both layout and intrinsic size
201 // computation. We're normally just interested in intrinsic inline sizes 197 // computation. We're normally just interested in intrinsic inline sizes
202 // (a.k.a widths in most of the cases) for the computeIntrinsicLogicalWidths() 198 // (a.k.a widths in most of the cases) for the computeIntrinsicLogicalWidths()
203 // computations. That's why we don't need to keep around different values for 199 // computations. That's why we don't need to keep around different values for
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 static GridTrackSizingDirection FlowAwareDirectionForChild( 293 static GridTrackSizingDirection FlowAwareDirectionForChild(
298 const LayoutGrid*, 294 const LayoutGrid*,
299 const LayoutBox& child, 295 const LayoutBox& child,
300 GridTrackSizingDirection); 296 GridTrackSizingDirection);
301 297
302 GridTrackSizingAlgorithm& algorithm_; 298 GridTrackSizingAlgorithm& algorithm_;
303 }; 299 };
304 } 300 }
305 301
306 #endif // GridTrackSizingAlgorithm_h 302 #endif // GridTrackSizingAlgorithm_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698