Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "core/css/properties/CSSPropertyCounterUtils.h" | |
| 6 | |
| 7 #include "core/css/CSSValueList.h" | |
| 8 #include "core/css/CSSValuePair.h" | |
| 9 #include "core/css/parser/CSSParserTokenRange.h" | |
| 10 #include "core/css/parser/CSSPropertyParserHelpers.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 CSSValue* CSSPropertyCounterUtils::consumeCounter( | |
| 15 CSSParserTokenRange& range, | |
| 16 CounterDefaultValue defaultValue) { | |
| 17 if (range.peek().id() == CSSValueNone) | |
| 18 return CSSPropertyParserHelpers::consumeIdent(range); | |
| 19 | |
| 20 CSSValueList* list = CSSValueList::createSpaceSeparated(); | |
| 21 do { | |
| 22 CSSCustomIdentValue* counterName = | |
| 23 CSSPropertyParserHelpers::consumeCustomIdent(range); | |
| 24 if (!counterName) | |
| 25 return nullptr; | |
| 26 int value = static_cast<int>(defaultValue); | |
|
suzyh_UTC10 (ex-contributor)
2017/03/28 02:26:08
This int-iness enum-iness arrangement is a bit wei
| |
| 27 if (CSSPrimitiveValue* counterValue = | |
| 28 CSSPropertyParserHelpers::consumeInteger(range)) | |
| 29 value = clampTo<int>(counterValue->getDoubleValue()); | |
|
suzyh_UTC10 (ex-contributor)
2017/03/28 02:26:08
Would it make sense to use getIntValue() instead t
Bugs Nash
2017/03/28 02:32:50
I think we're experiencing creep here? This is a r
| |
| 30 list->append(*CSSValuePair::create( | |
| 31 counterName, | |
| 32 CSSPrimitiveValue::create(value, CSSPrimitiveValue::UnitType::Integer), | |
| 33 CSSValuePair::DropIdenticalValues)); | |
| 34 } while (!range.atEnd()); | |
| 35 return list; | |
| 36 } | |
| 37 | |
| 38 } // namespace blink | |
| OLD | NEW |