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 "core/StylePropertyShorthand.h" | 7 #include "core/StylePropertyShorthand.h" |
8 #include "core/css/CSSBasicShapeValues.h" | 8 #include "core/css/CSSBasicShapeValues.h" |
9 #include "core/css/CSSBorderImage.h" | 9 #include "core/css/CSSBorderImage.h" |
10 #include "core/css/CSSContentDistributionValue.h" | 10 #include "core/css/CSSContentDistributionValue.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "core/css/CSSUnicodeRangeValue.h" | 33 #include "core/css/CSSUnicodeRangeValue.h" |
34 #include "core/css/CSSUnsetValue.h" | 34 #include "core/css/CSSUnsetValue.h" |
35 #include "core/css/CSSValuePair.h" | 35 #include "core/css/CSSValuePair.h" |
36 #include "core/css/CSSVariableReferenceValue.h" | 36 #include "core/css/CSSVariableReferenceValue.h" |
37 #include "core/css/FontFace.h" | 37 #include "core/css/FontFace.h" |
38 #include "core/css/HashTools.h" | 38 #include "core/css/HashTools.h" |
39 #include "core/css/parser/CSSParserFastPaths.h" | 39 #include "core/css/parser/CSSParserFastPaths.h" |
40 #include "core/css/parser/CSSParserIdioms.h" | 40 #include "core/css/parser/CSSParserIdioms.h" |
41 #include "core/css/parser/CSSPropertyParserHelpers.h" | 41 #include "core/css/parser/CSSPropertyParserHelpers.h" |
42 #include "core/css/parser/CSSVariableParser.h" | 42 #include "core/css/parser/CSSVariableParser.h" |
| 43 #include "core/css/properties/CSSPropertyDescriptor.h" |
43 #include "core/frame/UseCounter.h" | 44 #include "core/frame/UseCounter.h" |
44 #include "core/layout/LayoutTheme.h" | 45 #include "core/layout/LayoutTheme.h" |
45 #include "core/svg/SVGPathUtilities.h" | 46 #include "core/svg/SVGPathUtilities.h" |
46 #include "wtf/text/StringBuilder.h" | 47 #include "wtf/text/StringBuilder.h" |
47 #include <memory> | 48 #include <memory> |
48 | 49 |
49 namespace blink { | 50 namespace blink { |
50 | 51 |
51 using namespace CSSPropertyParserHelpers; | 52 using namespace CSSPropertyParserHelpers; |
52 | 53 |
(...skipping 3365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3418 CSSPropertyID currentShorthand) { | 3419 CSSPropertyID currentShorthand) { |
3419 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); | 3420 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); |
3420 if (CSSParserFastPaths::isKeywordPropertyID(property)) { | 3421 if (CSSParserFastPaths::isKeywordPropertyID(property)) { |
3421 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue( | 3422 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue( |
3422 property, m_range.peek().id(), m_context.mode())) | 3423 property, m_range.peek().id(), m_context.mode())) |
3423 return nullptr; | 3424 return nullptr; |
3424 countKeywordOnlyPropertyUsage(property, m_context.useCounter(), | 3425 countKeywordOnlyPropertyUsage(property, m_context.useCounter(), |
3425 m_range.peek().id()); | 3426 m_range.peek().id()); |
3426 return consumeIdent(m_range); | 3427 return consumeIdent(m_range); |
3427 } | 3428 } |
| 3429 |
| 3430 // Gets the parsing function for our current property from the property API. |
| 3431 // If it has been implemented, we call this function, otherwise we manually |
| 3432 // parse this value in the switch statement below. As we implement APIs for |
| 3433 // other properties, those properties will be taken out of the switch |
| 3434 // statement. |
| 3435 const CSSPropertyDescriptor& cssPropertyDesc = |
| 3436 CSSPropertyDescriptor::get(property); |
| 3437 if (cssPropertyDesc.temporaryCanReadValue) |
| 3438 return cssPropertyDesc.parseSingleValue(m_range, m_context); |
| 3439 |
3428 switch (property) { | 3440 switch (property) { |
3429 case CSSPropertyWillChange: | 3441 case CSSPropertyWillChange: |
3430 return consumeWillChange(m_range); | 3442 return consumeWillChange(m_range); |
3431 case CSSPropertyPage: | 3443 case CSSPropertyPage: |
3432 return consumePage(m_range); | 3444 return consumePage(m_range); |
3433 case CSSPropertyQuotes: | 3445 case CSSPropertyQuotes: |
3434 return consumeQuotes(m_range); | 3446 return consumeQuotes(m_range); |
3435 case CSSPropertyWebkitHighlight: | 3447 case CSSPropertyWebkitHighlight: |
3436 return consumeWebkitHighlight(m_range); | 3448 return consumeWebkitHighlight(m_range); |
3437 case CSSPropertyFontVariantCaps: | 3449 case CSSPropertyFontVariantCaps: |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3508 case CSSPropertyWebkitMarginAfter: | 3520 case CSSPropertyWebkitMarginAfter: |
3509 return consumeMarginOrOffset(m_range, m_context.mode(), | 3521 return consumeMarginOrOffset(m_range, m_context.mode(), |
3510 UnitlessQuirk::Forbid); | 3522 UnitlessQuirk::Forbid); |
3511 case CSSPropertyPaddingTop: | 3523 case CSSPropertyPaddingTop: |
3512 case CSSPropertyPaddingRight: | 3524 case CSSPropertyPaddingRight: |
3513 case CSSPropertyPaddingBottom: | 3525 case CSSPropertyPaddingBottom: |
3514 case CSSPropertyPaddingLeft: | 3526 case CSSPropertyPaddingLeft: |
3515 return consumeLengthOrPercent(m_range, m_context.mode(), | 3527 return consumeLengthOrPercent(m_range, m_context.mode(), |
3516 ValueRangeNonNegative, | 3528 ValueRangeNonNegative, |
3517 UnitlessQuirk::Allow); | 3529 UnitlessQuirk::Allow); |
3518 case CSSPropertyWebkitPaddingStart: | |
3519 case CSSPropertyWebkitPaddingEnd: | |
3520 case CSSPropertyWebkitPaddingBefore: | |
3521 case CSSPropertyWebkitPaddingAfter: | |
3522 return consumeLengthOrPercent(m_range, m_context.mode(), | |
3523 ValueRangeNonNegative, | |
3524 UnitlessQuirk::Forbid); | |
3525 case CSSPropertyClip: | 3530 case CSSPropertyClip: |
3526 return consumeClip(m_range, m_context.mode()); | 3531 return consumeClip(m_range, m_context.mode()); |
3527 case CSSPropertyTouchAction: | 3532 case CSSPropertyTouchAction: |
3528 return consumeTouchAction(m_range); | 3533 return consumeTouchAction(m_range); |
3529 case CSSPropertyScrollSnapDestination: | 3534 case CSSPropertyScrollSnapDestination: |
3530 case CSSPropertyObjectPosition: | 3535 case CSSPropertyObjectPosition: |
3531 case CSSPropertyPerspectiveOrigin: | 3536 case CSSPropertyPerspectiveOrigin: |
3532 return consumePosition(m_range, m_context.mode(), UnitlessQuirk::Forbid); | 3537 return consumePosition(m_range, m_context.mode(), UnitlessQuirk::Forbid); |
3533 case CSSPropertyWebkitLineClamp: | 3538 case CSSPropertyWebkitLineClamp: |
3534 return consumeLineClamp(m_range); | 3539 return consumeLineClamp(m_range); |
(...skipping 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5329 case CSSPropertyGridTemplate: | 5334 case CSSPropertyGridTemplate: |
5330 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); | 5335 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); |
5331 case CSSPropertyGrid: | 5336 case CSSPropertyGrid: |
5332 return consumeGridShorthand(important); | 5337 return consumeGridShorthand(important); |
5333 default: | 5338 default: |
5334 return false; | 5339 return false; |
5335 } | 5340 } |
5336 } | 5341 } |
5337 | 5342 |
5338 } // namespace blink | 5343 } // namespace blink |
OLD | NEW |