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 "config.h" | 5 #include "config.h" |
6 #include "core/css/parser/CSSPropertyParser.h" | 6 #include "core/css/parser/CSSPropertyParser.h" |
7 | 7 |
8 #include "core/StylePropertyShorthand.h" | 8 #include "core/StylePropertyShorthand.h" |
9 #include "core/css/CSSCalculationValue.h" | 9 #include "core/css/CSSCalculationValue.h" |
10 #include "core/css/CSSCustomIdentValue.h" | 10 #include "core/css/CSSCustomIdentValue.h" |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 if (!range.atEnd() && !consumePan(range, panX, panY)) | 868 if (!range.atEnd() && !consumePan(range, panX, panY)) |
869 return nullptr; | 869 return nullptr; |
870 | 870 |
871 if (panX) | 871 if (panX) |
872 list->append(panX.release()); | 872 list->append(panX.release()); |
873 if (panY) | 873 if (panY) |
874 list->append(panY.release()); | 874 list->append(panY.release()); |
875 return list.release(); | 875 return list.release(); |
876 } | 876 } |
877 | 877 |
| 878 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeLineClamp(CSSParserToken
Range& range, CSSParserMode cssParserMode) |
| 879 { |
| 880 if (range.peek().type() != PercentageToken && range.peek().type() != NumberT
oken) |
| 881 return nullptr; |
| 882 RefPtrWillBeRawPtr<CSSPrimitiveValue> clampValue = consumePercent(range, Val
ueRangeNonNegative); |
| 883 if (clampValue) |
| 884 return clampValue; |
| 885 // When specifying number of lines, don't allow 0 as a valid value. |
| 886 return consumeInteger(range, cssParserMode, 1); |
| 887 } |
| 888 |
| 889 static PassRefPtrWillBeRawPtr<CSSValue> consumeLocale(CSSParserTokenRange& range
) |
| 890 { |
| 891 if (range.peek().id() == CSSValueAuto) |
| 892 return consumeIdent(range); |
| 893 return consumeString(range); |
| 894 } |
| 895 |
878 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
ID propId) | 896 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
ID propId) |
879 { | 897 { |
880 m_range.consumeWhitespace(); | 898 m_range.consumeWhitespace(); |
881 switch (propId) { | 899 switch (propId) { |
882 case CSSPropertyWillChange: | 900 case CSSPropertyWillChange: |
883 return consumeWillChange(m_range); | 901 return consumeWillChange(m_range); |
884 case CSSPropertyPage: | 902 case CSSPropertyPage: |
885 return consumePage(m_range); | 903 return consumePage(m_range); |
886 case CSSPropertyQuotes: | 904 case CSSPropertyQuotes: |
887 return consumeQuotes(m_range); | 905 return consumeQuotes(m_range); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 return consumeWidthOrHeight(m_range, m_context, UnitlessQuirk::Allow); | 949 return consumeWidthOrHeight(m_range, m_context, UnitlessQuirk::Allow); |
932 case CSSPropertyWebkitMinLogicalWidth: | 950 case CSSPropertyWebkitMinLogicalWidth: |
933 case CSSPropertyWebkitMinLogicalHeight: | 951 case CSSPropertyWebkitMinLogicalHeight: |
934 case CSSPropertyWebkitLogicalWidth: | 952 case CSSPropertyWebkitLogicalWidth: |
935 case CSSPropertyWebkitLogicalHeight: | 953 case CSSPropertyWebkitLogicalHeight: |
936 return consumeWidthOrHeight(m_range, m_context); | 954 return consumeWidthOrHeight(m_range, m_context); |
937 case CSSPropertyClip: | 955 case CSSPropertyClip: |
938 return consumeClip(m_range, m_context.mode()); | 956 return consumeClip(m_range, m_context.mode()); |
939 case CSSPropertyTouchAction: | 957 case CSSPropertyTouchAction: |
940 return consumeTouchAction(m_range); | 958 return consumeTouchAction(m_range); |
| 959 case CSSPropertyWebkitLineClamp: |
| 960 return consumeLineClamp(m_range, m_context.mode()); |
| 961 case CSSPropertyWebkitFontSizeDelta: |
| 962 return consumeLength(m_range, m_context.mode(), ValueRangeAll, UnitlessQ
uirk::Allow); |
| 963 case CSSPropertyWebkitHyphenateCharacter: |
| 964 case CSSPropertyWebkitLocale: |
| 965 return consumeLocale(m_range); |
941 default: | 966 default: |
942 return nullptr; | 967 return nullptr; |
943 } | 968 } |
944 } | 969 } |
945 | 970 |
946 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse
rTokenRange& range) | 971 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse
rTokenRange& range) |
947 { | 972 { |
948 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated
(); | 973 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated
(); |
949 | 974 |
950 do { | 975 do { |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1325 } | 1350 } |
1326 case CSSPropertyBorderSpacing: | 1351 case CSSPropertyBorderSpacing: |
1327 return consumeBorderSpacing(important); | 1352 return consumeBorderSpacing(important); |
1328 default: | 1353 default: |
1329 m_currentShorthand = oldShorthand; | 1354 m_currentShorthand = oldShorthand; |
1330 return false; | 1355 return false; |
1331 } | 1356 } |
1332 } | 1357 } |
1333 | 1358 |
1334 } // namespace blink | 1359 } // namespace blink |
OLD | NEW |