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 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 case MinMaxTrackSizing: | 1030 case MinMaxTrackSizing: |
1031 RefPtr<CSSValueList> minMaxTrackBreadths = CSSValueList::createCommaSepa
rated(); | 1031 RefPtr<CSSValueList> minMaxTrackBreadths = CSSValueList::createCommaSepa
rated(); |
1032 minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.minTrackB
readth(), style, renderView)); | 1032 minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.minTrackB
readth(), style, renderView)); |
1033 minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.maxTrackB
readth(), style, renderView)); | 1033 minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.maxTrackB
readth(), style, renderView)); |
1034 return CSSFunctionValue::create("minmax(", minMaxTrackBreadths); | 1034 return CSSFunctionValue::create("minmax(", minMaxTrackBreadths); |
1035 } | 1035 } |
1036 ASSERT_NOT_REACHED(); | 1036 ASSERT_NOT_REACHED(); |
1037 return 0; | 1037 return 0; |
1038 } | 1038 } |
1039 | 1039 |
1040 static void addValuesForNamedGridLinesAtIndex(const NamedGridLinesMap& namedGrid
Lines, size_t i, CSSValueList& list) | 1040 static void addValuesForNamedGridLinesAtIndex(const OrderedNamedGridLines& order
edNamedGridLines, size_t i, CSSValueList& list) |
1041 { | 1041 { |
1042 // Note that this won't return the results in the order specified in the sty
le sheet, | 1042 const Vector<String>& namedGridLines = orderedNamedGridLines.get(i); |
1043 // which is probably fine as we stil *do* return all the expected values. | 1043 for (size_t j = 0; j < namedGridLines.size(); ++j) |
1044 NamedGridLinesMap::const_iterator it = namedGridLines.begin(); | 1044 list.append(cssValuePool().createValue(namedGridLines[j], CSSPrimitiveVa
lue::CSS_STRING)); |
1045 NamedGridLinesMap::const_iterator end = namedGridLines.end(); | |
1046 for (; it != end; ++it) { | |
1047 const Vector<size_t>& linesIndexes = it->value; | |
1048 for (size_t j = 0; j < linesIndexes.size(); ++j) { | |
1049 if (linesIndexes[j] != i) | |
1050 continue; | |
1051 | |
1052 list.append(cssValuePool().createValue(it->key, CSSPrimitiveValue::C
SS_STRING)); | |
1053 break; | |
1054 } | |
1055 } | |
1056 } | 1045 } |
1057 | 1046 |
1058 static PassRefPtr<CSSValue> valueForGridTrackList(const Vector<GridTrackSize>& t
rackSizes, const NamedGridLinesMap& namedGridLines, const RenderStyle* style, Re
nderView* renderView) | 1047 static PassRefPtr<CSSValue> valueForGridTrackList(const Vector<GridTrackSize>& t
rackSizes, const OrderedNamedGridLines& orderedNamedGridLines, const RenderStyle
* style, RenderView* renderView) |
1059 { | 1048 { |
1060 // Handle the 'none' case here. | 1049 // Handle the 'none' case here. |
1061 if (!trackSizes.size()) { | 1050 if (!trackSizes.size()) { |
1062 ASSERT(namedGridLines.isEmpty()); | 1051 ASSERT(orderedNamedGridLines.isEmpty()); |
1063 return cssValuePool().createIdentifierValue(CSSValueNone); | 1052 return cssValuePool().createIdentifierValue(CSSValueNone); |
1064 } | 1053 } |
1065 | 1054 |
1066 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 1055 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
1067 for (size_t i = 0; i < trackSizes.size(); ++i) { | 1056 for (size_t i = 0; i < trackSizes.size(); ++i) { |
1068 addValuesForNamedGridLinesAtIndex(namedGridLines, i, *list); | 1057 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); |
1069 list->append(valueForGridTrackSize(trackSizes[i], style, renderView)); | 1058 list->append(valueForGridTrackSize(trackSizes[i], style, renderView)); |
1070 } | 1059 } |
1071 // Those are the trailing <string>* allowed in the syntax. | 1060 // Those are the trailing <string>* allowed in the syntax. |
1072 addValuesForNamedGridLinesAtIndex(namedGridLines, trackSizes.size(), *list); | 1061 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, trackSizes.size(),
*list); |
1073 return list.release(); | 1062 return list.release(); |
1074 } | 1063 } |
1075 | 1064 |
1076 static PassRefPtr<CSSValue> valueForGridPosition(const GridPosition& position) | 1065 static PassRefPtr<CSSValue> valueForGridPosition(const GridPosition& position) |
1077 { | 1066 { |
1078 if (position.isAuto()) | 1067 if (position.isAuto()) |
1079 return cssValuePool().createIdentifierValue(CSSValueAuto); | 1068 return cssValuePool().createIdentifierValue(CSSValueAuto); |
1080 | 1069 |
1081 if (position.isNamedGridArea()) | 1070 if (position.isNamedGridArea()) |
1082 return cssValuePool().createValue(position.namedGridLine(), CSSPrimitive
Value::CSS_STRING); | 1071 return cssValuePool().createValue(position.namedGridLine(), CSSPrimitive
Value::CSS_STRING); |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1995 } | 1984 } |
1996 return list.release(); | 1985 return list.release(); |
1997 } | 1986 } |
1998 case CSSPropertyGridAutoColumns: | 1987 case CSSPropertyGridAutoColumns: |
1999 return valueForGridTrackSize(style->gridAutoColumns(), style.get(),
m_node->document()->renderView()); | 1988 return valueForGridTrackSize(style->gridAutoColumns(), style.get(),
m_node->document()->renderView()); |
2000 case CSSPropertyGridAutoFlow: | 1989 case CSSPropertyGridAutoFlow: |
2001 return cssValuePool().createValue(style->gridAutoFlow()); | 1990 return cssValuePool().createValue(style->gridAutoFlow()); |
2002 case CSSPropertyGridAutoRows: | 1991 case CSSPropertyGridAutoRows: |
2003 return valueForGridTrackSize(style->gridAutoRows(), style.get(), m_n
ode->document()->renderView()); | 1992 return valueForGridTrackSize(style->gridAutoRows(), style.get(), m_n
ode->document()->renderView()); |
2004 case CSSPropertyGridDefinitionColumns: | 1993 case CSSPropertyGridDefinitionColumns: |
2005 return valueForGridTrackList(style->gridDefinitionColumns(), style->
namedGridColumnLines(), style.get(), m_node->document()->renderView()); | 1994 return valueForGridTrackList(style->gridDefinitionColumns(), style->
orderedNamedGridColumnLines(), style.get(), m_node->document()->renderView()); |
2006 case CSSPropertyGridDefinitionRows: | 1995 case CSSPropertyGridDefinitionRows: |
2007 return valueForGridTrackList(style->gridDefinitionRows(), style->nam
edGridRowLines(), style.get(), m_node->document()->renderView()); | 1996 return valueForGridTrackList(style->gridDefinitionRows(), style->ord
eredNamedGridRowLines(), style.get(), m_node->document()->renderView()); |
2008 | 1997 |
2009 case CSSPropertyGridColumnStart: | 1998 case CSSPropertyGridColumnStart: |
2010 return valueForGridPosition(style->gridColumnStart()); | 1999 return valueForGridPosition(style->gridColumnStart()); |
2011 case CSSPropertyGridColumnEnd: | 2000 case CSSPropertyGridColumnEnd: |
2012 return valueForGridPosition(style->gridColumnEnd()); | 2001 return valueForGridPosition(style->gridColumnEnd()); |
2013 case CSSPropertyGridRowStart: | 2002 case CSSPropertyGridRowStart: |
2014 return valueForGridPosition(style->gridRowStart()); | 2003 return valueForGridPosition(style->gridRowStart()); |
2015 case CSSPropertyGridRowEnd: | 2004 case CSSPropertyGridRowEnd: |
2016 return valueForGridPosition(style->gridRowEnd()); | 2005 return valueForGridPosition(style->gridRowEnd()); |
2017 case CSSPropertyGridColumn: | 2006 case CSSPropertyGridColumn: |
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3162 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB
ackgroundSize, CSSPropertyBackgroundOrigin, | 3151 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB
ackgroundSize, CSSPropertyBackgroundOrigin, |
3163 CSSPropertyB
ackgroundClip }; | 3152 CSSPropertyB
ackgroundClip }; |
3164 | 3153 |
3165 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); | 3154 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); |
3166 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa
ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash
Seperator)))); | 3155 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa
ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash
Seperator)))); |
3167 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa
ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe
perator)))); | 3156 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa
ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe
perator)))); |
3168 return list.release(); | 3157 return list.release(); |
3169 } | 3158 } |
3170 | 3159 |
3171 } // namespace WebCore | 3160 } // namespace WebCore |
OLD | NEW |