| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
| 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
| 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
| 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
| 10 * | 10 * |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 , m_context(context) | 107 , m_context(context) |
| 108 , m_inViewport(inViewport) | 108 , m_inViewport(inViewport) |
| 109 , m_parsedProperties(parsedProperties) | 109 , m_parsedProperties(parsedProperties) |
| 110 , m_ruleType(ruleType) | 110 , m_ruleType(ruleType) |
| 111 , m_inParseShorthand(0) | 111 , m_inParseShorthand(0) |
| 112 , m_currentShorthand(CSSPropertyInvalid) | 112 , m_currentShorthand(CSSPropertyInvalid) |
| 113 , m_implicitShorthand(false) | 113 , m_implicitShorthand(false) |
| 114 { | 114 { |
| 115 } | 115 } |
| 116 | 116 |
| 117 bool CSSPropertyParser::parseValue(CSSPropertyID property, bool important, | 117 bool CSSPropertyParser::parseValue(CSSPropertyID property, |
| 118 CSSParserValueList* valueList, const CSSParserContext& context, bool inViewp
ort, | 118 CSSParserValueList* valueList, const CSSParserContext& context, bool inViewp
ort, |
| 119 Vector<CSSProperty, 256>& parsedProperties, CSSRuleSourceData::Type ruleType
) | 119 Vector<CSSProperty, 256>& parsedProperties, CSSRuleSourceData::Type ruleType
) |
| 120 { | 120 { |
| 121 CSSPropertyParser parser(valueList, context, inViewport, parsedProperties, r
uleType); | 121 CSSPropertyParser parser(valueList, context, inViewport, parsedProperties, r
uleType); |
| 122 return parser.parseValue(property, important); | 122 return parser.parseValue(property); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void CSSPropertyParser::addProperty(CSSPropertyID propId, PassRefPtr<CSSValue> v
alue, bool important, bool implicit) | 125 void CSSPropertyParser::addProperty(CSSPropertyID propId, PassRefPtr<CSSValue> v
alue, bool implicit) |
| 126 { | 126 { |
| 127 int shorthandIndex = 0; | 127 int shorthandIndex = 0; |
| 128 bool setFromShorthand = false; | 128 bool setFromShorthand = false; |
| 129 | 129 |
| 130 if (m_currentShorthand) { | 130 if (m_currentShorthand) { |
| 131 Vector<StylePropertyShorthand, 4> shorthands; | 131 Vector<StylePropertyShorthand, 4> shorthands; |
| 132 getMatchingShorthandsForLonghand(propId, &shorthands); | 132 getMatchingShorthandsForLonghand(propId, &shorthands); |
| 133 // Viewport descriptors have width and height as shorthands, but it does
n't | 133 // Viewport descriptors have width and height as shorthands, but it does
n't |
| 134 // make sense for CSSProperties.in to consider them as such. The shortha
nd | 134 // make sense for CSSProperties.in to consider them as such. The shortha
nd |
| 135 // index is only used by the inspector and doesn't affect viewport | 135 // index is only used by the inspector and doesn't affect viewport |
| 136 // descriptors. | 136 // descriptors. |
| 137 if (shorthands.isEmpty()) | 137 if (shorthands.isEmpty()) |
| 138 ASSERT(m_currentShorthand == CSSPropertyWidth || m_currentShorthand
== CSSPropertyHeight); | 138 ASSERT(m_currentShorthand == CSSPropertyWidth || m_currentShorthand
== CSSPropertyHeight); |
| 139 else | 139 else |
| 140 setFromShorthand = true; | 140 setFromShorthand = true; |
| 141 | 141 |
| 142 if (shorthands.size() > 1) | 142 if (shorthands.size() > 1) |
| 143 shorthandIndex = indexOfShorthandForLonghand(m_currentShorthand, sho
rthands); | 143 shorthandIndex = indexOfShorthandForLonghand(m_currentShorthand, sho
rthands); |
| 144 } | 144 } |
| 145 | 145 |
| 146 m_parsedProperties.append(CSSProperty(propId, value, important, setFromShort
hand, shorthandIndex, m_implicitShorthand || implicit)); | 146 m_parsedProperties.append(CSSProperty(propId, value, setFromShorthand, short
handIndex, m_implicitShorthand || implicit)); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void CSSPropertyParser::rollbackLastProperties(int num) | 149 void CSSPropertyParser::rollbackLastProperties(int num) |
| 150 { | 150 { |
| 151 ASSERT(num >= 0); | 151 ASSERT(num >= 0); |
| 152 ASSERT(m_parsedProperties.size() >= static_cast<unsigned>(num)); | 152 ASSERT(m_parsedProperties.size() >= static_cast<unsigned>(num)); |
| 153 m_parsedProperties.shrink(m_parsedProperties.size() - num); | 153 m_parsedProperties.shrink(m_parsedProperties.size() - num); |
| 154 } | 154 } |
| 155 | 155 |
| 156 KURL CSSPropertyParser::completeURL(const String& url) const | 156 KURL CSSPropertyParser::completeURL(const String& url) const |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 if (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveV
alue::CSS_VMAX) | 373 if (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveV
alue::CSS_VMAX) |
| 374 return createPrimitiveNumericValue(value); | 374 return createPrimitiveNumericValue(value); |
| 375 if (value->unit >= CSSPrimitiveValue::CSS_DPPX && value->unit <= CSSPrimitiv
eValue::CSS_DPCM) | 375 if (value->unit >= CSSPrimitiveValue::CSS_DPPX && value->unit <= CSSPrimitiv
eValue::CSS_DPCM) |
| 376 return createPrimitiveNumericValue(value); | 376 return createPrimitiveNumericValue(value); |
| 377 if (isCalculation(value)) | 377 if (isCalculation(value)) |
| 378 return CSSPrimitiveValue::create(m_parsedCalculation.release()); | 378 return CSSPrimitiveValue::create(m_parsedCalculation.release()); |
| 379 | 379 |
| 380 return nullptr; | 380 return nullptr; |
| 381 } | 381 } |
| 382 | 382 |
| 383 void CSSPropertyParser::addExpandedPropertyForValue(CSSPropertyID propId, PassRe
fPtr<CSSValue> prpValue, bool important) | 383 void CSSPropertyParser::addExpandedPropertyForValue(CSSPropertyID propId, PassRe
fPtr<CSSValue> prpValue) |
| 384 { | 384 { |
| 385 const StylePropertyShorthand& shorthand = shorthandForProperty(propId); | 385 const StylePropertyShorthand& shorthand = shorthandForProperty(propId); |
| 386 unsigned shorthandLength = shorthand.length(); | 386 unsigned shorthandLength = shorthand.length(); |
| 387 if (!shorthandLength) { | 387 if (!shorthandLength) { |
| 388 addProperty(propId, prpValue, important); | 388 addProperty(propId, prpValue); |
| 389 return; | 389 return; |
| 390 } | 390 } |
| 391 | 391 |
| 392 RefPtr<CSSValue> value = prpValue; | 392 RefPtr<CSSValue> value = prpValue; |
| 393 ShorthandScope scope(this, propId); | 393 ShorthandScope scope(this, propId); |
| 394 const CSSPropertyID* longhands = shorthand.properties(); | 394 const CSSPropertyID* longhands = shorthand.properties(); |
| 395 for (unsigned i = 0; i < shorthandLength; ++i) | 395 for (unsigned i = 0; i < shorthandLength; ++i) |
| 396 addProperty(longhands[i], value, important); | 396 addProperty(longhands[i], value); |
| 397 } | 397 } |
| 398 | 398 |
| 399 bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important) | 399 bool CSSPropertyParser::parseValue(CSSPropertyID propId) |
| 400 { | 400 { |
| 401 if (!isInternalPropertyAndValueParsingEnabledForMode(m_context.mode()) && is
InternalProperty(propId)) | 401 if (!isInternalPropertyAndValueParsingEnabledForMode(m_context.mode()) && is
InternalProperty(propId)) |
| 402 return false; | 402 return false; |
| 403 | 403 |
| 404 // We don't count the UA style sheet in our statistics. | 404 // We don't count the UA style sheet in our statistics. |
| 405 if (m_context.useCounter()) | 405 if (m_context.useCounter()) |
| 406 m_context.useCounter()->count(m_context, propId); | 406 m_context.useCounter()->count(m_context, propId); |
| 407 | 407 |
| 408 if (!m_valueList) | 408 if (!m_valueList) |
| 409 return false; | 409 return false; |
| 410 | 410 |
| 411 CSSParserValue* value = m_valueList->current(); | 411 CSSParserValue* value = m_valueList->current(); |
| 412 | 412 |
| 413 if (!value) | 413 if (!value) |
| 414 return false; | 414 return false; |
| 415 | 415 |
| 416 if (inViewport()) { | 416 if (inViewport()) { |
| 417 // Allow @viewport rules from UA stylesheets even if the feature is disa
bled. | 417 // Allow @viewport rules from UA stylesheets even if the feature is disa
bled. |
| 418 if (!RuntimeEnabledFeatures::cssViewportEnabled() && !isUASheetBehavior(
m_context.mode())) | 418 if (!RuntimeEnabledFeatures::cssViewportEnabled() && !isUASheetBehavior(
m_context.mode())) |
| 419 return false; | 419 return false; |
| 420 | 420 |
| 421 return parseViewportProperty(propId, important); | 421 return parseViewportProperty(propId); |
| 422 } | 422 } |
| 423 | 423 |
| 424 // Note: m_parsedCalculation is used to pass the calc value to validUnit and
then cleared at the end of this function. | 424 // Note: m_parsedCalculation is used to pass the calc value to validUnit and
then cleared at the end of this function. |
| 425 // FIXME: This is to avoid having to pass parsedCalc to all validUnit caller
s. | 425 // FIXME: This is to avoid having to pass parsedCalc to all validUnit caller
s. |
| 426 ASSERT(!m_parsedCalculation); | 426 ASSERT(!m_parsedCalculation); |
| 427 | 427 |
| 428 CSSValueID id = value->id; | 428 CSSValueID id = value->id; |
| 429 | 429 |
| 430 int num = inShorthand() ? 1 : m_valueList->size(); | 430 int num = inShorthand() ? 1 : m_valueList->size(); |
| 431 | 431 |
| 432 if (id == CSSValueInherit) { | 432 if (id == CSSValueInherit) { |
| 433 if (num != 1) | 433 if (num != 1) |
| 434 return false; | 434 return false; |
| 435 addExpandedPropertyForValue(propId, cssValuePool().createInheritedValue(
), important); | 435 addExpandedPropertyForValue(propId, cssValuePool().createInheritedValue(
)); |
| 436 return true; | 436 return true; |
| 437 } | 437 } |
| 438 else if (id == CSSValueInitial) { | 438 else if (id == CSSValueInitial) { |
| 439 if (num != 1) | 439 if (num != 1) |
| 440 return false; | 440 return false; |
| 441 addExpandedPropertyForValue(propId, cssValuePool().createExplicitInitial
Value(), important); | 441 addExpandedPropertyForValue(propId, cssValuePool().createExplicitInitial
Value()); |
| 442 return true; | 442 return true; |
| 443 } | 443 } |
| 444 | 444 |
| 445 if (isKeywordPropertyID(propId)) { | 445 if (isKeywordPropertyID(propId)) { |
| 446 if (!isValidKeywordPropertyAndValue(propId, id, m_context)) | 446 if (!isValidKeywordPropertyAndValue(propId, id, m_context)) |
| 447 return false; | 447 return false; |
| 448 if (m_valueList->next() && !inShorthand()) | 448 if (m_valueList->next() && !inShorthand()) |
| 449 return false; | 449 return false; |
| 450 addProperty(propId, cssValuePool().createIdentifierValue(id), important)
; | 450 addProperty(propId, cssValuePool().createIdentifierValue(id)); |
| 451 return true; | 451 return true; |
| 452 } | 452 } |
| 453 | 453 |
| 454 bool validPrimitive = false; | 454 bool validPrimitive = false; |
| 455 RefPtr<CSSValue> parsedValue = nullptr; | 455 RefPtr<CSSValue> parsedValue = nullptr; |
| 456 | 456 |
| 457 switch (propId) { | 457 switch (propId) { |
| 458 case CSSPropertySize: // <length>{1,2} | auto | [ <page-size
> || [ portrait | landscape] ] | 458 case CSSPropertySize: // <length>{1,2} | auto | [ <page-size
> || [ portrait | landscape] ] |
| 459 return parseSize(propId, important); | 459 return parseSize(propId); |
| 460 | 460 |
| 461 case CSSPropertyQuotes: // [<string> <string>]+ | none | 461 case CSSPropertyQuotes: // [<string> <string>]+ | none |
| 462 if (id == CSSValueNone) | 462 if (id == CSSValueNone) |
| 463 validPrimitive = true; | 463 validPrimitive = true; |
| 464 else | 464 else |
| 465 parsedValue = parseQuotes(); | 465 parsedValue = parseQuotes(); |
| 466 break; | 466 break; |
| 467 | 467 |
| 468 case CSSPropertyClip: // <shape> | auto | inherit | 468 case CSSPropertyClip: // <shape> | auto | inherit |
| 469 if (id == CSSValueAuto) | 469 if (id == CSSValueAuto) |
| 470 validPrimitive = true; | 470 validPrimitive = true; |
| 471 else if (value->unit == CSSParserValue::Function) | 471 else if (value->unit == CSSParserValue::Function) |
| 472 return parseClipShape(propId, important); | 472 return parseClipShape(propId); |
| 473 break; | 473 break; |
| 474 | 474 |
| 475 /* Start of supported CSS properties with validation. This is needed for par
seShorthand to work | 475 /* Start of supported CSS properties with validation. This is needed for par
seShorthand to work |
| 476 * correctly and allows optimization in blink::applyRule(..) | 476 * correctly and allows optimization in blink::applyRule(..) |
| 477 */ | 477 */ |
| 478 case CSSPropertyOverflow: { | 478 case CSSPropertyOverflow: { |
| 479 ShorthandScope scope(this, propId); | 479 ShorthandScope scope(this, propId); |
| 480 if (num != 1 || !parseValue(CSSPropertyOverflowY, important)) | 480 if (num != 1 || !parseValue(CSSPropertyOverflowY)) |
| 481 return false; | 481 return false; |
| 482 | 482 |
| 483 RefPtr<CSSValue> overflowXValue = nullptr; | 483 RefPtr<CSSValue> overflowXValue = nullptr; |
| 484 | 484 |
| 485 // FIXME: -webkit-paged-x or -webkit-paged-y only apply to overflow-y. I
f this value has been | 485 // FIXME: -webkit-paged-x or -webkit-paged-y only apply to overflow-y. I
f this value has been |
| 486 // set using the shorthand, then for now overflow-x will default to auto
, but once we implement | 486 // set using the shorthand, then for now overflow-x will default to auto
, but once we implement |
| 487 // pagination controls, it should default to hidden. If the overflow-y v
alue is anything but | 487 // pagination controls, it should default to hidden. If the overflow-y v
alue is anything but |
| 488 // paged-x or paged-y, then overflow-x and overflow-y should have the sa
me value. | 488 // paged-x or paged-y, then overflow-x and overflow-y should have the sa
me value. |
| 489 if (id == CSSValueWebkitPagedX || id == CSSValueWebkitPagedY) | 489 if (id == CSSValueWebkitPagedX || id == CSSValueWebkitPagedY) |
| 490 overflowXValue = cssValuePool().createIdentifierValue(CSSValueAuto); | 490 overflowXValue = cssValuePool().createIdentifierValue(CSSValueAuto); |
| 491 else | 491 else |
| 492 overflowXValue = m_parsedProperties.last().value(); | 492 overflowXValue = m_parsedProperties.last().value(); |
| 493 addProperty(CSSPropertyOverflowX, overflowXValue.release(), important); | 493 addProperty(CSSPropertyOverflowX, overflowXValue.release()); |
| 494 return true; | 494 return true; |
| 495 } | 495 } |
| 496 | 496 |
| 497 case CSSPropertyTextAlign: | 497 case CSSPropertyTextAlign: |
| 498 // left | right | center | justify | -webkit-match-parent | 498 // left | right | center | justify | -webkit-match-parent |
| 499 // | start | end | <string> | inherit | 499 // | start | end | <string> | inherit |
| 500 if ((id >= CSSValueLeft && id <= CSSValueWebkitMatchParent) || id == CSS
ValueStart || id == CSSValueEnd | 500 if ((id >= CSSValueLeft && id <= CSSValueWebkitMatchParent) || id == CSS
ValueStart || id == CSSValueEnd |
| 501 || value->unit == CSSPrimitiveValue::CSS_STRING) | 501 || value->unit == CSSPrimitiveValue::CSS_STRING) |
| 502 validPrimitive = true; | 502 validPrimitive = true; |
| 503 break; | 503 break; |
| 504 | 504 |
| 505 case CSSPropertyFontWeight: { // normal | bold | bolder | lighter | 100 | 2
00 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit | 505 case CSSPropertyFontWeight: { // normal | bold | bolder | lighter | 100 | 2
00 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit |
| 506 if (m_valueList->size() != 1) | 506 if (m_valueList->size() != 1) |
| 507 return false; | 507 return false; |
| 508 return parseFontWeight(important); | 508 return parseFontWeight(); |
| 509 } | 509 } |
| 510 | 510 |
| 511 case CSSPropertyBorderSpacing: { | 511 case CSSPropertyBorderSpacing: { |
| 512 if (num == 1) { | 512 if (num == 1) { |
| 513 ShorthandScope scope(this, CSSPropertyBorderSpacing); | 513 ShorthandScope scope(this, CSSPropertyBorderSpacing); |
| 514 if (!parseValue(CSSPropertyWebkitBorderHorizontalSpacing, important)
) | 514 if (!parseValue(CSSPropertyWebkitBorderHorizontalSpacing)) |
| 515 return false; | 515 return false; |
| 516 CSSValue* value = m_parsedProperties.last().value(); | 516 CSSValue* value = m_parsedProperties.last().value(); |
| 517 addProperty(CSSPropertyWebkitBorderVerticalSpacing, value, important
); | 517 addProperty(CSSPropertyWebkitBorderVerticalSpacing, value); |
| 518 return true; | 518 return true; |
| 519 } | 519 } |
| 520 else if (num == 2) { | 520 else if (num == 2) { |
| 521 ShorthandScope scope(this, CSSPropertyBorderSpacing); | 521 ShorthandScope scope(this, CSSPropertyBorderSpacing); |
| 522 if (!parseValue(CSSPropertyWebkitBorderHorizontalSpacing, important)
|| !parseValue(CSSPropertyWebkitBorderVerticalSpacing, important)) | 522 if (!parseValue(CSSPropertyWebkitBorderHorizontalSpacing) || !parseV
alue(CSSPropertyWebkitBorderVerticalSpacing)) |
| 523 return false; | 523 return false; |
| 524 return true; | 524 return true; |
| 525 } | 525 } |
| 526 return false; | 526 return false; |
| 527 } | 527 } |
| 528 case CSSPropertyWebkitBorderHorizontalSpacing: | 528 case CSSPropertyWebkitBorderHorizontalSpacing: |
| 529 case CSSPropertyWebkitBorderVerticalSpacing: | 529 case CSSPropertyWebkitBorderVerticalSpacing: |
| 530 validPrimitive = validUnit(value, FLength | FNonNeg); | 530 validPrimitive = validUnit(value, FLength | FNonNeg); |
| 531 break; | 531 break; |
| 532 case CSSPropertyOutlineColor: // <color> | invert | inherit | 532 case CSSPropertyOutlineColor: // <color> | invert | inherit |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 RefPtr<CSSValue> val1 = nullptr; | 662 RefPtr<CSSValue> val1 = nullptr; |
| 663 RefPtr<CSSValue> val2 = nullptr; | 663 RefPtr<CSSValue> val2 = nullptr; |
| 664 CSSPropertyID propId1, propId2; | 664 CSSPropertyID propId1, propId2; |
| 665 bool result = false; | 665 bool result = false; |
| 666 if (parseFillProperty(propId, propId1, propId2, val1, val2)) { | 666 if (parseFillProperty(propId, propId1, propId2, val1, val2)) { |
| 667 if (propId == CSSPropertyBackgroundPosition || | 667 if (propId == CSSPropertyBackgroundPosition || |
| 668 propId == CSSPropertyBackgroundRepeat || | 668 propId == CSSPropertyBackgroundRepeat || |
| 669 propId == CSSPropertyWebkitMaskPosition || | 669 propId == CSSPropertyWebkitMaskPosition || |
| 670 propId == CSSPropertyWebkitMaskRepeat) { | 670 propId == CSSPropertyWebkitMaskRepeat) { |
| 671 ShorthandScope scope(this, propId); | 671 ShorthandScope scope(this, propId); |
| 672 addProperty(propId1, val1.release(), important); | 672 addProperty(propId1, val1.release()); |
| 673 if (val2) | 673 if (val2) |
| 674 addProperty(propId2, val2.release(), important); | 674 addProperty(propId2, val2.release()); |
| 675 } else { | 675 } else { |
| 676 addProperty(propId1, val1.release(), important); | 676 addProperty(propId1, val1.release()); |
| 677 if (val2) | 677 if (val2) |
| 678 addProperty(propId2, val2.release(), important); | 678 addProperty(propId2, val2.release()); |
| 679 } | 679 } |
| 680 result = true; | 680 result = true; |
| 681 } | 681 } |
| 682 m_implicitShorthand = false; | 682 m_implicitShorthand = false; |
| 683 return result; | 683 return result; |
| 684 } | 684 } |
| 685 case CSSPropertyObjectPosition: | 685 case CSSPropertyObjectPosition: |
| 686 ASSERT(RuntimeEnabledFeatures::objectFitPositionEnabled()); | 686 ASSERT(RuntimeEnabledFeatures::objectFitPositionEnabled()); |
| 687 parsedValue = parseObjectPosition(); | 687 parsedValue = parseObjectPosition(); |
| 688 break; | 688 break; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 break; | 763 break; |
| 764 | 764 |
| 765 case CSSPropertyWidth: | 765 case CSSPropertyWidth: |
| 766 case CSSPropertyWebkitLogicalWidth: | 766 case CSSPropertyWebkitLogicalWidth: |
| 767 case CSSPropertyHeight: | 767 case CSSPropertyHeight: |
| 768 case CSSPropertyWebkitLogicalHeight: | 768 case CSSPropertyWebkitLogicalHeight: |
| 769 validPrimitive = (id == CSSValueAuto || validWidthOrHeight(value)); | 769 validPrimitive = (id == CSSValueAuto || validWidthOrHeight(value)); |
| 770 break; | 770 break; |
| 771 | 771 |
| 772 case CSSPropertyFontSize: | 772 case CSSPropertyFontSize: |
| 773 return parseFontSize(important); | 773 return parseFontSize(); |
| 774 | 774 |
| 775 case CSSPropertyFontVariant: // normal | small-caps | inherit | 775 case CSSPropertyFontVariant: // normal | small-caps | inherit |
| 776 return parseFontVariant(important); | 776 return parseFontVariant(); |
| 777 | 777 |
| 778 case CSSPropertyVerticalAlign: | 778 case CSSPropertyVerticalAlign: |
| 779 // baseline | sub | super | top | text-top | middle | bottom | text-bott
om | | 779 // baseline | sub | super | top | text-top | middle | bottom | text-bott
om | |
| 780 // <percentage> | <length> | inherit | 780 // <percentage> | <length> | inherit |
| 781 | 781 |
| 782 if (id >= CSSValueBaseline && id <= CSSValueWebkitBaselineMiddle) | 782 if (id >= CSSValueBaseline && id <= CSSValueWebkitBaselineMiddle) |
| 783 validPrimitive = true; | 783 validPrimitive = true; |
| 784 else | 784 else |
| 785 validPrimitive = (!id && validUnit(value, FLength | FPercent)); | 785 validPrimitive = (!id && validUnit(value, FLength | FPercent)); |
| 786 break; | 786 break; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 812 break; | 812 break; |
| 813 | 813 |
| 814 case CSSPropertyZIndex: // auto | <integer> | inherit | 814 case CSSPropertyZIndex: // auto | <integer> | inherit |
| 815 if (id == CSSValueAuto) | 815 if (id == CSSValueAuto) |
| 816 validPrimitive = true; | 816 validPrimitive = true; |
| 817 else | 817 else |
| 818 validPrimitive = (!id && validUnit(value, FInteger)); | 818 validPrimitive = (!id && validUnit(value, FInteger)); |
| 819 break; | 819 break; |
| 820 | 820 |
| 821 case CSSPropertyLineHeight: | 821 case CSSPropertyLineHeight: |
| 822 return parseLineHeight(important); | 822 return parseLineHeight(); |
| 823 case CSSPropertyFontFamily: | 823 case CSSPropertyFontFamily: |
| 824 // [[ <family-name> | <generic-family> ],]* [<family-name> | <generic-fa
mily>] | inherit | 824 // [[ <family-name> | <generic-family> ],]* [<family-name> | <generic-fa
mily>] | inherit |
| 825 { | 825 { |
| 826 parsedValue = parseFontFamily(); | 826 parsedValue = parseFontFamily(); |
| 827 break; | 827 break; |
| 828 } | 828 } |
| 829 | 829 |
| 830 case CSSPropertyTextDecoration: | 830 case CSSPropertyTextDecoration: |
| 831 // Fall through 'text-decoration-line' parsing if CSS 3 Text Decoration | 831 // Fall through 'text-decoration-line' parsing if CSS 3 Text Decoration |
| 832 // is disabled to match CSS 2.1 rules for parsing 'text-decoration'. | 832 // is disabled to match CSS 2.1 rules for parsing 'text-decoration'. |
| 833 if (RuntimeEnabledFeatures::css3TextDecorationsEnabled()) { | 833 if (RuntimeEnabledFeatures::css3TextDecorationsEnabled()) { |
| 834 // [ <text-decoration-line> || <text-decoration-style> || <text-deco
ration-color> ] | inherit | 834 // [ <text-decoration-line> || <text-decoration-style> || <text-deco
ration-color> ] | inherit |
| 835 return parseShorthand(CSSPropertyTextDecoration, textDecorationShort
hand(), important); | 835 return parseShorthand(CSSPropertyTextDecoration, textDecorationShort
hand()); |
| 836 } | 836 } |
| 837 case CSSPropertyWebkitTextDecorationsInEffect: | 837 case CSSPropertyWebkitTextDecorationsInEffect: |
| 838 case CSSPropertyTextDecorationLine: | 838 case CSSPropertyTextDecorationLine: |
| 839 // none | [ underline || overline || line-through || blink ] | inherit | 839 // none | [ underline || overline || line-through || blink ] | inherit |
| 840 return parseTextDecoration(propId, important); | 840 return parseTextDecoration(propId); |
| 841 | 841 |
| 842 case CSSPropertyTextUnderlinePosition: | 842 case CSSPropertyTextUnderlinePosition: |
| 843 // auto | under | inherit | 843 // auto | under | inherit |
| 844 ASSERT(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); | 844 ASSERT(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); |
| 845 return parseTextUnderlinePosition(important); | 845 return parseTextUnderlinePosition(); |
| 846 | 846 |
| 847 case CSSPropertySrc: // Only used within @font-face and @-webkit-filter, so
cannot use inherit | initial or be !important. This is a list of urls or local r
eferences. | 847 case CSSPropertySrc: // Only used within @font-face and @-webkit-filter, so
cannot use inherit | initial. This is a list of urls or local references. |
| 848 parsedValue = parseFontFaceSrc(); | 848 parsedValue = parseFontFaceSrc(); |
| 849 break; | 849 break; |
| 850 | 850 |
| 851 case CSSPropertyUnicodeRange: | 851 case CSSPropertyUnicodeRange: |
| 852 parsedValue = parseFontFaceUnicodeRange(); | 852 parsedValue = parseFontFaceUnicodeRange(); |
| 853 break; | 853 break; |
| 854 | 854 |
| 855 /* CSS3 properties */ | 855 /* CSS3 properties */ |
| 856 | 856 |
| 857 case CSSPropertyBorderImage: | 857 case CSSPropertyBorderImage: |
| 858 case CSSPropertyWebkitMaskBoxImage: | 858 case CSSPropertyWebkitMaskBoxImage: |
| 859 return parseBorderImageShorthand(propId, important); | 859 return parseBorderImageShorthand(propId); |
| 860 case CSSPropertyWebkitBorderImage: { | 860 case CSSPropertyWebkitBorderImage: { |
| 861 if (RefPtr<CSSValue> result = parseBorderImage(propId)) { | 861 if (RefPtr<CSSValue> result = parseBorderImage(propId)) { |
| 862 addProperty(propId, result, important); | 862 addProperty(propId, result); |
| 863 return true; | 863 return true; |
| 864 } | 864 } |
| 865 return false; | 865 return false; |
| 866 } | 866 } |
| 867 | 867 |
| 868 case CSSPropertyBorderImageOutset: | 868 case CSSPropertyBorderImageOutset: |
| 869 case CSSPropertyWebkitMaskBoxImageOutset: { | 869 case CSSPropertyWebkitMaskBoxImageOutset: { |
| 870 RefPtr<CSSPrimitiveValue> result = nullptr; | 870 RefPtr<CSSPrimitiveValue> result = nullptr; |
| 871 if (parseBorderImageOutset(result)) { | 871 if (parseBorderImageOutset(result)) { |
| 872 addProperty(propId, result, important); | 872 addProperty(propId, result); |
| 873 return true; | 873 return true; |
| 874 } | 874 } |
| 875 break; | 875 break; |
| 876 } | 876 } |
| 877 case CSSPropertyBorderImageRepeat: | 877 case CSSPropertyBorderImageRepeat: |
| 878 case CSSPropertyWebkitMaskBoxImageRepeat: { | 878 case CSSPropertyWebkitMaskBoxImageRepeat: { |
| 879 RefPtr<CSSValue> result = nullptr; | 879 RefPtr<CSSValue> result = nullptr; |
| 880 if (parseBorderImageRepeat(result)) { | 880 if (parseBorderImageRepeat(result)) { |
| 881 addProperty(propId, result, important); | 881 addProperty(propId, result); |
| 882 return true; | 882 return true; |
| 883 } | 883 } |
| 884 break; | 884 break; |
| 885 } | 885 } |
| 886 case CSSPropertyBorderImageSlice: | 886 case CSSPropertyBorderImageSlice: |
| 887 case CSSPropertyWebkitMaskBoxImageSlice: { | 887 case CSSPropertyWebkitMaskBoxImageSlice: { |
| 888 RefPtr<CSSBorderImageSliceValue> result = nullptr; | 888 RefPtr<CSSBorderImageSliceValue> result = nullptr; |
| 889 if (parseBorderImageSlice(propId, result)) { | 889 if (parseBorderImageSlice(propId, result)) { |
| 890 addProperty(propId, result, important); | 890 addProperty(propId, result); |
| 891 return true; | 891 return true; |
| 892 } | 892 } |
| 893 break; | 893 break; |
| 894 } | 894 } |
| 895 case CSSPropertyBorderImageWidth: | 895 case CSSPropertyBorderImageWidth: |
| 896 case CSSPropertyWebkitMaskBoxImageWidth: { | 896 case CSSPropertyWebkitMaskBoxImageWidth: { |
| 897 RefPtr<CSSPrimitiveValue> result = nullptr; | 897 RefPtr<CSSPrimitiveValue> result = nullptr; |
| 898 if (parseBorderImageWidth(result)) { | 898 if (parseBorderImageWidth(result)) { |
| 899 addProperty(propId, result, important); | 899 addProperty(propId, result); |
| 900 return true; | 900 return true; |
| 901 } | 901 } |
| 902 break; | 902 break; |
| 903 } | 903 } |
| 904 case CSSPropertyBorderTopRightRadius: | 904 case CSSPropertyBorderTopRightRadius: |
| 905 case CSSPropertyBorderTopLeftRadius: | 905 case CSSPropertyBorderTopLeftRadius: |
| 906 case CSSPropertyBorderBottomLeftRadius: | 906 case CSSPropertyBorderBottomLeftRadius: |
| 907 case CSSPropertyBorderBottomRightRadius: { | 907 case CSSPropertyBorderBottomRightRadius: { |
| 908 if (num != 1 && num != 2) | 908 if (num != 1 && num != 2) |
| 909 return false; | 909 return false; |
| 910 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); | 910 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); |
| 911 if (!validPrimitive) | 911 if (!validPrimitive) |
| 912 return false; | 912 return false; |
| 913 RefPtr<CSSPrimitiveValue> parsedValue1 = createPrimitiveNumericValue(val
ue); | 913 RefPtr<CSSPrimitiveValue> parsedValue1 = createPrimitiveNumericValue(val
ue); |
| 914 RefPtr<CSSPrimitiveValue> parsedValue2 = nullptr; | 914 RefPtr<CSSPrimitiveValue> parsedValue2 = nullptr; |
| 915 if (num == 2) { | 915 if (num == 2) { |
| 916 value = m_valueList->next(); | 916 value = m_valueList->next(); |
| 917 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); | 917 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); |
| 918 if (!validPrimitive) | 918 if (!validPrimitive) |
| 919 return false; | 919 return false; |
| 920 parsedValue2 = createPrimitiveNumericValue(value); | 920 parsedValue2 = createPrimitiveNumericValue(value); |
| 921 } else | 921 } else |
| 922 parsedValue2 = parsedValue1; | 922 parsedValue2 = parsedValue1; |
| 923 | 923 |
| 924 addProperty(propId, createPrimitiveValuePair(parsedValue1.release(), par
sedValue2.release()), important); | 924 addProperty(propId, createPrimitiveValuePair(parsedValue1.release(), par
sedValue2.release())); |
| 925 return true; | 925 return true; |
| 926 } | 926 } |
| 927 case CSSPropertyTabSize: | 927 case CSSPropertyTabSize: |
| 928 validPrimitive = validUnit(value, FInteger | FNonNeg); | 928 validPrimitive = validUnit(value, FInteger | FNonNeg); |
| 929 break; | 929 break; |
| 930 case CSSPropertyWebkitAspectRatio: | 930 case CSSPropertyWebkitAspectRatio: |
| 931 parsedValue = parseAspectRatio(); | 931 parsedValue = parseAspectRatio(); |
| 932 break; | 932 break; |
| 933 case CSSPropertyBorderRadius: | 933 case CSSPropertyBorderRadius: |
| 934 case CSSPropertyWebkitBorderRadius: | 934 case CSSPropertyWebkitBorderRadius: |
| 935 return parseBorderRadius(propId, important); | 935 return parseBorderRadius(propId); |
| 936 case CSSPropertyOutlineOffset: | 936 case CSSPropertyOutlineOffset: |
| 937 validPrimitive = validUnit(value, FLength); | 937 validPrimitive = validUnit(value, FLength); |
| 938 break; | 938 break; |
| 939 case CSSPropertyTextShadow: // CSS2 property, dropped in CSS2.1, back in CSS
3, so treat as CSS3 | 939 case CSSPropertyTextShadow: // CSS2 property, dropped in CSS2.1, back in CSS
3, so treat as CSS3 |
| 940 case CSSPropertyBoxShadow: | 940 case CSSPropertyBoxShadow: |
| 941 case CSSPropertyWebkitBoxShadow: | 941 case CSSPropertyWebkitBoxShadow: |
| 942 if (id == CSSValueNone) | 942 if (id == CSSValueNone) |
| 943 validPrimitive = true; | 943 validPrimitive = true; |
| 944 else { | 944 else { |
| 945 RefPtr<CSSValueList> shadowValueList = parseShadow(m_valueList, prop
Id); | 945 RefPtr<CSSValueList> shadowValueList = parseShadow(m_valueList, prop
Id); |
| 946 if (shadowValueList) { | 946 if (shadowValueList) { |
| 947 addProperty(propId, shadowValueList.release(), important); | 947 addProperty(propId, shadowValueList.release()); |
| 948 m_valueList->next(); | 948 m_valueList->next(); |
| 949 return true; | 949 return true; |
| 950 } | 950 } |
| 951 return false; | 951 return false; |
| 952 } | 952 } |
| 953 break; | 953 break; |
| 954 case CSSPropertyOpacity: | 954 case CSSPropertyOpacity: |
| 955 validPrimitive = validUnit(value, FNumber); | 955 validPrimitive = validUnit(value, FNumber); |
| 956 break; | 956 break; |
| 957 case CSSPropertyFilter: | 957 case CSSPropertyFilter: |
| 958 if (id == CSSValueNone) | 958 if (id == CSSValueNone) |
| 959 validPrimitive = true; | 959 validPrimitive = true; |
| 960 else { | 960 else { |
| 961 RefPtr<CSSValue> val = parseFilter(); | 961 RefPtr<CSSValue> val = parseFilter(); |
| 962 if (val) { | 962 if (val) { |
| 963 addProperty(propId, val, important); | 963 addProperty(propId, val); |
| 964 return true; | 964 return true; |
| 965 } | 965 } |
| 966 return false; | 966 return false; |
| 967 } | 967 } |
| 968 break; | 968 break; |
| 969 case CSSPropertyFlex: { | 969 case CSSPropertyFlex: { |
| 970 ShorthandScope scope(this, propId); | 970 ShorthandScope scope(this, propId); |
| 971 if (id == CSSValueNone) { | 971 if (id == CSSValueNone) { |
| 972 addProperty(CSSPropertyFlexGrow, cssValuePool().createValue(0, CSSPr
imitiveValue::CSS_NUMBER), important); | 972 addProperty(CSSPropertyFlexGrow, cssValuePool().createValue(0, CSSPr
imitiveValue::CSS_NUMBER)); |
| 973 addProperty(CSSPropertyFlexShrink, cssValuePool().createValue(0, CSS
PrimitiveValue::CSS_NUMBER), important); | 973 addProperty(CSSPropertyFlexShrink, cssValuePool().createValue(0, CSS
PrimitiveValue::CSS_NUMBER)); |
| 974 addProperty(CSSPropertyFlexBasis, cssValuePool().createIdentifierVal
ue(CSSValueAuto), important); | 974 addProperty(CSSPropertyFlexBasis, cssValuePool().createIdentifierVal
ue(CSSValueAuto)); |
| 975 return true; | 975 return true; |
| 976 } | 976 } |
| 977 return parseFlex(m_valueList, important); | 977 return parseFlex(m_valueList); |
| 978 } | 978 } |
| 979 case CSSPropertyFlexBasis: | 979 case CSSPropertyFlexBasis: |
| 980 // FIXME: Support intrinsic dimensions too. | 980 // FIXME: Support intrinsic dimensions too. |
| 981 if (id == CSSValueAuto) | 981 if (id == CSSValueAuto) |
| 982 validPrimitive = true; | 982 validPrimitive = true; |
| 983 else | 983 else |
| 984 validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonN
eg)); | 984 validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonN
eg)); |
| 985 break; | 985 break; |
| 986 case CSSPropertyFlexGrow: | 986 case CSSPropertyFlexGrow: |
| 987 case CSSPropertyFlexShrink: | 987 case CSSPropertyFlexShrink: |
| 988 validPrimitive = validUnit(value, FNumber | FNonNeg); | 988 validPrimitive = validUnit(value, FNumber | FNonNeg); |
| 989 break; | 989 break; |
| 990 case CSSPropertyOrder: | 990 case CSSPropertyOrder: |
| 991 validPrimitive = validUnit(value, FInteger); | 991 validPrimitive = validUnit(value, FInteger); |
| 992 break; | 992 break; |
| 993 case CSSPropertyTransform: | 993 case CSSPropertyTransform: |
| 994 case CSSPropertyWebkitTransform: | 994 case CSSPropertyWebkitTransform: |
| 995 if (id == CSSValueNone) | 995 if (id == CSSValueNone) |
| 996 validPrimitive = true; | 996 validPrimitive = true; |
| 997 else { | 997 else { |
| 998 RefPtr<CSSValue> transformValue = parseTransform(propId); | 998 RefPtr<CSSValue> transformValue = parseTransform(propId); |
| 999 if (transformValue) { | 999 if (transformValue) { |
| 1000 addProperty(propId, transformValue.release(), important); | 1000 addProperty(propId, transformValue.release()); |
| 1001 return true; | 1001 return true; |
| 1002 } | 1002 } |
| 1003 return false; | 1003 return false; |
| 1004 } | 1004 } |
| 1005 break; | 1005 break; |
| 1006 case CSSPropertyTransformOrigin: { | 1006 case CSSPropertyTransformOrigin: { |
| 1007 RefPtr<CSSValueList> list = parseTransformOrigin(); | 1007 RefPtr<CSSValueList> list = parseTransformOrigin(); |
| 1008 if (!list) | 1008 if (!list) |
| 1009 return false; | 1009 return false; |
| 1010 // These values are added to match gecko serialization. | 1010 // These values are added to match gecko serialization. |
| 1011 if (list->length() == 1) | 1011 if (list->length() == 1) |
| 1012 list->append(cssValuePool().createValue(50, CSSPrimitiveValue::CSS_P
ERCENTAGE)); | 1012 list->append(cssValuePool().createValue(50, CSSPrimitiveValue::CSS_P
ERCENTAGE)); |
| 1013 if (list->length() == 2) | 1013 if (list->length() == 2) |
| 1014 list->append(cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX
)); | 1014 list->append(cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX
)); |
| 1015 addProperty(propId, list.release(), important); | 1015 addProperty(propId, list.release()); |
| 1016 return true; | 1016 return true; |
| 1017 } | 1017 } |
| 1018 case CSSPropertyWebkitPerspectiveOriginX: | 1018 case CSSPropertyWebkitPerspectiveOriginX: |
| 1019 case CSSPropertyWebkitTransformOriginX: | 1019 case CSSPropertyWebkitTransformOriginX: |
| 1020 parsedValue = parseFillPositionX(m_valueList); | 1020 parsedValue = parseFillPositionX(m_valueList); |
| 1021 if (parsedValue) | 1021 if (parsedValue) |
| 1022 m_valueList->next(); | 1022 m_valueList->next(); |
| 1023 break; | 1023 break; |
| 1024 case CSSPropertyWebkitPerspectiveOriginY: | 1024 case CSSPropertyWebkitPerspectiveOriginY: |
| 1025 case CSSPropertyWebkitTransformOriginY: | 1025 case CSSPropertyWebkitTransformOriginY: |
| 1026 parsedValue = parseFillPositionY(m_valueList); | 1026 parsedValue = parseFillPositionY(m_valueList); |
| 1027 if (parsedValue) | 1027 if (parsedValue) |
| 1028 m_valueList->next(); | 1028 m_valueList->next(); |
| 1029 break; | 1029 break; |
| 1030 case CSSPropertyWebkitTransformOriginZ: | 1030 case CSSPropertyWebkitTransformOriginZ: |
| 1031 validPrimitive = validUnit(value, FLength); | 1031 validPrimitive = validUnit(value, FLength); |
| 1032 break; | 1032 break; |
| 1033 case CSSPropertyWebkitTransformOrigin: | 1033 case CSSPropertyWebkitTransformOrigin: |
| 1034 return parseWebkitTransformOriginShorthand(important); | 1034 return parseWebkitTransformOriginShorthand(); |
| 1035 case CSSPropertyPerspective: | 1035 case CSSPropertyPerspective: |
| 1036 if (id == CSSValueNone) { | 1036 if (id == CSSValueNone) { |
| 1037 validPrimitive = true; | 1037 validPrimitive = true; |
| 1038 } else if (validUnit(value, FLength | FNonNeg)) { | 1038 } else if (validUnit(value, FLength | FNonNeg)) { |
| 1039 addProperty(propId, createPrimitiveNumericValue(value), important); | 1039 addProperty(propId, createPrimitiveNumericValue(value)); |
| 1040 return true; | 1040 return true; |
| 1041 } | 1041 } |
| 1042 break; | 1042 break; |
| 1043 case CSSPropertyWebkitPerspective: | 1043 case CSSPropertyWebkitPerspective: |
| 1044 if (id == CSSValueNone) { | 1044 if (id == CSSValueNone) { |
| 1045 validPrimitive = true; | 1045 validPrimitive = true; |
| 1046 } else if (validUnit(value, FNumber | FLength | FNonNeg)) { | 1046 } else if (validUnit(value, FNumber | FLength | FNonNeg)) { |
| 1047 // Accepting valueless numbers is a quirk of the -webkit prefixed ve
rsion of the property. | 1047 // Accepting valueless numbers is a quirk of the -webkit prefixed ve
rsion of the property. |
| 1048 addProperty(propId, createPrimitiveNumericValue(value), important); | 1048 addProperty(propId, createPrimitiveNumericValue(value)); |
| 1049 return true; | 1049 return true; |
| 1050 } | 1050 } |
| 1051 break; | 1051 break; |
| 1052 case CSSPropertyPerspectiveOrigin: { | 1052 case CSSPropertyPerspectiveOrigin: { |
| 1053 RefPtr<CSSValueList> list = parseTransformOrigin(); | 1053 RefPtr<CSSValueList> list = parseTransformOrigin(); |
| 1054 if (!list || list->length() == 3) | 1054 if (!list || list->length() == 3) |
| 1055 return false; | 1055 return false; |
| 1056 // This values are added to match gecko serialization. | 1056 // This values are added to match gecko serialization. |
| 1057 if (list->length() == 1) | 1057 if (list->length() == 1) |
| 1058 list->append(cssValuePool().createValue(50, CSSPrimitiveValue::CSS_P
ERCENTAGE)); | 1058 list->append(cssValuePool().createValue(50, CSSPrimitiveValue::CSS_P
ERCENTAGE)); |
| 1059 addProperty(propId, list.release(), important); | 1059 addProperty(propId, list.release()); |
| 1060 return true; | 1060 return true; |
| 1061 } | 1061 } |
| 1062 case CSSPropertyWebkitPerspectiveOrigin: { | 1062 case CSSPropertyWebkitPerspectiveOrigin: { |
| 1063 if (m_valueList->size() > 2) | 1063 if (m_valueList->size() > 2) |
| 1064 return false; | 1064 return false; |
| 1065 RefPtr<CSSValue> originX = nullptr; | 1065 RefPtr<CSSValue> originX = nullptr; |
| 1066 RefPtr<CSSValue> originY = nullptr; | 1066 RefPtr<CSSValue> originY = nullptr; |
| 1067 parse2ValuesFillPosition(m_valueList, originX, originY); | 1067 parse2ValuesFillPosition(m_valueList, originX, originY); |
| 1068 if (!originX) | 1068 if (!originX) |
| 1069 return false; | 1069 return false; |
| 1070 addProperty(CSSPropertyWebkitPerspectiveOriginX, originX.release(), impo
rtant); | 1070 addProperty(CSSPropertyWebkitPerspectiveOriginX, originX.release()); |
| 1071 addProperty(CSSPropertyWebkitPerspectiveOriginY, originY.release(), impo
rtant); | 1071 addProperty(CSSPropertyWebkitPerspectiveOriginY, originY.release()); |
| 1072 return true; | 1072 return true; |
| 1073 } | 1073 } |
| 1074 case CSSPropertyAnimationDelay: | 1074 case CSSPropertyAnimationDelay: |
| 1075 case CSSPropertyAnimationDirection: | 1075 case CSSPropertyAnimationDirection: |
| 1076 case CSSPropertyAnimationDuration: | 1076 case CSSPropertyAnimationDuration: |
| 1077 case CSSPropertyAnimationFillMode: | 1077 case CSSPropertyAnimationFillMode: |
| 1078 case CSSPropertyAnimationName: | 1078 case CSSPropertyAnimationName: |
| 1079 case CSSPropertyAnimationPlayState: | 1079 case CSSPropertyAnimationPlayState: |
| 1080 case CSSPropertyAnimationIterationCount: | 1080 case CSSPropertyAnimationIterationCount: |
| 1081 case CSSPropertyAnimationTimingFunction: | 1081 case CSSPropertyAnimationTimingFunction: |
| 1082 case CSSPropertyTransitionDelay: | 1082 case CSSPropertyTransitionDelay: |
| 1083 case CSSPropertyTransitionDuration: | 1083 case CSSPropertyTransitionDuration: |
| 1084 case CSSPropertyTransitionTimingFunction: | 1084 case CSSPropertyTransitionTimingFunction: |
| 1085 case CSSPropertyTransitionProperty: { | 1085 case CSSPropertyTransitionProperty: { |
| 1086 if (RefPtr<CSSValueList> val = parseAnimationPropertyList(propId)) { | 1086 if (RefPtr<CSSValueList> val = parseAnimationPropertyList(propId)) { |
| 1087 addProperty(propId, val.release(), important); | 1087 addProperty(propId, val.release()); |
| 1088 return true; | 1088 return true; |
| 1089 } | 1089 } |
| 1090 return false; | 1090 return false; |
| 1091 } | 1091 } |
| 1092 | 1092 |
| 1093 case CSSPropertyWillChange: | 1093 case CSSPropertyWillChange: |
| 1094 parsedValue = parseWillChange(); | 1094 parsedValue = parseWillChange(); |
| 1095 break; | 1095 break; |
| 1096 // End of CSS3 properties | 1096 // End of CSS3 properties |
| 1097 | 1097 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1124 m_valueList->next(); | 1124 m_valueList->next(); |
| 1125 break; | 1125 break; |
| 1126 | 1126 |
| 1127 /* shorthand properties */ | 1127 /* shorthand properties */ |
| 1128 case CSSPropertyBackground: { | 1128 case CSSPropertyBackground: { |
| 1129 // Position must come before color in this array because a plain old "0"
is a legal color | 1129 // Position must come before color in this array because a plain old "0"
is a legal color |
| 1130 // in quirks mode but it's usually the X coordinate of a position. | 1130 // in quirks mode but it's usually the X coordinate of a position. |
| 1131 const CSSPropertyID properties[] = { CSSPropertyBackgroundImage, CSSProp
ertyBackgroundRepeat, | 1131 const CSSPropertyID properties[] = { CSSPropertyBackgroundImage, CSSProp
ertyBackgroundRepeat, |
| 1132 CSSPropertyBackgroundAttachment, CSSPropertyB
ackgroundPosition, CSSPropertyBackgroundOrigin, | 1132 CSSPropertyBackgroundAttachment, CSSPropertyB
ackgroundPosition, CSSPropertyBackgroundOrigin, |
| 1133 CSSPropertyBackgroundClip, CSSPropertyBackgro
undColor, CSSPropertyBackgroundSize }; | 1133 CSSPropertyBackgroundClip, CSSPropertyBackgro
undColor, CSSPropertyBackgroundSize }; |
| 1134 return parseFillShorthand(propId, properties, WTF_ARRAY_LENGTH(propertie
s), important); | 1134 return parseFillShorthand(propId, properties, WTF_ARRAY_LENGTH(propertie
s)); |
| 1135 } | 1135 } |
| 1136 case CSSPropertyWebkitMask: { | 1136 case CSSPropertyWebkitMask: { |
| 1137 const CSSPropertyID properties[] = { CSSPropertyWebkitMaskImage, CSSProp
ertyWebkitMaskRepeat, | 1137 const CSSPropertyID properties[] = { CSSPropertyWebkitMaskImage, CSSProp
ertyWebkitMaskRepeat, |
| 1138 CSSPropertyWebkitMaskPosition, CSSPropertyWebkitMaskOrigin, CSSPrope
rtyWebkitMaskClip, CSSPropertyWebkitMaskSize }; | 1138 CSSPropertyWebkitMaskPosition, CSSPropertyWebkitMaskOrigin, CSSPrope
rtyWebkitMaskClip, CSSPropertyWebkitMaskSize }; |
| 1139 return parseFillShorthand(propId, properties, WTF_ARRAY_LENGTH(propertie
s), important); | 1139 return parseFillShorthand(propId, properties, WTF_ARRAY_LENGTH(propertie
s)); |
| 1140 } | 1140 } |
| 1141 case CSSPropertyBorder: | 1141 case CSSPropertyBorder: |
| 1142 // [ 'border-width' || 'border-style' || <color> ] | inherit | 1142 // [ 'border-width' || 'border-style' || <color> ] | inherit |
| 1143 { | 1143 { |
| 1144 if (parseShorthand(propId, parsingShorthandForProperty(CSSPropertyBorder
), important)) { | 1144 if (parseShorthand(propId, parsingShorthandForProperty(CSSPropertyBorder
))) { |
| 1145 // The CSS3 Borders and Backgrounds specification says that border a
lso resets border-image. It's as | 1145 // The CSS3 Borders and Backgrounds specification says that border a
lso resets border-image. It's as |
| 1146 // though a value of none was specified for the image. | 1146 // though a value of none was specified for the image. |
| 1147 addExpandedPropertyForValue(CSSPropertyBorderImage, cssValuePool().c
reateImplicitInitialValue(), important); | 1147 addExpandedPropertyForValue(CSSPropertyBorderImage, cssValuePool().c
reateImplicitInitialValue()); |
| 1148 return true; | 1148 return true; |
| 1149 } | 1149 } |
| 1150 return false; | 1150 return false; |
| 1151 } | 1151 } |
| 1152 case CSSPropertyBorderTop: | 1152 case CSSPropertyBorderTop: |
| 1153 // [ 'border-top-width' || 'border-style' || <color> ] | inherit | 1153 // [ 'border-top-width' || 'border-style' || <color> ] | inherit |
| 1154 return parseShorthand(propId, borderTopShorthand(), important); | 1154 return parseShorthand(propId, borderTopShorthand()); |
| 1155 case CSSPropertyBorderRight: | 1155 case CSSPropertyBorderRight: |
| 1156 // [ 'border-right-width' || 'border-style' || <color> ] | inherit | 1156 // [ 'border-right-width' || 'border-style' || <color> ] | inherit |
| 1157 return parseShorthand(propId, borderRightShorthand(), important); | 1157 return parseShorthand(propId, borderRightShorthand()); |
| 1158 case CSSPropertyBorderBottom: | 1158 case CSSPropertyBorderBottom: |
| 1159 // [ 'border-bottom-width' || 'border-style' || <color> ] | inherit | 1159 // [ 'border-bottom-width' || 'border-style' || <color> ] | inherit |
| 1160 return parseShorthand(propId, borderBottomShorthand(), important); | 1160 return parseShorthand(propId, borderBottomShorthand()); |
| 1161 case CSSPropertyBorderLeft: | 1161 case CSSPropertyBorderLeft: |
| 1162 // [ 'border-left-width' || 'border-style' || <color> ] | inherit | 1162 // [ 'border-left-width' || 'border-style' || <color> ] | inherit |
| 1163 return parseShorthand(propId, borderLeftShorthand(), important); | 1163 return parseShorthand(propId, borderLeftShorthand()); |
| 1164 case CSSPropertyWebkitBorderStart: | 1164 case CSSPropertyWebkitBorderStart: |
| 1165 return parseShorthand(propId, webkitBorderStartShorthand(), important); | 1165 return parseShorthand(propId, webkitBorderStartShorthand()); |
| 1166 case CSSPropertyWebkitBorderEnd: | 1166 case CSSPropertyWebkitBorderEnd: |
| 1167 return parseShorthand(propId, webkitBorderEndShorthand(), important); | 1167 return parseShorthand(propId, webkitBorderEndShorthand()); |
| 1168 case CSSPropertyWebkitBorderBefore: | 1168 case CSSPropertyWebkitBorderBefore: |
| 1169 return parseShorthand(propId, webkitBorderBeforeShorthand(), important); | 1169 return parseShorthand(propId, webkitBorderBeforeShorthand()); |
| 1170 case CSSPropertyWebkitBorderAfter: | 1170 case CSSPropertyWebkitBorderAfter: |
| 1171 return parseShorthand(propId, webkitBorderAfterShorthand(), important); | 1171 return parseShorthand(propId, webkitBorderAfterShorthand()); |
| 1172 case CSSPropertyOutline: | 1172 case CSSPropertyOutline: |
| 1173 // [ 'outline-color' || 'outline-style' || 'outline-width' ] | inherit | 1173 // [ 'outline-color' || 'outline-style' || 'outline-width' ] | inherit |
| 1174 return parseShorthand(propId, outlineShorthand(), important); | 1174 return parseShorthand(propId, outlineShorthand()); |
| 1175 case CSSPropertyBorderColor: | 1175 case CSSPropertyBorderColor: |
| 1176 // <color>{1,4} | inherit | 1176 // <color>{1,4} | inherit |
| 1177 return parse4Values(propId, borderColorShorthand().properties(), importa
nt); | 1177 return parse4Values(propId, borderColorShorthand().properties()); |
| 1178 case CSSPropertyBorderWidth: | 1178 case CSSPropertyBorderWidth: |
| 1179 // <border-width>{1,4} | inherit | 1179 // <border-width>{1,4} | inherit |
| 1180 return parse4Values(propId, borderWidthShorthand().properties(), importa
nt); | 1180 return parse4Values(propId, borderWidthShorthand().properties()); |
| 1181 case CSSPropertyBorderStyle: | 1181 case CSSPropertyBorderStyle: |
| 1182 // <border-style>{1,4} | inherit | 1182 // <border-style>{1,4} | inherit |
| 1183 return parse4Values(propId, borderStyleShorthand().properties(), importa
nt); | 1183 return parse4Values(propId, borderStyleShorthand().properties()); |
| 1184 case CSSPropertyMargin: | 1184 case CSSPropertyMargin: |
| 1185 // <margin-width>{1,4} | inherit | 1185 // <margin-width>{1,4} | inherit |
| 1186 return parse4Values(propId, marginShorthand().properties(), important); | 1186 return parse4Values(propId, marginShorthand().properties()); |
| 1187 case CSSPropertyPadding: | 1187 case CSSPropertyPadding: |
| 1188 // <padding-width>{1,4} | inherit | 1188 // <padding-width>{1,4} | inherit |
| 1189 return parse4Values(propId, paddingShorthand().properties(), important); | 1189 return parse4Values(propId, paddingShorthand().properties()); |
| 1190 case CSSPropertyFlexFlow: | 1190 case CSSPropertyFlexFlow: |
| 1191 return parseShorthand(propId, flexFlowShorthand(), important); | 1191 return parseShorthand(propId, flexFlowShorthand()); |
| 1192 case CSSPropertyFont: | 1192 case CSSPropertyFont: |
| 1193 // [ [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [
/ 'line-height' ]? | 1193 // [ [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [
/ 'line-height' ]? |
| 1194 // 'font-family' ] | inherit | 1194 // 'font-family' ] | inherit |
| 1195 return parseFont(important); | 1195 return parseFont(); |
| 1196 case CSSPropertyListStyle: | 1196 case CSSPropertyListStyle: |
| 1197 return parseShorthand(propId, listStyleShorthand(), important); | 1197 return parseShorthand(propId, listStyleShorthand()); |
| 1198 case CSSPropertyWebkitTextStroke: | 1198 case CSSPropertyWebkitTextStroke: |
| 1199 return parseShorthand(propId, webkitTextStrokeShorthand(), important); | 1199 return parseShorthand(propId, webkitTextStrokeShorthand()); |
| 1200 case CSSPropertyAnimation: | 1200 case CSSPropertyAnimation: |
| 1201 return parseAnimationShorthand(propId, important); | 1201 return parseAnimationShorthand(propId); |
| 1202 case CSSPropertyTransition: | 1202 case CSSPropertyTransition: |
| 1203 return parseTransitionShorthand(propId, important); | 1203 return parseTransitionShorthand(propId); |
| 1204 case CSSPropertyInvalid: | 1204 case CSSPropertyInvalid: |
| 1205 return false; | 1205 return false; |
| 1206 case CSSPropertyPage: | 1206 case CSSPropertyPage: |
| 1207 return parsePage(propId, important); | 1207 return parsePage(propId); |
| 1208 // CSS Text Layout Module Level 3: Vertical writing support | 1208 // CSS Text Layout Module Level 3: Vertical writing support |
| 1209 case CSSPropertyWebkitTextEmphasis: | 1209 case CSSPropertyWebkitTextEmphasis: |
| 1210 return parseShorthand(propId, webkitTextEmphasisShorthand(), important); | 1210 return parseShorthand(propId, webkitTextEmphasisShorthand()); |
| 1211 | 1211 |
| 1212 case CSSPropertyWebkitTextEmphasisStyle: | 1212 case CSSPropertyWebkitTextEmphasisStyle: |
| 1213 return parseTextEmphasisStyle(important); | 1213 return parseTextEmphasisStyle(); |
| 1214 | 1214 |
| 1215 case CSSPropertyWebkitTextOrientation: | 1215 case CSSPropertyWebkitTextOrientation: |
| 1216 // FIXME: For now just support sideways, sideways-right, upright and ver
tical-right. | 1216 // FIXME: For now just support sideways, sideways-right, upright and ver
tical-right. |
| 1217 if (id == CSSValueSideways || id == CSSValueSidewaysRight || id == CSSVa
lueVerticalRight || id == CSSValueUpright) | 1217 if (id == CSSValueSideways || id == CSSValueSidewaysRight || id == CSSVa
lueVerticalRight || id == CSSValueUpright) |
| 1218 validPrimitive = true; | 1218 validPrimitive = true; |
| 1219 break; | 1219 break; |
| 1220 | 1220 |
| 1221 case CSSPropertyWebkitLineBoxContain: | 1221 case CSSPropertyWebkitLineBoxContain: |
| 1222 if (id == CSSValueNone) | 1222 if (id == CSSValueNone) |
| 1223 validPrimitive = true; | 1223 validPrimitive = true; |
| 1224 else | 1224 else |
| 1225 return parseLineBoxContain(important); | 1225 return parseLineBoxContain(); |
| 1226 break; | 1226 break; |
| 1227 case CSSPropertyWebkitFontFeatureSettings: | 1227 case CSSPropertyWebkitFontFeatureSettings: |
| 1228 if (id == CSSValueNormal) | 1228 if (id == CSSValueNormal) |
| 1229 validPrimitive = true; | 1229 validPrimitive = true; |
| 1230 else | 1230 else |
| 1231 return parseFontFeatureSettings(important); | 1231 return parseFontFeatureSettings(); |
| 1232 break; | 1232 break; |
| 1233 | 1233 |
| 1234 case CSSPropertyFontVariantLigatures: | 1234 case CSSPropertyFontVariantLigatures: |
| 1235 if (id == CSSValueNormal) | 1235 if (id == CSSValueNormal) |
| 1236 validPrimitive = true; | 1236 validPrimitive = true; |
| 1237 else | 1237 else |
| 1238 return parseFontVariantLigatures(important); | 1238 return parseFontVariantLigatures(); |
| 1239 break; | 1239 break; |
| 1240 case CSSPropertyWebkitClipPath: | 1240 case CSSPropertyWebkitClipPath: |
| 1241 if (id == CSSValueNone) { | 1241 if (id == CSSValueNone) { |
| 1242 validPrimitive = true; | 1242 validPrimitive = true; |
| 1243 } else if (value->unit == CSSParserValue::Function) { | 1243 } else if (value->unit == CSSParserValue::Function) { |
| 1244 parsedValue = parseBasicShape(); | 1244 parsedValue = parseBasicShape(); |
| 1245 } else if (value->unit == CSSPrimitiveValue::CSS_URI) { | 1245 } else if (value->unit == CSSPrimitiveValue::CSS_URI) { |
| 1246 parsedValue = CSSPrimitiveValue::create(value->string, CSSPrimitiveV
alue::CSS_URI); | 1246 parsedValue = CSSPrimitiveValue::create(value->string, CSSPrimitiveV
alue::CSS_URI); |
| 1247 addProperty(propId, parsedValue.release(), important); | 1247 addProperty(propId, parsedValue.release()); |
| 1248 return true; | 1248 return true; |
| 1249 } | 1249 } |
| 1250 break; | 1250 break; |
| 1251 case CSSPropertyTouchAction: | 1251 case CSSPropertyTouchAction: |
| 1252 parsedValue = parseTouchAction(); | 1252 parsedValue = parseTouchAction(); |
| 1253 break; | 1253 break; |
| 1254 | 1254 |
| 1255 // Properties below are validated inside parseViewportProperty, because we | 1255 // Properties below are validated inside parseViewportProperty, because we |
| 1256 // check for parser state. We need to invalidate if someone adds them outsid
e | 1256 // check for parser state. We need to invalidate if someone adds them outsid
e |
| 1257 // a @viewport rule. | 1257 // a @viewport rule. |
| 1258 case CSSPropertyOrientation: | 1258 case CSSPropertyOrientation: |
| 1259 validPrimitive = false; | 1259 validPrimitive = false; |
| 1260 break; | 1260 break; |
| 1261 | 1261 |
| 1262 default: | 1262 default: |
| 1263 return false; | 1263 return false; |
| 1264 } | 1264 } |
| 1265 | 1265 |
| 1266 if (validPrimitive) { | 1266 if (validPrimitive) { |
| 1267 parsedValue = parseValidPrimitive(id, value); | 1267 parsedValue = parseValidPrimitive(id, value); |
| 1268 m_valueList->next(); | 1268 m_valueList->next(); |
| 1269 } | 1269 } |
| 1270 ASSERT(!m_parsedCalculation); | 1270 ASSERT(!m_parsedCalculation); |
| 1271 if (parsedValue) { | 1271 if (parsedValue) { |
| 1272 if (!m_valueList->current() || inShorthand()) { | 1272 if (!m_valueList->current() || inShorthand()) { |
| 1273 addProperty(propId, parsedValue.release(), important); | 1273 addProperty(propId, parsedValue.release()); |
| 1274 return true; | 1274 return true; |
| 1275 } | 1275 } |
| 1276 } | 1276 } |
| 1277 return false; | 1277 return false; |
| 1278 } | 1278 } |
| 1279 | 1279 |
| 1280 void CSSPropertyParser::addFillValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue
> rval) | 1280 void CSSPropertyParser::addFillValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue
> rval) |
| 1281 { | 1281 { |
| 1282 if (lval) { | 1282 if (lval) { |
| 1283 if (lval->isBaseValueList()) | 1283 if (lval->isBaseValueList()) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1299 if (parserValue->id == CSSValueBorderBox || parserValue->id == CSSValuePaddi
ngBox | 1299 if (parserValue->id == CSSValueBorderBox || parserValue->id == CSSValuePaddi
ngBox |
| 1300 || parserValue->id == CSSValueContentBox) { | 1300 || parserValue->id == CSSValueContentBox) { |
| 1301 cssValue = cssValuePool().createIdentifierValue(parserValue->id); | 1301 cssValue = cssValuePool().createIdentifierValue(parserValue->id); |
| 1302 return true; | 1302 return true; |
| 1303 } | 1303 } |
| 1304 return false; | 1304 return false; |
| 1305 } | 1305 } |
| 1306 | 1306 |
| 1307 const int cMaxFillProperties = 9; | 1307 const int cMaxFillProperties = 9; |
| 1308 | 1308 |
| 1309 bool CSSPropertyParser::parseFillShorthand(CSSPropertyID propId, const CSSProper
tyID* properties, int numProperties, bool important) | 1309 bool CSSPropertyParser::parseFillShorthand(CSSPropertyID propId, const CSSProper
tyID* properties, int numProperties) |
| 1310 { | 1310 { |
| 1311 ASSERT(numProperties <= cMaxFillProperties); | 1311 ASSERT(numProperties <= cMaxFillProperties); |
| 1312 if (numProperties > cMaxFillProperties) | 1312 if (numProperties > cMaxFillProperties) |
| 1313 return false; | 1313 return false; |
| 1314 | 1314 |
| 1315 ShorthandScope scope(this, propId); | 1315 ShorthandScope scope(this, propId); |
| 1316 | 1316 |
| 1317 bool parsedProperty[cMaxFillProperties] = { false }; | 1317 bool parsedProperty[cMaxFillProperties] = { false }; |
| 1318 RefPtr<CSSValue> values[cMaxFillProperties]; | 1318 RefPtr<CSSValue> values[cMaxFillProperties]; |
| 1319 #if ENABLE(OILPAN) | 1319 #if ENABLE(OILPAN) |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 if (properties[i] == CSSPropertyBackgroundPosition || properties[i]
== CSSPropertyWebkitMaskPosition) | 1418 if (properties[i] == CSSPropertyBackgroundPosition || properties[i]
== CSSPropertyWebkitMaskPosition) |
| 1419 addFillValue(positionYValue, cssValuePool().createImplicitInitia
lValue()); | 1419 addFillValue(positionYValue, cssValuePool().createImplicitInitia
lValue()); |
| 1420 if (properties[i] == CSSPropertyBackgroundRepeat || properties[i] ==
CSSPropertyWebkitMaskRepeat) | 1420 if (properties[i] == CSSPropertyBackgroundRepeat || properties[i] ==
CSSPropertyWebkitMaskRepeat) |
| 1421 addFillValue(repeatYValue, cssValuePool().createImplicitInitialV
alue()); | 1421 addFillValue(repeatYValue, cssValuePool().createImplicitInitialV
alue()); |
| 1422 if (properties[i] == CSSPropertyBackgroundOrigin || properties[i] ==
CSSPropertyWebkitMaskOrigin) { | 1422 if (properties[i] == CSSPropertyBackgroundOrigin || properties[i] ==
CSSPropertyWebkitMaskOrigin) { |
| 1423 // If background-origin wasn't present, then reset background-cl
ip also. | 1423 // If background-origin wasn't present, then reset background-cl
ip also. |
| 1424 addFillValue(clipValue, cssValuePool().createImplicitInitialValu
e()); | 1424 addFillValue(clipValue, cssValuePool().createImplicitInitialValu
e()); |
| 1425 } | 1425 } |
| 1426 } | 1426 } |
| 1427 if (properties[i] == CSSPropertyBackgroundPosition) { | 1427 if (properties[i] == CSSPropertyBackgroundPosition) { |
| 1428 addProperty(CSSPropertyBackgroundPositionX, values[i].release(), imp
ortant); | 1428 addProperty(CSSPropertyBackgroundPositionX, values[i].release()); |
| 1429 // it's OK to call positionYValue.release() since we only see CSSPro
pertyBackgroundPosition once | 1429 // it's OK to call positionYValue.release() since we only see CSSPro
pertyBackgroundPosition once |
| 1430 addProperty(CSSPropertyBackgroundPositionY, positionYValue.release()
, important); | 1430 addProperty(CSSPropertyBackgroundPositionY, positionYValue.release()
); |
| 1431 } else if (properties[i] == CSSPropertyWebkitMaskPosition) { | 1431 } else if (properties[i] == CSSPropertyWebkitMaskPosition) { |
| 1432 addProperty(CSSPropertyWebkitMaskPositionX, values[i].release(), imp
ortant); | 1432 addProperty(CSSPropertyWebkitMaskPositionX, values[i].release()); |
| 1433 // it's OK to call positionYValue.release() since we only see CSSPro
pertyWebkitMaskPosition once | 1433 // it's OK to call positionYValue.release() since we only see CSSPro
pertyWebkitMaskPosition once |
| 1434 addProperty(CSSPropertyWebkitMaskPositionY, positionYValue.release()
, important); | 1434 addProperty(CSSPropertyWebkitMaskPositionY, positionYValue.release()
); |
| 1435 } else if (properties[i] == CSSPropertyBackgroundRepeat) { | 1435 } else if (properties[i] == CSSPropertyBackgroundRepeat) { |
| 1436 addProperty(CSSPropertyBackgroundRepeatX, values[i].release(), impor
tant); | 1436 addProperty(CSSPropertyBackgroundRepeatX, values[i].release()); |
| 1437 // it's OK to call repeatYValue.release() since we only see CSSPrope
rtyBackgroundPosition once | 1437 // it's OK to call repeatYValue.release() since we only see CSSPrope
rtyBackgroundPosition once |
| 1438 addProperty(CSSPropertyBackgroundRepeatY, repeatYValue.release(), im
portant); | 1438 addProperty(CSSPropertyBackgroundRepeatY, repeatYValue.release()); |
| 1439 } else if (properties[i] == CSSPropertyWebkitMaskRepeat) { | 1439 } else if (properties[i] == CSSPropertyWebkitMaskRepeat) { |
| 1440 addProperty(CSSPropertyWebkitMaskRepeatX, values[i].release(), impor
tant); | 1440 addProperty(CSSPropertyWebkitMaskRepeatX, values[i].release()); |
| 1441 // it's OK to call repeatYValue.release() since we only see CSSPrope
rtyBackgroundPosition once | 1441 // it's OK to call repeatYValue.release() since we only see CSSPrope
rtyBackgroundPosition once |
| 1442 addProperty(CSSPropertyWebkitMaskRepeatY, repeatYValue.release(), im
portant); | 1442 addProperty(CSSPropertyWebkitMaskRepeatY, repeatYValue.release()); |
| 1443 } else if ((properties[i] == CSSPropertyBackgroundClip || properties[i]
== CSSPropertyWebkitMaskClip) && !foundClip) | 1443 } else if ((properties[i] == CSSPropertyBackgroundClip || properties[i]
== CSSPropertyWebkitMaskClip) && !foundClip) |
| 1444 // Value is already set while updating origin | 1444 // Value is already set while updating origin |
| 1445 continue; | 1445 continue; |
| 1446 else | 1446 else |
| 1447 addProperty(properties[i], values[i].release(), important); | 1447 addProperty(properties[i], values[i].release()); |
| 1448 | 1448 |
| 1449 // Add in clip values when we hit the corresponding origin property. | 1449 // Add in clip values when we hit the corresponding origin property. |
| 1450 if (properties[i] == CSSPropertyBackgroundOrigin && !foundClip) | 1450 if (properties[i] == CSSPropertyBackgroundOrigin && !foundClip) |
| 1451 addProperty(CSSPropertyBackgroundClip, clipValue.release(), importan
t); | 1451 addProperty(CSSPropertyBackgroundClip, clipValue.release()); |
| 1452 else if (properties[i] == CSSPropertyWebkitMaskOrigin && !foundClip) | 1452 else if (properties[i] == CSSPropertyWebkitMaskOrigin && !foundClip) |
| 1453 addProperty(CSSPropertyWebkitMaskClip, clipValue.release(), importan
t); | 1453 addProperty(CSSPropertyWebkitMaskClip, clipValue.release()); |
| 1454 } | 1454 } |
| 1455 | 1455 |
| 1456 m_implicitShorthand = false; | 1456 m_implicitShorthand = false; |
| 1457 return true; | 1457 return true; |
| 1458 } | 1458 } |
| 1459 | 1459 |
| 1460 static bool isValidTransitionPropertyList(CSSValueList* value) | 1460 static bool isValidTransitionPropertyList(CSSValueList* value) |
| 1461 { | 1461 { |
| 1462 if (value->length() < 2) | 1462 if (value->length() < 2) |
| 1463 return true; | 1463 return true; |
| 1464 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { | 1464 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { |
| 1465 // FIXME: Shorthand parsing shouldn't add initial to the list since it w
on't round-trip | 1465 // FIXME: Shorthand parsing shouldn't add initial to the list since it w
on't round-trip |
| 1466 if (i.value()->isInitialValue()) | 1466 if (i.value()->isInitialValue()) |
| 1467 continue; | 1467 continue; |
| 1468 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(i.value()); | 1468 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(i.value()); |
| 1469 if (primitiveValue->isValueID() && primitiveValue->getValueID() == CSSVa
lueNone) | 1469 if (primitiveValue->isValueID() && primitiveValue->getValueID() == CSSVa
lueNone) |
| 1470 return false; | 1470 return false; |
| 1471 } | 1471 } |
| 1472 return true; | 1472 return true; |
| 1473 } | 1473 } |
| 1474 | 1474 |
| 1475 bool CSSPropertyParser::parseAnimationShorthand(CSSPropertyID propId, bool impor
tant) | 1475 bool CSSPropertyParser::parseAnimationShorthand(CSSPropertyID propId) |
| 1476 { | 1476 { |
| 1477 const StylePropertyShorthand& animationProperties = parsingShorthandForPrope
rty(propId); | 1477 const StylePropertyShorthand& animationProperties = parsingShorthandForPrope
rty(propId); |
| 1478 const unsigned numProperties = 8; | 1478 const unsigned numProperties = 8; |
| 1479 | 1479 |
| 1480 // The list of properties in the shorthand should be the same | 1480 // The list of properties in the shorthand should be the same |
| 1481 // length as the list with animation name in last position, even though they
are | 1481 // length as the list with animation name in last position, even though they
are |
| 1482 // in a different order. | 1482 // in a different order. |
| 1483 ASSERT(numProperties == animationProperties.length()); | 1483 ASSERT(numProperties == animationProperties.length()); |
| 1484 ASSERT(numProperties == shorthandForProperty(propId).length()); | 1484 ASSERT(numProperties == shorthandForProperty(propId).length()); |
| 1485 | 1485 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1517 // invalid shorthand and we have to ignore it | 1517 // invalid shorthand and we have to ignore it |
| 1518 if (!found) | 1518 if (!found) |
| 1519 return false; | 1519 return false; |
| 1520 } | 1520 } |
| 1521 | 1521 |
| 1522 for (size_t i = 0; i < numProperties; ++i) { | 1522 for (size_t i = 0; i < numProperties; ++i) { |
| 1523 // If we didn't find the property, set an intial value. | 1523 // If we didn't find the property, set an intial value. |
| 1524 if (!parsedProperty[i]) | 1524 if (!parsedProperty[i]) |
| 1525 values[i]->append(cssValuePool().createImplicitInitialValue()); | 1525 values[i]->append(cssValuePool().createImplicitInitialValue()); |
| 1526 | 1526 |
| 1527 addProperty(animationProperties.properties()[i], values[i].release(), im
portant); | 1527 addProperty(animationProperties.properties()[i], values[i].release()); |
| 1528 } | 1528 } |
| 1529 | 1529 |
| 1530 return true; | 1530 return true; |
| 1531 } | 1531 } |
| 1532 | 1532 |
| 1533 bool CSSPropertyParser::parseTransitionShorthand(CSSPropertyID propId, bool impo
rtant) | 1533 bool CSSPropertyParser::parseTransitionShorthand(CSSPropertyID propId) |
| 1534 { | 1534 { |
| 1535 const unsigned numProperties = 4; | 1535 const unsigned numProperties = 4; |
| 1536 const StylePropertyShorthand& shorthand = parsingShorthandForProperty(propId
); | 1536 const StylePropertyShorthand& shorthand = parsingShorthandForProperty(propId
); |
| 1537 ASSERT(numProperties == shorthand.length()); | 1537 ASSERT(numProperties == shorthand.length()); |
| 1538 | 1538 |
| 1539 ShorthandScope scope(this, propId); | 1539 ShorthandScope scope(this, propId); |
| 1540 | 1540 |
| 1541 bool parsedProperty[numProperties] = { false }; | 1541 bool parsedProperty[numProperties] = { false }; |
| 1542 RefPtr<CSSValueList> values[numProperties]; | 1542 RefPtr<CSSValueList> values[numProperties]; |
| 1543 for (size_t i = 0; i < numProperties; ++i) | 1543 for (size_t i = 0; i < numProperties; ++i) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1573 } | 1573 } |
| 1574 | 1574 |
| 1575 ASSERT(shorthand.properties()[3] == CSSPropertyTransitionProperty); | 1575 ASSERT(shorthand.properties()[3] == CSSPropertyTransitionProperty); |
| 1576 if (!isValidTransitionPropertyList(values[3].get())) | 1576 if (!isValidTransitionPropertyList(values[3].get())) |
| 1577 return false; | 1577 return false; |
| 1578 | 1578 |
| 1579 // Fill in any remaining properties with the initial value and add | 1579 // Fill in any remaining properties with the initial value and add |
| 1580 for (size_t i = 0; i < numProperties; ++i) { | 1580 for (size_t i = 0; i < numProperties; ++i) { |
| 1581 if (!parsedProperty[i]) | 1581 if (!parsedProperty[i]) |
| 1582 values[i]->append(cssValuePool().createImplicitInitialValue()); | 1582 values[i]->append(cssValuePool().createImplicitInitialValue()); |
| 1583 addProperty(shorthand.properties()[i], values[i].release(), important); | 1583 addProperty(shorthand.properties()[i], values[i].release()); |
| 1584 } | 1584 } |
| 1585 | 1585 |
| 1586 return true; | 1586 return true; |
| 1587 } | 1587 } |
| 1588 | 1588 |
| 1589 bool CSSPropertyParser::parseShorthand(CSSPropertyID propId, const StyleProperty
Shorthand& shorthand, bool important) | 1589 bool CSSPropertyParser::parseShorthand(CSSPropertyID propId, const StyleProperty
Shorthand& shorthand) |
| 1590 { | 1590 { |
| 1591 // We try to match as many properties as possible | 1591 // We try to match as many properties as possible |
| 1592 // We set up an array of booleans to mark which property has been found, | 1592 // We set up an array of booleans to mark which property has been found, |
| 1593 // and we try to search for properties until it makes no longer any sense. | 1593 // and we try to search for properties until it makes no longer any sense. |
| 1594 ShorthandScope scope(this, propId); | 1594 ShorthandScope scope(this, propId); |
| 1595 | 1595 |
| 1596 bool found = false; | 1596 bool found = false; |
| 1597 unsigned propertiesParsed = 0; | 1597 unsigned propertiesParsed = 0; |
| 1598 bool propertyFound[6] = { false, false, false, false, false, false }; // 6 i
s enough size. | 1598 bool propertyFound[6] = { false, false, false, false, false, false }; // 6 i
s enough size. |
| 1599 | 1599 |
| 1600 while (m_valueList->current()) { | 1600 while (m_valueList->current()) { |
| 1601 found = false; | 1601 found = false; |
| 1602 for (unsigned propIndex = 0; !found && propIndex < shorthand.length(); +
+propIndex) { | 1602 for (unsigned propIndex = 0; !found && propIndex < shorthand.length(); +
+propIndex) { |
| 1603 if (!propertyFound[propIndex] && parseValue(shorthand.properties()[p
ropIndex], important)) { | 1603 if (!propertyFound[propIndex] && parseValue(shorthand.properties()[p
ropIndex])) { |
| 1604 propertyFound[propIndex] = found = true; | 1604 propertyFound[propIndex] = found = true; |
| 1605 propertiesParsed++; | 1605 propertiesParsed++; |
| 1606 } | 1606 } |
| 1607 } | 1607 } |
| 1608 | 1608 |
| 1609 // if we didn't find at least one match, this is an | 1609 // if we didn't find at least one match, this is an |
| 1610 // invalid shorthand and we have to ignore it | 1610 // invalid shorthand and we have to ignore it |
| 1611 if (!found) | 1611 if (!found) |
| 1612 return false; | 1612 return false; |
| 1613 } | 1613 } |
| 1614 | 1614 |
| 1615 if (propertiesParsed == shorthand.length()) | 1615 if (propertiesParsed == shorthand.length()) |
| 1616 return true; | 1616 return true; |
| 1617 | 1617 |
| 1618 // Fill in any remaining properties with the initial value. | 1618 // Fill in any remaining properties with the initial value. |
| 1619 ImplicitScope implicitScope(this); | 1619 ImplicitScope implicitScope(this); |
| 1620 const StylePropertyShorthand* const* const propertiesForInitialization = sho
rthand.propertiesForInitialization(); | 1620 const StylePropertyShorthand* const* const propertiesForInitialization = sho
rthand.propertiesForInitialization(); |
| 1621 for (unsigned i = 0; i < shorthand.length(); ++i) { | 1621 for (unsigned i = 0; i < shorthand.length(); ++i) { |
| 1622 if (propertyFound[i]) | 1622 if (propertyFound[i]) |
| 1623 continue; | 1623 continue; |
| 1624 | 1624 |
| 1625 if (propertiesForInitialization) { | 1625 if (propertiesForInitialization) { |
| 1626 const StylePropertyShorthand& initProperties = *(propertiesForInitia
lization[i]); | 1626 const StylePropertyShorthand& initProperties = *(propertiesForInitia
lization[i]); |
| 1627 for (unsigned propIndex = 0; propIndex < initProperties.length(); ++
propIndex) | 1627 for (unsigned propIndex = 0; propIndex < initProperties.length(); ++
propIndex) |
| 1628 addProperty(initProperties.properties()[propIndex], cssValuePool
().createImplicitInitialValue(), important); | 1628 addProperty(initProperties.properties()[propIndex], cssValuePool
().createImplicitInitialValue()); |
| 1629 } else | 1629 } else |
| 1630 addProperty(shorthand.properties()[i], cssValuePool().createImplicit
InitialValue(), important); | 1630 addProperty(shorthand.properties()[i], cssValuePool().createImplicit
InitialValue()); |
| 1631 } | 1631 } |
| 1632 | 1632 |
| 1633 return true; | 1633 return true; |
| 1634 } | 1634 } |
| 1635 | 1635 |
| 1636 bool CSSPropertyParser::parse4Values(CSSPropertyID propId, const CSSPropertyID *
properties, bool important) | 1636 bool CSSPropertyParser::parse4Values(CSSPropertyID propId, const CSSPropertyID *
properties) |
| 1637 { | 1637 { |
| 1638 /* From the CSS 2 specs, 8.3 | 1638 /* From the CSS 2 specs, 8.3 |
| 1639 * If there is only one value, it applies to all sides. If there are two val
ues, the top and | 1639 * If there is only one value, it applies to all sides. If there are two val
ues, the top and |
| 1640 * bottom margins are set to the first value and the right and left margins
are set to the second. | 1640 * bottom margins are set to the first value and the right and left margins
are set to the second. |
| 1641 * If there are three values, the top is set to the first value, the left an
d right are set to the | 1641 * If there are three values, the top is set to the first value, the left an
d right are set to the |
| 1642 * second, and the bottom is set to the third. If there are four values, the
y apply to the top, | 1642 * second, and the bottom is set to the third. If there are four values, the
y apply to the top, |
| 1643 * right, bottom, and left, respectively. | 1643 * right, bottom, and left, respectively. |
| 1644 */ | 1644 */ |
| 1645 | 1645 |
| 1646 int num = inShorthand() ? 1 : m_valueList->size(); | 1646 int num = inShorthand() ? 1 : m_valueList->size(); |
| 1647 | 1647 |
| 1648 ShorthandScope scope(this, propId); | 1648 ShorthandScope scope(this, propId); |
| 1649 | 1649 |
| 1650 // the order is top, right, bottom, left | 1650 // the order is top, right, bottom, left |
| 1651 switch (num) { | 1651 switch (num) { |
| 1652 case 1: { | 1652 case 1: { |
| 1653 if (!parseValue(properties[0], important)) | 1653 if (!parseValue(properties[0])) |
| 1654 return false; | 1654 return false; |
| 1655 CSSValue* value = m_parsedProperties.last().value(); | 1655 CSSValue* value = m_parsedProperties.last().value(); |
| 1656 ImplicitScope implicitScope(this); | 1656 ImplicitScope implicitScope(this); |
| 1657 addProperty(properties[1], value, important); | 1657 addProperty(properties[1], value); |
| 1658 addProperty(properties[2], value, important); | 1658 addProperty(properties[2], value); |
| 1659 addProperty(properties[3], value, important); | 1659 addProperty(properties[3], value); |
| 1660 break; | 1660 break; |
| 1661 } | 1661 } |
| 1662 case 2: { | 1662 case 2: { |
| 1663 if (!parseValue(properties[0], important) || !parseValue(properties[
1], important)) | 1663 if (!parseValue(properties[0]) || !parseValue(properties[1])) |
| 1664 return false; | 1664 return false; |
| 1665 CSSValue* value = m_parsedProperties[m_parsedProperties.size() - 2].
value(); | 1665 CSSValue* value = m_parsedProperties[m_parsedProperties.size() - 2].
value(); |
| 1666 ImplicitScope implicitScope(this); | 1666 ImplicitScope implicitScope(this); |
| 1667 addProperty(properties[2], value, important); | 1667 addProperty(properties[2], value); |
| 1668 value = m_parsedProperties[m_parsedProperties.size() - 2].value(); | 1668 value = m_parsedProperties[m_parsedProperties.size() - 2].value(); |
| 1669 addProperty(properties[3], value, important); | 1669 addProperty(properties[3], value); |
| 1670 break; | 1670 break; |
| 1671 } | 1671 } |
| 1672 case 3: { | 1672 case 3: { |
| 1673 if (!parseValue(properties[0], important) || !parseValue(properties[
1], important) || !parseValue(properties[2], important)) | 1673 if (!parseValue(properties[0]) || !parseValue(properties[1]) || !par
seValue(properties[2])) |
| 1674 return false; | 1674 return false; |
| 1675 CSSValue* value = m_parsedProperties[m_parsedProperties.size() - 2].
value(); | 1675 CSSValue* value = m_parsedProperties[m_parsedProperties.size() - 2].
value(); |
| 1676 ImplicitScope implicitScope(this); | 1676 ImplicitScope implicitScope(this); |
| 1677 addProperty(properties[3], value, important); | 1677 addProperty(properties[3], value); |
| 1678 break; | 1678 break; |
| 1679 } | 1679 } |
| 1680 case 4: { | 1680 case 4: { |
| 1681 if (!parseValue(properties[0], important) || !parseValue(properties[
1], important) || | 1681 if (!parseValue(properties[0]) || !parseValue(properties[1]) || |
| 1682 !parseValue(properties[2], important) || !parseValue(properties[
3], important)) | 1682 !parseValue(properties[2]) || !parseValue(properties[3])) |
| 1683 return false; | 1683 return false; |
| 1684 break; | 1684 break; |
| 1685 } | 1685 } |
| 1686 default: { | 1686 default: { |
| 1687 return false; | 1687 return false; |
| 1688 } | 1688 } |
| 1689 } | 1689 } |
| 1690 | 1690 |
| 1691 return true; | 1691 return true; |
| 1692 } | 1692 } |
| 1693 | 1693 |
| 1694 // auto | <identifier> | 1694 // auto | <identifier> |
| 1695 bool CSSPropertyParser::parsePage(CSSPropertyID propId, bool important) | 1695 bool CSSPropertyParser::parsePage(CSSPropertyID propId) |
| 1696 { | 1696 { |
| 1697 ASSERT(propId == CSSPropertyPage); | 1697 ASSERT(propId == CSSPropertyPage); |
| 1698 | 1698 |
| 1699 if (m_valueList->size() != 1) | 1699 if (m_valueList->size() != 1) |
| 1700 return false; | 1700 return false; |
| 1701 | 1701 |
| 1702 CSSParserValue* value = m_valueList->current(); | 1702 CSSParserValue* value = m_valueList->current(); |
| 1703 if (!value) | 1703 if (!value) |
| 1704 return false; | 1704 return false; |
| 1705 | 1705 |
| 1706 if (value->id == CSSValueAuto) { | 1706 if (value->id == CSSValueAuto) { |
| 1707 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp
ortant); | 1707 addProperty(propId, cssValuePool().createIdentifierValue(value->id)); |
| 1708 return true; | 1708 return true; |
| 1709 } else if (value->id == 0 && value->unit == CSSPrimitiveValue::CSS_IDENT) { | 1709 } else if (value->id == 0 && value->unit == CSSPrimitiveValue::CSS_IDENT) { |
| 1710 addProperty(propId, createPrimitiveStringValue(value), important); | 1710 addProperty(propId, createPrimitiveStringValue(value)); |
| 1711 return true; | 1711 return true; |
| 1712 } | 1712 } |
| 1713 return false; | 1713 return false; |
| 1714 } | 1714 } |
| 1715 | 1715 |
| 1716 // <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ] | 1716 // <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ] |
| 1717 bool CSSPropertyParser::parseSize(CSSPropertyID propId, bool important) | 1717 bool CSSPropertyParser::parseSize(CSSPropertyID propId) |
| 1718 { | 1718 { |
| 1719 ASSERT(propId == CSSPropertySize); | 1719 ASSERT(propId == CSSPropertySize); |
| 1720 | 1720 |
| 1721 if (m_valueList->size() > 2) | 1721 if (m_valueList->size() > 2) |
| 1722 return false; | 1722 return false; |
| 1723 | 1723 |
| 1724 CSSParserValue* value = m_valueList->current(); | 1724 CSSParserValue* value = m_valueList->current(); |
| 1725 if (!value) | 1725 if (!value) |
| 1726 return false; | 1726 return false; |
| 1727 | 1727 |
| 1728 RefPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSeparated(); | 1728 RefPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSeparated(); |
| 1729 | 1729 |
| 1730 // First parameter. | 1730 // First parameter. |
| 1731 SizeParameterType paramType = parseSizeParameter(parsedValues.get(), value,
None); | 1731 SizeParameterType paramType = parseSizeParameter(parsedValues.get(), value,
None); |
| 1732 if (paramType == None) | 1732 if (paramType == None) |
| 1733 return false; | 1733 return false; |
| 1734 | 1734 |
| 1735 // Second parameter, if any. | 1735 // Second parameter, if any. |
| 1736 value = m_valueList->next(); | 1736 value = m_valueList->next(); |
| 1737 if (value) { | 1737 if (value) { |
| 1738 paramType = parseSizeParameter(parsedValues.get(), value, paramType); | 1738 paramType = parseSizeParameter(parsedValues.get(), value, paramType); |
| 1739 if (paramType == None) | 1739 if (paramType == None) |
| 1740 return false; | 1740 return false; |
| 1741 } | 1741 } |
| 1742 | 1742 |
| 1743 addProperty(propId, parsedValues.release(), important); | 1743 addProperty(propId, parsedValues.release()); |
| 1744 return true; | 1744 return true; |
| 1745 } | 1745 } |
| 1746 | 1746 |
| 1747 CSSPropertyParser::SizeParameterType CSSPropertyParser::parseSizeParameter(CSSVa
lueList* parsedValues, CSSParserValue* value, SizeParameterType prevParamType) | 1747 CSSPropertyParser::SizeParameterType CSSPropertyParser::parseSizeParameter(CSSVa
lueList* parsedValues, CSSParserValue* value, SizeParameterType prevParamType) |
| 1748 { | 1748 { |
| 1749 switch (value->id) { | 1749 switch (value->id) { |
| 1750 case CSSValueAuto: | 1750 case CSSValueAuto: |
| 1751 if (prevParamType == None) { | 1751 if (prevParamType == None) { |
| 1752 parsedValues->append(cssValuePool().createIdentifierValue(value->id)
); | 1752 parsedValues->append(cssValuePool().createIdentifierValue(value->id)
); |
| 1753 return Auto; | 1753 return Auto; |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2546 ASSERT(CSSPropertyMetadata::isEnabledProperty(property)); | 2546 ASSERT(CSSPropertyMetadata::isEnabledProperty(property)); |
| 2547 return cssValuePool().createIdentifierValue(property); | 2547 return cssValuePool().createIdentifierValue(property); |
| 2548 } | 2548 } |
| 2549 if (value->id == CSSValueNone) | 2549 if (value->id == CSSValueNone) |
| 2550 return cssValuePool().createIdentifierValue(CSSValueNone); | 2550 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 2551 if (value->id == CSSValueInitial || value->id == CSSValueInherit) | 2551 if (value->id == CSSValueInitial || value->id == CSSValueInherit) |
| 2552 return nullptr; | 2552 return nullptr; |
| 2553 return createPrimitiveStringValue(value); | 2553 return createPrimitiveStringValue(value); |
| 2554 } | 2554 } |
| 2555 | 2555 |
| 2556 bool CSSPropertyParser::parseWebkitTransformOriginShorthand(bool important) | 2556 bool CSSPropertyParser::parseWebkitTransformOriginShorthand() |
| 2557 { | 2557 { |
| 2558 RefPtr<CSSValue> originX = nullptr; | 2558 RefPtr<CSSValue> originX = nullptr; |
| 2559 RefPtr<CSSValue> originY = nullptr; | 2559 RefPtr<CSSValue> originY = nullptr; |
| 2560 RefPtr<CSSValue> originZ = nullptr; | 2560 RefPtr<CSSValue> originZ = nullptr; |
| 2561 | 2561 |
| 2562 parse2ValuesFillPosition(m_valueList, originX, originY); | 2562 parse2ValuesFillPosition(m_valueList, originX, originY); |
| 2563 | 2563 |
| 2564 if (m_valueList->current()) { | 2564 if (m_valueList->current()) { |
| 2565 if (!validUnit(m_valueList->current(), FLength)) | 2565 if (!validUnit(m_valueList->current(), FLength)) |
| 2566 return false; | 2566 return false; |
| 2567 originZ = createPrimitiveNumericValue(m_valueList->current()); | 2567 originZ = createPrimitiveNumericValue(m_valueList->current()); |
| 2568 m_valueList->next(); | 2568 m_valueList->next(); |
| 2569 } else { | 2569 } else { |
| 2570 originZ = cssValuePool().createImplicitInitialValue(); | 2570 originZ = cssValuePool().createImplicitInitialValue(); |
| 2571 } | 2571 } |
| 2572 | 2572 |
| 2573 addProperty(CSSPropertyWebkitTransformOriginX, originX.release(), important)
; | 2573 addProperty(CSSPropertyWebkitTransformOriginX, originX.release()); |
| 2574 addProperty(CSSPropertyWebkitTransformOriginY, originY.release(), important)
; | 2574 addProperty(CSSPropertyWebkitTransformOriginY, originY.release()); |
| 2575 addProperty(CSSPropertyWebkitTransformOriginZ, originZ.release(), important)
; | 2575 addProperty(CSSPropertyWebkitTransformOriginZ, originZ.release()); |
| 2576 | 2576 |
| 2577 return true; | 2577 return true; |
| 2578 } | 2578 } |
| 2579 | 2579 |
| 2580 bool CSSPropertyParser::parseCubicBezierTimingFunctionValue(CSSParserValueList*&
args, double& result) | 2580 bool CSSPropertyParser::parseCubicBezierTimingFunctionValue(CSSParserValueList*&
args, double& result) |
| 2581 { | 2581 { |
| 2582 CSSParserValue* v = args->current(); | 2582 CSSParserValue* v = args->current(); |
| 2583 if (!validUnit(v, FNumber)) | 2583 if (!validUnit(v, FNumber)) |
| 2584 return false; | 2584 return false; |
| 2585 result = v->fValue; | 2585 result = v->fValue; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2732 return nullptr; | 2732 return nullptr; |
| 2733 ASSERT(list->length()); | 2733 ASSERT(list->length()); |
| 2734 return list.release(); | 2734 return list.release(); |
| 2735 } | 2735 } |
| 2736 | 2736 |
| 2737 static inline bool isCSSWideKeyword(CSSParserValue& value) | 2737 static inline bool isCSSWideKeyword(CSSParserValue& value) |
| 2738 { | 2738 { |
| 2739 return value.id == CSSValueInitial || value.id == CSSValueInherit || value.i
d == CSSValueDefault; | 2739 return value.id == CSSValueInitial || value.id == CSSValueInherit || value.i
d == CSSValueDefault; |
| 2740 } | 2740 } |
| 2741 | 2741 |
| 2742 bool CSSPropertyParser::parseClipShape(CSSPropertyID propId, bool important) | 2742 bool CSSPropertyParser::parseClipShape(CSSPropertyID propId) |
| 2743 { | 2743 { |
| 2744 CSSParserValue* value = m_valueList->current(); | 2744 CSSParserValue* value = m_valueList->current(); |
| 2745 CSSParserValueList* args = value->function->args.get(); | 2745 CSSParserValueList* args = value->function->args.get(); |
| 2746 | 2746 |
| 2747 if (!equalIgnoringCase(value->function->name, "rect(") || !args) | 2747 if (!equalIgnoringCase(value->function->name, "rect(") || !args) |
| 2748 return false; | 2748 return false; |
| 2749 | 2749 |
| 2750 // rect(t, r, b, l) || rect(t r b l) | 2750 // rect(t, r, b, l) || rect(t r b l) |
| 2751 if (args->size() != 4 && args->size() != 7) | 2751 if (args->size() != 4 && args->size() != 7) |
| 2752 return false; | 2752 return false; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2768 else | 2768 else |
| 2769 rect->setLeft(length); | 2769 rect->setLeft(length); |
| 2770 a = args->next(); | 2770 a = args->next(); |
| 2771 if (a && args->size() == 7) { | 2771 if (a && args->size() == 7) { |
| 2772 if (!consumeComma(args)) | 2772 if (!consumeComma(args)) |
| 2773 return false; | 2773 return false; |
| 2774 a = args->current(); | 2774 a = args->current(); |
| 2775 } | 2775 } |
| 2776 i++; | 2776 i++; |
| 2777 } | 2777 } |
| 2778 addProperty(propId, cssValuePool().createValue(rect.release()), important); | 2778 addProperty(propId, cssValuePool().createValue(rect.release())); |
| 2779 m_valueList->next(); | 2779 m_valueList->next(); |
| 2780 return true; | 2780 return true; |
| 2781 } | 2781 } |
| 2782 | 2782 |
| 2783 static void completeBorderRadii(RefPtr<CSSPrimitiveValue> radii[4]) | 2783 static void completeBorderRadii(RefPtr<CSSPrimitiveValue> radii[4]) |
| 2784 { | 2784 { |
| 2785 if (radii[3]) | 2785 if (radii[3]) |
| 2786 return; | 2786 return; |
| 2787 if (!radii[2]) { | 2787 if (!radii[2]) { |
| 2788 if (!radii[1]) | 2788 if (!radii[1]) |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2917 return id == CSSValueBaseline || id == CSSValueLastBaseline; | 2917 return id == CSSValueBaseline || id == CSSValueLastBaseline; |
| 2918 } | 2918 } |
| 2919 | 2919 |
| 2920 static bool isItemPositionKeyword(CSSValueID id) | 2920 static bool isItemPositionKeyword(CSSValueID id) |
| 2921 { | 2921 { |
| 2922 return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter | 2922 return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter |
| 2923 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle
xStart | 2923 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle
xStart |
| 2924 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight; | 2924 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight; |
| 2925 } | 2925 } |
| 2926 | 2926 |
| 2927 bool CSSPropertyParser::parseItemPositionOverflowPosition(CSSPropertyID propId,
bool important) | 2927 bool CSSPropertyParser::parseItemPositionOverflowPosition(CSSPropertyID propId) |
| 2928 { | 2928 { |
| 2929 // auto | stretch | <baseline-position> | [<item-position> && <overflow-posi
tion>? ] | 2929 // auto | stretch | <baseline-position> | [<item-position> && <overflow-posi
tion>? ] |
| 2930 // <baseline-position> = baseline | last-baseline; | 2930 // <baseline-position> = baseline | last-baseline; |
| 2931 // <item-position> = center | start | end | self-start | self-end | flex-sta
rt | flex-end | left | right; | 2931 // <item-position> = center | start | end | self-start | self-end | flex-sta
rt | flex-end | left | right; |
| 2932 // <overflow-position> = true | safe | 2932 // <overflow-position> = true | safe |
| 2933 | 2933 |
| 2934 CSSParserValue* value = m_valueList->current(); | 2934 CSSParserValue* value = m_valueList->current(); |
| 2935 if (!value) | 2935 if (!value) |
| 2936 return false; | 2936 return false; |
| 2937 | 2937 |
| 2938 if (value->id == CSSValueAuto || value->id == CSSValueStretch || isBaselineP
ositionKeyword(value->id)) { | 2938 if (value->id == CSSValueAuto || value->id == CSSValueStretch || isBaselineP
ositionKeyword(value->id)) { |
| 2939 if (m_valueList->next()) | 2939 if (m_valueList->next()) |
| 2940 return false; | 2940 return false; |
| 2941 | 2941 |
| 2942 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp
ortant); | 2942 addProperty(propId, cssValuePool().createIdentifierValue(value->id)); |
| 2943 return true; | 2943 return true; |
| 2944 } | 2944 } |
| 2945 | 2945 |
| 2946 RefPtr<CSSPrimitiveValue> position = nullptr; | 2946 RefPtr<CSSPrimitiveValue> position = nullptr; |
| 2947 RefPtr<CSSPrimitiveValue> overflowAlignmentKeyword = nullptr; | 2947 RefPtr<CSSPrimitiveValue> overflowAlignmentKeyword = nullptr; |
| 2948 if (isItemPositionKeyword(value->id)) { | 2948 if (isItemPositionKeyword(value->id)) { |
| 2949 position = cssValuePool().createIdentifierValue(value->id); | 2949 position = cssValuePool().createIdentifierValue(value->id); |
| 2950 value = m_valueList->next(); | 2950 value = m_valueList->next(); |
| 2951 if (value) { | 2951 if (value) { |
| 2952 if (value->id == CSSValueTrue || value->id == CSSValueSafe) | 2952 if (value->id == CSSValueTrue || value->id == CSSValueSafe) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2963 return false; | 2963 return false; |
| 2964 } else { | 2964 } else { |
| 2965 return false; | 2965 return false; |
| 2966 } | 2966 } |
| 2967 | 2967 |
| 2968 if (m_valueList->next()) | 2968 if (m_valueList->next()) |
| 2969 return false; | 2969 return false; |
| 2970 | 2970 |
| 2971 ASSERT(position); | 2971 ASSERT(position); |
| 2972 if (overflowAlignmentKeyword) | 2972 if (overflowAlignmentKeyword) |
| 2973 addProperty(propId, createPrimitiveValuePair(position, overflowAlignment
Keyword), important); | 2973 addProperty(propId, createPrimitiveValuePair(position, overflowAlignment
Keyword)); |
| 2974 else | 2974 else |
| 2975 addProperty(propId, position.release(), important); | 2975 addProperty(propId, position.release()); |
| 2976 | 2976 |
| 2977 return true; | 2977 return true; |
| 2978 } | 2978 } |
| 2979 | 2979 |
| 2980 PassRefPtr<CSSPrimitiveValue> CSSPropertyParser::parseShapeRadius(CSSParserValue
* value) | 2980 PassRefPtr<CSSPrimitiveValue> CSSPropertyParser::parseShapeRadius(CSSParserValue
* value) |
| 2981 { | 2981 { |
| 2982 if (value->id == CSSValueClosestSide || value->id == CSSValueFarthestSide) | 2982 if (value->id == CSSValueClosestSide || value->id == CSSValueFarthestSide) |
| 2983 return cssValuePool().createIdentifierValue(value->id); | 2983 return cssValuePool().createIdentifierValue(value->id); |
| 2984 | 2984 |
| 2985 if (!validUnit(value, FLength | FPercent | FNonNeg)) | 2985 if (!validUnit(value, FLength | FPercent | FNonNeg)) |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3221 | 3221 |
| 3222 if (!shape) | 3222 if (!shape) |
| 3223 return nullptr; | 3223 return nullptr; |
| 3224 | 3224 |
| 3225 m_valueList->next(); | 3225 m_valueList->next(); |
| 3226 | 3226 |
| 3227 return cssValuePool().createValue(shape.release()); | 3227 return cssValuePool().createValue(shape.release()); |
| 3228 } | 3228 } |
| 3229 | 3229 |
| 3230 // [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [ / 'line-he
ight' ]? 'font-family' | 3230 // [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [ / 'line-he
ight' ]? 'font-family' |
| 3231 bool CSSPropertyParser::parseFont(bool important) | 3231 bool CSSPropertyParser::parseFont() |
| 3232 { | 3232 { |
| 3233 // Let's check if there is an inherit or initial somewhere in the shorthand. | 3233 // Let's check if there is an inherit or initial somewhere in the shorthand. |
| 3234 for (unsigned i = 0; i < m_valueList->size(); ++i) { | 3234 for (unsigned i = 0; i < m_valueList->size(); ++i) { |
| 3235 if (m_valueList->valueAt(i)->id == CSSValueInherit || m_valueList->value
At(i)->id == CSSValueInitial) | 3235 if (m_valueList->valueAt(i)->id == CSSValueInherit || m_valueList->value
At(i)->id == CSSValueInitial) |
| 3236 return false; | 3236 return false; |
| 3237 } | 3237 } |
| 3238 | 3238 |
| 3239 ShorthandScope scope(this, CSSPropertyFont); | 3239 ShorthandScope scope(this, CSSPropertyFont); |
| 3240 // Optional font-style, font-variant and font-weight. | 3240 // Optional font-style, font-variant and font-weight. |
| 3241 bool fontStyleParsed = false; | 3241 bool fontStyleParsed = false; |
| 3242 bool fontVariantParsed = false; | 3242 bool fontVariantParsed = false; |
| 3243 bool fontWeightParsed = false; | 3243 bool fontWeightParsed = false; |
| 3244 bool fontStretchParsed = false; | 3244 bool fontStretchParsed = false; |
| 3245 CSSParserValue* value = m_valueList->current(); | 3245 CSSParserValue* value = m_valueList->current(); |
| 3246 for (; value; value = m_valueList->next()) { | 3246 for (; value; value = m_valueList->next()) { |
| 3247 if (!fontStyleParsed && isValidKeywordPropertyAndValue(CSSPropertyFontSt
yle, value->id, m_context)) { | 3247 if (!fontStyleParsed && isValidKeywordPropertyAndValue(CSSPropertyFontSt
yle, value->id, m_context)) { |
| 3248 addProperty(CSSPropertyFontStyle, cssValuePool().createIdentifierVal
ue(value->id), important); | 3248 addProperty(CSSPropertyFontStyle, cssValuePool().createIdentifierVal
ue(value->id)); |
| 3249 fontStyleParsed = true; | 3249 fontStyleParsed = true; |
| 3250 } else if (!fontVariantParsed && (value->id == CSSValueNormal || value->
id == CSSValueSmallCaps)) { | 3250 } else if (!fontVariantParsed && (value->id == CSSValueNormal || value->
id == CSSValueSmallCaps)) { |
| 3251 // Font variant in the shorthand is particular, it only accepts norm
al or small-caps. | 3251 // Font variant in the shorthand is particular, it only accepts norm
al or small-caps. |
| 3252 addProperty(CSSPropertyFontVariant, cssValuePool().createIdentifierV
alue(value->id), important); | 3252 addProperty(CSSPropertyFontVariant, cssValuePool().createIdentifierV
alue(value->id)); |
| 3253 fontVariantParsed = true; | 3253 fontVariantParsed = true; |
| 3254 } else if (!fontWeightParsed && parseFontWeight(important)) { | 3254 } else if (!fontWeightParsed && parseFontWeight()) { |
| 3255 fontWeightParsed = true; | 3255 fontWeightParsed = true; |
| 3256 } else if (!fontStretchParsed && isValidKeywordPropertyAndValue(CSSPrope
rtyFontStretch, value->id, m_context)) { | 3256 } else if (!fontStretchParsed && isValidKeywordPropertyAndValue(CSSPrope
rtyFontStretch, value->id, m_context)) { |
| 3257 addProperty(CSSPropertyFontStretch, cssValuePool().createIdentifierV
alue(value->id), important); | 3257 addProperty(CSSPropertyFontStretch, cssValuePool().createIdentifierV
alue(value->id)); |
| 3258 fontStretchParsed = true; | 3258 fontStretchParsed = true; |
| 3259 } else { | 3259 } else { |
| 3260 break; | 3260 break; |
| 3261 } | 3261 } |
| 3262 } | 3262 } |
| 3263 | 3263 |
| 3264 if (!value) | 3264 if (!value) |
| 3265 return false; | 3265 return false; |
| 3266 | 3266 |
| 3267 if (!fontStyleParsed) | 3267 if (!fontStyleParsed) |
| 3268 addProperty(CSSPropertyFontStyle, cssValuePool().createIdentifierValue(C
SSValueNormal), important, true); | 3268 addProperty(CSSPropertyFontStyle, cssValuePool().createIdentifierValue(C
SSValueNormal), true); |
| 3269 if (!fontVariantParsed) | 3269 if (!fontVariantParsed) |
| 3270 addProperty(CSSPropertyFontVariant, cssValuePool().createIdentifierValue
(CSSValueNormal), important, true); | 3270 addProperty(CSSPropertyFontVariant, cssValuePool().createIdentifierValue
(CSSValueNormal), true); |
| 3271 if (!fontWeightParsed) | 3271 if (!fontWeightParsed) |
| 3272 addProperty(CSSPropertyFontWeight, cssValuePool().createIdentifierValue(
CSSValueNormal), important, true); | 3272 addProperty(CSSPropertyFontWeight, cssValuePool().createIdentifierValue(
CSSValueNormal), true); |
| 3273 if (!fontStretchParsed) | 3273 if (!fontStretchParsed) |
| 3274 addProperty(CSSPropertyFontStretch, cssValuePool().createIdentifierValue
(CSSValueNormal), important, true); | 3274 addProperty(CSSPropertyFontStretch, cssValuePool().createIdentifierValue
(CSSValueNormal), true); |
| 3275 | 3275 |
| 3276 // Now a font size _must_ come. | 3276 // Now a font size _must_ come. |
| 3277 // <absolute-size> | <relative-size> | <length> | <percentage> | inherit | 3277 // <absolute-size> | <relative-size> | <length> | <percentage> | inherit |
| 3278 if (!parseFontSize(important)) | 3278 if (!parseFontSize()) |
| 3279 return false; | 3279 return false; |
| 3280 | 3280 |
| 3281 value = m_valueList->current(); | 3281 value = m_valueList->current(); |
| 3282 if (!value) | 3282 if (!value) |
| 3283 return false; | 3283 return false; |
| 3284 | 3284 |
| 3285 if (isForwardSlashOperator(value)) { | 3285 if (isForwardSlashOperator(value)) { |
| 3286 // The line-height property. | 3286 // The line-height property. |
| 3287 value = m_valueList->next(); | 3287 value = m_valueList->next(); |
| 3288 if (!value) | 3288 if (!value) |
| 3289 return false; | 3289 return false; |
| 3290 if (!parseLineHeight(important)) | 3290 if (!parseLineHeight()) |
| 3291 return false; | 3291 return false; |
| 3292 } else | 3292 } else |
| 3293 addProperty(CSSPropertyLineHeight, cssValuePool().createIdentifierValue(
CSSValueNormal), important, true); | 3293 addProperty(CSSPropertyLineHeight, cssValuePool().createIdentifierValue(
CSSValueNormal), true); |
| 3294 | 3294 |
| 3295 // Font family must come now. | 3295 // Font family must come now. |
| 3296 RefPtr<CSSValue> parsedFamilyValue = parseFontFamily(); | 3296 RefPtr<CSSValue> parsedFamilyValue = parseFontFamily(); |
| 3297 if (!parsedFamilyValue) | 3297 if (!parsedFamilyValue) |
| 3298 return false; | 3298 return false; |
| 3299 | 3299 |
| 3300 addProperty(CSSPropertyFontFamily, parsedFamilyValue.release(), important); | 3300 addProperty(CSSPropertyFontFamily, parsedFamilyValue.release()); |
| 3301 | 3301 |
| 3302 // FIXME: http://www.w3.org/TR/2011/WD-css3-fonts-20110324/#font-prop requir
es that | 3302 // FIXME: http://www.w3.org/TR/2011/WD-css3-fonts-20110324/#font-prop requir
es that |
| 3303 // "font-stretch", "font-size-adjust", and "font-kerning" be reset to their
initial values | 3303 // "font-stretch", "font-size-adjust", and "font-kerning" be reset to their
initial values |
| 3304 // but we don't seem to support them at the moment. They should also be adde
d here once implemented. | 3304 // but we don't seem to support them at the moment. They should also be adde
d here once implemented. |
| 3305 if (m_valueList->current()) | 3305 if (m_valueList->current()) |
| 3306 return false; | 3306 return false; |
| 3307 | 3307 |
| 3308 return true; | 3308 return true; |
| 3309 } | 3309 } |
| 3310 | 3310 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3408 else | 3408 else |
| 3409 break; | 3409 break; |
| 3410 } | 3410 } |
| 3411 familyBuilder.commit(); | 3411 familyBuilder.commit(); |
| 3412 | 3412 |
| 3413 if (!list->length()) | 3413 if (!list->length()) |
| 3414 list = nullptr; | 3414 list = nullptr; |
| 3415 return list.release(); | 3415 return list.release(); |
| 3416 } | 3416 } |
| 3417 | 3417 |
| 3418 bool CSSPropertyParser::parseLineHeight(bool important) | 3418 bool CSSPropertyParser::parseLineHeight() |
| 3419 { | 3419 { |
| 3420 CSSParserValue* value = m_valueList->current(); | 3420 CSSParserValue* value = m_valueList->current(); |
| 3421 CSSValueID id = value->id; | 3421 CSSValueID id = value->id; |
| 3422 bool validPrimitive = false; | 3422 bool validPrimitive = false; |
| 3423 // normal | <number> | <length> | <percentage> | inherit | 3423 // normal | <number> | <length> | <percentage> | inherit |
| 3424 if (id == CSSValueNormal) | 3424 if (id == CSSValueNormal) |
| 3425 validPrimitive = true; | 3425 validPrimitive = true; |
| 3426 else | 3426 else |
| 3427 validPrimitive = (!id && validUnit(value, FNumber | FLength | FPercent |
FNonNeg)); | 3427 validPrimitive = (!id && validUnit(value, FNumber | FLength | FPercent |
FNonNeg)); |
| 3428 if (validPrimitive && (!m_valueList->next() || inShorthand())) | 3428 if (validPrimitive && (!m_valueList->next() || inShorthand())) |
| 3429 addProperty(CSSPropertyLineHeight, parseValidPrimitive(id, value), impor
tant); | 3429 addProperty(CSSPropertyLineHeight, parseValidPrimitive(id, value)); |
| 3430 return validPrimitive; | 3430 return validPrimitive; |
| 3431 } | 3431 } |
| 3432 | 3432 |
| 3433 bool CSSPropertyParser::parseFontSize(bool important) | 3433 bool CSSPropertyParser::parseFontSize() |
| 3434 { | 3434 { |
| 3435 CSSParserValue* value = m_valueList->current(); | 3435 CSSParserValue* value = m_valueList->current(); |
| 3436 CSSValueID id = value->id; | 3436 CSSValueID id = value->id; |
| 3437 bool validPrimitive = false; | 3437 bool validPrimitive = false; |
| 3438 // <absolute-size> | <relative-size> | <length> | <percentage> | inherit | 3438 // <absolute-size> | <relative-size> | <length> | <percentage> | inherit |
| 3439 if (id >= CSSValueXxSmall && id <= CSSValueLarger) | 3439 if (id >= CSSValueXxSmall && id <= CSSValueLarger) |
| 3440 validPrimitive = true; | 3440 validPrimitive = true; |
| 3441 else | 3441 else |
| 3442 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); | 3442 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); |
| 3443 if (validPrimitive && (!m_valueList->next() || inShorthand())) | 3443 if (validPrimitive && (!m_valueList->next() || inShorthand())) |
| 3444 addProperty(CSSPropertyFontSize, parseValidPrimitive(id, value), importa
nt); | 3444 addProperty(CSSPropertyFontSize, parseValidPrimitive(id, value)); |
| 3445 return validPrimitive; | 3445 return validPrimitive; |
| 3446 } | 3446 } |
| 3447 | 3447 |
| 3448 bool CSSPropertyParser::parseFontVariant(bool important) | 3448 bool CSSPropertyParser::parseFontVariant() |
| 3449 { | 3449 { |
| 3450 RefPtr<CSSValueList> values = nullptr; | 3450 RefPtr<CSSValueList> values = nullptr; |
| 3451 if (m_valueList->size() > 1) | 3451 if (m_valueList->size() > 1) |
| 3452 values = CSSValueList::createCommaSeparated(); | 3452 values = CSSValueList::createCommaSeparated(); |
| 3453 bool expectComma = false; | 3453 bool expectComma = false; |
| 3454 for (CSSParserValue* val = m_valueList->current(); val; val = m_valueList->c
urrent()) { | 3454 for (CSSParserValue* val = m_valueList->current(); val; val = m_valueList->c
urrent()) { |
| 3455 RefPtr<CSSPrimitiveValue> parsedValue = nullptr; | 3455 RefPtr<CSSPrimitiveValue> parsedValue = nullptr; |
| 3456 if (!expectComma) { | 3456 if (!expectComma) { |
| 3457 expectComma = true; | 3457 expectComma = true; |
| 3458 if (val->id == CSSValueNormal || val->id == CSSValueSmallCaps) | 3458 if (val->id == CSSValueNormal || val->id == CSSValueSmallCaps) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3472 } | 3472 } |
| 3473 | 3473 |
| 3474 if (!parsedValue) | 3474 if (!parsedValue) |
| 3475 return false; | 3475 return false; |
| 3476 | 3476 |
| 3477 m_valueList->next(); | 3477 m_valueList->next(); |
| 3478 | 3478 |
| 3479 if (values) | 3479 if (values) |
| 3480 values->append(parsedValue.release()); | 3480 values->append(parsedValue.release()); |
| 3481 else { | 3481 else { |
| 3482 addProperty(CSSPropertyFontVariant, parsedValue.release(), important
); | 3482 addProperty(CSSPropertyFontVariant, parsedValue.release()); |
| 3483 return true; | 3483 return true; |
| 3484 } | 3484 } |
| 3485 } | 3485 } |
| 3486 | 3486 |
| 3487 if (values && values->length()) { | 3487 if (values && values->length()) { |
| 3488 if (m_ruleType != CSSRuleSourceData::FONT_FACE_RULE) | 3488 if (m_ruleType != CSSRuleSourceData::FONT_FACE_RULE) |
| 3489 return false; | 3489 return false; |
| 3490 addProperty(CSSPropertyFontVariant, values.release(), important); | 3490 addProperty(CSSPropertyFontVariant, values.release()); |
| 3491 return true; | 3491 return true; |
| 3492 } | 3492 } |
| 3493 | 3493 |
| 3494 return false; | 3494 return false; |
| 3495 } | 3495 } |
| 3496 | 3496 |
| 3497 bool CSSPropertyParser::parseFontWeight(bool important) | 3497 bool CSSPropertyParser::parseFontWeight() |
| 3498 { | 3498 { |
| 3499 CSSParserValue* value = m_valueList->current(); | 3499 CSSParserValue* value = m_valueList->current(); |
| 3500 if (value->id >= CSSValueNormal && value->id <= CSSValueLighter) { | 3500 if (value->id >= CSSValueNormal && value->id <= CSSValueLighter) { |
| 3501 addProperty(CSSPropertyFontWeight, cssValuePool().createIdentifierValue(
value->id), important); | 3501 addProperty(CSSPropertyFontWeight, cssValuePool().createIdentifierValue(
value->id)); |
| 3502 return true; | 3502 return true; |
| 3503 } | 3503 } |
| 3504 if (value->unit == CSSPrimitiveValue::CSS_NUMBER) { | 3504 if (value->unit == CSSPrimitiveValue::CSS_NUMBER) { |
| 3505 int weight = static_cast<int>(value->fValue); | 3505 int weight = static_cast<int>(value->fValue); |
| 3506 if (!(weight % 100) && weight >= 100 && weight <= 900) { | 3506 if (!(weight % 100) && weight >= 100 && weight <= 900) { |
| 3507 addProperty(CSSPropertyFontWeight, cssValuePool().createIdentifierVa
lue(static_cast<CSSValueID>(CSSValue100 + weight / 100 - 1)), important); | 3507 addProperty(CSSPropertyFontWeight, cssValuePool().createIdentifierVa
lue(static_cast<CSSValueID>(CSSValue100 + weight / 100 - 1))); |
| 3508 return true; | 3508 return true; |
| 3509 } | 3509 } |
| 3510 } | 3510 } |
| 3511 return false; | 3511 return false; |
| 3512 } | 3512 } |
| 3513 | 3513 |
| 3514 bool CSSPropertyParser::parseFontFaceSrcURI(CSSValueList* valueList) | 3514 bool CSSPropertyParser::parseFontFaceSrcURI(CSSValueList* valueList) |
| 3515 { | 3515 { |
| 3516 RefPtr<CSSFontFaceSrcValue> uriValue(CSSFontFaceSrcValue::create(completeURL
(m_valueList->current()->string))); | 3516 RefPtr<CSSFontFaceSrcValue> uriValue(CSSFontFaceSrcValue::create(completeURL
(m_valueList->current()->string))); |
| 3517 uriValue->setReferrer(m_context.referrer()); | 3517 uriValue->setReferrer(m_context.referrer()); |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4325 } | 4325 } |
| 4326 | 4326 |
| 4327 return nullptr; | 4327 return nullptr; |
| 4328 } | 4328 } |
| 4329 | 4329 |
| 4330 static bool isFlexBasisMiddleArg(double flexGrow, double flexShrink, double unse
tValue, int argSize) | 4330 static bool isFlexBasisMiddleArg(double flexGrow, double flexShrink, double unse
tValue, int argSize) |
| 4331 { | 4331 { |
| 4332 return flexGrow != unsetValue && flexShrink == unsetValue && argSize == 3; | 4332 return flexGrow != unsetValue && flexShrink == unsetValue && argSize == 3; |
| 4333 } | 4333 } |
| 4334 | 4334 |
| 4335 bool CSSPropertyParser::parseFlex(CSSParserValueList* args, bool important) | 4335 bool CSSPropertyParser::parseFlex(CSSParserValueList* args) |
| 4336 { | 4336 { |
| 4337 if (!args || !args->size() || args->size() > 3) | 4337 if (!args || !args->size() || args->size() > 3) |
| 4338 return false; | 4338 return false; |
| 4339 static const double unsetValue = -1; | 4339 static const double unsetValue = -1; |
| 4340 double flexGrow = unsetValue; | 4340 double flexGrow = unsetValue; |
| 4341 double flexShrink = unsetValue; | 4341 double flexShrink = unsetValue; |
| 4342 RefPtr<CSSPrimitiveValue> flexBasis = nullptr; | 4342 RefPtr<CSSPrimitiveValue> flexBasis = nullptr; |
| 4343 | 4343 |
| 4344 while (CSSParserValue* arg = args->current()) { | 4344 while (CSSParserValue* arg = args->current()) { |
| 4345 if (validUnit(arg, FNumber | FNonNeg)) { | 4345 if (validUnit(arg, FNumber | FNonNeg)) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 4363 args->next(); | 4363 args->next(); |
| 4364 } | 4364 } |
| 4365 | 4365 |
| 4366 if (flexGrow == unsetValue) | 4366 if (flexGrow == unsetValue) |
| 4367 flexGrow = 1; | 4367 flexGrow = 1; |
| 4368 if (flexShrink == unsetValue) | 4368 if (flexShrink == unsetValue) |
| 4369 flexShrink = 1; | 4369 flexShrink = 1; |
| 4370 if (!flexBasis) | 4370 if (!flexBasis) |
| 4371 flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PERCENT
AGE); | 4371 flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PERCENT
AGE); |
| 4372 | 4372 |
| 4373 addProperty(CSSPropertyFlexGrow, cssValuePool().createValue(clampToFloat(fle
xGrow), CSSPrimitiveValue::CSS_NUMBER), important); | 4373 addProperty(CSSPropertyFlexGrow, cssValuePool().createValue(clampToFloat(fle
xGrow), CSSPrimitiveValue::CSS_NUMBER)); |
| 4374 addProperty(CSSPropertyFlexShrink, cssValuePool().createValue(clampToFloat(f
lexShrink), CSSPrimitiveValue::CSS_NUMBER), important); | 4374 addProperty(CSSPropertyFlexShrink, cssValuePool().createValue(clampToFloat(f
lexShrink), CSSPrimitiveValue::CSS_NUMBER)); |
| 4375 addProperty(CSSPropertyFlexBasis, flexBasis, important); | 4375 addProperty(CSSPropertyFlexBasis, flexBasis); |
| 4376 return true; | 4376 return true; |
| 4377 } | 4377 } |
| 4378 | 4378 |
| 4379 PassRefPtr<CSSValue> CSSPropertyParser::parseObjectPosition() | 4379 PassRefPtr<CSSValue> CSSPropertyParser::parseObjectPosition() |
| 4380 { | 4380 { |
| 4381 RefPtr<CSSValue> xValue = nullptr; | 4381 RefPtr<CSSValue> xValue = nullptr; |
| 4382 RefPtr<CSSValue> yValue = nullptr; | 4382 RefPtr<CSSValue> yValue = nullptr; |
| 4383 parseFillPosition(m_valueList, xValue, yValue); | 4383 parseFillPosition(m_valueList, xValue, yValue); |
| 4384 if (!xValue || !yValue) | 4384 if (!xValue || !yValue) |
| 4385 return nullptr; | 4385 return nullptr; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4468 m_allowRepeat = m_allowForwardSlashOperator = m_requireWidth = m_require
Outset = false; | 4468 m_allowRepeat = m_allowForwardSlashOperator = m_requireWidth = m_require
Outset = false; |
| 4469 m_allowImageSlice = !m_imageSlice; | 4469 m_allowImageSlice = !m_imageSlice; |
| 4470 m_allowImage = !m_image; | 4470 m_allowImage = !m_image; |
| 4471 } | 4471 } |
| 4472 | 4472 |
| 4473 PassRefPtr<CSSValue> commitCSSValue() | 4473 PassRefPtr<CSSValue> commitCSSValue() |
| 4474 { | 4474 { |
| 4475 return createBorderImageValue(m_image, m_imageSlice.get(), m_borderWidth
.get(), m_outset.get(), m_repeat.get()); | 4475 return createBorderImageValue(m_image, m_imageSlice.get(), m_borderWidth
.get(), m_outset.get(), m_repeat.get()); |
| 4476 } | 4476 } |
| 4477 | 4477 |
| 4478 void commitMaskBoxImage(CSSPropertyParser* parser, bool important) | 4478 void commitMaskBoxImage(CSSPropertyParser* parser) |
| 4479 { | 4479 { |
| 4480 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageSource, parser, m
_image, important); | 4480 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageSource, parser, m
_image); |
| 4481 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageSlice, parser, m_
imageSlice.get(), important); | 4481 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageSlice, parser, m_
imageSlice.get()); |
| 4482 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageWidth, parser, m_
borderWidth.get(), important); | 4482 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageWidth, parser, m_
borderWidth.get()); |
| 4483 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageOutset, parser, m
_outset.get(), important); | 4483 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageOutset, parser, m
_outset.get()); |
| 4484 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageRepeat, parser, m
_repeat.get(), important); | 4484 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageRepeat, parser, m
_repeat.get()); |
| 4485 } | 4485 } |
| 4486 | 4486 |
| 4487 void commitBorderImage(CSSPropertyParser* parser, bool important) | 4487 void commitBorderImage(CSSPropertyParser* parser) |
| 4488 { | 4488 { |
| 4489 commitBorderImageProperty(CSSPropertyBorderImageSource, parser, m_image,
important); | 4489 commitBorderImageProperty(CSSPropertyBorderImageSource, parser, m_image)
; |
| 4490 commitBorderImageProperty(CSSPropertyBorderImageSlice, parser, m_imageSl
ice.get(), important); | 4490 commitBorderImageProperty(CSSPropertyBorderImageSlice, parser, m_imageSl
ice.get()); |
| 4491 commitBorderImageProperty(CSSPropertyBorderImageWidth, parser, m_borderW
idth.get(), important); | 4491 commitBorderImageProperty(CSSPropertyBorderImageWidth, parser, m_borderW
idth.get()); |
| 4492 commitBorderImageProperty(CSSPropertyBorderImageOutset, parser, m_outset
.get(), important); | 4492 commitBorderImageProperty(CSSPropertyBorderImageOutset, parser, m_outset
.get()); |
| 4493 commitBorderImageProperty(CSSPropertyBorderImageRepeat, parser, m_repeat
, important); | 4493 commitBorderImageProperty(CSSPropertyBorderImageRepeat, parser, m_repeat
); |
| 4494 } | 4494 } |
| 4495 | 4495 |
| 4496 void commitBorderImageProperty(CSSPropertyID propId, CSSPropertyParser* pars
er, PassRefPtr<CSSValue> value, bool important) | 4496 void commitBorderImageProperty(CSSPropertyID propId, CSSPropertyParser* pars
er, PassRefPtr<CSSValue> value) |
| 4497 { | 4497 { |
| 4498 if (value) | 4498 if (value) |
| 4499 parser->addProperty(propId, value, important); | 4499 parser->addProperty(propId, value); |
| 4500 else | 4500 else |
| 4501 parser->addProperty(propId, cssValuePool().createImplicitInitialValu
e(), important, true); | 4501 parser->addProperty(propId, cssValuePool().createImplicitInitialValu
e(), true); |
| 4502 } | 4502 } |
| 4503 | 4503 |
| 4504 static bool buildFromParser(CSSPropertyParser&, CSSPropertyID, BorderImagePa
rseContext&); | 4504 static bool buildFromParser(CSSPropertyParser&, CSSPropertyID, BorderImagePa
rseContext&); |
| 4505 | 4505 |
| 4506 bool m_canAdvance; | 4506 bool m_canAdvance; |
| 4507 | 4507 |
| 4508 bool m_allowCommit; | 4508 bool m_allowCommit; |
| 4509 bool m_allowImage; | 4509 bool m_allowImage; |
| 4510 bool m_allowImageSlice; | 4510 bool m_allowImageSlice; |
| 4511 bool m_allowRepeat; | 4511 bool m_allowRepeat; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4576 | 4576 |
| 4577 if (!context.canAdvance()) | 4577 if (!context.canAdvance()) |
| 4578 return false; | 4578 return false; |
| 4579 | 4579 |
| 4580 parser.m_valueList->next(); | 4580 parser.m_valueList->next(); |
| 4581 } | 4581 } |
| 4582 | 4582 |
| 4583 return context.allowCommit(); | 4583 return context.allowCommit(); |
| 4584 } | 4584 } |
| 4585 | 4585 |
| 4586 bool CSSPropertyParser::parseBorderImageShorthand(CSSPropertyID propId, bool imp
ortant) | 4586 bool CSSPropertyParser::parseBorderImageShorthand(CSSPropertyID propId) |
| 4587 { | 4587 { |
| 4588 BorderImageParseContext context; | 4588 BorderImageParseContext context; |
| 4589 if (BorderImageParseContext::buildFromParser(*this, propId, context)) { | 4589 if (BorderImageParseContext::buildFromParser(*this, propId, context)) { |
| 4590 switch (propId) { | 4590 switch (propId) { |
| 4591 case CSSPropertyWebkitMaskBoxImage: | 4591 case CSSPropertyWebkitMaskBoxImage: |
| 4592 context.commitMaskBoxImage(this, important); | 4592 context.commitMaskBoxImage(this); |
| 4593 return true; | 4593 return true; |
| 4594 case CSSPropertyBorderImage: | 4594 case CSSPropertyBorderImage: |
| 4595 context.commitBorderImage(this, important); | 4595 context.commitBorderImage(this); |
| 4596 return true; | 4596 return true; |
| 4597 default: | 4597 default: |
| 4598 ASSERT_NOT_REACHED(); | 4598 ASSERT_NOT_REACHED(); |
| 4599 return false; | 4599 return false; |
| 4600 } | 4600 } |
| 4601 } | 4601 } |
| 4602 return false; | 4602 return false; |
| 4603 } | 4603 } |
| 4604 | 4604 |
| 4605 PassRefPtr<CSSValue> CSSPropertyParser::parseBorderImage(CSSPropertyID propId) | 4605 PassRefPtr<CSSValue> CSSPropertyParser::parseBorderImage(CSSPropertyID propId) |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4865 bool CSSPropertyParser::parseBorderImageWidth(RefPtr<CSSPrimitiveValue>& result) | 4865 bool CSSPropertyParser::parseBorderImageWidth(RefPtr<CSSPrimitiveValue>& result) |
| 4866 { | 4866 { |
| 4867 return parseBorderImageQuad(FLength | FNumber | FNonNeg | FPercent, result); | 4867 return parseBorderImageQuad(FLength | FNumber | FNonNeg | FPercent, result); |
| 4868 } | 4868 } |
| 4869 | 4869 |
| 4870 bool CSSPropertyParser::parseBorderImageOutset(RefPtr<CSSPrimitiveValue>& result
) | 4870 bool CSSPropertyParser::parseBorderImageOutset(RefPtr<CSSPrimitiveValue>& result
) |
| 4871 { | 4871 { |
| 4872 return parseBorderImageQuad(FLength | FNumber | FNonNeg, result); | 4872 return parseBorderImageQuad(FLength | FNumber | FNonNeg, result); |
| 4873 } | 4873 } |
| 4874 | 4874 |
| 4875 bool CSSPropertyParser::parseBorderRadius(CSSPropertyID propId, bool important) | 4875 bool CSSPropertyParser::parseBorderRadius(CSSPropertyID propId) |
| 4876 { | 4876 { |
| 4877 unsigned num = m_valueList->size(); | 4877 unsigned num = m_valueList->size(); |
| 4878 if (num > 9) | 4878 if (num > 9) |
| 4879 return false; | 4879 return false; |
| 4880 | 4880 |
| 4881 ShorthandScope scope(this, propId); | 4881 ShorthandScope scope(this, propId); |
| 4882 RefPtr<CSSPrimitiveValue> radii[2][4]; | 4882 RefPtr<CSSPrimitiveValue> radii[2][4]; |
| 4883 #if ENABLE(OILPAN) | 4883 #if ENABLE(OILPAN) |
| 4884 // Zero initialize the array of raw pointers. | 4884 // Zero initialize the array of raw pointers. |
| 4885 memset(&radii, 0, sizeof(radii)); | 4885 memset(&radii, 0, sizeof(radii)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4921 } | 4921 } |
| 4922 | 4922 |
| 4923 if (!indexAfterSlash) { | 4923 if (!indexAfterSlash) { |
| 4924 completeBorderRadii(radii[0]); | 4924 completeBorderRadii(radii[0]); |
| 4925 for (unsigned i = 0; i < 4; ++i) | 4925 for (unsigned i = 0; i < 4; ++i) |
| 4926 radii[1][i] = radii[0][i]; | 4926 radii[1][i] = radii[0][i]; |
| 4927 } else | 4927 } else |
| 4928 completeBorderRadii(radii[1]); | 4928 completeBorderRadii(radii[1]); |
| 4929 | 4929 |
| 4930 ImplicitScope implicitScope(this); | 4930 ImplicitScope implicitScope(this); |
| 4931 addProperty(CSSPropertyBorderTopLeftRadius, createPrimitiveValuePair(radii[0
][0].release(), radii[1][0].release()), important); | 4931 addProperty(CSSPropertyBorderTopLeftRadius, createPrimitiveValuePair(radii[0
][0].release(), radii[1][0].release())); |
| 4932 addProperty(CSSPropertyBorderTopRightRadius, createPrimitiveValuePair(radii[
0][1].release(), radii[1][1].release()), important); | 4932 addProperty(CSSPropertyBorderTopRightRadius, createPrimitiveValuePair(radii[
0][1].release(), radii[1][1].release())); |
| 4933 addProperty(CSSPropertyBorderBottomRightRadius, createPrimitiveValuePair(rad
ii[0][2].release(), radii[1][2].release()), important); | 4933 addProperty(CSSPropertyBorderBottomRightRadius, createPrimitiveValuePair(rad
ii[0][2].release(), radii[1][2].release())); |
| 4934 addProperty(CSSPropertyBorderBottomLeftRadius, createPrimitiveValuePair(radi
i[0][3].release(), radii[1][3].release()), important); | 4934 addProperty(CSSPropertyBorderBottomLeftRadius, createPrimitiveValuePair(radi
i[0][3].release(), radii[1][3].release())); |
| 4935 return true; | 4935 return true; |
| 4936 } | 4936 } |
| 4937 | 4937 |
| 4938 PassRefPtr<CSSValue> CSSPropertyParser::parseAspectRatio() | 4938 PassRefPtr<CSSValue> CSSPropertyParser::parseAspectRatio() |
| 4939 { | 4939 { |
| 4940 unsigned num = m_valueList->size(); | 4940 unsigned num = m_valueList->size(); |
| 4941 if (num == 1 && m_valueList->valueAt(0)->id == CSSValueNone) { | 4941 if (num == 1 && m_valueList->valueAt(0)->id == CSSValueNone) { |
| 4942 m_valueList->next(); | 4942 m_valueList->next(); |
| 4943 return cssValuePool().createIdentifierValue(CSSValueNone); | 4943 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 4944 } | 4944 } |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5656 } | 5656 } |
| 5657 value = m_valueList->next(); | 5657 value = m_valueList->next(); |
| 5658 } | 5658 } |
| 5659 | 5659 |
| 5660 if (list->length()) | 5660 if (list->length()) |
| 5661 return list.release(); | 5661 return list.release(); |
| 5662 | 5662 |
| 5663 return nullptr; | 5663 return nullptr; |
| 5664 } | 5664 } |
| 5665 | 5665 |
| 5666 void CSSPropertyParser::addTextDecorationProperty(CSSPropertyID propId, PassRefP
tr<CSSValue> value, bool important) | 5666 void CSSPropertyParser::addTextDecorationProperty(CSSPropertyID propId, PassRefP
tr<CSSValue> value) |
| 5667 { | 5667 { |
| 5668 // The text-decoration-line property takes priority over text-decoration, un
less the latter has important priority set. | 5668 // The text-decoration-line property takes priority over text-decoration. |
| 5669 if (propId == CSSPropertyTextDecoration && !important && !inShorthand()) { | 5669 if (propId == CSSPropertyTextDecoration && !inShorthand()) { |
| 5670 for (unsigned i = 0; i < m_parsedProperties.size(); ++i) { | 5670 for (unsigned i = 0; i < m_parsedProperties.size(); ++i) { |
| 5671 if (m_parsedProperties[i].id() == CSSPropertyTextDecorationLine) | 5671 if (m_parsedProperties[i].id() == CSSPropertyTextDecorationLine) |
| 5672 return; | 5672 return; |
| 5673 } | 5673 } |
| 5674 } | 5674 } |
| 5675 addProperty(propId, value, important); | 5675 addProperty(propId, value); |
| 5676 } | 5676 } |
| 5677 | 5677 |
| 5678 bool CSSPropertyParser::parseTextDecoration(CSSPropertyID propId, bool important
) | 5678 bool CSSPropertyParser::parseTextDecoration(CSSPropertyID propId) |
| 5679 { | 5679 { |
| 5680 ASSERT(propId != CSSPropertyTextDecorationLine || RuntimeEnabledFeatures::cs
s3TextDecorationsEnabled()); | 5680 ASSERT(propId != CSSPropertyTextDecorationLine || RuntimeEnabledFeatures::cs
s3TextDecorationsEnabled()); |
| 5681 | 5681 |
| 5682 CSSParserValue* value = m_valueList->current(); | 5682 CSSParserValue* value = m_valueList->current(); |
| 5683 if (value && value->id == CSSValueNone) { | 5683 if (value && value->id == CSSValueNone) { |
| 5684 addTextDecorationProperty(propId, cssValuePool().createIdentifierValue(C
SSValueNone), important); | 5684 addTextDecorationProperty(propId, cssValuePool().createIdentifierValue(C
SSValueNone)); |
| 5685 m_valueList->next(); | 5685 m_valueList->next(); |
| 5686 return true; | 5686 return true; |
| 5687 } | 5687 } |
| 5688 | 5688 |
| 5689 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 5689 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 5690 bool isValid = true; | 5690 bool isValid = true; |
| 5691 while (isValid && value) { | 5691 while (isValid && value) { |
| 5692 switch (value->id) { | 5692 switch (value->id) { |
| 5693 case CSSValueUnderline: | 5693 case CSSValueUnderline: |
| 5694 case CSSValueOverline: | 5694 case CSSValueOverline: |
| 5695 case CSSValueLineThrough: | 5695 case CSSValueLineThrough: |
| 5696 case CSSValueBlink: | 5696 case CSSValueBlink: |
| 5697 list->append(cssValuePool().createIdentifierValue(value->id)); | 5697 list->append(cssValuePool().createIdentifierValue(value->id)); |
| 5698 break; | 5698 break; |
| 5699 default: | 5699 default: |
| 5700 isValid = false; | 5700 isValid = false; |
| 5701 break; | 5701 break; |
| 5702 } | 5702 } |
| 5703 if (isValid) | 5703 if (isValid) |
| 5704 value = m_valueList->next(); | 5704 value = m_valueList->next(); |
| 5705 } | 5705 } |
| 5706 | 5706 |
| 5707 // Values are either valid or in shorthand scope. | 5707 // Values are either valid or in shorthand scope. |
| 5708 if (list->length() && (isValid || inShorthand())) { | 5708 if (list->length() && (isValid || inShorthand())) { |
| 5709 addTextDecorationProperty(propId, list.release(), important); | 5709 addTextDecorationProperty(propId, list.release()); |
| 5710 return true; | 5710 return true; |
| 5711 } | 5711 } |
| 5712 | 5712 |
| 5713 return false; | 5713 return false; |
| 5714 } | 5714 } |
| 5715 | 5715 |
| 5716 bool CSSPropertyParser::parseTextUnderlinePosition(bool important) | 5716 bool CSSPropertyParser::parseTextUnderlinePosition() |
| 5717 { | 5717 { |
| 5718 // The text-underline-position property has syntax "auto | [ under || [ left
| right ] ]". | 5718 // The text-underline-position property has syntax "auto | [ under || [ left
| right ] ]". |
| 5719 // However, values 'left' and 'right' are not implemented yet, so we will pa
rse syntax | 5719 // However, values 'left' and 'right' are not implemented yet, so we will pa
rse syntax |
| 5720 // "auto | under" for now. | 5720 // "auto | under" for now. |
| 5721 CSSParserValue* value = m_valueList->current(); | 5721 CSSParserValue* value = m_valueList->current(); |
| 5722 switch (value->id) { | 5722 switch (value->id) { |
| 5723 case CSSValueAuto: | 5723 case CSSValueAuto: |
| 5724 case CSSValueUnder: | 5724 case CSSValueUnder: |
| 5725 if (m_valueList->next()) | 5725 if (m_valueList->next()) |
| 5726 return false; | 5726 return false; |
| 5727 addProperty(CSSPropertyTextUnderlinePosition, cssValuePool().createIdent
ifierValue(value->id), important); | 5727 addProperty(CSSPropertyTextUnderlinePosition, cssValuePool().createIdent
ifierValue(value->id)); |
| 5728 return true; | 5728 return true; |
| 5729 default: | 5729 default: |
| 5730 return false; | 5730 return false; |
| 5731 } | 5731 } |
| 5732 } | 5732 } |
| 5733 | 5733 |
| 5734 bool CSSPropertyParser::parseTextEmphasisStyle(bool important) | 5734 bool CSSPropertyParser::parseTextEmphasisStyle() |
| 5735 { | 5735 { |
| 5736 unsigned valueListSize = m_valueList->size(); | 5736 unsigned valueListSize = m_valueList->size(); |
| 5737 | 5737 |
| 5738 RefPtr<CSSPrimitiveValue> fill = nullptr; | 5738 RefPtr<CSSPrimitiveValue> fill = nullptr; |
| 5739 RefPtr<CSSPrimitiveValue> shape = nullptr; | 5739 RefPtr<CSSPrimitiveValue> shape = nullptr; |
| 5740 | 5740 |
| 5741 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { | 5741 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { |
| 5742 if (value->unit == CSSPrimitiveValue::CSS_STRING) { | 5742 if (value->unit == CSSPrimitiveValue::CSS_STRING) { |
| 5743 if (fill || shape || (valueListSize != 1 && !inShorthand())) | 5743 if (fill || shape || (valueListSize != 1 && !inShorthand())) |
| 5744 return false; | 5744 return false; |
| 5745 addProperty(CSSPropertyWebkitTextEmphasisStyle, createPrimitiveStrin
gValue(value), important); | 5745 addProperty(CSSPropertyWebkitTextEmphasisStyle, createPrimitiveStrin
gValue(value)); |
| 5746 m_valueList->next(); | 5746 m_valueList->next(); |
| 5747 return true; | 5747 return true; |
| 5748 } | 5748 } |
| 5749 | 5749 |
| 5750 if (value->id == CSSValueNone) { | 5750 if (value->id == CSSValueNone) { |
| 5751 if (fill || shape || (valueListSize != 1 && !inShorthand())) | 5751 if (fill || shape || (valueListSize != 1 && !inShorthand())) |
| 5752 return false; | 5752 return false; |
| 5753 addProperty(CSSPropertyWebkitTextEmphasisStyle, cssValuePool().creat
eIdentifierValue(CSSValueNone), important); | 5753 addProperty(CSSPropertyWebkitTextEmphasisStyle, cssValuePool().creat
eIdentifierValue(CSSValueNone)); |
| 5754 m_valueList->next(); | 5754 m_valueList->next(); |
| 5755 return true; | 5755 return true; |
| 5756 } | 5756 } |
| 5757 | 5757 |
| 5758 if (value->id == CSSValueOpen || value->id == CSSValueFilled) { | 5758 if (value->id == CSSValueOpen || value->id == CSSValueFilled) { |
| 5759 if (fill) | 5759 if (fill) |
| 5760 return false; | 5760 return false; |
| 5761 fill = cssValuePool().createIdentifierValue(value->id); | 5761 fill = cssValuePool().createIdentifierValue(value->id); |
| 5762 } else if (value->id == CSSValueDot || value->id == CSSValueCircle || va
lue->id == CSSValueDoubleCircle || value->id == CSSValueTriangle || value->id ==
CSSValueSesame) { | 5762 } else if (value->id == CSSValueDot || value->id == CSSValueCircle || va
lue->id == CSSValueDoubleCircle || value->id == CSSValueTriangle || value->id ==
CSSValueSesame) { |
| 5763 if (shape) | 5763 if (shape) |
| 5764 return false; | 5764 return false; |
| 5765 shape = cssValuePool().createIdentifierValue(value->id); | 5765 shape = cssValuePool().createIdentifierValue(value->id); |
| 5766 } else if (!inShorthand()) | 5766 } else if (!inShorthand()) |
| 5767 return false; | 5767 return false; |
| 5768 else | 5768 else |
| 5769 break; | 5769 break; |
| 5770 } | 5770 } |
| 5771 | 5771 |
| 5772 if (fill && shape) { | 5772 if (fill && shape) { |
| 5773 RefPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSeparated()
; | 5773 RefPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSeparated()
; |
| 5774 parsedValues->append(fill.release()); | 5774 parsedValues->append(fill.release()); |
| 5775 parsedValues->append(shape.release()); | 5775 parsedValues->append(shape.release()); |
| 5776 addProperty(CSSPropertyWebkitTextEmphasisStyle, parsedValues.release(),
important); | 5776 addProperty(CSSPropertyWebkitTextEmphasisStyle, parsedValues.release()); |
| 5777 return true; | 5777 return true; |
| 5778 } | 5778 } |
| 5779 if (fill) { | 5779 if (fill) { |
| 5780 addProperty(CSSPropertyWebkitTextEmphasisStyle, fill.release(), importan
t); | 5780 addProperty(CSSPropertyWebkitTextEmphasisStyle, fill.release()); |
| 5781 return true; | 5781 return true; |
| 5782 } | 5782 } |
| 5783 if (shape) { | 5783 if (shape) { |
| 5784 addProperty(CSSPropertyWebkitTextEmphasisStyle, shape.release(), importa
nt); | 5784 addProperty(CSSPropertyWebkitTextEmphasisStyle, shape.release()); |
| 5785 return true; | 5785 return true; |
| 5786 } | 5786 } |
| 5787 | 5787 |
| 5788 return false; | 5788 return false; |
| 5789 } | 5789 } |
| 5790 | 5790 |
| 5791 PassRefPtr<CSSValue> CSSPropertyParser::parseTextIndent() | 5791 PassRefPtr<CSSValue> CSSPropertyParser::parseTextIndent() |
| 5792 { | 5792 { |
| 5793 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 5793 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 5794 | 5794 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 5820 } | 5820 } |
| 5821 return nullptr; | 5821 return nullptr; |
| 5822 } | 5822 } |
| 5823 | 5823 |
| 5824 if (!hasLengthOrPercentage) | 5824 if (!hasLengthOrPercentage) |
| 5825 return nullptr; | 5825 return nullptr; |
| 5826 | 5826 |
| 5827 return list.release(); | 5827 return list.release(); |
| 5828 } | 5828 } |
| 5829 | 5829 |
| 5830 bool CSSPropertyParser::parseLineBoxContain(bool important) | 5830 bool CSSPropertyParser::parseLineBoxContain() |
| 5831 { | 5831 { |
| 5832 LineBoxContain lineBoxContain = LineBoxContainNone; | 5832 LineBoxContain lineBoxContain = LineBoxContainNone; |
| 5833 | 5833 |
| 5834 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { | 5834 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { |
| 5835 LineBoxContainFlags flag; | 5835 LineBoxContainFlags flag; |
| 5836 if (value->id == CSSValueBlock) { | 5836 if (value->id == CSSValueBlock) { |
| 5837 flag = LineBoxContainBlock; | 5837 flag = LineBoxContainBlock; |
| 5838 } else if (value->id == CSSValueInline) { | 5838 } else if (value->id == CSSValueInline) { |
| 5839 flag = LineBoxContainInline; | 5839 flag = LineBoxContainInline; |
| 5840 } else if (value->id == CSSValueFont) { | 5840 } else if (value->id == CSSValueFont) { |
| 5841 flag = LineBoxContainFont; | 5841 flag = LineBoxContainFont; |
| 5842 } else if (value->id == CSSValueGlyphs) { | 5842 } else if (value->id == CSSValueGlyphs) { |
| 5843 flag = LineBoxContainGlyphs; | 5843 flag = LineBoxContainGlyphs; |
| 5844 } else if (value->id == CSSValueReplaced) { | 5844 } else if (value->id == CSSValueReplaced) { |
| 5845 flag = LineBoxContainReplaced; | 5845 flag = LineBoxContainReplaced; |
| 5846 } else if (value->id == CSSValueInlineBox) { | 5846 } else if (value->id == CSSValueInlineBox) { |
| 5847 flag = LineBoxContainInlineBox; | 5847 flag = LineBoxContainInlineBox; |
| 5848 } else { | 5848 } else { |
| 5849 return false; | 5849 return false; |
| 5850 } | 5850 } |
| 5851 if (lineBoxContain & flag) | 5851 if (lineBoxContain & flag) |
| 5852 return false; | 5852 return false; |
| 5853 lineBoxContain |= flag; | 5853 lineBoxContain |= flag; |
| 5854 } | 5854 } |
| 5855 | 5855 |
| 5856 if (!lineBoxContain) | 5856 if (!lineBoxContain) |
| 5857 return false; | 5857 return false; |
| 5858 | 5858 |
| 5859 addProperty(CSSPropertyWebkitLineBoxContain, CSSLineBoxContainValue::create(
lineBoxContain), important); | 5859 addProperty(CSSPropertyWebkitLineBoxContain, CSSLineBoxContainValue::create(
lineBoxContain)); |
| 5860 return true; | 5860 return true; |
| 5861 } | 5861 } |
| 5862 | 5862 |
| 5863 bool CSSPropertyParser::parseFontFeatureTag(CSSValueList* settings) | 5863 bool CSSPropertyParser::parseFontFeatureTag(CSSValueList* settings) |
| 5864 { | 5864 { |
| 5865 // Feature tag name consists of 4-letter characters. | 5865 // Feature tag name consists of 4-letter characters. |
| 5866 static const unsigned tagNameLength = 4; | 5866 static const unsigned tagNameLength = 4; |
| 5867 | 5867 |
| 5868 CSSParserValue* value = m_valueList->current(); | 5868 CSSParserValue* value = m_valueList->current(); |
| 5869 // Feature tag name comes first | 5869 // Feature tag name comes first |
| (...skipping 20 matching lines...) Expand all Loading... |
| 5890 m_valueList->next(); | 5890 m_valueList->next(); |
| 5891 } else if (value->id == CSSValueOn || value->id == CSSValueOff) { | 5891 } else if (value->id == CSSValueOn || value->id == CSSValueOff) { |
| 5892 tagValue = value->id == CSSValueOn; | 5892 tagValue = value->id == CSSValueOn; |
| 5893 m_valueList->next(); | 5893 m_valueList->next(); |
| 5894 } | 5894 } |
| 5895 } | 5895 } |
| 5896 settings->append(CSSFontFeatureValue::create(tag, tagValue)); | 5896 settings->append(CSSFontFeatureValue::create(tag, tagValue)); |
| 5897 return true; | 5897 return true; |
| 5898 } | 5898 } |
| 5899 | 5899 |
| 5900 bool CSSPropertyParser::parseFontFeatureSettings(bool important) | 5900 bool CSSPropertyParser::parseFontFeatureSettings() |
| 5901 { | 5901 { |
| 5902 if (m_valueList->size() == 1 && m_valueList->current()->id == CSSValueNormal
) { | 5902 if (m_valueList->size() == 1 && m_valueList->current()->id == CSSValueNormal
) { |
| 5903 RefPtr<CSSPrimitiveValue> normalValue = cssValuePool().createIdentifierV
alue(CSSValueNormal); | 5903 RefPtr<CSSPrimitiveValue> normalValue = cssValuePool().createIdentifierV
alue(CSSValueNormal); |
| 5904 m_valueList->next(); | 5904 m_valueList->next(); |
| 5905 addProperty(CSSPropertyWebkitFontFeatureSettings, normalValue.release(),
important); | 5905 addProperty(CSSPropertyWebkitFontFeatureSettings, normalValue.release())
; |
| 5906 return true; | 5906 return true; |
| 5907 } | 5907 } |
| 5908 | 5908 |
| 5909 RefPtr<CSSValueList> settings = CSSValueList::createCommaSeparated(); | 5909 RefPtr<CSSValueList> settings = CSSValueList::createCommaSeparated(); |
| 5910 while (true) { | 5910 while (true) { |
| 5911 if (!m_valueList->current() || !parseFontFeatureTag(settings.get())) | 5911 if (!m_valueList->current() || !parseFontFeatureTag(settings.get())) |
| 5912 return false; | 5912 return false; |
| 5913 if (!m_valueList->current()) | 5913 if (!m_valueList->current()) |
| 5914 break; | 5914 break; |
| 5915 if (!consumeComma(m_valueList)) | 5915 if (!consumeComma(m_valueList)) |
| 5916 return false; | 5916 return false; |
| 5917 } | 5917 } |
| 5918 addProperty(CSSPropertyWebkitFontFeatureSettings, settings.release(), import
ant); | 5918 addProperty(CSSPropertyWebkitFontFeatureSettings, settings.release()); |
| 5919 return true; | 5919 return true; |
| 5920 } | 5920 } |
| 5921 | 5921 |
| 5922 bool CSSPropertyParser::parseFontVariantLigatures(bool important) | 5922 bool CSSPropertyParser::parseFontVariantLigatures() |
| 5923 { | 5923 { |
| 5924 RefPtr<CSSValueList> ligatureValues = CSSValueList::createSpaceSeparated(); | 5924 RefPtr<CSSValueList> ligatureValues = CSSValueList::createSpaceSeparated(); |
| 5925 bool sawCommonLigaturesValue = false; | 5925 bool sawCommonLigaturesValue = false; |
| 5926 bool sawDiscretionaryLigaturesValue = false; | 5926 bool sawDiscretionaryLigaturesValue = false; |
| 5927 bool sawHistoricalLigaturesValue = false; | 5927 bool sawHistoricalLigaturesValue = false; |
| 5928 bool sawContextualLigaturesValue = false; | 5928 bool sawContextualLigaturesValue = false; |
| 5929 | 5929 |
| 5930 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { | 5930 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { |
| 5931 if (value->unit != CSSPrimitiveValue::CSS_IDENT) | 5931 if (value->unit != CSSPrimitiveValue::CSS_IDENT) |
| 5932 return false; | 5932 return false; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 5961 ligatureValues->append(cssValuePool().createIdentifierValue(value->i
d)); | 5961 ligatureValues->append(cssValuePool().createIdentifierValue(value->i
d)); |
| 5962 break; | 5962 break; |
| 5963 default: | 5963 default: |
| 5964 return false; | 5964 return false; |
| 5965 } | 5965 } |
| 5966 } | 5966 } |
| 5967 | 5967 |
| 5968 if (!ligatureValues->length()) | 5968 if (!ligatureValues->length()) |
| 5969 return false; | 5969 return false; |
| 5970 | 5970 |
| 5971 addProperty(CSSPropertyFontVariantLigatures, ligatureValues.release(), impor
tant); | 5971 addProperty(CSSPropertyFontVariantLigatures, ligatureValues.release()); |
| 5972 return true; | 5972 return true; |
| 5973 } | 5973 } |
| 5974 | 5974 |
| 5975 bool CSSPropertyParser::parseCalculation(CSSParserValue* value, ValueRange range
) | 5975 bool CSSPropertyParser::parseCalculation(CSSParserValue* value, ValueRange range
) |
| 5976 { | 5976 { |
| 5977 ASSERT(isCalculation(value)); | 5977 ASSERT(isCalculation(value)); |
| 5978 | 5978 |
| 5979 CSSParserValueList* args = value->function->args.get(); | 5979 CSSParserValueList* args = value->function->args.get(); |
| 5980 if (!args || !args->size()) | 5980 if (!args || !args->size()) |
| 5981 return false; | 5981 return false; |
| 5982 | 5982 |
| 5983 ASSERT(!m_parsedCalculation); | 5983 ASSERT(!m_parsedCalculation); |
| 5984 m_parsedCalculation = CSSCalcValue::create(value->function->name, args, rang
e); | 5984 m_parsedCalculation = CSSCalcValue::create(value->function->name, args, rang
e); |
| 5985 | 5985 |
| 5986 if (!m_parsedCalculation) | 5986 if (!m_parsedCalculation) |
| 5987 return false; | 5987 return false; |
| 5988 | 5988 |
| 5989 return true; | 5989 return true; |
| 5990 } | 5990 } |
| 5991 | 5991 |
| 5992 bool CSSPropertyParser::parseViewportProperty(CSSPropertyID propId, bool importa
nt) | 5992 bool CSSPropertyParser::parseViewportProperty(CSSPropertyID propId) |
| 5993 { | 5993 { |
| 5994 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled() || isUASheetBehavior(m_c
ontext.mode())); | 5994 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled() || isUASheetBehavior(m_c
ontext.mode())); |
| 5995 | 5995 |
| 5996 CSSParserValue* value = m_valueList->current(); | 5996 CSSParserValue* value = m_valueList->current(); |
| 5997 if (!value) | 5997 if (!value) |
| 5998 return false; | 5998 return false; |
| 5999 | 5999 |
| 6000 CSSValueID id = value->id; | 6000 CSSValueID id = value->id; |
| 6001 bool validPrimitive = false; | 6001 bool validPrimitive = false; |
| 6002 | 6002 |
| 6003 switch (propId) { | 6003 switch (propId) { |
| 6004 case CSSPropertyMinWidth: // auto | <length> | <percentage> | 6004 case CSSPropertyMinWidth: // auto | <length> | <percentage> |
| 6005 case CSSPropertyMaxWidth: | 6005 case CSSPropertyMaxWidth: |
| 6006 case CSSPropertyMinHeight: | 6006 case CSSPropertyMinHeight: |
| 6007 case CSSPropertyMaxHeight: | 6007 case CSSPropertyMaxHeight: |
| 6008 if (id == CSSValueAuto) | 6008 if (id == CSSValueAuto) |
| 6009 validPrimitive = true; | 6009 validPrimitive = true; |
| 6010 else | 6010 else |
| 6011 validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonN
eg)); | 6011 validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonN
eg)); |
| 6012 break; | 6012 break; |
| 6013 case CSSPropertyWidth: // shorthand | 6013 case CSSPropertyWidth: // shorthand |
| 6014 return parseViewportShorthand(propId, CSSPropertyMinWidth, CSSPropertyMa
xWidth, important); | 6014 return parseViewportShorthand(propId, CSSPropertyMinWidth, CSSPropertyMa
xWidth); |
| 6015 case CSSPropertyHeight: | 6015 case CSSPropertyHeight: |
| 6016 return parseViewportShorthand(propId, CSSPropertyMinHeight, CSSPropertyM
axHeight, important); | 6016 return parseViewportShorthand(propId, CSSPropertyMinHeight, CSSPropertyM
axHeight); |
| 6017 case CSSPropertyOrientation: // auto | portrait | landscape | 6017 case CSSPropertyOrientation: // auto | portrait | landscape |
| 6018 if (id == CSSValueAuto || id == CSSValuePortrait || id == CSSValueLandsc
ape) | 6018 if (id == CSSValueAuto || id == CSSValuePortrait || id == CSSValueLandsc
ape) |
| 6019 validPrimitive = true; | 6019 validPrimitive = true; |
| 6020 default: | 6020 default: |
| 6021 break; | 6021 break; |
| 6022 } | 6022 } |
| 6023 | 6023 |
| 6024 RefPtr<CSSValue> parsedValue = nullptr; | 6024 RefPtr<CSSValue> parsedValue = nullptr; |
| 6025 if (validPrimitive) { | 6025 if (validPrimitive) { |
| 6026 parsedValue = parseValidPrimitive(id, value); | 6026 parsedValue = parseValidPrimitive(id, value); |
| 6027 m_valueList->next(); | 6027 m_valueList->next(); |
| 6028 } | 6028 } |
| 6029 | 6029 |
| 6030 if (parsedValue) { | 6030 if (parsedValue) { |
| 6031 if (!m_valueList->current() || inShorthand()) { | 6031 if (!m_valueList->current() || inShorthand()) { |
| 6032 addProperty(propId, parsedValue.release(), important); | 6032 addProperty(propId, parsedValue.release()); |
| 6033 return true; | 6033 return true; |
| 6034 } | 6034 } |
| 6035 } | 6035 } |
| 6036 | 6036 |
| 6037 return false; | 6037 return false; |
| 6038 } | 6038 } |
| 6039 | 6039 |
| 6040 bool CSSPropertyParser::parseViewportShorthand(CSSPropertyID propId, CSSProperty
ID first, CSSPropertyID second, bool important) | 6040 bool CSSPropertyParser::parseViewportShorthand(CSSPropertyID propId, CSSProperty
ID first, CSSPropertyID second) |
| 6041 { | 6041 { |
| 6042 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled() || isUASheetBehavior(m_c
ontext.mode())); | 6042 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled() || isUASheetBehavior(m_c
ontext.mode())); |
| 6043 unsigned numValues = m_valueList->size(); | 6043 unsigned numValues = m_valueList->size(); |
| 6044 | 6044 |
| 6045 if (numValues > 2) | 6045 if (numValues > 2) |
| 6046 return false; | 6046 return false; |
| 6047 | 6047 |
| 6048 ShorthandScope scope(this, propId); | 6048 ShorthandScope scope(this, propId); |
| 6049 | 6049 |
| 6050 if (!parseViewportProperty(first, important)) | 6050 if (!parseViewportProperty(first)) |
| 6051 return false; | 6051 return false; |
| 6052 | 6052 |
| 6053 // If just one value is supplied, the second value | 6053 // If just one value is supplied, the second value |
| 6054 // is implicitly initialized with the first value. | 6054 // is implicitly initialized with the first value. |
| 6055 if (numValues == 1) | 6055 if (numValues == 1) |
| 6056 m_valueList->previous(); | 6056 m_valueList->previous(); |
| 6057 | 6057 |
| 6058 return parseViewportProperty(second, important); | 6058 return parseViewportProperty(second); |
| 6059 } | 6059 } |
| 6060 | 6060 |
| 6061 template <typename CharacterType> | 6061 template <typename CharacterType> |
| 6062 static CSSPropertyID cssPropertyID(const CharacterType* propertyName, unsigned l
ength) | 6062 static CSSPropertyID cssPropertyID(const CharacterType* propertyName, unsigned l
ength) |
| 6063 { | 6063 { |
| 6064 char buffer[maxCSSPropertyNameLength + 1]; // 1 for null character | 6064 char buffer[maxCSSPropertyNameLength + 1]; // 1 for null character |
| 6065 | 6065 |
| 6066 for (unsigned i = 0; i != length; ++i) { | 6066 for (unsigned i = 0; i != length; ++i) { |
| 6067 CharacterType c = propertyName[i]; | 6067 CharacterType c = propertyName[i]; |
| 6068 if (c == 0 || c >= 0x7F) | 6068 if (c == 0 || c >= 0x7F) |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6143 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 6143 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
| 6144 } | 6144 } |
| 6145 | 6145 |
| 6146 bool CSSPropertyParser::isSystemColor(int id) | 6146 bool CSSPropertyParser::isSystemColor(int id) |
| 6147 { | 6147 { |
| 6148 // FIXME(sky): remove | 6148 // FIXME(sky): remove |
| 6149 return false; | 6149 return false; |
| 6150 } | 6150 } |
| 6151 | 6151 |
| 6152 } // namespace blink | 6152 } // namespace blink |
| OLD | NEW |