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

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: New approach 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..56f2034fd0032492b9b6f42447745e942c127e88 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());
@@ -1863,11 +1864,16 @@ bool LayoutGrid::IsBaselineContextComputed(GridAxis baseline_axis) const {
}
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())
Manuel Rego 2017/05/11 14:10:08 I'm not sure if the condition should be this or if
+ continue;
for (const auto& group : context.value->SharedGroups()) {
- if (group.size() > 1)
+ auto track_size =
+ track_sizing_algorithm_.Tracks(kForColumns)[context.key].BaseSize();
+ if ((group.size() > 1) &&
+ (group.MaxAscent() + group.MaxDescent() > track_size))
return true;
}
}
@@ -1875,11 +1881,16 @@ bool LayoutGrid::BaselineMayAffectIntrinsicWidth() const {
}
bool LayoutGrid::BaselineMayAffectIntrinsicHeight() const {
Manuel Rego 2017/05/11 14:10:08 Nit: These 2 methods look very similar, could we j
jfernandez 2017/05/11 21:51:30 Acknowledged.
- 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())
Manuel Rego 2017/05/11 14:10:08 Ditto.
jfernandez 2017/05/11 21:51:30 Acknowledged.
Manuel Rego 2017/05/16 10:29:39 This is not modified yet.
+ 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