| 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 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 | 829 |
| 830 if (trackListIsEmpty) | 830 if (trackListIsEmpty) |
| 831 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 831 return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
| 832 | 832 |
| 833 size_t repetitions = isLayoutGrid ? toLayoutGrid(layoutObject)->autoRepeatCo
untForDirection(direction) : 0; | 833 size_t repetitions = isLayoutGrid ? toLayoutGrid(layoutObject)->autoRepeatCo
untForDirection(direction) : 0; |
| 834 OrderedNamedLinesCollector collector(style, isRowAxis, repetitions); | 834 OrderedNamedLinesCollector collector(style, isRowAxis, repetitions); |
| 835 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 835 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 836 size_t insertionIndex; | 836 size_t insertionIndex; |
| 837 if (isLayoutGrid) { | 837 if (isLayoutGrid) { |
| 838 const auto* grid = toLayoutGrid(layoutObject); | 838 const auto* grid = toLayoutGrid(layoutObject); |
| 839 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? gri
d->columnPositions() : grid->rowPositions(); | 839 Vector<LayoutUnit> computedTrackSizes = grid->trackSizesForComputedStyle
(direction); |
| 840 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro
m that, the grid container can generate implicit grid tracks, | 840 size_t numTracks = computedTrackSizes.size(); |
| 841 // so we'll have more trackPositions than trackSizes as the latter only
contain the explicit grid. | |
| 842 ASSERT(trackPositions.size() - 1 >= trackSizes.size()); | |
| 843 | 841 |
| 844 size_t i; | 842 for (size_t i = 0; i < numTracks; ++i) { |
| 845 LayoutUnit gutterSize = grid->guttersSize(direction, 2); | |
| 846 LayoutUnit offsetBetweenTracks = grid->offsetBetweenTracks(direction); | |
| 847 for (i = 0; i < trackPositions.size() - 2; ++i) { | |
| 848 addValuesForNamedGridLinesAtIndex(collector, i, *list); | 843 addValuesForNamedGridLinesAtIndex(collector, i, *list); |
| 849 list->append(*zoomAdjustedPixelValue(trackPositions[i + 1] - trackPo
sitions[i] - gutterSize - offsetBetweenTracks, style)); | 844 list->append(*zoomAdjustedPixelValue(computedTrackSizes[i], style)); |
| 850 } | 845 } |
| 851 // Last track line does not have any gutter or distribution offset. | 846 addValuesForNamedGridLinesAtIndex(collector, numTracks + 1, *list); |
| 852 addValuesForNamedGridLinesAtIndex(collector, i, *list); | 847 |
| 853 list->append(*zoomAdjustedPixelValue(trackPositions[i + 1] - trackPositi
ons[i], style)); | 848 insertionIndex = numTracks; |
| 854 insertionIndex = trackPositions.size() - 1; | |
| 855 } else { | 849 } else { |
| 856 for (size_t i = 0; i < trackSizes.size(); ++i) { | 850 for (size_t i = 0; i < trackSizes.size(); ++i) { |
| 857 addValuesForNamedGridLinesAtIndex(collector, i, *list); | 851 addValuesForNamedGridLinesAtIndex(collector, i, *list); |
| 858 list->append(*specifiedValueForGridTrackSize(trackSizes[i], style)); | 852 list->append(*specifiedValueForGridTrackSize(trackSizes[i], style)); |
| 859 } | 853 } |
| 860 insertionIndex = trackSizes.size(); | 854 insertionIndex = trackSizes.size(); |
| 861 } | 855 } |
| 862 // Those are the trailing <string>* allowed in the syntax. | 856 // Those are the trailing <string>* allowed in the syntax. |
| 863 addValuesForNamedGridLinesAtIndex(collector, insertionIndex, *list); | 857 addValuesForNamedGridLinesAtIndex(collector, insertionIndex, *list); |
| 864 return list; | 858 return list; |
| (...skipping 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3003 case CSSPropertyAll: | 2997 case CSSPropertyAll: |
| 3004 return nullptr; | 2998 return nullptr; |
| 3005 default: | 2999 default: |
| 3006 break; | 3000 break; |
| 3007 } | 3001 } |
| 3008 ASSERT_NOT_REACHED(); | 3002 ASSERT_NOT_REACHED(); |
| 3009 return nullptr; | 3003 return nullptr; |
| 3010 } | 3004 } |
| 3011 | 3005 |
| 3012 } // namespace blink | 3006 } // namespace blink |
| OLD | NEW |