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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutGrid.cpp

Issue 2834473003: [css-grid] Preemptively store intrinsic sizes during layout (Closed)
Patch Set: More tests 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 they are just an
284 // intermediate result of the track sizing algorithm. Apart from eventually
285 // saving an algorithm execution (if {min|max}PreferredLogicalWidth() are
286 // called later), it fixes the use case of computing the preferred logical
287 // widths *after* the layout process. Although not very common, this happens
288 // in the Mac (content::RenderViewImpl::didUpdateLayout()) or under some
289 // circumstances when grids are also flex items (crbug.com/708159).
290 if (PreferredLogicalWidthsDirty()) {
291 LayoutUnit scrollbar_width = LayoutUnit(ScrollbarLogicalWidth());
292 min_preferred_logical_width_ =
293 track_sizing_algorithm_.MinContentSize() + scrollbar_width;
294 max_preferred_logical_width_ =
295 track_sizing_algorithm_.MaxContentSize() + scrollbar_width;
296 ClearPreferredLogicalWidthsDirty();
297 }
298
283 // 2- Next, the track sizing algorithm resolves the sizes of the grid rows, 299 // 2- Next, the track sizing algorithm resolves the sizes of the grid rows,
284 // using the grid column sizes calculated in the previous step. 300 // using the grid column sizes calculated in the previous step.
285 if (CachedHasDefiniteLogicalHeight()) { 301 if (CachedHasDefiniteLogicalHeight()) {
286 ComputeTrackSizesForDefiniteSize( 302 ComputeTrackSizesForDefiniteSize(
287 kForRows, AvailableLogicalHeight(kExcludeMarginBorderPadding)); 303 kForRows, AvailableLogicalHeight(kExcludeMarginBorderPadding));
288 } else { 304 } else {
289 ComputeTrackSizesForIndefiniteSize(track_sizing_algorithm_, kForRows, 305 ComputeTrackSizesForIndefiniteSize(track_sizing_algorithm_, kForRows,
290 grid_, min_content_height_, 306 grid_, min_content_height_,
291 max_content_height_); 307 max_content_height_);
292 } 308 }
(...skipping 2096 matching lines...) Expand 10 before | Expand all | Expand 10 after
2389 if (direction == kForRows) 2405 if (direction == kForRows)
2390 return grid.NumTracks(kForRows); 2406 return grid.NumTracks(kForRows);
2391 2407
2392 return grid.NumTracks(kForRows) 2408 return grid.NumTracks(kForRows)
2393 ? grid.NumTracks(kForColumns) 2409 ? grid.NumTracks(kForColumns)
2394 : GridPositionsResolver::ExplicitGridColumnCount( 2410 : GridPositionsResolver::ExplicitGridColumnCount(
2395 StyleRef(), grid.AutoRepeatTracks(kForColumns)); 2411 StyleRef(), grid.AutoRepeatTracks(kForColumns));
2396 } 2412 }
2397 2413
2398 } // namespace blink 2414 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698