| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> | 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
| 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
| 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. | 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. |
| 7 * Copyright (C) 2015 Google Inc. All rights reserved. | 7 * Copyright (C) 2015 Google Inc. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Lesser General Public | 10 * modify it under the terms of the GNU Lesser General Public |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 | 836 |
| 837 if (trackListIsEmpty) | 837 if (trackListIsEmpty) |
| 838 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 838 return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
| 839 | 839 |
| 840 size_t repetitions = isLayoutGrid ? toLayoutGrid(layoutObject)->autoRepeatCo
untForDirection(direction) : 0; | 840 size_t repetitions = isLayoutGrid ? toLayoutGrid(layoutObject)->autoRepeatCo
untForDirection(direction) : 0; |
| 841 OrderedNamedLinesCollector collector(style, isRowAxis, repetitions); | 841 OrderedNamedLinesCollector collector(style, isRowAxis, repetitions); |
| 842 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 842 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 843 size_t insertionIndex; | 843 size_t insertionIndex; |
| 844 if (isLayoutGrid) { | 844 if (isLayoutGrid) { |
| 845 const auto* grid = toLayoutGrid(layoutObject); | 845 const auto* grid = toLayoutGrid(layoutObject); |
| 846 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? gri
d->columnPositions() : grid->rowPositions(); | 846 Vector<LayoutUnit> computedTrackSizes = grid->trackSizesForComputedStyle
(direction); |
| 847 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro
m that, the grid container can generate implicit grid tracks, | 847 size_t numTracks = computedTrackSizes.size(); |
| 848 // so we'll have more trackPositions than trackSizes as the latter only
contain the explicit grid. | |
| 849 ASSERT(trackPositions.size() - 1 >= trackSizes.size()); | |
| 850 | 848 |
| 851 size_t i; | 849 for (size_t i = 0; i < numTracks; ++i) { |
| 852 LayoutUnit gutterSize = grid->guttersSize(direction, 2); | |
| 853 LayoutUnit offsetBetweenTracks = grid->offsetBetweenTracks(direction); | |
| 854 for (i = 0; i < trackPositions.size() - 2; ++i) { | |
| 855 addValuesForNamedGridLinesAtIndex(collector, i, *list); | 850 addValuesForNamedGridLinesAtIndex(collector, i, *list); |
| 856 list->append(*zoomAdjustedPixelValue(trackPositions[i + 1] - trackPo
sitions[i] - gutterSize - offsetBetweenTracks, style)); | 851 list->append(*zoomAdjustedPixelValue(computedTrackSizes[i], style)); |
| 857 } | 852 } |
| 858 // Last track line does not have any gutter or distribution offset. | 853 addValuesForNamedGridLinesAtIndex(collector, numTracks + 1, *list); |
| 859 addValuesForNamedGridLinesAtIndex(collector, i, *list); | 854 |
| 860 list->append(*zoomAdjustedPixelValue(trackPositions[i + 1] - trackPositi
ons[i], style)); | 855 insertionIndex = numTracks; |
| 861 insertionIndex = trackPositions.size() - 1; | |
| 862 } else { | 856 } else { |
| 863 for (size_t i = 0; i < trackSizes.size(); ++i) { | 857 for (size_t i = 0; i < trackSizes.size(); ++i) { |
| 864 addValuesForNamedGridLinesAtIndex(collector, i, *list); | 858 addValuesForNamedGridLinesAtIndex(collector, i, *list); |
| 865 list->append(*specifiedValueForGridTrackSize(trackSizes[i], style)); | 859 list->append(*specifiedValueForGridTrackSize(trackSizes[i], style)); |
| 866 } | 860 } |
| 867 insertionIndex = trackSizes.size(); | 861 insertionIndex = trackSizes.size(); |
| 868 } | 862 } |
| 869 // Those are the trailing <string>* allowed in the syntax. | 863 // Those are the trailing <string>* allowed in the syntax. |
| 870 addValuesForNamedGridLinesAtIndex(collector, insertionIndex, *list); | 864 addValuesForNamedGridLinesAtIndex(collector, insertionIndex, *list); |
| 871 return list; | 865 return list; |
| (...skipping 2140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3012 case CSSPropertyAll: | 3006 case CSSPropertyAll: |
| 3013 return nullptr; | 3007 return nullptr; |
| 3014 default: | 3008 default: |
| 3015 break; | 3009 break; |
| 3016 } | 3010 } |
| 3017 ASSERT_NOT_REACHED(); | 3011 ASSERT_NOT_REACHED(); |
| 3018 return nullptr; | 3012 return nullptr; |
| 3019 } | 3013 } |
| 3020 | 3014 |
| 3021 } // namespace blink | 3015 } // namespace blink |
| OLD | NEW |