Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp

Issue 1309513008: [css-grid] Implement grid gutters (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased patch for landing Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. 9 * Copyright (C) 2012 Intel Corporation. All rights reserved.
10 * 10 *
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 break; 1139 break;
1140 1140
1141 case CSSPropertyGridColumnEnd: 1141 case CSSPropertyGridColumnEnd:
1142 case CSSPropertyGridColumnStart: 1142 case CSSPropertyGridColumnStart:
1143 case CSSPropertyGridRowEnd: 1143 case CSSPropertyGridRowEnd:
1144 case CSSPropertyGridRowStart: 1144 case CSSPropertyGridRowStart:
1145 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 1145 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1146 parsedValue = parseGridPosition(); 1146 parsedValue = parseGridPosition();
1147 break; 1147 break;
1148 1148
1149 case CSSPropertyGridColumnGap:
1150 case CSSPropertyGridRowGap:
1151 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1152 validPrimitive = validUnit(value, FLength | FNonNeg);
1153 break;
1154
1155 case CSSPropertyGridGap:
1156 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1157 return parseGridGapShorthand(important);
1158
1149 case CSSPropertyGridColumn: 1159 case CSSPropertyGridColumn:
1150 case CSSPropertyGridRow: 1160 case CSSPropertyGridRow:
1151 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 1161 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1152 return parseGridItemPositionShorthand(propId, important); 1162 return parseGridItemPositionShorthand(propId, important);
1153 1163
1154 case CSSPropertyGridArea: 1164 case CSSPropertyGridArea:
1155 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 1165 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1156 return parseGridAreaShorthand(important); 1166 return parseGridAreaShorthand(important);
1157 1167
1158 case CSSPropertyGridTemplateAreas: 1168 case CSSPropertyGridTemplateAreas:
(...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after
3160 return false; 3170 return false;
3161 } else { 3171 } else {
3162 endValue = gridMissingGridPositionValue(startValue.get()); 3172 endValue = gridMissingGridPositionValue(startValue.get());
3163 } 3173 }
3164 3174
3165 addProperty(shorthand.properties()[0], startValue, important); 3175 addProperty(shorthand.properties()[0], startValue, important);
3166 addProperty(shorthand.properties()[1], endValue, important); 3176 addProperty(shorthand.properties()[1], endValue, important);
3167 return true; 3177 return true;
3168 } 3178 }
3169 3179
3180 bool CSSPropertyParser::parseGridGapShorthand(bool important)
3181 {
3182 ShorthandScope scope(this, CSSPropertyGridGap);
3183 ASSERT(shorthandForProperty(CSSPropertyGridGap).length() == 2);
3184
3185 CSSParserValue* value = m_valueList->current();
3186 if (!value)
3187 return false;
3188
3189 if (!validUnit(value, FLength | FNonNeg))
3190 return false;
3191
3192 RefPtrWillBeRawPtr<CSSPrimitiveValue> columnGap = createPrimitiveNumericValu e(value);
3193 RefPtrWillBeRawPtr<CSSPrimitiveValue> rowGap = nullptr;
3194
3195 value = m_valueList->next();
3196 if (value) {
3197 if (!validUnit(value, FLength | FNonNeg))
3198 return false;
3199
3200 rowGap = createPrimitiveNumericValue(value);
3201 if (m_valueList->next())
3202 return false;
3203 } else {
3204 rowGap = columnGap;
3205 }
3206
3207 addProperty(CSSPropertyGridColumnGap, columnGap, important);
3208 addProperty(CSSPropertyGridRowGap, rowGap, important);
3209
3210 return true;
3211 }
3212
3170 bool CSSPropertyParser::parseGridTemplateRowsAndAreas(PassRefPtrWillBeRawPtr<CSS Value> templateColumns, bool important) 3213 bool CSSPropertyParser::parseGridTemplateRowsAndAreas(PassRefPtrWillBeRawPtr<CSS Value> templateColumns, bool important)
3171 { 3214 {
3172 NamedGridAreaMap gridAreaMap; 3215 NamedGridAreaMap gridAreaMap;
3173 size_t rowCount = 0; 3216 size_t rowCount = 0;
3174 size_t columnCount = 0; 3217 size_t columnCount = 0;
3175 bool trailingIdentWasAdded = false; 3218 bool trailingIdentWasAdded = false;
3176 RefPtrWillBeRawPtr<CSSValueList> templateRows = CSSValueList::createSpaceSep arated(); 3219 RefPtrWillBeRawPtr<CSSValueList> templateRows = CSSValueList::createSpaceSep arated();
3177 3220
3178 // At least template-areas strings must be defined. 3221 // At least template-areas strings must be defined.
3179 if (!m_valueList->current()) 3222 if (!m_valueList->current())
(...skipping 3982 matching lines...) Expand 10 before | Expand all | Expand 10 after
7162 } 7205 }
7163 } 7206 }
7164 7207
7165 if (!list->length()) 7208 if (!list->length())
7166 return nullptr; 7209 return nullptr;
7167 7210
7168 return list.release(); 7211 return list.release();
7169 } 7212 }
7170 7213
7171 } // namespace blink 7214 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h ('k') | third_party/WebKit/Source/core/frame/UseCounter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698