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

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

Issue 2856163002: [css-grid] Avoid the relayout forced on orthogonal grid items (Closed)
Patch Set: Do no clear overrideContainingBlock 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 | « no previous file | 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 // information (which may trigger relayout). 246 // information (which may trigger relayout).
247 LayoutState state(*this); 247 LayoutState state(*this);
248 248
249 LayoutSize previous_size = Size(); 249 LayoutSize previous_size = Size();
250 has_definite_logical_height_ = HasDefiniteLogicalHeight(); 250 has_definite_logical_height_ = HasDefiniteLogicalHeight();
251 251
252 // Grid's layout logic controls the grid item's override size, hence 252 // Grid's layout logic controls the grid item's override size, hence
253 // we need to clear any override size set previously, so it doesn't 253 // we need to clear any override size set previously, so it doesn't
254 // interfere in current layout execution. 254 // interfere in current layout execution.
255 for (auto* child = FirstInFlowChildBox(); child; 255 for (auto* child = FirstInFlowChildBox(); child;
256 child = child->NextInFlowSiblingBox()) { 256 child = child->NextInFlowSiblingBox())
257 child->ClearOverrideSize(); 257 child->ClearOverrideSize();
258 if (!IsOrthogonalChild(*child) ||
259 (!SizesLogicalWidthToFitContent(StyleRef().LogicalWidth()) &&
260 !StyleRef().LogicalWidth().IsIntrinsicOrAuto()))
261 continue;
262 // Additionally, we may need to clear containingBlock override sizes and
263 // force a layout of the grid items to ensure we get the same result when
264 // grid's intrinsic size is computed again in the updateLogicalWidth call
265 // bellow.
266 child->ClearContainingBlockOverrideSize();
267 child->ForceLayout();
268 }
269 258
270 UpdateLogicalWidth(); 259 UpdateLogicalWidth();
271 260
272 TextAutosizer::LayoutScope text_autosizer_layout_scope(this, &layout_scope); 261 TextAutosizer::LayoutScope text_autosizer_layout_scope(this, &layout_scope);
273 262
274 LayoutUnit available_space_for_columns = AvailableLogicalWidth(); 263 LayoutUnit available_space_for_columns = AvailableLogicalWidth();
275 PlaceItemsOnGrid(grid_, available_space_for_columns); 264 PlaceItemsOnGrid(grid_, available_space_for_columns);
276 265
277 // 1- First, the track sizing algorithm is used to resolve the sizes of the 266 // 1- First, the track sizing algorithm is used to resolve the sizes of the
278 // grid columns. 267 // grid columns.
(...skipping 2125 matching lines...) Expand 10 before | Expand all | Expand 10 after
2404 if (direction == kForRows) 2393 if (direction == kForRows)
2405 return grid.NumTracks(kForRows); 2394 return grid.NumTracks(kForRows);
2406 2395
2407 return grid.NumTracks(kForRows) 2396 return grid.NumTracks(kForRows)
2408 ? grid.NumTracks(kForColumns) 2397 ? grid.NumTracks(kForColumns)
2409 : GridPositionsResolver::ExplicitGridColumnCount( 2398 : GridPositionsResolver::ExplicitGridColumnCount(
2410 StyleRef(), grid.AutoRepeatTracks(kForColumns)); 2399 StyleRef(), grid.AutoRepeatTracks(kForColumns));
2411 } 2400 }
2412 2401
2413 } // namespace blink 2402 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698