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/CSSCalculationValue.h" | 10 #include "core/css/CSSCalculationValue.h" |
(...skipping 3336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3347 | 3347 |
3348 RefPtrWillBeRawPtr<CSSValue> mask = nullptr; | 3348 RefPtrWillBeRawPtr<CSSValue> mask = nullptr; |
3349 if (!range.atEnd()) { | 3349 if (!range.atEnd()) { |
3350 mask = consumeWebkitBorderImage(CSSPropertyWebkitBoxReflect, range, cont ext); | 3350 mask = consumeWebkitBorderImage(CSSPropertyWebkitBoxReflect, range, cont ext); |
3351 if (!mask) | 3351 if (!mask) |
3352 return nullptr; | 3352 return nullptr; |
3353 } | 3353 } |
3354 return CSSReflectValue::create(direction.release(), offset.release(), mask.r elease()); | 3354 return CSSReflectValue::create(direction.release(), offset.release(), mask.r elease()); |
3355 } | 3355 } |
3356 | 3356 |
3357 static PassRefPtrWillBeRawPtr<CSSValue> consumeFontSizeAdjust(CSSParserTokenRang e& range) | |
3358 { | |
3359 if (range.peek().id() == CSSValueNone) | |
3360 return consumeIdent(range); | |
3361 return consumeNumber(range, ValueRangeNonNegative); | |
3362 } | |
3363 | |
3364 static PassRefPtrWillBeRawPtr<CSSValue> consumeImageOrientation(CSSParserTokenRa nge& range, CSSParserMode cssParserMode) | |
3365 { | |
3366 if (!RuntimeEnabledFeatures::imageOrientationEnabled()) | |
Timothy Loh
2016/02/11 02:53:01
more consistent with other runtime-enabled propert
rwlbuis
2016/02/11 20:47:54
Not sure why I implemented it that way... Just an
| |
3367 return nullptr; | |
3368 if (range.peek().id() == CSSValueFromImage) | |
3369 return consumeIdent(range); | |
3370 if (range.peek().type() != NumberToken) { | |
3371 RefPtrWillBeRawPtr<CSSPrimitiveValue> angle = consumeAngle(range, cssPar serMode); | |
3372 if (angle && angle->getIntValue() == 0) | |
Timothy Loh
2016/02/11 02:53:01
getDoubleValue might be better
rwlbuis
2016/02/11 20:47:54
Done.
| |
3373 return angle; | |
3374 } | |
3375 return nullptr; | |
3376 } | |
3377 | |
3357 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID unresolvedProperty) | 3378 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID unresolvedProperty) |
3358 { | 3379 { |
3359 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); | 3380 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); |
3360 if (CSSParserFastPaths::isKeywordPropertyID(property)) { | 3381 if (CSSParserFastPaths::isKeywordPropertyID(property)) { |
3361 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(property, m_rang e.peek().id())) | 3382 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(property, m_rang e.peek().id())) |
3362 return nullptr; | 3383 return nullptr; |
3363 return consumeIdent(m_range); | 3384 return consumeIdent(m_range); |
3364 } | 3385 } |
3365 switch (property) { | 3386 switch (property) { |
3366 case CSSPropertyWillChange: | 3387 case CSSPropertyWillChange: |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3419 return consumeWidthOrHeight(m_range, m_context, UnitlessQuirk::Allow); | 3440 return consumeWidthOrHeight(m_range, m_context, UnitlessQuirk::Allow); |
3420 case CSSPropertyWebkitMinLogicalWidth: | 3441 case CSSPropertyWebkitMinLogicalWidth: |
3421 case CSSPropertyWebkitMinLogicalHeight: | 3442 case CSSPropertyWebkitMinLogicalHeight: |
3422 case CSSPropertyWebkitLogicalWidth: | 3443 case CSSPropertyWebkitLogicalWidth: |
3423 case CSSPropertyWebkitLogicalHeight: | 3444 case CSSPropertyWebkitLogicalHeight: |
3424 return consumeWidthOrHeight(m_range, m_context); | 3445 return consumeWidthOrHeight(m_range, m_context); |
3425 case CSSPropertyMarginTop: | 3446 case CSSPropertyMarginTop: |
3426 case CSSPropertyMarginRight: | 3447 case CSSPropertyMarginRight: |
3427 case CSSPropertyMarginBottom: | 3448 case CSSPropertyMarginBottom: |
3428 case CSSPropertyMarginLeft: | 3449 case CSSPropertyMarginLeft: |
3450 case CSSPropertyBottom: | |
3451 case CSSPropertyLeft: | |
3452 case CSSPropertyRight: | |
3453 case CSSPropertyTop: | |
3429 return consumeMarginWidth(m_range, m_context.mode(), UnitlessQuirk::Allo w); | 3454 return consumeMarginWidth(m_range, m_context.mode(), UnitlessQuirk::Allo w); |
Timothy Loh
2016/02/11 02:53:01
These aren't really margins though (I guess they'r
rwlbuis
2016/02/11 20:47:54
True, I hope you like the new method name better,
| |
3430 case CSSPropertyWebkitMarginStart: | 3455 case CSSPropertyWebkitMarginStart: |
3431 case CSSPropertyWebkitMarginEnd: | 3456 case CSSPropertyWebkitMarginEnd: |
3432 case CSSPropertyWebkitMarginBefore: | 3457 case CSSPropertyWebkitMarginBefore: |
3433 case CSSPropertyWebkitMarginAfter: | 3458 case CSSPropertyWebkitMarginAfter: |
3434 return consumeMarginWidth(m_range, m_context.mode(), UnitlessQuirk::Forb id); | 3459 return consumeMarginWidth(m_range, m_context.mode(), UnitlessQuirk::Forb id); |
3435 case CSSPropertyPaddingTop: | 3460 case CSSPropertyPaddingTop: |
3436 case CSSPropertyPaddingRight: | 3461 case CSSPropertyPaddingRight: |
3437 case CSSPropertyPaddingBottom: | 3462 case CSSPropertyPaddingBottom: |
3438 case CSSPropertyPaddingLeft: | 3463 case CSSPropertyPaddingLeft: |
3439 return consumeLengthOrPercent(m_range, m_context.mode(), ValueRangeNonNe gative, UnitlessQuirk::Allow); | 3464 return consumeLengthOrPercent(m_range, m_context.mode(), ValueRangeNonNe gative, UnitlessQuirk::Allow); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3667 case CSSPropertyBorderImageOutset: | 3692 case CSSPropertyBorderImageOutset: |
3668 case CSSPropertyWebkitMaskBoxImageOutset: | 3693 case CSSPropertyWebkitMaskBoxImageOutset: |
3669 return consumeBorderImageOutset(m_range); | 3694 return consumeBorderImageOutset(m_range); |
3670 case CSSPropertyBorderImageWidth: | 3695 case CSSPropertyBorderImageWidth: |
3671 case CSSPropertyWebkitMaskBoxImageWidth: | 3696 case CSSPropertyWebkitMaskBoxImageWidth: |
3672 return consumeBorderImageWidth(m_range); | 3697 return consumeBorderImageWidth(m_range); |
3673 case CSSPropertyWebkitBorderImage: | 3698 case CSSPropertyWebkitBorderImage: |
3674 return consumeWebkitBorderImage(property, m_range, m_context); | 3699 return consumeWebkitBorderImage(property, m_range, m_context); |
3675 case CSSPropertyWebkitBoxReflect: | 3700 case CSSPropertyWebkitBoxReflect: |
3676 return consumeReflect(m_range, m_context); | 3701 return consumeReflect(m_range, m_context); |
3702 case CSSPropertyFontSizeAdjust: | |
3703 ASSERT(RuntimeEnabledFeatures::cssFontSizeAdjustEnabled()); | |
3704 return consumeFontSizeAdjust(m_range); | |
3705 case CSSPropertyImageOrientation: | |
3706 return consumeImageOrientation(m_range, m_context.mode()); | |
3677 default: | 3707 default: |
3678 CSSParserValueList valueList(m_range); | 3708 CSSParserValueList valueList(m_range); |
3679 if (valueList.size()) { | 3709 if (valueList.size()) { |
3680 m_valueList = &valueList; | 3710 m_valueList = &valueList; |
3681 if (RefPtrWillBeRawPtr<CSSValue> result = legacyParseValue(unresolve dProperty)) { | 3711 if (RefPtrWillBeRawPtr<CSSValue> result = legacyParseValue(unresolve dProperty)) { |
3682 while (!m_range.atEnd()) | 3712 while (!m_range.atEnd()) |
3683 m_range.consume(); | 3713 m_range.consume(); |
3684 return result.release(); | 3714 return result.release(); |
3685 } | 3715 } |
3686 } | 3716 } |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4361 m_currentShorthand = oldShorthand; | 4391 m_currentShorthand = oldShorthand; |
4362 CSSParserValueList valueList(m_range); | 4392 CSSParserValueList valueList(m_range); |
4363 if (!valueList.size()) | 4393 if (!valueList.size()) |
4364 return false; | 4394 return false; |
4365 m_valueList = &valueList; | 4395 m_valueList = &valueList; |
4366 return legacyParseShorthand(unresolvedProperty, important); | 4396 return legacyParseShorthand(unresolvedProperty, important); |
4367 } | 4397 } |
4368 } | 4398 } |
4369 | 4399 |
4370 } // namespace blink | 4400 } // namespace blink |
OLD | NEW |