| 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 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue:
:create(); | 880 RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue:
:create(); |
| 881 for (size_t j = 0; j < namedGridLines.size(); ++j) | 881 for (size_t j = 0; j < namedGridLines.size(); ++j) |
| 882 lineNames->append(cssValuePool().createValue(namedGridLines[j], CSSPrimi
tiveValue::CSS_STRING)); | 882 lineNames->append(cssValuePool().createValue(namedGridLines[j], CSSPrimi
tiveValue::CSS_STRING)); |
| 883 list.append(lineNames.release()); | 883 list.append(lineNames.release()); |
| 884 } | 884 } |
| 885 | 885 |
| 886 static PassRefPtrWillBeRawPtr<CSSValue> valueForGridTrackList(GridTrackSizingDir
ection direction, RenderObject* renderer, const RenderStyle& style) | 886 static PassRefPtrWillBeRawPtr<CSSValue> valueForGridTrackList(GridTrackSizingDir
ection direction, RenderObject* renderer, const RenderStyle& style) |
| 887 { | 887 { |
| 888 const Vector<GridTrackSize>& trackSizes = direction == ForColumns ? style.gr
idTemplateColumns() : style.gridTemplateRows(); | 888 const Vector<GridTrackSize>& trackSizes = direction == ForColumns ? style.gr
idTemplateColumns() : style.gridTemplateRows(); |
| 889 const OrderedNamedGridLines& orderedNamedGridLines = direction == ForColumns
? style.orderedNamedGridColumnLines() : style.orderedNamedGridRowLines(); | 889 const OrderedNamedGridLines& orderedNamedGridLines = direction == ForColumns
? style.orderedNamedGridColumnLines() : style.orderedNamedGridRowLines(); |
| 890 bool isRenderGrid = renderer && renderer->isRenderGrid(); |
| 890 | 891 |
| 891 // Handle the 'none' case here. | 892 // Handle the 'none' case. |
| 892 if (!trackSizes.size()) { | 893 bool trackListIsEmpty = trackSizes.isEmpty(); |
| 894 if (isRenderGrid && trackListIsEmpty) { |
| 895 // For grids we should consider every listed track, whether implicitly o
r explicitly created. If we don't have |
| 896 // any explicit track and there are no children then there are no implic
it tracks. We cannot simply check the |
| 897 // number of rows/columns in our internal grid representation because it
's always at least 1x1 (see r143331). |
| 898 trackListIsEmpty = !toRenderBlock(renderer)->firstChild(); |
| 899 } |
| 900 |
| 901 if (trackListIsEmpty) { |
| 893 ASSERT(orderedNamedGridLines.isEmpty()); | 902 ASSERT(orderedNamedGridLines.isEmpty()); |
| 894 return cssValuePool().createIdentifierValue(CSSValueNone); | 903 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 895 } | 904 } |
| 896 | 905 |
| 897 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 906 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
| 898 if (renderer && renderer->isRenderGrid()) { | 907 if (isRenderGrid) { |
| 899 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? toR
enderGrid(renderer)->columnPositions() : toRenderGrid(renderer)->rowPositions(); | 908 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? toR
enderGrid(renderer)->columnPositions() : toRenderGrid(renderer)->rowPositions(); |
| 900 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro
m that, the grid container can generate implicit grid tracks, | 909 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro
m that, the grid container can generate implicit grid tracks, |
| 901 // so we'll have more trackPositions than trackSizes as the latter only
contain the explicit grid. | 910 // so we'll have more trackPositions than trackSizes as the latter only
contain the explicit grid. |
| 902 ASSERT(trackPositions.size() - 1 >= trackSizes.size()); | 911 ASSERT(trackPositions.size() - 1 >= trackSizes.size()); |
| 903 | 912 |
| 904 for (size_t i = 0; i < trackSizes.size(); ++i) { | 913 for (size_t i = 0; i < trackPositions.size() - 1; ++i) { |
| 905 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); | 914 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); |
| 906 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPos
itions[i], style)); | 915 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPos
itions[i], style)); |
| 907 } | 916 } |
| 908 } else { | 917 } else { |
| 909 for (size_t i = 0; i < trackSizes.size(); ++i) { | 918 for (size_t i = 0; i < trackSizes.size(); ++i) { |
| 910 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); | 919 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); |
| 911 list->append(specifiedValueForGridTrackSize(trackSizes[i], style)); | 920 list->append(specifiedValueForGridTrackSize(trackSizes[i], style)); |
| 912 } | 921 } |
| 913 } | 922 } |
| 914 // Those are the trailing <string>* allowed in the syntax. | 923 // Those are the trailing <string>* allowed in the syntax. |
| (...skipping 2093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3008 return list.release(); | 3017 return list.release(); |
| 3009 } | 3018 } |
| 3010 | 3019 |
| 3011 void CSSComputedStyleDeclaration::trace(Visitor* visitor) | 3020 void CSSComputedStyleDeclaration::trace(Visitor* visitor) |
| 3012 { | 3021 { |
| 3013 visitor->trace(m_node); | 3022 visitor->trace(m_node); |
| 3014 CSSStyleDeclaration::trace(visitor); | 3023 CSSStyleDeclaration::trace(visitor); |
| 3015 } | 3024 } |
| 3016 | 3025 |
| 3017 } // namespace blink | 3026 } // namespace blink |
| OLD | NEW |