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

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

Issue 2868283002: [css-grid] Check if baseline alignment affects grid areas sizing (Closed)
Patch Set: Applied suggested changes. 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutGrid.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
index 58d131096b4f51b0708bb3f642378d9f7d7f7b91..50108410973a11870a834e0fd01493f1914de574 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -219,7 +219,8 @@ void LayoutGrid::RepeatTracksSizingIfNeeded(
ComputeTrackSizesForDefiniteSize(kForColumns, available_space_for_columns);
ComputeTrackSizesForDefiniteSize(kForRows, available_space_for_rows);
- if (baseline_affect_intrinsic_height) {
+ if (baseline_affect_intrinsic_height &&
+ StyleRef().LogicalHeight().IsIntrinsicOrAuto()) {
SetLogicalHeight(ComputeTrackBasedLogicalHeight() +
BorderAndPaddingLogicalHeight() +
ScrollbarLogicalHeight());
@@ -1862,24 +1863,36 @@ bool LayoutGrid::IsBaselineContextComputed(GridAxis baseline_axis) const {
: !col_axis_alignment_context_.IsEmpty();
}
+// TODO (lajava): Maybe refactoring these methods based on direction.
svillar 2017/05/25 07:26:27 I think it's better to do the refactoring in this
jfernandez 2017/05/30 10:39:30 Acknowledged.
bool LayoutGrid::BaselineMayAffectIntrinsicWidth() const {
- if (!StyleRef().LogicalWidth().IsIntrinsicOrAuto())
- return false;
for (const auto& context : col_axis_alignment_context_) {
+ auto track_size =
+ track_sizing_algorithm_.GetGridTrackSize(kForColumns, context.key);
+ if (!track_size.IsContentSized())
+ continue;
for (const auto& group : context.value->SharedGroups()) {
- if (group.size() > 1)
+ auto track_size =
svillar 2017/05/25 07:26:27 Having two "auto track_size" in the same method is
jfernandez 2017/05/30 10:39:30 Acknowledged.
+ track_sizing_algorithm_.Tracks(kForColumns)[context.key].BaseSize();
+ if ((group.size() > 1) &&
svillar 2017/05/25 07:26:27 Perhaps is a dumb question and the code was alread
jfernandez 2017/05/30 10:39:30 group is the baseline-sharing group [1] which cont
+ (group.MaxAscent() + group.MaxDescent() > track_size))
return true;
}
}
return false;
}
+// TODO (lajava): Maybe refactoring these methods based on direction.
bool LayoutGrid::BaselineMayAffectIntrinsicHeight() const {
- if (!StyleRef().LogicalHeight().IsIntrinsicOrAuto())
- return false;
for (const auto& context : row_axis_alignment_context_) {
+ auto track_size =
+ track_sizing_algorithm_.GetGridTrackSize(kForRows, context.key);
+ if (!track_size.IsContentSized())
+ continue;
for (const auto& group : context.value->SharedGroups()) {
- if (group.size() > 1)
+ auto track_size =
+ track_sizing_algorithm_.Tracks(kForRows)[context.key].BaseSize();
+ if ((group.size() > 1) &&
+ (group.MaxAscent() + group.MaxDescent() > track_size))
return true;
}
}

Powered by Google App Engine
This is Rietveld 408576698