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

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

Issue 2318993002: [css-grid] Fix performance regression in grid layout (Closed)
Patch Set: Created 4 years, 3 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
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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 // 1. Initialize per Grid track variables. 665 // 1. Initialize per Grid track variables.
666 for (size_t i = 0; i < tracks.size(); ++i) { 666 for (size_t i = 0; i < tracks.size(); ++i) {
667 GridTrack& track = tracks[i]; 667 GridTrack& track = tracks[i];
668 GridTrackSize trackSize = gridTrackSize(direction, i, sizingData.sizingO peration); 668 GridTrackSize trackSize = gridTrackSize(direction, i, sizingData.sizingO peration);
669 669
670 track.setBaseSize(computeUsedBreadthOfMinLength(trackSize, maxSize)); 670 track.setBaseSize(computeUsedBreadthOfMinLength(trackSize, maxSize));
671 track.setGrowthLimit(computeUsedBreadthOfMaxLength(trackSize, track.base Size(), maxSize)); 671 track.setGrowthLimit(computeUsedBreadthOfMaxLength(trackSize, track.base Size(), maxSize));
672 track.setInfinitelyGrowable(false); 672 track.setInfinitelyGrowable(false);
673 673
674 if (trackSize.isFitContent()) { 674 if (trackSize.isFitContent()) {
675 GridLength gridLength = trackSize.length(); 675 GridLength gridLength = trackSize.fitContentTrackBreadth();
676 if (!gridLength.hasPercentage() || hasDefiniteFreeSpace) 676 if (!gridLength.hasPercentage() || hasDefiniteFreeSpace)
677 track.setGrowthLimitCap(valueForLength(gridLength.length(), maxS ize)); 677 track.setGrowthLimitCap(valueForLength(gridLength.length(), maxS ize));
678 } 678 }
679 679
680 if (trackSize.isContentSized()) 680 if (trackSize.isContentSized())
681 sizingData.contentSizedTracksIndex.append(i); 681 sizingData.contentSizedTracksIndex.append(i);
682 if (trackSize.maxTrackBreadth().isFlex()) 682 if (trackSize.maxTrackBreadth().isFlex())
683 flexibleSizedTracksIndex.append(i); 683 flexibleSizedTracksIndex.append(i);
684 } 684 }
685 685
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 else if (trackSize.hasMaxContentMinTrackBreadth()) 1137 else if (trackSize.hasMaxContentMinTrackBreadth())
1138 track.setBaseSize(std::max(track.baseSize(), maxContentForChild(gridItem , direction, sizingData))); 1138 track.setBaseSize(std::max(track.baseSize(), maxContentForChild(gridItem , direction, sizingData)));
1139 else if (trackSize.hasAutoMinTrackBreadth()) 1139 else if (trackSize.hasAutoMinTrackBreadth())
1140 track.setBaseSize(std::max(track.baseSize(), minSizeForChild(gridItem, d irection, sizingData))); 1140 track.setBaseSize(std::max(track.baseSize(), minSizeForChild(gridItem, d irection, sizingData)));
1141 1141
1142 if (trackSize.hasMinContentMaxTrackBreadth()) { 1142 if (trackSize.hasMinContentMaxTrackBreadth()) {
1143 track.setGrowthLimit(std::max(track.growthLimit(), minContentForChild(gr idItem, direction, sizingData))); 1143 track.setGrowthLimit(std::max(track.growthLimit(), minContentForChild(gr idItem, direction, sizingData)));
1144 } else if (trackSize.hasMaxContentOrAutoMaxTrackBreadth()) { 1144 } else if (trackSize.hasMaxContentOrAutoMaxTrackBreadth()) {
1145 LayoutUnit growthLimit = maxContentForChild(gridItem, direction, sizingD ata); 1145 LayoutUnit growthLimit = maxContentForChild(gridItem, direction, sizingD ata);
1146 if (trackSize.isFitContent()) { 1146 if (trackSize.isFitContent()) {
1147 DCHECK(trackSize.length().isLength()); 1147 DCHECK(trackSize.fitContentTrackBreadth().isLength());
Manuel Rego 2016/09/07 10:56:47 Probably this DCHECK() is not really useful anymor
svillar 2016/09/07 16:27:51 Right.
1148 growthLimit = std::min(growthLimit, valueForLength(trackSize.length( ).length(), sizingData.availableSpace())); 1148 growthLimit = std::min(growthLimit, valueForLength(trackSize.fitCont entTrackBreadth().length(), sizingData.availableSpace()));
1149 } 1149 }
1150 track.setGrowthLimit(std::max(track.growthLimit(), growthLimit)); 1150 track.setGrowthLimit(std::max(track.growthLimit(), growthLimit));
1151 } 1151 }
1152 } 1152 }
1153 1153
1154 static LayoutUnit trackSizeForTrackSizeComputationPhase(TrackSizeComputationPhas e phase, const GridTrack& track, TrackSizeRestriction restriction) 1154 static LayoutUnit trackSizeForTrackSizeComputationPhase(TrackSizeComputationPhas e phase, const GridTrack& track, TrackSizeRestriction restriction)
1155 { 1155 {
1156 switch (phase) { 1156 switch (phase) {
1157 case ResolveIntrinsicMinimums: 1157 case ResolveIntrinsicMinimums:
1158 case ResolveContentBasedMinimums: 1158 case ResolveContentBasedMinimums:
(...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after
2658 return isOrthogonalChild(child) ? childLocation.transposedPoint() : childLoc ation; 2658 return isOrthogonalChild(child) ? childLocation.transposedPoint() : childLoc ation;
2659 } 2659 }
2660 2660
2661 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const 2661 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const
2662 { 2662 {
2663 if (!m_gridItemArea.isEmpty()) 2663 if (!m_gridItemArea.isEmpty())
2664 GridPainter(*this).paintChildren(paintInfo, paintOffset); 2664 GridPainter(*this).paintChildren(paintInfo, paintOffset);
2665 } 2665 }
2666 2666
2667 } // namespace blink 2667 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698