| 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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 if ((id >= CSSValueWebkitAuto && id <= CSSValueWebkitMatchParent) || id
== CSSValueStart || id == CSSValueEnd | 554 if ((id >= CSSValueWebkitAuto && id <= CSSValueWebkitMatchParent) || id
== CSSValueStart || id == CSSValueEnd |
| 555 || value->unit == CSSPrimitiveValue::CSS_STRING) | 555 || value->unit == CSSPrimitiveValue::CSS_STRING) |
| 556 validPrimitive = true; | 556 validPrimitive = true; |
| 557 break; | 557 break; |
| 558 | 558 |
| 559 case CSSPropertyFontWeight: { // normal | bold | bolder | lighter | 100 | 2
00 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit | 559 case CSSPropertyFontWeight: { // normal | bold | bolder | lighter | 100 | 2
00 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit |
| 560 if (m_valueList->size() != 1) | 560 if (m_valueList->size() != 1) |
| 561 return false; | 561 return false; |
| 562 return parseFontWeight(important); | 562 return parseFontWeight(important); |
| 563 } | 563 } |
| 564 | |
| 565 case CSSPropertyFontStretch: { // normal | ultra-condensed | extra-condensed
| condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultr
a-expanded | |
| 566 if (m_valueList->size() != 1) | |
| 567 return false; | |
| 568 return parseFontStretch(important); | |
| 569 } | |
| 570 | |
| 571 case CSSPropertyBorderSpacing: { | 564 case CSSPropertyBorderSpacing: { |
| 572 if (num == 1) { | 565 if (num == 1) { |
| 573 ShorthandScope scope(this, CSSPropertyBorderSpacing); | 566 ShorthandScope scope(this, CSSPropertyBorderSpacing); |
| 574 if (!parseValue(CSSPropertyWebkitBorderHorizontalSpacing, important)
) | 567 if (!parseValue(CSSPropertyWebkitBorderHorizontalSpacing, important)
) |
| 575 return false; | 568 return false; |
| 576 CSSValue* value = m_parsedProperties.last().value(); | 569 CSSValue* value = m_parsedProperties.last().value(); |
| 577 addProperty(CSSPropertyWebkitBorderVerticalSpacing, value, important
); | 570 addProperty(CSSPropertyWebkitBorderVerticalSpacing, value, important
); |
| 578 return true; | 571 return true; |
| 579 } | 572 } |
| 580 else if (num == 2) { | 573 else if (num == 2) { |
| (...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1438 break; | 1431 break; |
| 1439 case CSSPropertyWebkitAnimation: | 1432 case CSSPropertyWebkitAnimation: |
| 1440 return parseAnimationShorthand(propId, important); | 1433 return parseAnimationShorthand(propId, important); |
| 1441 case CSSPropertyTransition: | 1434 case CSSPropertyTransition: |
| 1442 case CSSPropertyWebkitTransition: | 1435 case CSSPropertyWebkitTransition: |
| 1443 return parseTransitionShorthand(propId, important); | 1436 return parseTransitionShorthand(propId, important); |
| 1444 case CSSPropertyInvalid: | 1437 case CSSPropertyInvalid: |
| 1445 return false; | 1438 return false; |
| 1446 case CSSPropertyPage: | 1439 case CSSPropertyPage: |
| 1447 return parsePage(propId, important); | 1440 return parsePage(propId, important); |
| 1441 case CSSPropertyFontStretch: |
| 1442 return false; |
| 1448 // CSS Text Layout Module Level 3: Vertical writing support | 1443 // CSS Text Layout Module Level 3: Vertical writing support |
| 1449 case CSSPropertyWebkitTextEmphasis: | 1444 case CSSPropertyWebkitTextEmphasis: |
| 1450 return parseShorthand(propId, webkitTextEmphasisShorthand(), important); | 1445 return parseShorthand(propId, webkitTextEmphasisShorthand(), important); |
| 1451 | 1446 |
| 1452 case CSSPropertyWebkitTextEmphasisStyle: | 1447 case CSSPropertyWebkitTextEmphasisStyle: |
| 1453 return parseTextEmphasisStyle(important); | 1448 return parseTextEmphasisStyle(important); |
| 1454 | 1449 |
| 1455 case CSSPropertyWebkitTextOrientation: | 1450 case CSSPropertyWebkitTextOrientation: |
| 1456 // FIXME: For now just support sideways, sideways-right, upright and ver
tical-right. | 1451 // FIXME: For now just support sideways, sideways-right, upright and ver
tical-right. |
| 1457 if (id == CSSValueSideways || id == CSSValueSidewaysRight || id == CSSVa
lueVerticalRight || id == CSSValueUpright) | 1452 if (id == CSSValueSideways || id == CSSValueSidewaysRight || id == CSSVa
lueVerticalRight || id == CSSValueUpright) |
| (...skipping 3075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4533 for (unsigned i = 0; i < m_valueList->size(); ++i) { | 4528 for (unsigned i = 0; i < m_valueList->size(); ++i) { |
| 4534 if (m_valueList->valueAt(i)->id == CSSValueInherit || m_valueList->value
At(i)->id == CSSValueInitial) | 4529 if (m_valueList->valueAt(i)->id == CSSValueInherit || m_valueList->value
At(i)->id == CSSValueInitial) |
| 4535 return false; | 4530 return false; |
| 4536 } | 4531 } |
| 4537 | 4532 |
| 4538 ShorthandScope scope(this, CSSPropertyFont); | 4533 ShorthandScope scope(this, CSSPropertyFont); |
| 4539 // Optional font-style, font-variant and font-weight. | 4534 // Optional font-style, font-variant and font-weight. |
| 4540 bool fontStyleParsed = false; | 4535 bool fontStyleParsed = false; |
| 4541 bool fontVariantParsed = false; | 4536 bool fontVariantParsed = false; |
| 4542 bool fontWeightParsed = false; | 4537 bool fontWeightParsed = false; |
| 4543 bool fontStretchParsed = false; | |
| 4544 CSSParserValue* value; | 4538 CSSParserValue* value; |
| 4545 while ((value = m_valueList->current())) { | 4539 while ((value = m_valueList->current())) { |
| 4546 if (!fontStyleParsed && isValidKeywordPropertyAndValue(CSSPropertyFontSt
yle, value->id, m_context)) { | 4540 if (!fontStyleParsed && isValidKeywordPropertyAndValue(CSSPropertyFontSt
yle, value->id, m_context)) { |
| 4547 addProperty(CSSPropertyFontStyle, cssValuePool().createIdentifierVal
ue(value->id), important); | 4541 addProperty(CSSPropertyFontStyle, cssValuePool().createIdentifierVal
ue(value->id), important); |
| 4548 fontStyleParsed = true; | 4542 fontStyleParsed = true; |
| 4549 } else if (!fontVariantParsed && (value->id == CSSValueNormal || value->
id == CSSValueSmallCaps)) { | 4543 } else if (!fontVariantParsed && (value->id == CSSValueNormal || value->
id == CSSValueSmallCaps)) { |
| 4550 // Font variant in the shorthand is particular, it only accepts norm
al or small-caps. | 4544 // Font variant in the shorthand is particular, it only accepts norm
al or small-caps. |
| 4551 addProperty(CSSPropertyFontVariant, cssValuePool().createIdentifierV
alue(value->id), important); | 4545 addProperty(CSSPropertyFontVariant, cssValuePool().createIdentifierV
alue(value->id), important); |
| 4552 fontVariantParsed = true; | 4546 fontVariantParsed = true; |
| 4553 } else if (!fontWeightParsed && parseFontWeight(important)) { | 4547 } else if (!fontWeightParsed && parseFontWeight(important)) |
| 4554 fontWeightParsed = true; | 4548 fontWeightParsed = true; |
| 4555 } else if (!fontStretchParsed && parseFontStretch(important)) { | 4549 else |
| 4556 fontStretchParsed = true; | |
| 4557 } else { | |
| 4558 break; | 4550 break; |
| 4559 } | |
| 4560 m_valueList->next(); | 4551 m_valueList->next(); |
| 4561 } | 4552 } |
| 4562 | 4553 |
| 4563 if (!value) | 4554 if (!value) |
| 4564 return false; | 4555 return false; |
| 4565 | 4556 |
| 4566 if (!fontStyleParsed) | 4557 if (!fontStyleParsed) |
| 4567 addProperty(CSSPropertyFontStyle, cssValuePool().createIdentifierValue(C
SSValueNormal), important, true); | 4558 addProperty(CSSPropertyFontStyle, cssValuePool().createIdentifierValue(C
SSValueNormal), important, true); |
| 4568 if (!fontVariantParsed) | 4559 if (!fontVariantParsed) |
| 4569 addProperty(CSSPropertyFontVariant, cssValuePool().createIdentifierValue
(CSSValueNormal), important, true); | 4560 addProperty(CSSPropertyFontVariant, cssValuePool().createIdentifierValue
(CSSValueNormal), important, true); |
| 4570 if (!fontWeightParsed) | 4561 if (!fontWeightParsed) |
| 4571 addProperty(CSSPropertyFontWeight, cssValuePool().createIdentifierValue(
CSSValueNormal), important, true); | 4562 addProperty(CSSPropertyFontWeight, cssValuePool().createIdentifierValue(
CSSValueNormal), important, true); |
| 4572 if (!fontStretchParsed) | |
| 4573 addProperty(CSSPropertyFontStretch, cssValuePool().createIdentifierValue
(CSSValueNormal), important, true); | |
| 4574 | 4563 |
| 4575 // Now a font size _must_ come. | 4564 // Now a font size _must_ come. |
| 4576 // <absolute-size> | <relative-size> | <length> | <percentage> | inherit | 4565 // <absolute-size> | <relative-size> | <length> | <percentage> | inherit |
| 4577 if (!parseFontSize(important)) | 4566 if (!parseFontSize(important)) |
| 4578 return false; | 4567 return false; |
| 4579 | 4568 |
| 4580 value = m_valueList->current(); | 4569 value = m_valueList->current(); |
| 4581 if (!value) | 4570 if (!value) |
| 4582 return false; | 4571 return false; |
| 4583 | 4572 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4802 if (validUnit(value, FInteger | FNonNeg, HTMLQuirksMode)) { | 4791 if (validUnit(value, FInteger | FNonNeg, HTMLQuirksMode)) { |
| 4803 int weight = static_cast<int>(value->fValue); | 4792 int weight = static_cast<int>(value->fValue); |
| 4804 if (!(weight % 100) && weight >= 100 && weight <= 900) { | 4793 if (!(weight % 100) && weight >= 100 && weight <= 900) { |
| 4805 addProperty(CSSPropertyFontWeight, cssValuePool().createIdentifierVa
lue(static_cast<CSSValueID>(CSSValue100 + weight / 100 - 1)), important); | 4794 addProperty(CSSPropertyFontWeight, cssValuePool().createIdentifierVa
lue(static_cast<CSSValueID>(CSSValue100 + weight / 100 - 1)), important); |
| 4806 return true; | 4795 return true; |
| 4807 } | 4796 } |
| 4808 } | 4797 } |
| 4809 return false; | 4798 return false; |
| 4810 } | 4799 } |
| 4811 | 4800 |
| 4812 bool CSSPropertyParser::parseFontStretch(bool important) | |
| 4813 { | |
| 4814 CSSParserValue* value = m_valueList->current(); | |
| 4815 if (value->id == CSSValueNormal || (value->id >= CSSValueUltraCondensed && v
alue->id <= CSSValueUltraExpanded)) { | |
| 4816 addProperty(CSSPropertyFontStretch, cssValuePool().createIdentifierValue
(value->id), important); | |
| 4817 return true; | |
| 4818 } | |
| 4819 return false; | |
| 4820 } | |
| 4821 | |
| 4822 bool CSSPropertyParser::parseFontFaceSrcURI(CSSValueList* valueList) | 4801 bool CSSPropertyParser::parseFontFaceSrcURI(CSSValueList* valueList) |
| 4823 { | 4802 { |
| 4824 RefPtrWillBeRawPtr<CSSFontFaceSrcValue> uriValue(CSSFontFaceSrcValue::create
(completeURL(m_valueList->current()->string))); | 4803 RefPtrWillBeRawPtr<CSSFontFaceSrcValue> uriValue(CSSFontFaceSrcValue::create
(completeURL(m_valueList->current()->string))); |
| 4825 | 4804 |
| 4826 CSSParserValue* value = m_valueList->next(); | 4805 CSSParserValue* value = m_valueList->next(); |
| 4827 if (!value) { | 4806 if (!value) { |
| 4828 valueList->append(uriValue.release()); | 4807 valueList->append(uriValue.release()); |
| 4829 return true; | 4808 return true; |
| 4830 } | 4809 } |
| 4831 if (value->unit == CSSParserValue::Operator && value->iValue == ',') { | 4810 if (value->unit == CSSParserValue::Operator && value->iValue == ',') { |
| (...skipping 3644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8476 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); | 8455 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); |
| 8477 if (!seenStroke) | 8456 if (!seenStroke) |
| 8478 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); | 8457 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); |
| 8479 if (!seenMarkers) | 8458 if (!seenMarkers) |
| 8480 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); | 8459 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); |
| 8481 | 8460 |
| 8482 return parsedValues.release(); | 8461 return parsedValues.release(); |
| 8483 } | 8462 } |
| 8484 | 8463 |
| 8485 } // namespace WebCore | 8464 } // namespace WebCore |
| OLD | NEW |