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 3483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3494 case CSSPropertyObjectPosition: | 3494 case CSSPropertyObjectPosition: |
3495 case CSSPropertyPerspectiveOrigin: | 3495 case CSSPropertyPerspectiveOrigin: |
3496 return consumePosition(m_range, m_context.mode(), UnitlessQuirk::Forbid)
; | 3496 return consumePosition(m_range, m_context.mode(), UnitlessQuirk::Forbid)
; |
3497 case CSSPropertyWebkitLineClamp: | 3497 case CSSPropertyWebkitLineClamp: |
3498 return consumeLineClamp(m_range); | 3498 return consumeLineClamp(m_range); |
3499 case CSSPropertyWebkitFontSizeDelta: | 3499 case CSSPropertyWebkitFontSizeDelta: |
3500 return consumeLength(m_range, m_context.mode(), ValueRangeAll, UnitlessQ
uirk::Allow); | 3500 return consumeLength(m_range, m_context.mode(), ValueRangeAll, UnitlessQ
uirk::Allow); |
3501 case CSSPropertyWebkitHyphenateCharacter: | 3501 case CSSPropertyWebkitHyphenateCharacter: |
3502 case CSSPropertyWebkitLocale: | 3502 case CSSPropertyWebkitLocale: |
3503 return consumeLocale(m_range); | 3503 return consumeLocale(m_range); |
3504 case CSSPropertyWebkitColumnWidth: | 3504 case CSSPropertyColumnWidth: |
3505 return consumeColumnWidth(m_range); | 3505 return consumeColumnWidth(m_range); |
3506 case CSSPropertyWebkitColumnCount: | 3506 case CSSPropertyColumnCount: |
3507 return consumeColumnCount(m_range); | 3507 return consumeColumnCount(m_range); |
3508 case CSSPropertyWebkitColumnGap: | 3508 case CSSPropertyColumnGap: |
3509 return consumeColumnGap(m_range, m_context.mode()); | 3509 return consumeColumnGap(m_range, m_context.mode()); |
3510 case CSSPropertyWebkitColumnSpan: | 3510 case CSSPropertyColumnSpan: |
3511 return consumeColumnSpan(m_range, m_context.mode()); | 3511 return consumeColumnSpan(m_range, m_context.mode()); |
3512 case CSSPropertyZoom: | 3512 case CSSPropertyZoom: |
3513 return consumeZoom(m_range, m_context); | 3513 return consumeZoom(m_range, m_context); |
3514 case CSSPropertyAnimationDelay: | 3514 case CSSPropertyAnimationDelay: |
3515 case CSSPropertyTransitionDelay: | 3515 case CSSPropertyTransitionDelay: |
3516 case CSSPropertyAnimationDirection: | 3516 case CSSPropertyAnimationDirection: |
3517 case CSSPropertyAnimationDuration: | 3517 case CSSPropertyAnimationDuration: |
3518 case CSSPropertyTransitionDuration: | 3518 case CSSPropertyTransitionDuration: |
3519 case CSSPropertyAnimationFillMode: | 3519 case CSSPropertyAnimationFillMode: |
3520 case CSSPropertyAnimationIterationCount: | 3520 case CSSPropertyAnimationIterationCount: |
(...skipping 24 matching lines...) Expand all Loading... |
3545 case CSSPropertyWebkitTapHighlightColor: | 3545 case CSSPropertyWebkitTapHighlightColor: |
3546 case CSSPropertyWebkitTextEmphasisColor: | 3546 case CSSPropertyWebkitTextEmphasisColor: |
3547 case CSSPropertyWebkitBorderStartColor: | 3547 case CSSPropertyWebkitBorderStartColor: |
3548 case CSSPropertyWebkitBorderEndColor: | 3548 case CSSPropertyWebkitBorderEndColor: |
3549 case CSSPropertyWebkitBorderBeforeColor: | 3549 case CSSPropertyWebkitBorderBeforeColor: |
3550 case CSSPropertyWebkitBorderAfterColor: | 3550 case CSSPropertyWebkitBorderAfterColor: |
3551 case CSSPropertyWebkitTextStrokeColor: | 3551 case CSSPropertyWebkitTextStrokeColor: |
3552 case CSSPropertyStopColor: | 3552 case CSSPropertyStopColor: |
3553 case CSSPropertyFloodColor: | 3553 case CSSPropertyFloodColor: |
3554 case CSSPropertyLightingColor: | 3554 case CSSPropertyLightingColor: |
3555 case CSSPropertyWebkitColumnRuleColor: | 3555 case CSSPropertyColumnRuleColor: |
3556 return consumeColor(m_range, m_context.mode()); | 3556 return consumeColor(m_range, m_context.mode()); |
3557 case CSSPropertyColor: | 3557 case CSSPropertyColor: |
3558 return consumeColor(m_range, m_context.mode(), inQuirksMode()); | 3558 return consumeColor(m_range, m_context.mode(), inQuirksMode()); |
3559 case CSSPropertyWebkitBorderStartWidth: | 3559 case CSSPropertyWebkitBorderStartWidth: |
3560 case CSSPropertyWebkitBorderEndWidth: | 3560 case CSSPropertyWebkitBorderEndWidth: |
3561 case CSSPropertyWebkitBorderBeforeWidth: | 3561 case CSSPropertyWebkitBorderBeforeWidth: |
3562 case CSSPropertyWebkitBorderAfterWidth: | 3562 case CSSPropertyWebkitBorderAfterWidth: |
3563 return consumeBorderWidth(m_range, m_context.mode(), UnitlessQuirk::Forb
id); | 3563 return consumeBorderWidth(m_range, m_context.mode(), UnitlessQuirk::Forb
id); |
3564 case CSSPropertyBorderBottomColor: | 3564 case CSSPropertyBorderBottomColor: |
3565 case CSSPropertyBorderLeftColor: | 3565 case CSSPropertyBorderLeftColor: |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3630 case CSSPropertyFilter: | 3630 case CSSPropertyFilter: |
3631 case CSSPropertyMask: | 3631 case CSSPropertyMask: |
3632 return consumeNoneOrURI(m_range); | 3632 return consumeNoneOrURI(m_range); |
3633 case CSSPropertyFlexBasis: | 3633 case CSSPropertyFlexBasis: |
3634 return consumeFlexBasis(m_range, m_context.mode()); | 3634 return consumeFlexBasis(m_range, m_context.mode()); |
3635 case CSSPropertyFlexGrow: | 3635 case CSSPropertyFlexGrow: |
3636 case CSSPropertyFlexShrink: | 3636 case CSSPropertyFlexShrink: |
3637 return consumeNumber(m_range, ValueRangeNonNegative); | 3637 return consumeNumber(m_range, ValueRangeNonNegative); |
3638 case CSSPropertyStrokeDasharray: | 3638 case CSSPropertyStrokeDasharray: |
3639 return consumeStrokeDasharray(m_range); | 3639 return consumeStrokeDasharray(m_range); |
3640 case CSSPropertyWebkitColumnRuleWidth: | 3640 case CSSPropertyColumnRuleWidth: |
3641 return consumeColumnRuleWidth(m_range, m_context.mode()); | 3641 return consumeColumnRuleWidth(m_range, m_context.mode()); |
3642 case CSSPropertyStrokeOpacity: | 3642 case CSSPropertyStrokeOpacity: |
3643 case CSSPropertyFillOpacity: | 3643 case CSSPropertyFillOpacity: |
3644 case CSSPropertyStopOpacity: | 3644 case CSSPropertyStopOpacity: |
3645 case CSSPropertyFloodOpacity: | 3645 case CSSPropertyFloodOpacity: |
3646 case CSSPropertyOpacity: | 3646 case CSSPropertyOpacity: |
3647 case CSSPropertyWebkitBoxFlex: | 3647 case CSSPropertyWebkitBoxFlex: |
3648 return consumeNumber(m_range, ValueRangeAll); | 3648 return consumeNumber(m_range, ValueRangeAll); |
3649 case CSSPropertyBaselineShift: | 3649 case CSSPropertyBaselineShift: |
3650 return consumeBaselineShift(m_range); | 3650 return consumeBaselineShift(m_range); |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4081 RefPtrWillBeRawPtr<CSSValue> columnCount = nullptr; | 4081 RefPtrWillBeRawPtr<CSSValue> columnCount = nullptr; |
4082 if (!consumeColumnWidthOrCount(m_range, m_context.mode(), columnWidth, colum
nCount)) | 4082 if (!consumeColumnWidthOrCount(m_range, m_context.mode(), columnWidth, colum
nCount)) |
4083 return false; | 4083 return false; |
4084 consumeColumnWidthOrCount(m_range, m_context.mode(), columnWidth, columnCoun
t); | 4084 consumeColumnWidthOrCount(m_range, m_context.mode(), columnWidth, columnCoun
t); |
4085 if (!m_range.atEnd()) | 4085 if (!m_range.atEnd()) |
4086 return false; | 4086 return false; |
4087 if (!columnWidth) | 4087 if (!columnWidth) |
4088 columnWidth = cssValuePool().createIdentifierValue(CSSValueAuto); | 4088 columnWidth = cssValuePool().createIdentifierValue(CSSValueAuto); |
4089 if (!columnCount) | 4089 if (!columnCount) |
4090 columnCount = cssValuePool().createIdentifierValue(CSSValueAuto); | 4090 columnCount = cssValuePool().createIdentifierValue(CSSValueAuto); |
4091 addProperty(CSSPropertyWebkitColumnWidth, columnWidth.release(), important); | 4091 addProperty(CSSPropertyColumnWidth, columnWidth.release(), important); |
4092 addProperty(CSSPropertyWebkitColumnCount, columnCount.release(), important); | 4092 addProperty(CSSPropertyColumnCount, columnCount.release(), important); |
4093 return true; | 4093 return true; |
4094 } | 4094 } |
4095 | 4095 |
4096 bool CSSPropertyParser::consumeShorthandGreedily(const StylePropertyShorthand& s
horthand, bool important) | 4096 bool CSSPropertyParser::consumeShorthandGreedily(const StylePropertyShorthand& s
horthand, bool important) |
4097 { | 4097 { |
4098 ASSERT(shorthand.length() <= 6); // Existing shorthands have at most 6 longh
ands. | 4098 ASSERT(shorthand.length() <= 6); // Existing shorthands have at most 6 longh
ands. |
4099 RefPtrWillBeRawPtr<CSSValue> longhands[6] = { nullptr, nullptr, nullptr, nul
lptr, nullptr, nullptr }; | 4099 RefPtrWillBeRawPtr<CSSValue> longhands[6] = { nullptr, nullptr, nullptr, nul
lptr, nullptr, nullptr }; |
4100 const CSSPropertyID* shorthandProperties = shorthand.properties(); | 4100 const CSSPropertyID* shorthandProperties = shorthand.properties(); |
4101 do { | 4101 do { |
4102 bool foundLonghand = false; | 4102 bool foundLonghand = false; |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4413 return true; | 4413 return true; |
4414 } | 4414 } |
4415 case CSSPropertyFont: { | 4415 case CSSPropertyFont: { |
4416 const CSSParserToken& token = m_range.peek(); | 4416 const CSSParserToken& token = m_range.peek(); |
4417 if (token.id() >= CSSValueCaption && token.id() <= CSSValueStatusBar) | 4417 if (token.id() >= CSSValueCaption && token.id() <= CSSValueStatusBar) |
4418 return consumeSystemFont(important); | 4418 return consumeSystemFont(important); |
4419 return consumeFont(important); | 4419 return consumeFont(important); |
4420 } | 4420 } |
4421 case CSSPropertyBorderSpacing: | 4421 case CSSPropertyBorderSpacing: |
4422 return consumeBorderSpacing(important); | 4422 return consumeBorderSpacing(important); |
4423 case CSSPropertyWebkitColumns: { | 4423 case CSSPropertyColumns: { |
4424 // TODO(rwlbuis): investigate if this shorthand hack can be removed. | 4424 // TODO(rwlbuis): investigate if this shorthand hack can be removed. |
4425 m_currentShorthand = oldShorthand; | 4425 m_currentShorthand = oldShorthand; |
4426 return consumeColumns(important); | 4426 return consumeColumns(important); |
4427 } | 4427 } |
4428 case CSSPropertyAnimation: | 4428 case CSSPropertyAnimation: |
4429 return consumeAnimationShorthand(animationShorthandForParsing(), unresol
vedProperty == CSSPropertyAliasWebkitAnimation, important); | 4429 return consumeAnimationShorthand(animationShorthandForParsing(), unresol
vedProperty == CSSPropertyAliasWebkitAnimation, important); |
4430 case CSSPropertyTransition: | 4430 case CSSPropertyTransition: |
4431 return consumeAnimationShorthand(transitionShorthandForParsing(), false,
important); | 4431 return consumeAnimationShorthand(transitionShorthandForParsing(), false,
important); |
4432 case CSSPropertyTextDecoration: | 4432 case CSSPropertyTextDecoration: |
4433 ASSERT(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); | 4433 ASSERT(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); |
(...skipping 25 matching lines...) Expand all Loading... |
4459 return false; | 4459 return false; |
4460 addProperty(CSSPropertyMarkerStart, marker, important); | 4460 addProperty(CSSPropertyMarkerStart, marker, important); |
4461 addProperty(CSSPropertyMarkerMid, marker, important); | 4461 addProperty(CSSPropertyMarkerMid, marker, important); |
4462 addProperty(CSSPropertyMarkerEnd, marker.release(), important); | 4462 addProperty(CSSPropertyMarkerEnd, marker.release(), important); |
4463 return true; | 4463 return true; |
4464 } | 4464 } |
4465 case CSSPropertyFlex: | 4465 case CSSPropertyFlex: |
4466 return consumeFlex(important); | 4466 return consumeFlex(important); |
4467 case CSSPropertyFlexFlow: | 4467 case CSSPropertyFlexFlow: |
4468 return consumeShorthandGreedily(flexFlowShorthand(), important); | 4468 return consumeShorthandGreedily(flexFlowShorthand(), important); |
4469 case CSSPropertyWebkitColumnRule: | 4469 case CSSPropertyColumnRule: |
4470 return consumeShorthandGreedily(webkitColumnRuleShorthand(), important); | 4470 return consumeShorthandGreedily(columnRuleShorthand(), important); |
4471 case CSSPropertyListStyle: | 4471 case CSSPropertyListStyle: |
4472 return consumeShorthandGreedily(listStyleShorthand(), important); | 4472 return consumeShorthandGreedily(listStyleShorthand(), important); |
4473 case CSSPropertyBorderRadius: { | 4473 case CSSPropertyBorderRadius: { |
4474 RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalRadii[4]; | 4474 RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalRadii[4]; |
4475 RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalRadii[4]; | 4475 RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalRadii[4]; |
4476 if (!consumeRadii(horizontalRadii, verticalRadii, m_range, m_context.mod
e(), unresolvedProperty == CSSPropertyAliasWebkitBorderRadius)) | 4476 if (!consumeRadii(horizontalRadii, verticalRadii, m_range, m_context.mod
e(), unresolvedProperty == CSSPropertyAliasWebkitBorderRadius)) |
4477 return false; | 4477 return false; |
4478 addProperty(CSSPropertyBorderTopLeftRadius, CSSValuePair::create(horizon
talRadii[0].release(), verticalRadii[0].release(), CSSValuePair::DropIdenticalVa
lues), important); | 4478 addProperty(CSSPropertyBorderTopLeftRadius, CSSValuePair::create(horizon
talRadii[0].release(), verticalRadii[0].release(), CSSValuePair::DropIdenticalVa
lues), important); |
4479 addProperty(CSSPropertyBorderTopRightRadius, CSSValuePair::create(horizo
ntalRadii[1].release(), verticalRadii[1].release(), CSSValuePair::DropIdenticalV
alues), important); | 4479 addProperty(CSSPropertyBorderTopRightRadius, CSSValuePair::create(horizo
ntalRadii[1].release(), verticalRadii[1].release(), CSSValuePair::DropIdenticalV
alues), important); |
4480 addProperty(CSSPropertyBorderBottomRightRadius, CSSValuePair::create(hor
izontalRadii[2].release(), verticalRadii[2].release(), CSSValuePair::DropIdentic
alValues), important); | 4480 addProperty(CSSPropertyBorderBottomRightRadius, CSSValuePair::create(hor
izontalRadii[2].release(), verticalRadii[2].release(), CSSValuePair::DropIdentic
alValues), important); |
(...skipping 30 matching lines...) Expand all Loading... |
4511 m_currentShorthand = oldShorthand; | 4511 m_currentShorthand = oldShorthand; |
4512 CSSParserValueList valueList(m_range); | 4512 CSSParserValueList valueList(m_range); |
4513 if (!valueList.size()) | 4513 if (!valueList.size()) |
4514 return false; | 4514 return false; |
4515 m_valueList = &valueList; | 4515 m_valueList = &valueList; |
4516 return legacyParseShorthand(unresolvedProperty, important); | 4516 return legacyParseShorthand(unresolvedProperty, important); |
4517 } | 4517 } |
4518 } | 4518 } |
4519 | 4519 |
4520 } // namespace blink | 4520 } // namespace blink |
OLD | NEW |