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

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

Issue 2547053003: s/ passed(...) / WTF::passed(...) / to avoid future ambiguity w/ base::Passed. (Closed)
Patch Set: Rebasing... Created 4 years 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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 (m_direction == ForColumns) ? varyingTrackSpan : fixedTrackSpan; 360 (m_direction == ForColumns) ? varyingTrackSpan : fixedTrackSpan;
361 size_t columnSpan = 361 size_t columnSpan =
362 (m_direction == ForColumns) ? fixedTrackSpan : varyingTrackSpan; 362 (m_direction == ForColumns) ? fixedTrackSpan : varyingTrackSpan;
363 363
364 size_t& varyingTrackIndex = 364 size_t& varyingTrackIndex =
365 (m_direction == ForColumns) ? m_rowIndex : m_columnIndex; 365 (m_direction == ForColumns) ? m_rowIndex : m_columnIndex;
366 const size_t endOfVaryingTrackIndex = 366 const size_t endOfVaryingTrackIndex =
367 (m_direction == ForColumns) ? m_grid.size() : m_grid[0].size(); 367 (m_direction == ForColumns) ? m_grid.size() : m_grid[0].size();
368 for (; varyingTrackIndex < endOfVaryingTrackIndex; ++varyingTrackIndex) { 368 for (; varyingTrackIndex < endOfVaryingTrackIndex; ++varyingTrackIndex) {
369 if (checkEmptyCells(rowSpan, columnSpan)) { 369 if (checkEmptyCells(rowSpan, columnSpan)) {
370 std::unique_ptr<GridArea> result = wrapUnique( 370 std::unique_ptr<GridArea> result = WTF::wrapUnique(
371 new GridArea(GridSpan::translatedDefiniteGridSpan( 371 new GridArea(GridSpan::translatedDefiniteGridSpan(
372 m_rowIndex, m_rowIndex + rowSpan), 372 m_rowIndex, m_rowIndex + rowSpan),
373 GridSpan::translatedDefiniteGridSpan( 373 GridSpan::translatedDefiniteGridSpan(
374 m_columnIndex, m_columnIndex + columnSpan))); 374 m_columnIndex, m_columnIndex + columnSpan)));
375 // Advance the iterator to avoid an infinite loop where we would return 375 // Advance the iterator to avoid an infinite loop where we would return
376 // the same grid area over and over. 376 // the same grid area over and over.
377 ++varyingTrackIndex; 377 ++varyingTrackIndex;
378 return result; 378 return result;
379 } 379 }
380 } 380 }
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 additionalTracksToTreatAsInflexible->contains(index)) 1116 additionalTracksToTreatAsInflexible->contains(index))
1117 continue; 1117 continue;
1118 LayoutUnit baseSize = tracks[index].baseSize(); 1118 LayoutUnit baseSize = tracks[index].baseSize();
1119 double flexFactor = 1119 double flexFactor =
1120 gridTrackSize(direction, index).maxTrackBreadth().flex(); 1120 gridTrackSize(direction, index).maxTrackBreadth().flex();
1121 // treating all such tracks as inflexible. 1121 // treating all such tracks as inflexible.
1122 if (baseSize > hypotheticalFactorUnitSize * flexFactor) { 1122 if (baseSize > hypotheticalFactorUnitSize * flexFactor) {
1123 leftOverSpace -= baseSize; 1123 leftOverSpace -= baseSize;
1124 flexFactorSum -= flexFactor; 1124 flexFactorSum -= flexFactor;
1125 if (!additionalTracksToTreatAsInflexible) 1125 if (!additionalTracksToTreatAsInflexible)
1126 additionalTracksToTreatAsInflexible = makeUnique<TrackIndexSet>(); 1126 additionalTracksToTreatAsInflexible = WTF::makeUnique<TrackIndexSet>();
1127 additionalTracksToTreatAsInflexible->add(index); 1127 additionalTracksToTreatAsInflexible->add(index);
1128 validFlexFactorUnit = false; 1128 validFlexFactorUnit = false;
1129 } 1129 }
1130 } 1130 }
1131 if (!validFlexFactorUnit) 1131 if (!validFlexFactorUnit)
1132 return computeFlexFactorUnitSize( 1132 return computeFlexFactorUnitSize(
1133 tracks, direction, flexFactorSum, leftOverSpace, flexibleTracksIndexes, 1133 tracks, direction, flexFactorSum, leftOverSpace, flexibleTracksIndexes,
1134 std::move(additionalTracksToTreatAsInflexible)); 1134 std::move(additionalTracksToTreatAsInflexible));
1135 return hypotheticalFactorUnitSize; 1135 return hypotheticalFactorUnitSize;
1136 } 1136 }
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
2038 std::unique_ptr<OrderedTrackIndexSet> emptyTrackIndexes; 2038 std::unique_ptr<OrderedTrackIndexSet> emptyTrackIndexes;
2039 size_t insertionPoint = isRowAxis 2039 size_t insertionPoint = isRowAxis
2040 ? styleRef().gridAutoRepeatColumnsInsertionPoint() 2040 ? styleRef().gridAutoRepeatColumnsInsertionPoint()
2041 : styleRef().gridAutoRepeatRowsInsertionPoint(); 2041 : styleRef().gridAutoRepeatRowsInsertionPoint();
2042 size_t firstAutoRepeatTrack = 2042 size_t firstAutoRepeatTrack =
2043 insertionPoint + std::abs(grid.smallestTrackStart(direction)); 2043 insertionPoint + std::abs(grid.smallestTrackStart(direction));
2044 size_t lastAutoRepeatTrack = 2044 size_t lastAutoRepeatTrack =
2045 firstAutoRepeatTrack + grid.autoRepeatTracks(direction); 2045 firstAutoRepeatTrack + grid.autoRepeatTracks(direction);
2046 2046
2047 if (!m_grid.hasGridItems()) { 2047 if (!m_grid.hasGridItems()) {
2048 emptyTrackIndexes = wrapUnique(new OrderedTrackIndexSet); 2048 emptyTrackIndexes = WTF::wrapUnique(new OrderedTrackIndexSet);
2049 for (size_t trackIndex = firstAutoRepeatTrack; 2049 for (size_t trackIndex = firstAutoRepeatTrack;
2050 trackIndex < lastAutoRepeatTrack; ++trackIndex) 2050 trackIndex < lastAutoRepeatTrack; ++trackIndex)
2051 emptyTrackIndexes->add(trackIndex); 2051 emptyTrackIndexes->add(trackIndex);
2052 } else { 2052 } else {
2053 for (size_t trackIndex = firstAutoRepeatTrack; 2053 for (size_t trackIndex = firstAutoRepeatTrack;
2054 trackIndex < lastAutoRepeatTrack; ++trackIndex) { 2054 trackIndex < lastAutoRepeatTrack; ++trackIndex) {
2055 GridIterator iterator(grid, direction, trackIndex); 2055 GridIterator iterator(grid, direction, trackIndex);
2056 if (!iterator.nextGridItem()) { 2056 if (!iterator.nextGridItem()) {
2057 if (!emptyTrackIndexes) 2057 if (!emptyTrackIndexes)
2058 emptyTrackIndexes = wrapUnique(new OrderedTrackIndexSet); 2058 emptyTrackIndexes = WTF::wrapUnique(new OrderedTrackIndexSet);
2059 emptyTrackIndexes->add(trackIndex); 2059 emptyTrackIndexes->add(trackIndex);
2060 } 2060 }
2061 } 2061 }
2062 } 2062 }
2063 return emptyTrackIndexes; 2063 return emptyTrackIndexes;
2064 } 2064 }
2065 2065
2066 void LayoutGrid::placeItemsOnGrid(LayoutGrid::Grid& grid, 2066 void LayoutGrid::placeItemsOnGrid(LayoutGrid::Grid& grid,
2067 SizingOperation sizingOperation) { 2067 SizingOperation sizingOperation) {
2068 if (!grid.needsItemsPlacement()) 2068 if (!grid.needsItemsPlacement())
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
2221 GridTrackSizingDirection specifiedDirection, 2221 GridTrackSizingDirection specifiedDirection,
2222 const GridSpan& specifiedPositions) const { 2222 const GridSpan& specifiedPositions) const {
2223 GridTrackSizingDirection crossDirection = 2223 GridTrackSizingDirection crossDirection =
2224 specifiedDirection == ForColumns ? ForRows : ForColumns; 2224 specifiedDirection == ForColumns ? ForRows : ForColumns;
2225 const size_t endOfCrossDirection = grid.numTracks(crossDirection); 2225 const size_t endOfCrossDirection = grid.numTracks(crossDirection);
2226 size_t crossDirectionSpanSize = 2226 size_t crossDirectionSpanSize =
2227 GridPositionsResolver::spanSizeForAutoPlacedItem(*style(), gridItem, 2227 GridPositionsResolver::spanSizeForAutoPlacedItem(*style(), gridItem,
2228 crossDirection); 2228 crossDirection);
2229 GridSpan crossDirectionPositions = GridSpan::translatedDefiniteGridSpan( 2229 GridSpan crossDirectionPositions = GridSpan::translatedDefiniteGridSpan(
2230 endOfCrossDirection, endOfCrossDirection + crossDirectionSpanSize); 2230 endOfCrossDirection, endOfCrossDirection + crossDirectionSpanSize);
2231 return wrapUnique( 2231 return WTF::wrapUnique(
2232 new GridArea(specifiedDirection == ForColumns ? crossDirectionPositions 2232 new GridArea(specifiedDirection == ForColumns ? crossDirectionPositions
2233 : specifiedPositions, 2233 : specifiedPositions,
2234 specifiedDirection == ForColumns ? specifiedPositions 2234 specifiedDirection == ForColumns ? specifiedPositions
2235 : crossDirectionPositions)); 2235 : crossDirectionPositions));
2236 } 2236 }
2237 2237
2238 void LayoutGrid::placeSpecifiedMajorAxisItemsOnGrid( 2238 void LayoutGrid::placeSpecifiedMajorAxisItemsOnGrid(
2239 Grid& grid, 2239 Grid& grid,
2240 const Vector<LayoutBox*>& autoGridItems) const { 2240 const Vector<LayoutBox*>& autoGridItems) const {
2241 bool isForColumns = autoPlacementMajorAxisDirection() == ForColumns; 2241 bool isForColumns = autoPlacementMajorAxisDirection() == ForColumns;
(...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after
3598 if (direction == ForRows) 3598 if (direction == ForRows)
3599 return grid.numTracks(ForRows); 3599 return grid.numTracks(ForRows);
3600 3600
3601 return grid.numTracks(ForRows) 3601 return grid.numTracks(ForRows)
3602 ? grid.numTracks(ForColumns) 3602 ? grid.numTracks(ForColumns)
3603 : GridPositionsResolver::explicitGridColumnCount( 3603 : GridPositionsResolver::explicitGridColumnCount(
3604 styleRef(), grid.autoRepeatTracks(ForColumns)); 3604 styleRef(), grid.autoRepeatTracks(ForColumns));
3605 } 3605 }
3606 3606
3607 } // namespace blink 3607 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutCounter.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutTable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698