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

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

Issue 2688893002: Migrate WTF::HashSet::add() to ::insert() [continued] (Closed)
Patch Set: rebase, fix one platform-specific reference Created 3 years, 10 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 | third_party/WebKit/Source/core/origin_trials/OriginTrialContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/layout/GridTrackSizingAlgorithm.h" 5 #include "core/layout/GridTrackSizingAlgorithm.h"
6 6
7 #include "core/layout/Grid.h" 7 #include "core/layout/Grid.h"
8 #include "core/layout/LayoutGrid.h" 8 #include "core/layout/LayoutGrid.h"
9 #include "platform/LengthFunctions.h" 9 #include "platform/LengthFunctions.h"
10 10
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 } 1120 }
1121 1121
1122 void GridTrackSizingAlgorithm::resolveIntrinsicTrackSizes() { 1122 void GridTrackSizingAlgorithm::resolveIntrinsicTrackSizes() {
1123 Vector<GridItemWithSpan> itemsSortedByIncreasingSpan; 1123 Vector<GridItemWithSpan> itemsSortedByIncreasingSpan;
1124 if (m_grid.hasGridItems()) { 1124 if (m_grid.hasGridItems()) {
1125 HashSet<LayoutBox*> itemsSet; 1125 HashSet<LayoutBox*> itemsSet;
1126 for (const auto& trackIndex : m_contentSizedTracksIndex) { 1126 for (const auto& trackIndex : m_contentSizedTracksIndex) {
1127 GridIterator iterator(m_grid, m_direction, trackIndex); 1127 GridIterator iterator(m_grid, m_direction, trackIndex);
1128 GridTrack& track = tracks(m_direction)[trackIndex]; 1128 GridTrack& track = tracks(m_direction)[trackIndex];
1129 while (LayoutBox* gridItem = iterator.nextGridItem()) { 1129 while (LayoutBox* gridItem = iterator.nextGridItem()) {
1130 if (itemsSet.add(gridItem).isNewEntry) { 1130 if (itemsSet.insert(gridItem).isNewEntry) {
1131 const GridSpan& span = m_grid.gridItemSpan(*gridItem, m_direction); 1131 const GridSpan& span = m_grid.gridItemSpan(*gridItem, m_direction);
1132 if (span.integerSpan() == 1) { 1132 if (span.integerSpan() == 1) {
1133 sizeTrackToFitNonSpanningItem(span, *gridItem, track); 1133 sizeTrackToFitNonSpanningItem(span, *gridItem, track);
1134 } else if (!spanningItemCrossesFlexibleSizedTracks(span)) { 1134 } else if (!spanningItemCrossesFlexibleSizedTracks(span)) {
1135 itemsSortedByIncreasingSpan.push_back( 1135 itemsSortedByIncreasingSpan.push_back(
1136 GridItemWithSpan(*gridItem, span)); 1136 GridItemWithSpan(*gridItem, span));
1137 } 1137 }
1138 } 1138 }
1139 } 1139 }
1140 } 1140 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 continue; 1242 continue;
1243 LayoutUnit baseSize = tracks[index].baseSize(); 1243 LayoutUnit baseSize = tracks[index].baseSize();
1244 double flexFactor = 1244 double flexFactor =
1245 gridTrackSize(m_direction, index).maxTrackBreadth().flex(); 1245 gridTrackSize(m_direction, index).maxTrackBreadth().flex();
1246 // treating all such tracks as inflexible. 1246 // treating all such tracks as inflexible.
1247 if (baseSize > hypotheticalFactorUnitSize * flexFactor) { 1247 if (baseSize > hypotheticalFactorUnitSize * flexFactor) {
1248 leftOverSpace -= baseSize; 1248 leftOverSpace -= baseSize;
1249 flexFactorSum -= flexFactor; 1249 flexFactorSum -= flexFactor;
1250 if (!additionalTracksToTreatAsInflexible) 1250 if (!additionalTracksToTreatAsInflexible)
1251 additionalTracksToTreatAsInflexible = WTF::makeUnique<TrackIndexSet>(); 1251 additionalTracksToTreatAsInflexible = WTF::makeUnique<TrackIndexSet>();
1252 additionalTracksToTreatAsInflexible->add(index); 1252 additionalTracksToTreatAsInflexible->insert(index);
1253 validFlexFactorUnit = false; 1253 validFlexFactorUnit = false;
1254 } 1254 }
1255 } 1255 }
1256 if (!validFlexFactorUnit) { 1256 if (!validFlexFactorUnit) {
1257 return computeFlexFactorUnitSize( 1257 return computeFlexFactorUnitSize(
1258 tracks, flexFactorSum, leftOverSpace, flexibleTracksIndexes, 1258 tracks, flexFactorSum, leftOverSpace, flexibleTracksIndexes,
1259 std::move(additionalTracksToTreatAsInflexible)); 1259 std::move(additionalTracksToTreatAsInflexible));
1260 } 1260 }
1261 return hypotheticalFactorUnitSize; 1261 return hypotheticalFactorUnitSize;
1262 } 1262 }
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 DCHECK(m_algorithm.isValidTransition()); 1425 DCHECK(m_algorithm.isValidTransition());
1426 DCHECK(!m_algorithm.m_needsSetup); 1426 DCHECK(!m_algorithm.m_needsSetup);
1427 } 1427 }
1428 1428
1429 GridTrackSizingAlgorithm::StateMachine::~StateMachine() { 1429 GridTrackSizingAlgorithm::StateMachine::~StateMachine() {
1430 m_algorithm.advanceNextState(); 1430 m_algorithm.advanceNextState();
1431 m_algorithm.m_needsSetup = true; 1431 m_algorithm.m_needsSetup = true;
1432 } 1432 }
1433 1433
1434 } // namespace blink 1434 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/origin_trials/OriginTrialContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698