| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/css/properties/CSSPropertyAPIFontVariationSettings.h" | 5 #include "core/css/properties/CSSPropertyAPIFontVariationSettings.h" |
| 6 | 6 |
| 7 #include "core/css/CSSFontVariationValue.h" | 7 #include "core/css/CSSFontVariationValue.h" |
| 8 #include "core/css/CSSValueList.h" | 8 #include "core/css/CSSValueList.h" |
| 9 #include "core/css/parser/CSSParserContext.h" | 9 #include "core/css/parser/CSSParserContext.h" |
| 10 #include "core/css/parser/CSSPropertyParserHelpers.h" | 10 #include "core/css/parser/CSSPropertyParserHelpers.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 double tag_value = 0; | 36 double tag_value = 0; |
| 37 if (!CSSPropertyParserHelpers::ConsumeNumberRaw(range, tag_value)) | 37 if (!CSSPropertyParserHelpers::ConsumeNumberRaw(range, tag_value)) |
| 38 return nullptr; | 38 return nullptr; |
| 39 return CSSFontVariationValue::Create(tag, clampTo<float>(tag_value)); | 39 return CSSFontVariationValue::Create(tag, clampTo<float>(tag_value)); |
| 40 } | 40 } |
| 41 | 41 |
| 42 } // namespace | 42 } // namespace |
| 43 | 43 |
| 44 const CSSValue* CSSPropertyAPIFontVariationSettings::parseSingleValue( | 44 const CSSValue* CSSPropertyAPIFontVariationSettings::parseSingleValue( |
| 45 CSSParserTokenRange& range, | 45 CSSParserTokenRange& range, |
| 46 const CSSParserContext& context) { | 46 const CSSParserContext& context, |
| 47 CSSPropertyID) { |
| 47 DCHECK(RuntimeEnabledFeatures::cssVariableFontsEnabled()); | 48 DCHECK(RuntimeEnabledFeatures::cssVariableFontsEnabled()); |
| 48 if (range.Peek().Id() == CSSValueNormal) | 49 if (range.Peek().Id() == CSSValueNormal) |
| 49 return CSSPropertyParserHelpers::ConsumeIdent(range); | 50 return CSSPropertyParserHelpers::ConsumeIdent(range); |
| 50 CSSValueList* variation_settings = CSSValueList::CreateCommaSeparated(); | 51 CSSValueList* variation_settings = CSSValueList::CreateCommaSeparated(); |
| 51 do { | 52 do { |
| 52 CSSFontVariationValue* font_variation_value = | 53 CSSFontVariationValue* font_variation_value = |
| 53 ConsumeFontVariationTag(range); | 54 ConsumeFontVariationTag(range); |
| 54 if (!font_variation_value) | 55 if (!font_variation_value) |
| 55 return nullptr; | 56 return nullptr; |
| 56 variation_settings->Append(*font_variation_value); | 57 variation_settings->Append(*font_variation_value); |
| 57 } while (CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(range)); | 58 } while (CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(range)); |
| 58 return variation_settings; | 59 return variation_settings; |
| 59 } | 60 } |
| 60 | 61 |
| 61 } // namespace blink | 62 } // namespace blink |
| OLD | NEW |