Chromium Code Reviews| 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..acefcd8a0090838e4dad6f7505922b3168f0ebbd 100644 |
| --- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp |
| +++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp |
| @@ -185,26 +185,15 @@ void LayoutGrid::ComputeTrackSizesForDefiniteSize( |
| void LayoutGrid::RepeatTracksSizingIfNeeded( |
| LayoutUnit available_space_for_columns, |
| LayoutUnit available_space_for_rows) { |
| - // Baseline alignment may change item's intrinsic size, hence changing its |
| - // min-content contribution. |
| - // https://drafts.csswg.org/css-align-3/#baseline-align-content |
| - // https://drafts.csswg.org/css-align-3/#baseline-align-self |
| - bool baseline_affect_intrinsic_width = BaselineMayAffectIntrinsicWidth(); |
| - bool baseline_affect_intrinsic_height = BaselineMayAffectIntrinsicHeight(); |
| - |
| // In orthogonal flow cases column track's size is determined by using the |
| // computed row track's size, which it was estimated during the first cycle of |
| // the sizing algorithm. |
| - bool has_any_orthogonal = |
| - track_sizing_algorithm_.GetGrid().HasAnyOrthogonalGridItem(); |
| - |
| // TODO (lajava): these are just some of the cases which may require |
| // a new cycle of the sizing algorithm; there may be more. In addition, not |
| // all the cases with orthogonal flows require this extra cycle; we need a |
| // more specific condition to detect whether child's min-content contribution |
| // has changed or not. |
| - if (!baseline_affect_intrinsic_width && !baseline_affect_intrinsic_height && |
| - !has_any_orthogonal) |
| + if (!track_sizing_algorithm_.GetGrid().HasAnyOrthogonalGridItem()) |
|
svillar
2017/05/11 07:15:04
This method is executed only as part of the layout
|
| return; |
| // TODO (lajava): Whenever the min-content contribution of a grid item changes |
| @@ -218,12 +207,6 @@ void LayoutGrid::RepeatTracksSizingIfNeeded( |
| // and rows, to determine the final values. |
| ComputeTrackSizesForDefiniteSize(kForColumns, available_space_for_columns); |
| ComputeTrackSizesForDefiniteSize(kForRows, available_space_for_rows); |
| - |
| - if (baseline_affect_intrinsic_height) { |
| - SetLogicalHeight(ComputeTrackBasedLogicalHeight() + |
| - BorderAndPaddingLogicalHeight() + |
| - ScrollbarLogicalHeight()); |
| - } |
| } |
| void LayoutGrid::UpdateBlockLayout(bool relayout_children) { |
| @@ -263,6 +246,14 @@ void LayoutGrid::UpdateBlockLayout(bool relayout_children) { |
| LayoutUnit available_space_for_columns = AvailableLogicalWidth(); |
| PlaceItemsOnGrid(grid_, available_space_for_columns); |
| + // TODO (lajava): Items with relative size may have problems to synthesize |
| + // a baseline, since we neeed to resolve the size but we haven't defined yet |
| + // their corresponding grid area. This may lead to an incorrect baseline |
| + // computation, either because relative sizes are resolved as 0 (undefined |
| + // container's size) or they are based on the grid container's size instead |
| + // of the grid area. |
| + ComputeBaselineAlignmentContext(); |
| + |
| // 1- First, the track sizing algorithm is used to resolve the sizes of the |
| // grid columns. |
| // At this point the logical width is always definite as the above call to |
| @@ -313,15 +304,6 @@ void LayoutGrid::UpdateBlockLayout(bool relayout_children) { |
| kForRows, LogicalHeight() - track_based_logical_height); |
| } |
| - // TODO (lajava): We need to compute baselines after step 2 so |
| - // items with a relative size (percentages) can resolve it before |
| - // determining its baseline. However, we only set item's grid area |
| - // (via override sizes) as part of the content-sized tracks sizing |
| - // logic. Hence, items located at fixed or flexible tracks can't |
| - // resolve correctly their size at this stage, which may lead to |
| - // an incorrect computation of their shared context's baseline. |
| - ComputeBaselineAlignmentContext(); |
| - |
| // 3- If the min-content contribution of any grid items have changed based |
| // on the row sizes calculated in step 2, steps 1 and 2 are repeated with |
| // the new min-content contribution (once only). |
| @@ -1862,30 +1844,6 @@ bool LayoutGrid::IsBaselineContextComputed(GridAxis baseline_axis) const { |
| : !col_axis_alignment_context_.IsEmpty(); |
| } |
| -bool LayoutGrid::BaselineMayAffectIntrinsicWidth() const { |
| - if (!StyleRef().LogicalWidth().IsIntrinsicOrAuto()) |
| - return false; |
| - for (const auto& context : col_axis_alignment_context_) { |
| - for (const auto& group : context.value->SharedGroups()) { |
| - if (group.size() > 1) |
| - return true; |
| - } |
| - } |
| - return false; |
| -} |
| - |
| -bool LayoutGrid::BaselineMayAffectIntrinsicHeight() const { |
| - if (!StyleRef().LogicalHeight().IsIntrinsicOrAuto()) |
| - return false; |
| - for (const auto& context : row_axis_alignment_context_) { |
| - for (const auto& group : context.value->SharedGroups()) { |
| - if (group.size() > 1) |
| - return true; |
| - } |
| - } |
| - return false; |
| -} |
| - |
| void LayoutGrid::ComputeBaselineAlignmentContext() { |
| for (auto* child = FirstInFlowChildBox(); child; |
| child = child->NextInFlowSiblingBox()) { |