| 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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 if ((id >= CSSValueWebkitAuto && id <= CSSValueWebkitMatchParent) || id
== CSSValueStart || id == CSSValueEnd | 523 if ((id >= CSSValueWebkitAuto && id <= CSSValueWebkitMatchParent) || id
== CSSValueStart || id == CSSValueEnd |
| 524 || value->unit == CSSPrimitiveValue::CSS_STRING) | 524 || value->unit == CSSPrimitiveValue::CSS_STRING) |
| 525 validPrimitive = true; | 525 validPrimitive = true; |
| 526 break; | 526 break; |
| 527 | 527 |
| 528 case CSSPropertyFontWeight: { // normal | bold | bolder | lighter | 100 | 2
00 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit | 528 case CSSPropertyFontWeight: { // normal | bold | bolder | lighter | 100 | 2
00 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit |
| 529 if (m_valueList->size() != 1) | 529 if (m_valueList->size() != 1) |
| 530 return false; | 530 return false; |
| 531 return parseFontWeight(important); | 531 return parseFontWeight(important); |
| 532 } | 532 } |
| 533 |
| 534 case CSSPropertyFontStretch: { // normal | ultra-condensed | extra-condensed
| condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultr
a-expanded |
| 535 if (m_valueList->size() != 1) |
| 536 return false; |
| 537 return parseFontStretch(important); |
| 538 } |
| 539 |
| 533 case CSSPropertyBorderSpacing: { | 540 case CSSPropertyBorderSpacing: { |
| 534 if (num == 1) { | 541 if (num == 1) { |
| 535 ShorthandScope scope(this, CSSPropertyBorderSpacing); | 542 ShorthandScope scope(this, CSSPropertyBorderSpacing); |
| 536 if (!parseValue(CSSPropertyWebkitBorderHorizontalSpacing, important)
) | 543 if (!parseValue(CSSPropertyWebkitBorderHorizontalSpacing, important)
) |
| 537 return false; | 544 return false; |
| 538 CSSValue* value = m_parsedProperties.last().value(); | 545 CSSValue* value = m_parsedProperties.last().value(); |
| 539 addProperty(CSSPropertyWebkitBorderVerticalSpacing, value, important
); | 546 addProperty(CSSPropertyWebkitBorderVerticalSpacing, value, important
); |
| 540 return true; | 547 return true; |
| 541 } | 548 } |
| 542 else if (num == 2) { | 549 else if (num == 2) { |
| (...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1437 break; | 1444 break; |
| 1438 case CSSPropertyWebkitAnimation: | 1445 case CSSPropertyWebkitAnimation: |
| 1439 return parseAnimationShorthand(propId, important); | 1446 return parseAnimationShorthand(propId, important); |
| 1440 case CSSPropertyTransition: | 1447 case CSSPropertyTransition: |
| 1441 case CSSPropertyWebkitTransition: | 1448 case CSSPropertyWebkitTransition: |
| 1442 return parseTransitionShorthand(propId, important); | 1449 return parseTransitionShorthand(propId, important); |
| 1443 case CSSPropertyInvalid: | 1450 case CSSPropertyInvalid: |
| 1444 return false; | 1451 return false; |
| 1445 case CSSPropertyPage: | 1452 case CSSPropertyPage: |
| 1446 return parsePage(propId, important); | 1453 return parsePage(propId, important); |
| 1447 case CSSPropertyFontStretch: | |
| 1448 return false; | |
| 1449 // CSS Text Layout Module Level 3: Vertical writing support | 1454 // CSS Text Layout Module Level 3: Vertical writing support |
| 1450 case CSSPropertyWebkitTextEmphasis: | 1455 case CSSPropertyWebkitTextEmphasis: |
| 1451 return parseShorthand(propId, webkitTextEmphasisShorthand(), important); | 1456 return parseShorthand(propId, webkitTextEmphasisShorthand(), important); |
| 1452 | 1457 |
| 1453 case CSSPropertyWebkitTextEmphasisStyle: | 1458 case CSSPropertyWebkitTextEmphasisStyle: |
| 1454 return parseTextEmphasisStyle(important); | 1459 return parseTextEmphasisStyle(important); |
| 1455 | 1460 |
| 1456 case CSSPropertyWebkitTextOrientation: | 1461 case CSSPropertyWebkitTextOrientation: |
| 1457 // FIXME: For now just support sideways, sideways-right, upright and ver
tical-right. | 1462 // FIXME: For now just support sideways, sideways-right, upright and ver
tical-right. |
| 1458 if (id == CSSValueSideways || id == CSSValueSidewaysRight || id == CSSVa
lueVerticalRight || id == CSSValueUpright) | 1463 if (id == CSSValueSideways || id == CSSValueSidewaysRight || id == CSSVa
lueVerticalRight || id == CSSValueUpright) |
| (...skipping 3071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4530 for (unsigned i = 0; i < m_valueList->size(); ++i) { | 4535 for (unsigned i = 0; i < m_valueList->size(); ++i) { |
| 4531 if (m_valueList->valueAt(i)->id == CSSValueInherit || m_valueList->value
At(i)->id == CSSValueInitial) | 4536 if (m_valueList->valueAt(i)->id == CSSValueInherit || m_valueList->value
At(i)->id == CSSValueInitial) |
| 4532 return false; | 4537 return false; |
| 4533 } | 4538 } |
| 4534 | 4539 |
| 4535 ShorthandScope scope(this, CSSPropertyFont); | 4540 ShorthandScope scope(this, CSSPropertyFont); |
| 4536 // Optional font-style, font-variant and font-weight. | 4541 // Optional font-style, font-variant and font-weight. |
| 4537 bool fontStyleParsed = false; | 4542 bool fontStyleParsed = false; |
| 4538 bool fontVariantParsed = false; | 4543 bool fontVariantParsed = false; |
| 4539 bool fontWeightParsed = false; | 4544 bool fontWeightParsed = false; |
| 4545 bool fontStretchParsed = false; |
| 4540 CSSParserValue* value = m_valueList->current(); | 4546 CSSParserValue* value = m_valueList->current(); |
| 4541 for (; value; value = m_valueList->next()) { | 4547 for (; value; value = m_valueList->next()) { |
| 4542 if (!fontStyleParsed && isValidKeywordPropertyAndValue(CSSPropertyFontSt
yle, value->id, m_context)) { | 4548 if (!fontStyleParsed && isValidKeywordPropertyAndValue(CSSPropertyFontSt
yle, value->id, m_context)) { |
| 4543 addProperty(CSSPropertyFontStyle, cssValuePool().createIdentifierVal
ue(value->id), important); | 4549 addProperty(CSSPropertyFontStyle, cssValuePool().createIdentifierVal
ue(value->id), important); |
| 4544 fontStyleParsed = true; | 4550 fontStyleParsed = true; |
| 4545 } else if (!fontVariantParsed && (value->id == CSSValueNormal || value->
id == CSSValueSmallCaps)) { | 4551 } else if (!fontVariantParsed && (value->id == CSSValueNormal || value->
id == CSSValueSmallCaps)) { |
| 4546 // Font variant in the shorthand is particular, it only accepts norm
al or small-caps. | 4552 // Font variant in the shorthand is particular, it only accepts norm
al or small-caps. |
| 4547 addProperty(CSSPropertyFontVariant, cssValuePool().createIdentifierV
alue(value->id), important); | 4553 addProperty(CSSPropertyFontVariant, cssValuePool().createIdentifierV
alue(value->id), important); |
| 4548 fontVariantParsed = true; | 4554 fontVariantParsed = true; |
| 4549 } else if (!fontWeightParsed && parseFontWeight(important)) | 4555 } else if (!fontWeightParsed && parseFontWeight(important)) { |
| 4550 fontWeightParsed = true; | 4556 fontWeightParsed = true; |
| 4551 else | 4557 } else if (!fontStretchParsed && parseFontStretch(important)) { |
| 4558 fontStretchParsed = true; |
| 4559 } else { |
| 4552 break; | 4560 break; |
| 4561 } |
| 4553 } | 4562 } |
| 4554 | 4563 |
| 4555 if (!value) | 4564 if (!value) |
| 4556 return false; | 4565 return false; |
| 4557 | 4566 |
| 4558 if (!fontStyleParsed) | 4567 if (!fontStyleParsed) |
| 4559 addProperty(CSSPropertyFontStyle, cssValuePool().createIdentifierValue(C
SSValueNormal), important, true); | 4568 addProperty(CSSPropertyFontStyle, cssValuePool().createIdentifierValue(C
SSValueNormal), important, true); |
| 4560 if (!fontVariantParsed) | 4569 if (!fontVariantParsed) |
| 4561 addProperty(CSSPropertyFontVariant, cssValuePool().createIdentifierValue
(CSSValueNormal), important, true); | 4570 addProperty(CSSPropertyFontVariant, cssValuePool().createIdentifierValue
(CSSValueNormal), important, true); |
| 4562 if (!fontWeightParsed) | 4571 if (!fontWeightParsed) |
| 4563 addProperty(CSSPropertyFontWeight, cssValuePool().createIdentifierValue(
CSSValueNormal), important, true); | 4572 addProperty(CSSPropertyFontWeight, cssValuePool().createIdentifierValue(
CSSValueNormal), important, true); |
| 4573 if (!fontStretchParsed) |
| 4574 addProperty(CSSPropertyFontStretch, cssValuePool().createIdentifierValue
(CSSValueNormal), important, true); |
| 4564 | 4575 |
| 4565 // Now a font size _must_ come. | 4576 // Now a font size _must_ come. |
| 4566 // <absolute-size> | <relative-size> | <length> | <percentage> | inherit | 4577 // <absolute-size> | <relative-size> | <length> | <percentage> | inherit |
| 4567 if (!parseFontSize(important)) | 4578 if (!parseFontSize(important)) |
| 4568 return false; | 4579 return false; |
| 4569 | 4580 |
| 4570 value = m_valueList->current(); | 4581 value = m_valueList->current(); |
| 4571 if (!value) | 4582 if (!value) |
| 4572 return false; | 4583 return false; |
| 4573 | 4584 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4794 if (validUnit(value, FInteger | FNonNeg, HTMLQuirksMode)) { | 4805 if (validUnit(value, FInteger | FNonNeg, HTMLQuirksMode)) { |
| 4795 int weight = static_cast<int>(value->fValue); | 4806 int weight = static_cast<int>(value->fValue); |
| 4796 if (!(weight % 100) && weight >= 100 && weight <= 900) { | 4807 if (!(weight % 100) && weight >= 100 && weight <= 900) { |
| 4797 addProperty(CSSPropertyFontWeight, cssValuePool().createIdentifierVa
lue(static_cast<CSSValueID>(CSSValue100 + weight / 100 - 1)), important); | 4808 addProperty(CSSPropertyFontWeight, cssValuePool().createIdentifierVa
lue(static_cast<CSSValueID>(CSSValue100 + weight / 100 - 1)), important); |
| 4798 return true; | 4809 return true; |
| 4799 } | 4810 } |
| 4800 } | 4811 } |
| 4801 return false; | 4812 return false; |
| 4802 } | 4813 } |
| 4803 | 4814 |
| 4815 bool CSSPropertyParser::parseFontStretch(bool important) |
| 4816 { |
| 4817 CSSParserValue* value = m_valueList->current(); |
| 4818 if (value->id == CSSValueNormal || (value->id >= CSSValueUltraCondensed && v
alue->id <= CSSValueUltraExpanded)) { |
| 4819 addProperty(CSSPropertyFontStretch, cssValuePool().createIdentifierValue
(value->id), important); |
| 4820 return true; |
| 4821 } |
| 4822 return false; |
| 4823 } |
| 4824 |
| 4804 bool CSSPropertyParser::parseFontFaceSrcURI(CSSValueList* valueList) | 4825 bool CSSPropertyParser::parseFontFaceSrcURI(CSSValueList* valueList) |
| 4805 { | 4826 { |
| 4806 RefPtrWillBeRawPtr<CSSFontFaceSrcValue> uriValue(CSSFontFaceSrcValue::create
(completeURL(m_valueList->current()->string))); | 4827 RefPtrWillBeRawPtr<CSSFontFaceSrcValue> uriValue(CSSFontFaceSrcValue::create
(completeURL(m_valueList->current()->string))); |
| 4807 uriValue->setReferrer(m_context.referrer()); | 4828 uriValue->setReferrer(m_context.referrer()); |
| 4808 | 4829 |
| 4809 CSSParserValue* value = m_valueList->next(); | 4830 CSSParserValue* value = m_valueList->next(); |
| 4810 if (!value) { | 4831 if (!value) { |
| 4811 valueList->append(uriValue.release()); | 4832 valueList->append(uriValue.release()); |
| 4812 return true; | 4833 return true; |
| 4813 } | 4834 } |
| (...skipping 3670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8484 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); | 8505 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); |
| 8485 if (!seenStroke) | 8506 if (!seenStroke) |
| 8486 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); | 8507 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); |
| 8487 if (!seenMarkers) | 8508 if (!seenMarkers) |
| 8488 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); | 8509 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); |
| 8489 | 8510 |
| 8490 return parsedValues.release(); | 8511 return parsedValues.release(); |
| 8491 } | 8512 } |
| 8492 | 8513 |
| 8493 } // namespace blink | 8514 } // namespace blink |
| OLD | NEW |