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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 } | 637 } |
638 | 638 |
639 if (trackListIsEmpty) { | 639 if (trackListIsEmpty) { |
640 ASSERT(orderedNamedGridLines.isEmpty()); | 640 ASSERT(orderedNamedGridLines.isEmpty()); |
641 return cssValuePool().createIdentifierValue(CSSValueNone); | 641 return cssValuePool().createIdentifierValue(CSSValueNone); |
642 } | 642 } |
643 | 643 |
644 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 644 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
645 size_t insertionIndex; | 645 size_t insertionIndex; |
646 if (isLayoutGrid) { | 646 if (isLayoutGrid) { |
647 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? toL
ayoutGrid(layoutObject)->columnPositions() : toLayoutGrid(layoutObject)->rowPosi
tions(); | 647 const auto* grid = toLayoutGrid(layoutObject); |
| 648 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? gri
d->columnPositions() : grid->rowPositions(); |
648 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro
m that, the grid container can generate implicit grid tracks, | 649 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro
m that, the grid container can generate implicit grid tracks, |
649 // so we'll have more trackPositions than trackSizes as the latter only
contain the explicit grid. | 650 // so we'll have more trackPositions than trackSizes as the latter only
contain the explicit grid. |
650 ASSERT(trackPositions.size() - 1 >= trackSizes.size()); | 651 ASSERT(trackPositions.size() - 1 >= trackSizes.size()); |
651 | 652 |
652 size_t i; | 653 size_t i; |
653 LayoutUnit gutterSize = toLayoutGrid(layoutObject)->guttersSize(directio
n, 2); | 654 LayoutUnit gutterSize = grid->guttersSize(direction, 2); |
| 655 LayoutUnit offsetBetweenTracks = grid->offsetBetweenTracks(direction); |
654 for (i = 0; i < trackPositions.size() - 2; ++i) { | 656 for (i = 0; i < trackPositions.size() - 2; ++i) { |
655 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); | 657 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); |
656 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPos
itions[i] - gutterSize, style)); | 658 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPos
itions[i] - gutterSize - offsetBetweenTracks, style)); |
657 } | 659 } |
658 // Last track line does not have any gutter. | 660 // Last track line does not have any gutter or distribution offset. |
659 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); | 661 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); |
660 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPositio
ns[i], style)); | 662 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPositio
ns[i], style)); |
661 insertionIndex = trackPositions.size() - 1; | 663 insertionIndex = trackPositions.size() - 1; |
662 } else { | 664 } else { |
663 for (size_t i = 0; i < trackSizes.size(); ++i) { | 665 for (size_t i = 0; i < trackSizes.size(); ++i) { |
664 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); | 666 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); |
665 list->append(specifiedValueForGridTrackSize(trackSizes[i], style)); | 667 list->append(specifiedValueForGridTrackSize(trackSizes[i], style)); |
666 } | 668 } |
667 insertionIndex = trackSizes.size(); | 669 insertionIndex = trackSizes.size(); |
668 } | 670 } |
(...skipping 2162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2831 case CSSPropertyAll: | 2833 case CSSPropertyAll: |
2832 return nullptr; | 2834 return nullptr; |
2833 default: | 2835 default: |
2834 break; | 2836 break; |
2835 } | 2837 } |
2836 ASSERT_NOT_REACHED(); | 2838 ASSERT_NOT_REACHED(); |
2837 return nullptr; | 2839 return nullptr; |
2838 } | 2840 } |
2839 | 2841 |
2840 } // namespace blink | 2842 } // namespace blink |
OLD | NEW |