OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 // intrinsic width may also affect the extra Track Sizing algorithm cycles we | 212 // intrinsic width may also affect the extra Track Sizing algorithm cycles we |
213 // are about to execute. | 213 // are about to execute. |
214 // https://crbug.com/704713 | 214 // https://crbug.com/704713 |
215 // https://github.com/w3c/csswg-drafts/issues/1039 | 215 // https://github.com/w3c/csswg-drafts/issues/1039 |
216 | 216 |
217 // Hence we need to repeat computeUsedBreadthOfGridTracks for both, columns | 217 // Hence we need to repeat computeUsedBreadthOfGridTracks for both, columns |
218 // and rows, to determine the final values. | 218 // and rows, to determine the final values. |
219 ComputeTrackSizesForDefiniteSize(kForColumns, available_space_for_columns); | 219 ComputeTrackSizesForDefiniteSize(kForColumns, available_space_for_columns); |
220 ComputeTrackSizesForDefiniteSize(kForRows, available_space_for_rows); | 220 ComputeTrackSizesForDefiniteSize(kForRows, available_space_for_rows); |
221 | 221 |
222 if (baseline_affect_intrinsic_height) { | 222 if (baseline_affect_intrinsic_height && |
223 StyleRef().LogicalHeight().IsIntrinsicOrAuto()) { | |
223 SetLogicalHeight(ComputeTrackBasedLogicalHeight() + | 224 SetLogicalHeight(ComputeTrackBasedLogicalHeight() + |
224 BorderAndPaddingLogicalHeight() + | 225 BorderAndPaddingLogicalHeight() + |
225 ScrollbarLogicalHeight()); | 226 ScrollbarLogicalHeight()); |
226 } | 227 } |
227 } | 228 } |
228 | 229 |
229 void LayoutGrid::UpdateBlockLayout(bool relayout_children) { | 230 void LayoutGrid::UpdateBlockLayout(bool relayout_children) { |
230 DCHECK(NeedsLayout()); | 231 DCHECK(NeedsLayout()); |
231 | 232 |
232 // We cannot perform a simplifiedLayout() on a dirty grid that | 233 // We cannot perform a simplifiedLayout() on a dirty grid that |
(...skipping 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1856 return child.MarginLogicalWidth() + child.LogicalWidth() - ascent; | 1857 return child.MarginLogicalWidth() + child.LogicalWidth() - ascent; |
1857 } | 1858 } |
1858 | 1859 |
1859 bool LayoutGrid::IsBaselineContextComputed(GridAxis baseline_axis) const { | 1860 bool LayoutGrid::IsBaselineContextComputed(GridAxis baseline_axis) const { |
1860 return baseline_axis == kGridColumnAxis | 1861 return baseline_axis == kGridColumnAxis |
1861 ? !row_axis_alignment_context_.IsEmpty() | 1862 ? !row_axis_alignment_context_.IsEmpty() |
1862 : !col_axis_alignment_context_.IsEmpty(); | 1863 : !col_axis_alignment_context_.IsEmpty(); |
1863 } | 1864 } |
1864 | 1865 |
1865 bool LayoutGrid::BaselineMayAffectIntrinsicWidth() const { | 1866 bool LayoutGrid::BaselineMayAffectIntrinsicWidth() const { |
1866 if (!StyleRef().LogicalWidth().IsIntrinsicOrAuto()) | |
1867 return false; | |
1868 for (const auto& context : col_axis_alignment_context_) { | 1867 for (const auto& context : col_axis_alignment_context_) { |
1868 auto track_size = | |
1869 track_sizing_algorithm_.GetGridTrackSize(kForColumns, context.key); | |
1870 if (!track_size.IsContentSized()) | |
Manuel Rego
2017/05/11 14:10:08
I'm not sure if the condition should be this or if
| |
1871 continue; | |
1869 for (const auto& group : context.value->SharedGroups()) { | 1872 for (const auto& group : context.value->SharedGroups()) { |
1870 if (group.size() > 1) | 1873 auto track_size = |
1874 track_sizing_algorithm_.Tracks(kForColumns)[context.key].BaseSize(); | |
1875 if ((group.size() > 1) && | |
1876 (group.MaxAscent() + group.MaxDescent() > track_size)) | |
1871 return true; | 1877 return true; |
1872 } | 1878 } |
1873 } | 1879 } |
1874 return false; | 1880 return false; |
1875 } | 1881 } |
1876 | 1882 |
1877 bool LayoutGrid::BaselineMayAffectIntrinsicHeight() const { | 1883 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.
| |
1878 if (!StyleRef().LogicalHeight().IsIntrinsicOrAuto()) | |
1879 return false; | |
1880 for (const auto& context : row_axis_alignment_context_) { | 1884 for (const auto& context : row_axis_alignment_context_) { |
1885 auto track_size = | |
1886 track_sizing_algorithm_.GetGridTrackSize(kForRows, context.key); | |
1887 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.
| |
1888 continue; | |
1881 for (const auto& group : context.value->SharedGroups()) { | 1889 for (const auto& group : context.value->SharedGroups()) { |
1882 if (group.size() > 1) | 1890 auto track_size = |
1891 track_sizing_algorithm_.Tracks(kForRows)[context.key].BaseSize(); | |
1892 if ((group.size() > 1) && | |
1893 (group.MaxAscent() + group.MaxDescent() > track_size)) | |
1883 return true; | 1894 return true; |
1884 } | 1895 } |
1885 } | 1896 } |
1886 return false; | 1897 return false; |
1887 } | 1898 } |
1888 | 1899 |
1889 void LayoutGrid::ComputeBaselineAlignmentContext() { | 1900 void LayoutGrid::ComputeBaselineAlignmentContext() { |
1890 for (auto* child = FirstInFlowChildBox(); child; | 1901 for (auto* child = FirstInFlowChildBox(); child; |
1891 child = child->NextInFlowSiblingBox()) { | 1902 child = child->NextInFlowSiblingBox()) { |
1892 UpdateBaselineAlignmentContextIfNeeded(*child, kGridRowAxis); | 1903 UpdateBaselineAlignmentContextIfNeeded(*child, kGridRowAxis); |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2391 if (direction == kForRows) | 2402 if (direction == kForRows) |
2392 return grid.NumTracks(kForRows); | 2403 return grid.NumTracks(kForRows); |
2393 | 2404 |
2394 return grid.NumTracks(kForRows) | 2405 return grid.NumTracks(kForRows) |
2395 ? grid.NumTracks(kForColumns) | 2406 ? grid.NumTracks(kForColumns) |
2396 : GridPositionsResolver::ExplicitGridColumnCount( | 2407 : GridPositionsResolver::ExplicitGridColumnCount( |
2397 StyleRef(), grid.AutoRepeatTracks(kForColumns)); | 2408 StyleRef(), grid.AutoRepeatTracks(kForColumns)); |
2398 } | 2409 } |
2399 | 2410 |
2400 } // namespace blink | 2411 } // namespace blink |
OLD | NEW |