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

Unified Diff: third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp

Issue 2842413003: [css-grid] Wipe SizingOperation out (Closed)
Patch Set: refactoring Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp
diff --git a/third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp b/third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp
index 605738b48c0ee62416713f234e56380b6faf5d39..4740e44191213d586d177f5271cd317bbf4987ef 100644
--- a/third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp
+++ b/third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp
@@ -287,15 +287,10 @@ LayoutUnit GridTrackSizingAlgorithmStrategy::LogicalHeightForChild(
child.ClearOverrideLogicalContentHeight();
child.LayoutIfNeeded();
- GridAxis baseline_axis = GetLayoutGrid()->IsOrthogonalChild(child)
- ? kGridRowAxis
- : kGridColumnAxis;
- if (GetLayoutGrid()->IsBaselineAlignmentForChild(child, baseline_axis) &&
- GetLayoutGrid()->IsBaselineContextComputed(baseline_axis)) {
- auto& group =
- GetLayoutGrid()->GetBaselineGroupForChild(child, baseline_axis);
- return group.MaxAscent() + group.MaxDescent();
- }
+
+ if (auto baseline_extent = ExtentForBaselineAlignment(child))
+ return baseline_extent.value();
+
return child.LogicalHeight() + child.MarginLogicalHeight();
}
@@ -324,15 +319,10 @@ LayoutUnit GridTrackSizingAlgorithmStrategy::MinContentForChild(
return child.MinPreferredLogicalWidth() + margin_logical_width;
}
- if (Direction() == kForColumns &&
- algorithm_.sizing_operation_ == kIntrinsicSizeComputation) {
+ if (Direction() == kForColumns && !AvailableSpace()) {
DCHECK(GetLayoutGrid()->IsOrthogonalChild(child));
- if (GetLayoutGrid()->IsBaselineAlignmentForChild(child, kGridRowAxis) &&
- GetLayoutGrid()->IsBaselineContextComputed(kGridRowAxis)) {
- auto& group =
- GetLayoutGrid()->GetBaselineGroupForChild(child, kGridRowAxis);
- return group.MaxAscent() + group.MaxDescent();
- }
+ if (auto baseline_extent = ExtentForBaselineAlignment(child))
+ return baseline_extent.value();
}
if (UpdateOverrideContainingBlockContentSizeForChild(child,
@@ -431,6 +421,20 @@ void GridTrackSizingAlgorithmStrategy::DistributeSpaceToTracks(
available_logical_space);
}
+Optional<LayoutUnit>
+GridTrackSizingAlgorithmStrategy::ExtentForBaselineAlignment(
Manuel Rego 2017/04/27 16:06:48 This seems unrelated to the SizingOperation remova
+ LayoutBox& child) const {
+ auto grid = algorithm_.layout_grid_;
Manuel Rego 2017/04/27 16:06:48 Nit: We've GetLayoutGrid() for this.
+ GridAxis baseline_axis =
+ grid->IsOrthogonalChild(child) ? kGridRowAxis : kGridColumnAxis;
+ if (!grid->IsBaselineAlignmentForChild(child, baseline_axis) ||
+ !grid->IsBaselineContextComputed(baseline_axis))
+ return WTF::kNullopt;
+
+ auto& group = grid->GetBaselineGroupForChild(child, baseline_axis);
+ return group.MaxAscent() + group.MaxDescent();
+}
+
LayoutUnit DefiniteSizeStrategy::MinLogicalWidthForChild(
LayoutBox& child,
Length child_min_size,
@@ -1405,7 +1409,6 @@ bool GridTrackSizingAlgorithm::IsValidTransition() const {
void GridTrackSizingAlgorithm::Setup(GridTrackSizingDirection direction,
size_t num_tracks,
- SizingOperation sizing_operation,
Optional<LayoutUnit> available_space,
Optional<LayoutUnit> free_space) {
DCHECK(needs_setup_);
@@ -1415,8 +1418,6 @@ void GridTrackSizingAlgorithm::Setup(GridTrackSizingDirection direction,
direction, available_space ? available_space.value().ClampNegativeToZero()
: available_space);
- sizing_operation_ = sizing_operation;
-
if (available_space)
strategy_ = WTF::MakeUnique<DefiniteSizeStrategy>(*this);
else
« no previous file with comments | « third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.h ('k') | third_party/WebKit/Source/core/layout/LayoutGrid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698