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

Side by Side Diff: Source/core/rendering/RenderGrid.cpp

Issue 22983004: [CSS Grid Layout] Speed up content sized track layout (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « PerformanceTests/Layout/auto-grid-lots-of-data.html ('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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 return style()->gridDefinitionRows().size(); 502 return style()->gridDefinitionRows().size();
503 } 503 }
504 504
505 size_t RenderGrid::explicitGridSizeForSide(GridPositionSide side) const 505 size_t RenderGrid::explicitGridSizeForSide(GridPositionSide side) const
506 { 506 {
507 return (side == ColumnStartSide || side == ColumnEndSide) ? explicitGridColu mnCount() : explicitGridRowCount(); 507 return (side == ColumnStartSide || side == ColumnEndSide) ? explicitGridColu mnCount() : explicitGridRowCount();
508 } 508 }
509 509
510 LayoutUnit RenderGrid::logicalContentHeightForChild(RenderBox* child, Vector<Gri dTrack>& columnTracks) 510 LayoutUnit RenderGrid::logicalContentHeightForChild(RenderBox* child, Vector<Gri dTrack>& columnTracks)
511 { 511 {
512 // FIXME: We shouldn't force a layout every time this function is called but 512 if (child->style()->logicalHeight().isPercent())
ojan 2013/08/13 17:22:21 What if it's position:absolute; top:0; bottom: 0?
Julien - ping for review 2013/08/13 18:45:43 Absolutely positioned grid items don't participate
513 // 1) Return computeLogicalHeight's value if it's available. Unfortunately c omputeLogicalHeight
514 // doesn't return if the logical height is available so would need to be cha nged.
515 // 2) Relayout if the column track's used breadth changed OR the logical hei ght is unavailable.
516 if (!child->needsLayout())
517 child->setNeedsLayout(MarkOnlyThis); 513 child->setNeedsLayout(MarkOnlyThis);
518 514
519 child->setOverrideContainingBlockContentLogicalWidth(gridAreaBreadthForChild (child, ForColumns, columnTracks)); 515 child->setOverrideContainingBlockContentLogicalWidth(gridAreaBreadthForChild (child, ForColumns, columnTracks));
520 // If |child| has a percentage logical height, we shouldn't let it override its intrinsic height, which is 516 // If |child| has a percentage logical height, we shouldn't let it override its intrinsic height, which is
521 // what we are interested in here. Thus we need to set the override logical height to -1 (no possible resolution). 517 // what we are interested in here. Thus we need to set the override logical height to -1 (no possible resolution).
522 child->setOverrideContainingBlockContentLogicalHeight(-1); 518 child->setOverrideContainingBlockContentLogicalHeight(-1);
523 child->layout(); 519 child->layoutIfNeeded();
524 return child->logicalHeight(); 520 return child->logicalHeight();
525 } 521 }
526 522
527 LayoutUnit RenderGrid::minContentForChild(RenderBox* child, TrackSizingDirection direction, Vector<GridTrack>& columnTracks) 523 LayoutUnit RenderGrid::minContentForChild(RenderBox* child, TrackSizingDirection direction, Vector<GridTrack>& columnTracks)
528 { 524 {
529 bool hasOrthogonalWritingMode = child->isHorizontalWritingMode() != isHorizo ntalWritingMode(); 525 bool hasOrthogonalWritingMode = child->isHorizontalWritingMode() != isHorizo ntalWritingMode();
530 // FIXME: Properly support orthogonal writing mode. 526 // FIXME: Properly support orthogonal writing mode.
531 if (hasOrthogonalWritingMode) 527 if (hasOrthogonalWritingMode)
532 return 0; 528 return 0;
533 529
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 if (isOutOfFlowPositioned()) 1132 if (isOutOfFlowPositioned())
1137 return "RenderGrid (positioned)"; 1133 return "RenderGrid (positioned)";
1138 if (isAnonymous()) 1134 if (isAnonymous())
1139 return "RenderGrid (generated)"; 1135 return "RenderGrid (generated)";
1140 if (isRelPositioned()) 1136 if (isRelPositioned())
1141 return "RenderGrid (relative positioned)"; 1137 return "RenderGrid (relative positioned)";
1142 return "RenderGrid"; 1138 return "RenderGrid";
1143 } 1139 }
1144 1140
1145 } // namespace WebCore 1141 } // namespace WebCore
OLDNEW
« no previous file with comments | « PerformanceTests/Layout/auto-grid-lots-of-data.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698