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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 | 273 |
274 // 1- First, the track sizing algorithm is used to resolve the sizes of the | 274 // 1- First, the track sizing algorithm is used to resolve the sizes of the |
275 // grid columns. | 275 // grid columns. |
276 // At this point the logical width is always definite as the above call to | 276 // At this point the logical width is always definite as the above call to |
277 // updateLogicalWidth() properly resolves intrinsic sizes. We cannot do the | 277 // updateLogicalWidth() properly resolves intrinsic sizes. We cannot do the |
278 // same for heights though because many code paths inside | 278 // same for heights though because many code paths inside |
279 // updateLogicalHeight() require a previous call to setLogicalHeight() to | 279 // updateLogicalHeight() require a previous call to setLogicalHeight() to |
280 // resolve heights properly (like for positioned items for example). | 280 // resolve heights properly (like for positioned items for example). |
281 ComputeTrackSizesForDefiniteSize(kForColumns, available_space_for_columns); | 281 ComputeTrackSizesForDefiniteSize(kForColumns, available_space_for_columns); |
282 | 282 |
283 // We take the chance to store the intrinsic sizes as the track sizing | |
284 // algorithm always compute them as part of its execution. Apart from saving | |
jfernandez
2017/04/21 14:48:02
What do you mean with this sentence ?
svillar
2017/04/21 14:51:24
In order to compute the intrinsic sizes we have to
| |
285 // an algorithm execution, it fixes the use case of computing the preferred | |
jfernandez
2017/04/21 14:48:02
Why we save an algorithm execution with this chang
svillar
2017/04/21 14:51:23
Because we wouldn't have to call the algorithm lat
| |
286 // logical widths *after* the layout process. Although not very common, this | |
287 // happens in the Mac (content::RenderViewImpl::didUpdateLayout()) or under | |
288 // some circumstances when grids are also flex items (crbug.com/708159). | |
289 if (PreferredLogicalWidthsDirty()) { | |
290 LayoutUnit scrollbar_width = LayoutUnit(ScrollbarLogicalWidth()); | |
291 min_preferred_logical_width_ = | |
292 track_sizing_algorithm_.MinContentSize() + scrollbar_width; | |
293 max_preferred_logical_width_ = | |
294 track_sizing_algorithm_.MaxContentSize() + scrollbar_width; | |
295 ClearPreferredLogicalWidthsDirty(); | |
296 } | |
297 | |
283 // 2- Next, the track sizing algorithm resolves the sizes of the grid rows, | 298 // 2- Next, the track sizing algorithm resolves the sizes of the grid rows, |
284 // using the grid column sizes calculated in the previous step. | 299 // using the grid column sizes calculated in the previous step. |
285 if (CachedHasDefiniteLogicalHeight()) { | 300 if (CachedHasDefiniteLogicalHeight()) { |
286 ComputeTrackSizesForDefiniteSize( | 301 ComputeTrackSizesForDefiniteSize( |
287 kForRows, AvailableLogicalHeight(kExcludeMarginBorderPadding)); | 302 kForRows, AvailableLogicalHeight(kExcludeMarginBorderPadding)); |
288 } else { | 303 } else { |
289 ComputeTrackSizesForIndefiniteSize(track_sizing_algorithm_, kForRows, | 304 ComputeTrackSizesForIndefiniteSize(track_sizing_algorithm_, kForRows, |
290 grid_, min_content_height_, | 305 grid_, min_content_height_, |
291 max_content_height_); | 306 max_content_height_); |
292 } | 307 } |
(...skipping 2096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2389 if (direction == kForRows) | 2404 if (direction == kForRows) |
2390 return grid.NumTracks(kForRows); | 2405 return grid.NumTracks(kForRows); |
2391 | 2406 |
2392 return grid.NumTracks(kForRows) | 2407 return grid.NumTracks(kForRows) |
2393 ? grid.NumTracks(kForColumns) | 2408 ? grid.NumTracks(kForColumns) |
2394 : GridPositionsResolver::ExplicitGridColumnCount( | 2409 : GridPositionsResolver::ExplicitGridColumnCount( |
2395 StyleRef(), grid.AutoRepeatTracks(kForColumns)); | 2410 StyleRef(), grid.AutoRepeatTracks(kForColumns)); |
2396 } | 2411 } |
2397 | 2412 |
2398 } // namespace blink | 2413 } // namespace blink |
OLD | NEW |