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 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1028 case MinMaxTrackSizing: | 1028 case MinMaxTrackSizing: |
1029 RefPtr<CSSValueList> minMaxTrackBreadths = CSSValueList::createCommaSepa rated(); | 1029 RefPtr<CSSValueList> minMaxTrackBreadths = CSSValueList::createCommaSepa rated(); |
1030 minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.minTrackB readth(), style, renderView)); | 1030 minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.minTrackB readth(), style, renderView)); |
1031 minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.maxTrackB readth(), style, renderView)); | 1031 minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.maxTrackB readth(), style, renderView)); |
1032 return CSSFunctionValue::create("minmax(", minMaxTrackBreadths); | 1032 return CSSFunctionValue::create("minmax(", minMaxTrackBreadths); |
1033 } | 1033 } |
1034 ASSERT_NOT_REACHED(); | 1034 ASSERT_NOT_REACHED(); |
1035 return 0; | 1035 return 0; |
1036 } | 1036 } |
1037 | 1037 |
1038 static PassRefPtr<CSSValue> valueForGridTrackList(const Vector<GridTrackSize>& t rackSizes, const RenderStyle* style, RenderView *renderView) | 1038 static void addValuesForNamedGridLinesAtIndex(const NamedGridLinesMapping& named GridLines, size_t i, CSSValueList& list) |
1039 { | |
1040 // Note that this won't return the results in the order specified in the sty le sheet, | |
1041 // which is probably fine as we stil *do* return all the expected values. | |
1042 NamedGridLinesMapping::const_iterator it = namedGridLines.begin(); | |
1043 NamedGridLinesMapping::const_iterator end = namedGridLines.end(); | |
1044 for (; it != end; ++it) { | |
1045 Vector<size_t> linesIndexes = it->value; | |
esprehn
2013/05/03 21:45:58
const Vector<size_t>& ? I don't think you want to
Julien - ping for review
2013/05/06 16:22:33
Good catch (though we don't do a deep copy as Vect
| |
1046 for (size_t j = 0; j < linesIndexes.size(); ++j) { | |
1047 if (linesIndexes[j] != i) | |
1048 continue; | |
1049 | |
1050 list.append(cssValuePool().createValue(it->key, CSSPrimitiveValue::C SS_STRING)); | |
1051 break; | |
1052 } | |
1053 } | |
1054 } | |
1055 | |
1056 static PassRefPtr<CSSValue> valueForGridTrackList(const Vector<GridTrackSize>& t rackSizes, const NamedGridLinesMapping& namedGridLines, const RenderStyle* style , RenderView* renderView) | |
1039 { | 1057 { |
1040 // Handle the 'none' case here. | 1058 // Handle the 'none' case here. |
1041 if (!trackSizes.size()) | 1059 if (!trackSizes.size()) |
1042 return cssValuePool().createIdentifierValue(CSSValueNone); | 1060 return cssValuePool().createIdentifierValue(CSSValueNone); |
1043 | 1061 |
1044 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 1062 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
1045 for (size_t i = 0; i < trackSizes.size(); ++i) | 1063 for (size_t i = 0; i < trackSizes.size(); ++i) { |
1064 addValuesForNamedGridLinesAtIndex(namedGridLines, i, *list); | |
1046 list->append(valueForGridTrackSize(trackSizes[i], style, renderView)); | 1065 list->append(valueForGridTrackSize(trackSizes[i], style, renderView)); |
1066 } | |
1067 // Those are the trailing <string>* allowed in the syntax. | |
1068 addValuesForNamedGridLinesAtIndex(namedGridLines, trackSizes.size(), *list); | |
1047 return list.release(); | 1069 return list.release(); |
1048 } | 1070 } |
1049 | 1071 |
1050 static PassRefPtr<CSSValue> valueForGridPosition(const GridPosition& position) | 1072 static PassRefPtr<CSSValue> valueForGridPosition(const GridPosition& position) |
1051 { | 1073 { |
1052 if (position.isAuto()) | 1074 if (position.isAuto()) |
1053 return cssValuePool().createIdentifierValue(CSSValueAuto); | 1075 return cssValuePool().createIdentifierValue(CSSValueAuto); |
1054 | 1076 |
1055 if (position.isInteger()) | 1077 if (position.isInteger()) |
1056 return cssValuePool().createValue(position.integerPosition(), CSSPrimiti veValue::CSS_NUMBER); | 1078 return cssValuePool().createValue(position.integerPosition(), CSSPrimiti veValue::CSS_NUMBER); |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1909 } | 1931 } |
1910 return list.release(); | 1932 return list.release(); |
1911 } | 1933 } |
1912 case CSSPropertyWebkitGridAutoColumns: | 1934 case CSSPropertyWebkitGridAutoColumns: |
1913 return valueForGridTrackSize(style->gridAutoColumns(), style.get(), m_node->document()->renderView()); | 1935 return valueForGridTrackSize(style->gridAutoColumns(), style.get(), m_node->document()->renderView()); |
1914 case CSSPropertyWebkitGridAutoFlow: | 1936 case CSSPropertyWebkitGridAutoFlow: |
1915 return cssValuePool().createValue(style->gridAutoFlow()); | 1937 return cssValuePool().createValue(style->gridAutoFlow()); |
1916 case CSSPropertyWebkitGridAutoRows: | 1938 case CSSPropertyWebkitGridAutoRows: |
1917 return valueForGridTrackSize(style->gridAutoRows(), style.get(), m_n ode->document()->renderView()); | 1939 return valueForGridTrackSize(style->gridAutoRows(), style.get(), m_n ode->document()->renderView()); |
1918 case CSSPropertyWebkitGridColumns: | 1940 case CSSPropertyWebkitGridColumns: |
1919 return valueForGridTrackList(style->gridColumns(), style.get(), m_no de->document()->renderView()); | 1941 return valueForGridTrackList(style->gridColumns(), style->namedGridC olumnLines(), style.get(), m_node->document()->renderView()); |
1920 case CSSPropertyWebkitGridRows: | 1942 case CSSPropertyWebkitGridRows: |
1921 return valueForGridTrackList(style->gridRows(), style.get(), m_node- >document()->renderView()); | 1943 return valueForGridTrackList(style->gridRows(), style->namedGridRowL ines(), style.get(), m_node->document()->renderView()); |
1922 | 1944 |
1923 case CSSPropertyWebkitGridStart: | 1945 case CSSPropertyWebkitGridStart: |
1924 return valueForGridPosition(style->gridStart()); | 1946 return valueForGridPosition(style->gridStart()); |
1925 case CSSPropertyWebkitGridEnd: | 1947 case CSSPropertyWebkitGridEnd: |
1926 return valueForGridPosition(style->gridEnd()); | 1948 return valueForGridPosition(style->gridEnd()); |
1927 case CSSPropertyWebkitGridBefore: | 1949 case CSSPropertyWebkitGridBefore: |
1928 return valueForGridPosition(style->gridBefore()); | 1950 return valueForGridPosition(style->gridBefore()); |
1929 case CSSPropertyWebkitGridAfter: | 1951 case CSSPropertyWebkitGridAfter: |
1930 return valueForGridPosition(style->gridAfter()); | 1952 return valueForGridPosition(style->gridAfter()); |
1931 case CSSPropertyWebkitGridColumn: | 1953 case CSSPropertyWebkitGridColumn: |
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2992 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin, | 3014 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin, |
2993 CSSPropertyB ackgroundClip }; | 3015 CSSPropertyB ackgroundClip }; |
2994 | 3016 |
2995 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); | 3017 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); |
2996 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlashSeperat or)))); | 3018 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlashSeperat or)))); |
2997 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSeperator )))); | 3019 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSeperator )))); |
2998 return list.release(); | 3020 return list.release(); |
2999 } | 3021 } |
3000 | 3022 |
3001 } // namespace WebCore | 3023 } // namespace WebCore |
OLD | NEW |