| OLD | NEW |
| 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> |
| 9 #include "core/layout/LayoutBox.h" |
| 8 #include "core/style/GridPositionsResolver.h" | 10 #include "core/style/GridPositionsResolver.h" |
| 9 #include "core/style/GridTrackSize.h" | 11 #include "core/style/GridTrackSize.h" |
| 10 #include "platform/LayoutUnit.h" | 12 #include "platform/LayoutUnit.h" |
| 11 #include "wtf/HashSet.h" | 13 #include "wtf/HashSet.h" |
| 12 #include "wtf/Optional.h" | 14 #include "wtf/Optional.h" |
| 13 #include <memory> | |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 | 17 |
| 17 static const int infinity = -1; | 18 static const int infinity = -1; |
| 18 | 19 |
| 19 class Grid; | 20 class Grid; |
| 20 class GridTrackSizingAlgorithmStrategy; | 21 class GridTrackSizingAlgorithmStrategy; |
| 21 class LayoutGrid; | 22 class LayoutGrid; |
| 22 | 23 |
| 24 enum MarginDirection; |
| 25 |
| 23 enum SizingOperation { TrackSizing, IntrinsicSizeComputation }; | 26 enum SizingOperation { TrackSizing, IntrinsicSizeComputation }; |
| 24 | 27 |
| 25 enum TrackSizeComputationPhase { | 28 enum TrackSizeComputationPhase { |
| 26 ResolveIntrinsicMinimums, | 29 ResolveIntrinsicMinimums, |
| 27 ResolveContentBasedMinimums, | 30 ResolveContentBasedMinimums, |
| 28 ResolveMaxContentMinimums, | 31 ResolveMaxContentMinimums, |
| 29 ResolveIntrinsicMaximums, | 32 ResolveIntrinsicMaximums, |
| 30 ResolveMaxContentMaximums, | 33 ResolveMaxContentMaximums, |
| 31 MaximizeTracks, | 34 MaximizeTracks, |
| 32 }; | 35 }; |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 LayoutBox&, | 264 LayoutBox&, |
| 262 GridTrackSizingDirection) const; | 265 GridTrackSizingDirection) const; |
| 263 LayoutUnit computeTrackBasedSize() const; | 266 LayoutUnit computeTrackBasedSize() const; |
| 264 GridTrackSizingDirection direction() const { return m_algorithm.m_direction; } | 267 GridTrackSizingDirection direction() const { return m_algorithm.m_direction; } |
| 265 double findFrUnitSize(const GridSpan& tracksSpan, | 268 double findFrUnitSize(const GridSpan& tracksSpan, |
| 266 LayoutUnit leftOverSpace) const; | 269 LayoutUnit leftOverSpace) const; |
| 267 void distributeSpaceToTracks(Vector<GridTrack*>& tracks, | 270 void distributeSpaceToTracks(Vector<GridTrack*>& tracks, |
| 268 LayoutUnit& availableLogicalSpace) const; | 271 LayoutUnit& availableLogicalSpace) const; |
| 269 const LayoutGrid* layoutGrid() const { return m_algorithm.m_layoutGrid; } | 272 const LayoutGrid* layoutGrid() const { return m_algorithm.m_layoutGrid; } |
| 270 | 273 |
| 274 // Helper functions |
| 275 static LayoutUnit computeMarginLogicalSizeForChild( |
| 276 MarginDirection forDirection, |
| 277 const LayoutGrid*, |
| 278 const LayoutBox& child); |
| 279 static bool hasOverrideContainingBlockContentSizeForChild( |
| 280 const LayoutBox& child, |
| 281 GridTrackSizingDirection); |
| 282 static LayoutUnit overrideContainingBlockContentSizeForChild( |
| 283 const LayoutBox& child, |
| 284 GridTrackSizingDirection); |
| 285 static bool shouldClearOverrideContainingBlockContentSizeForChild( |
| 286 const LayoutBox& child, |
| 287 GridTrackSizingDirection); |
| 288 static void setOverrideContainingBlockContentSizeForChild( |
| 289 LayoutBox& child, |
| 290 GridTrackSizingDirection, |
| 291 LayoutUnit size); |
| 292 static GridTrackSizingDirection flowAwareDirectionForChild( |
| 293 const LayoutGrid*, |
| 294 const LayoutBox& child, |
| 295 GridTrackSizingDirection); |
| 296 |
| 271 GridTrackSizingAlgorithm& m_algorithm; | 297 GridTrackSizingAlgorithm& m_algorithm; |
| 272 }; | 298 }; |
| 273 } | 299 } |
| 274 | 300 |
| 275 #endif // GridTrackSizingAlgorithm_h | 301 #endif // GridTrackSizingAlgorithm_h |
| OLD | NEW |