| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/parser/CSSPropertyParser.h" | 5 #include "core/css/parser/CSSPropertyParser.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include "core/StylePropertyShorthand.h" | 8 #include "core/StylePropertyShorthand.h" |
| 9 #include "core/css/CSSBasicShapeValues.h" | 9 #include "core/css/CSSBasicShapeValues.h" |
| 10 #include "core/css/CSSBorderImage.h" | 10 #include "core/css/CSSBorderImage.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "core/css/HashTools.h" | 36 #include "core/css/HashTools.h" |
| 37 #include "core/css/parser/CSSParserFastPaths.h" | 37 #include "core/css/parser/CSSParserFastPaths.h" |
| 38 #include "core/css/parser/CSSParserIdioms.h" | 38 #include "core/css/parser/CSSParserIdioms.h" |
| 39 #include "core/css/parser/CSSPropertyParserHelpers.h" | 39 #include "core/css/parser/CSSPropertyParserHelpers.h" |
| 40 #include "core/css/parser/CSSVariableParser.h" | 40 #include "core/css/parser/CSSVariableParser.h" |
| 41 #include "core/css/parser/FontVariantLigaturesParser.h" | 41 #include "core/css/parser/FontVariantLigaturesParser.h" |
| 42 #include "core/css/parser/FontVariantNumericParser.h" | 42 #include "core/css/parser/FontVariantNumericParser.h" |
| 43 #include "core/css/properties/CSSPropertyAPI.h" | 43 #include "core/css/properties/CSSPropertyAPI.h" |
| 44 #include "core/css/properties/CSSPropertyAlignmentUtils.h" | 44 #include "core/css/properties/CSSPropertyAlignmentUtils.h" |
| 45 #include "core/css/properties/CSSPropertyColumnUtils.h" | 45 #include "core/css/properties/CSSPropertyColumnUtils.h" |
| 46 #include "core/css/properties/CSSPropertyCounterUtils.h" |
| 46 #include "core/css/properties/CSSPropertyDescriptor.h" | 47 #include "core/css/properties/CSSPropertyDescriptor.h" |
| 47 #include "core/css/properties/CSSPropertyFontUtils.h" | 48 #include "core/css/properties/CSSPropertyFontUtils.h" |
| 48 #include "core/css/properties/CSSPropertyLengthUtils.h" | 49 #include "core/css/properties/CSSPropertyLengthUtils.h" |
| 49 #include "core/css/properties/CSSPropertyMarginUtils.h" | 50 #include "core/css/properties/CSSPropertyMarginUtils.h" |
| 50 #include "core/css/properties/CSSPropertyPositionUtils.h" | 51 #include "core/css/properties/CSSPropertyPositionUtils.h" |
| 51 #include "core/css/properties/CSSPropertyShapeUtils.h" | 52 #include "core/css/properties/CSSPropertyShapeUtils.h" |
| 52 #include "core/frame/UseCounter.h" | 53 #include "core/frame/UseCounter.h" |
| 53 #include "core/layout/LayoutTheme.h" | 54 #include "core/layout/LayoutTheme.h" |
| 54 #include "core/svg/SVGPathUtilities.h" | 55 #include "core/svg/SVGPathUtilities.h" |
| 55 #include "wtf/text/StringBuilder.h" | 56 #include "wtf/text/StringBuilder.h" |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 if (fontVariant) | 309 if (fontVariant) |
| 309 values->append(*fontVariant); | 310 values->append(*fontVariant); |
| 310 } while (consumeCommaIncludingWhitespace(range)); | 311 } while (consumeCommaIncludingWhitespace(range)); |
| 311 | 312 |
| 312 if (values->length()) | 313 if (values->length()) |
| 313 return values; | 314 return values; |
| 314 | 315 |
| 315 return nullptr; | 316 return nullptr; |
| 316 } | 317 } |
| 317 | 318 |
| 318 static CSSValue* consumeCounter(CSSParserTokenRange& range, int defaultValue) { | |
| 319 if (range.peek().id() == CSSValueNone) | |
| 320 return consumeIdent(range); | |
| 321 | |
| 322 CSSValueList* list = CSSValueList::createSpaceSeparated(); | |
| 323 do { | |
| 324 CSSCustomIdentValue* counterName = consumeCustomIdent(range); | |
| 325 if (!counterName) | |
| 326 return nullptr; | |
| 327 int i = defaultValue; | |
| 328 if (CSSPrimitiveValue* counterValue = consumeInteger(range)) | |
| 329 i = clampTo<int>(counterValue->getDoubleValue()); | |
| 330 list->append(*CSSValuePair::create( | |
| 331 counterName, | |
| 332 CSSPrimitiveValue::create(i, CSSPrimitiveValue::UnitType::Integer), | |
| 333 CSSValuePair::DropIdenticalValues)); | |
| 334 } while (!range.atEnd()); | |
| 335 return list; | |
| 336 } | |
| 337 | |
| 338 static CSSValue* consumeLocale(CSSParserTokenRange& range) { | 319 static CSSValue* consumeLocale(CSSParserTokenRange& range) { |
| 339 if (range.peek().id() == CSSValueAuto) | 320 if (range.peek().id() == CSSValueAuto) |
| 340 return consumeIdent(range); | 321 return consumeIdent(range); |
| 341 return consumeString(range); | 322 return consumeString(range); |
| 342 } | 323 } |
| 343 | 324 |
| 344 static CSSValue* consumeAnimationIterationCount(CSSParserTokenRange& range) { | 325 static CSSValue* consumeAnimationIterationCount(CSSParserTokenRange& range) { |
| 345 if (range.peek().id() == CSSValueInfinite) | 326 if (range.peek().id() == CSSValueInfinite) |
| 346 return consumeIdent(range); | 327 return consumeIdent(range); |
| 347 return consumeNumber(range, ValueRangeNonNegative); | 328 return consumeNumber(range, ValueRangeNonNegative); |
| (...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1857 CSSPropertyDescriptor::get(property); | 1838 CSSPropertyDescriptor::get(property); |
| 1858 if (cssPropertyDesc.parseSingleValue) | 1839 if (cssPropertyDesc.parseSingleValue) |
| 1859 return cssPropertyDesc.parseSingleValue(m_range, m_context); | 1840 return cssPropertyDesc.parseSingleValue(m_range, m_context); |
| 1860 | 1841 |
| 1861 switch (property) { | 1842 switch (property) { |
| 1862 case CSSPropertyFontFeatureSettings: | 1843 case CSSPropertyFontFeatureSettings: |
| 1863 return CSSPropertyFontUtils::consumeFontFeatureSettings(m_range); | 1844 return CSSPropertyFontUtils::consumeFontFeatureSettings(m_range); |
| 1864 case CSSPropertyFontWeight: | 1845 case CSSPropertyFontWeight: |
| 1865 return CSSPropertyFontUtils::consumeFontWeight(m_range); | 1846 return CSSPropertyFontUtils::consumeFontWeight(m_range); |
| 1866 case CSSPropertyCounterIncrement: | 1847 case CSSPropertyCounterIncrement: |
| 1867 return consumeCounter(m_range, 1); | 1848 return CSSPropertyCounterUtils::consumeCounter( |
| 1849 m_range, CSSPropertyCounterUtils::kIncrementDefaultValue); |
| 1868 case CSSPropertyCounterReset: | 1850 case CSSPropertyCounterReset: |
| 1869 return consumeCounter(m_range, 0); | 1851 return CSSPropertyCounterUtils::consumeCounter( |
| 1852 m_range, CSSPropertyCounterUtils::kResetDefaultValue); |
| 1870 case CSSPropertyMaxWidth: | 1853 case CSSPropertyMaxWidth: |
| 1871 case CSSPropertyMaxHeight: | 1854 case CSSPropertyMaxHeight: |
| 1872 return CSSPropertyLengthUtils::consumeMaxWidthOrHeight( | 1855 return CSSPropertyLengthUtils::consumeMaxWidthOrHeight( |
| 1873 m_range, m_context, UnitlessQuirk::Allow); | 1856 m_range, m_context, UnitlessQuirk::Allow); |
| 1874 case CSSPropertyMinWidth: | 1857 case CSSPropertyMinWidth: |
| 1875 case CSSPropertyMinHeight: | 1858 case CSSPropertyMinHeight: |
| 1876 case CSSPropertyWidth: | 1859 case CSSPropertyWidth: |
| 1877 case CSSPropertyHeight: | 1860 case CSSPropertyHeight: |
| 1878 return CSSPropertyLengthUtils::consumeWidthOrHeight(m_range, m_context, | 1861 return CSSPropertyLengthUtils::consumeWidthOrHeight(m_range, m_context, |
| 1879 UnitlessQuirk::Allow); | 1862 UnitlessQuirk::Allow); |
| (...skipping 1722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3602 case CSSPropertyGrid: | 3585 case CSSPropertyGrid: |
| 3603 return consumeGridShorthand(important); | 3586 return consumeGridShorthand(important); |
| 3604 case CSSPropertyPlaceContent: | 3587 case CSSPropertyPlaceContent: |
| 3605 return consumePlaceContentShorthand(important); | 3588 return consumePlaceContentShorthand(important); |
| 3606 default: | 3589 default: |
| 3607 return false; | 3590 return false; |
| 3608 } | 3591 } |
| 3609 } | 3592 } |
| 3610 | 3593 |
| 3611 } // namespace blink | 3594 } // namespace blink |
| OLD | NEW |