| OLD | NEW |
| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 size_t rowSpan = (m_direction == ForColumns) ? varyingTrackSpan : fixedT
rackSpan; | 205 size_t rowSpan = (m_direction == ForColumns) ? varyingTrackSpan : fixedT
rackSpan; |
| 206 size_t columnSpan = (m_direction == ForColumns) ? fixedTrackSpan : varyi
ngTrackSpan; | 206 size_t columnSpan = (m_direction == ForColumns) ? fixedTrackSpan : varyi
ngTrackSpan; |
| 207 | 207 |
| 208 size_t& varyingTrackIndex = (m_direction == ForColumns) ? m_rowIndex : m
_columnIndex; | 208 size_t& varyingTrackIndex = (m_direction == ForColumns) ? m_rowIndex : m
_columnIndex; |
| 209 const size_t endOfVaryingTrackIndex = (m_direction == ForColumns) ? m_gr
id.size() : m_grid[0].size(); | 209 const size_t endOfVaryingTrackIndex = (m_direction == ForColumns) ? m_gr
id.size() : m_grid[0].size(); |
| 210 for (; varyingTrackIndex < endOfVaryingTrackIndex; ++varyingTrackIndex)
{ | 210 for (; varyingTrackIndex < endOfVaryingTrackIndex; ++varyingTrackIndex)
{ |
| 211 if (checkEmptyCells(rowSpan, columnSpan)) { | 211 if (checkEmptyCells(rowSpan, columnSpan)) { |
| 212 OwnPtr<GridArea> result = adoptPtr(new GridArea(GridSpan::transl
atedDefiniteGridSpan(m_rowIndex, m_rowIndex + rowSpan), GridSpan::translatedDefi
niteGridSpan(m_columnIndex, m_columnIndex + columnSpan))); | 212 OwnPtr<GridArea> result = adoptPtr(new GridArea(GridSpan::transl
atedDefiniteGridSpan(m_rowIndex, m_rowIndex + rowSpan), GridSpan::translatedDefi
niteGridSpan(m_columnIndex, m_columnIndex + columnSpan))); |
| 213 // Advance the iterator to avoid an infinite loop where we would
return the same grid area over and over. | 213 // Advance the iterator to avoid an infinite loop where we would
return the same grid area over and over. |
| 214 ++varyingTrackIndex; | 214 ++varyingTrackIndex; |
| 215 return result.release(); | 215 return result; |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 return nullptr; | 218 return nullptr; |
| 219 } | 219 } |
| 220 | 220 |
| 221 private: | 221 private: |
| 222 const GridRepresentation& m_grid; | 222 const GridRepresentation& m_grid; |
| 223 GridTrackSizingDirection m_direction; | 223 GridTrackSizingDirection m_direction; |
| 224 size_t m_rowIndex; | 224 size_t m_rowIndex; |
| 225 size_t m_columnIndex; | 225 size_t m_columnIndex; |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 if (baseSize > hypotheticalFactorUnitSize * flexFactor) { | 633 if (baseSize > hypotheticalFactorUnitSize * flexFactor) { |
| 634 leftOverSpace -= baseSize; | 634 leftOverSpace -= baseSize; |
| 635 flexFactorSum -= flexFactor; | 635 flexFactorSum -= flexFactor; |
| 636 if (!additionalTracksToTreatAsInflexible) | 636 if (!additionalTracksToTreatAsInflexible) |
| 637 additionalTracksToTreatAsInflexible = adoptPtr(new TrackIndexSet
()); | 637 additionalTracksToTreatAsInflexible = adoptPtr(new TrackIndexSet
()); |
| 638 additionalTracksToTreatAsInflexible->add(index); | 638 additionalTracksToTreatAsInflexible->add(index); |
| 639 validFlexFactorUnit = false; | 639 validFlexFactorUnit = false; |
| 640 } | 640 } |
| 641 } | 641 } |
| 642 if (!validFlexFactorUnit) | 642 if (!validFlexFactorUnit) |
| 643 return computeFlexFactorUnitSize(tracks, direction, flexFactorSum, leftO
verSpace, flexibleTracksIndexes, additionalTracksToTreatAsInflexible.release()); | 643 return computeFlexFactorUnitSize(tracks, direction, flexFactorSum, leftO
verSpace, flexibleTracksIndexes, std::move(additionalTracksToTreatAsInflexible))
; |
| 644 return hypotheticalFactorUnitSize; | 644 return hypotheticalFactorUnitSize; |
| 645 } | 645 } |
| 646 | 646 |
| 647 double LayoutGrid::findFlexFactorUnitSize(const Vector<GridTrack>& tracks, const
GridSpan& tracksSpan, GridTrackSizingDirection direction, LayoutUnit leftOverSp
ace) const | 647 double LayoutGrid::findFlexFactorUnitSize(const Vector<GridTrack>& tracks, const
GridSpan& tracksSpan, GridTrackSizingDirection direction, LayoutUnit leftOverSp
ace) const |
| 648 { | 648 { |
| 649 if (leftOverSpace <= 0) | 649 if (leftOverSpace <= 0) |
| 650 return 0; | 650 return 0; |
| 651 | 651 |
| 652 double flexFactorSum = 0; | 652 double flexFactorSum = 0; |
| 653 Vector<size_t, 8> flexibleTracksIndexes; | 653 Vector<size_t, 8> flexibleTracksIndexes; |
| (...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2240 | 2240 |
| 2241 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child, sizingData
)); | 2241 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child, sizingData
)); |
| 2242 } | 2242 } |
| 2243 | 2243 |
| 2244 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) const | 2244 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) const |
| 2245 { | 2245 { |
| 2246 GridPainter(*this).paintChildren(paintInfo, paintOffset); | 2246 GridPainter(*this).paintChildren(paintInfo, paintOffset); |
| 2247 } | 2247 } |
| 2248 | 2248 |
| 2249 } // namespace blink | 2249 } // namespace blink |
| OLD | NEW |