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

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: Changes after rune's review 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 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 break; 1137 break;
1138 1138
1139 case CSSPropertyGridColumnEnd: 1139 case CSSPropertyGridColumnEnd:
1140 case CSSPropertyGridColumnStart: 1140 case CSSPropertyGridColumnStart:
1141 case CSSPropertyGridRowEnd: 1141 case CSSPropertyGridRowEnd:
1142 case CSSPropertyGridRowStart: 1142 case CSSPropertyGridRowStart:
1143 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 1143 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1144 parsedValue = parseGridPosition(); 1144 parsedValue = parseGridPosition();
1145 break; 1145 break;
1146 1146
1147 case CSSPropertyGridColumnGap:
1148 case CSSPropertyGridRowGap:
1149 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1150 validPrimitive = validUnit(value, FLength | FNonNeg);
1151 break;
1152
1153 case CSSPropertyGridGap:
1154 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1155 return parseGridGapShorthand(important);
1156
1147 case CSSPropertyGridColumn: 1157 case CSSPropertyGridColumn:
1148 case CSSPropertyGridRow: 1158 case CSSPropertyGridRow:
1149 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 1159 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1150 return parseGridItemPositionShorthand(propId, important); 1160 return parseGridItemPositionShorthand(propId, important);
1151 1161
1152 case CSSPropertyGridArea: 1162 case CSSPropertyGridArea:
1153 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 1163 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1154 return parseGridAreaShorthand(important); 1164 return parseGridAreaShorthand(important);
1155 1165
1156 case CSSPropertyGridTemplateAreas: 1166 case CSSPropertyGridTemplateAreas:
(...skipping 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after
3164 return false; 3174 return false;
3165 } else { 3175 } else {
3166 endValue = gridMissingGridPositionValue(startValue.get()); 3176 endValue = gridMissingGridPositionValue(startValue.get());
3167 } 3177 }
3168 3178
3169 addProperty(shorthand.properties()[0], startValue, important); 3179 addProperty(shorthand.properties()[0], startValue, important);
3170 addProperty(shorthand.properties()[1], endValue, important); 3180 addProperty(shorthand.properties()[1], endValue, important);
3171 return true; 3181 return true;
3172 } 3182 }
3173 3183
3184 bool CSSPropertyParser::parseGridGapShorthand(bool important)
3185 {
3186 ShorthandScope scope(this, CSSPropertyGridGap);
3187 ASSERT(shorthandForProperty(CSSPropertyGridGap).length() == 2);
3188
3189 CSSParserValue* value = m_valueList->current();
3190 if (!value)
3191 return false;
3192
3193 RefPtrWillBeRawPtr<CSSPrimitiveValue> columnGap = nullptr;
fs 2015/10/07 10:25:19 Nit: With this new structure, I'd propose that the
3194 RefPtrWillBeRawPtr<CSSPrimitiveValue> rowGap = nullptr;
3195
3196 if (!validUnit(value, FLength | FNonNeg))
3197 return false;
3198
3199 columnGap = createPrimitiveNumericValue(value);
3200
3201 value = m_valueList->next();
3202 if (value) {
3203 if (!validUnit(value, FLength | FNonNeg))
3204 return false;
3205
3206 rowGap = createPrimitiveNumericValue(value);
3207 if (m_valueList->next())
3208 return false;
3209 } else {
3210 rowGap = columnGap;
3211 }
3212
3213 addProperty(CSSPropertyGridColumnGap, columnGap, important);
3214 addProperty(CSSPropertyGridRowGap, rowGap, important);
3215
3216 return true;
3217 }
3218
3174 bool CSSPropertyParser::parseGridTemplateRowsAndAreas(PassRefPtrWillBeRawPtr<CSS Value> templateColumns, bool important) 3219 bool CSSPropertyParser::parseGridTemplateRowsAndAreas(PassRefPtrWillBeRawPtr<CSS Value> templateColumns, bool important)
3175 { 3220 {
3176 NamedGridAreaMap gridAreaMap; 3221 NamedGridAreaMap gridAreaMap;
3177 size_t rowCount = 0; 3222 size_t rowCount = 0;
3178 size_t columnCount = 0; 3223 size_t columnCount = 0;
3179 bool trailingIdentWasAdded = false; 3224 bool trailingIdentWasAdded = false;
3180 RefPtrWillBeRawPtr<CSSValueList> templateRows = CSSValueList::createSpaceSep arated(); 3225 RefPtrWillBeRawPtr<CSSValueList> templateRows = CSSValueList::createSpaceSep arated();
3181 3226
3182 // At least template-areas strings must be defined. 3227 // At least template-areas strings must be defined.
3183 if (!m_valueList->current()) 3228 if (!m_valueList->current())
(...skipping 4253 matching lines...) Expand 10 before | Expand all | Expand 10 after
7437 } 7482 }
7438 } 7483 }
7439 7484
7440 if (!list->length()) 7485 if (!list->length())
7441 return nullptr; 7486 return nullptr;
7442 7487
7443 return list.release(); 7488 return list.release();
7444 } 7489 }
7445 7490
7446 } // namespace blink 7491 } // 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