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

Side by Side Diff: Source/core/css/resolver/StyleBuilderConverter.cpp

Issue 1186833003: Split up CSSPrimitiveValue::isString into isString and isCustomIdent (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « Source/core/css/resolver/CSSToStyleMap.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * * Redistributions of source code must retain the above copyright 4 * * Redistributions of source code must retain the above copyright
5 * notice, this list of conditions and the following disclaimer. 5 * notice, this list of conditions and the following disclaimer.
6 * * Redistributions in binary form must reproduce the above 6 * * Redistributions in binary form must reproduce the above
7 * copyright notice, this list of conditions and the following disclaimer 7 * copyright notice, this list of conditions and the following disclaimer
8 * in the documentation and/or other materials provided with the 8 * in the documentation and/or other materials provided with the
9 * distribution. 9 * distribution.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 case CSSValueWebkitPictograph: 123 case CSSValueWebkitPictograph:
124 return FontDescription::PictographFamily; 124 return FontDescription::PictographFamily;
125 default: 125 default:
126 return FontDescription::NoFamily; 126 return FontDescription::NoFamily;
127 } 127 }
128 } 128 }
129 129
130 static bool convertFontFamilyName(StyleResolverState& state, CSSPrimitiveValue* primitiveValue, 130 static bool convertFontFamilyName(StyleResolverState& state, CSSPrimitiveValue* primitiveValue,
131 FontDescription::GenericFamilyType& genericFamily, AtomicString& familyName) 131 FontDescription::GenericFamilyType& genericFamily, AtomicString& familyName)
132 { 132 {
133 if (primitiveValue->isString()) { 133 if (primitiveValue->isCustomIdent()) {
134 genericFamily = FontDescription::NoFamily; 134 genericFamily = FontDescription::NoFamily;
135 familyName = AtomicString(primitiveValue->getStringValue()); 135 familyName = AtomicString(primitiveValue->getStringValue());
136 } else if (state.document().settings()) { 136 } else if (state.document().settings()) {
137 genericFamily = convertGenericFamily(primitiveValue->getValueID()); 137 genericFamily = convertGenericFamily(primitiveValue->getValueID());
138 familyName = state.fontBuilder().genericFontFamilyName(genericFamily); 138 familyName = state.fontBuilder().genericFontFamilyName(genericFamily);
139 } 139 }
140 140
141 return !familyName.isEmpty(); 141 return !familyName.isEmpty();
142 } 142 }
143 143
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 { 394 {
395 // We accept the specification's grammar: 395 // We accept the specification's grammar:
396 // 'auto' | [ <integer> || <custom-ident> ] | [ span && [ <integer> || <cust om-ident> ] ] | <custom-ident> 396 // 'auto' | [ <integer> || <custom-ident> ] | [ span && [ <integer> || <cust om-ident> ] ] | <custom-ident>
397 397
398 GridPosition position; 398 GridPosition position;
399 399
400 if (value->isPrimitiveValue()) { 400 if (value->isPrimitiveValue()) {
401 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 401 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
402 // We translate <custom-ident> to <string> during parsing as it 402 // We translate <custom-ident> to <string> during parsing as it
403 // makes handling it more simple. 403 // makes handling it more simple.
404 if (primitiveValue->isString()) { 404 if (primitiveValue->isCustomIdent()) {
405 position.setNamedGridArea(primitiveValue->getStringValue()); 405 position.setNamedGridArea(primitiveValue->getStringValue());
406 return position; 406 return position;
407 } 407 }
408 408
409 ASSERT(primitiveValue->getValueID() == CSSValueAuto); 409 ASSERT(primitiveValue->getValueID() == CSSValueAuto);
410 return position; 410 return position;
411 } 411 }
412 412
413 CSSValueList* values = toCSSValueList(value); 413 CSSValueList* values = toCSSValueList(value);
414 ASSERT(values->length()); 414 ASSERT(values->length());
(...skipping 10 matching lines...) Expand all
425 ++it; 425 ++it;
426 currentValue = it != values->end() ? toCSSPrimitiveValue(it->get()) : 0; 426 currentValue = it != values->end() ? toCSSPrimitiveValue(it->get()) : 0;
427 } 427 }
428 428
429 if (currentValue && currentValue->isNumber()) { 429 if (currentValue && currentValue->isNumber()) {
430 gridLineNumber = currentValue->getIntValue(); 430 gridLineNumber = currentValue->getIntValue();
431 ++it; 431 ++it;
432 currentValue = it != values->end() ? toCSSPrimitiveValue(it->get()) : 0; 432 currentValue = it != values->end() ? toCSSPrimitiveValue(it->get()) : 0;
433 } 433 }
434 434
435 if (currentValue && currentValue->isString()) { 435 if (currentValue && currentValue->isCustomIdent()) {
436 gridLineName = currentValue->getStringValue(); 436 gridLineName = currentValue->getStringValue();
437 ++it; 437 ++it;
438 } 438 }
439 439
440 ASSERT(it == values->end()); 440 ASSERT(it == values->end());
441 if (isSpanPosition) 441 if (isSpanPosition)
442 position.setSpanPosition(gridLineNumber, gridLineName); 442 position.setSpanPosition(gridLineNumber, gridLineName);
443 else 443 else
444 position.setExplicitPosition(gridLineNumber, gridLineName); 444 position.setExplicitPosition(gridLineNumber, gridLineName);
445 445
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 CSSValueList* valueList = toCSSValueList(value); 931 CSSValueList* valueList = toCSSValueList(value);
932 coordinates.reserveInitialCapacity(valueList->length()); 932 coordinates.reserveInitialCapacity(valueList->length());
933 for (auto& snapCoordinate : *valueList) { 933 for (auto& snapCoordinate : *valueList) {
934 coordinates.uncheckedAppend(convertPosition(state, snapCoordinate.get()) ); 934 coordinates.uncheckedAppend(convertPosition(state, snapCoordinate.get()) );
935 } 935 }
936 936
937 return coordinates; 937 return coordinates;
938 } 938 }
939 939
940 } // namespace blink 940 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/resolver/CSSToStyleMap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698