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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 case CSSPropertyBorderTopColor: | 416 case CSSPropertyBorderTopColor: |
417 case CSSPropertyOutlineColor: | 417 case CSSPropertyOutlineColor: |
418 case CSSPropertyTextLineThroughColor: | 418 case CSSPropertyTextLineThroughColor: |
419 case CSSPropertyTextOverlineColor: | 419 case CSSPropertyTextOverlineColor: |
420 case CSSPropertyTextUnderlineColor: | 420 case CSSPropertyTextUnderlineColor: |
421 case CSSPropertyWebkitBorderAfterColor: | 421 case CSSPropertyWebkitBorderAfterColor: |
422 case CSSPropertyWebkitBorderBeforeColor: | 422 case CSSPropertyWebkitBorderBeforeColor: |
423 case CSSPropertyWebkitBorderEndColor: | 423 case CSSPropertyWebkitBorderEndColor: |
424 case CSSPropertyWebkitBorderStartColor: | 424 case CSSPropertyWebkitBorderStartColor: |
425 case CSSPropertyWebkitColumnRuleColor: | 425 case CSSPropertyWebkitColumnRuleColor: |
426 #if ENABLE(CSS3_TEXT) | |
427 case CSSPropertyWebkitTextDecorationColor: | |
428 #endif // CSS3_TEXT | |
429 case CSSPropertyWebkitTextEmphasisColor: | 426 case CSSPropertyWebkitTextEmphasisColor: |
430 case CSSPropertyWebkitTextFillColor: | 427 case CSSPropertyWebkitTextFillColor: |
431 case CSSPropertyWebkitTextStrokeColor: | 428 case CSSPropertyWebkitTextStrokeColor: |
432 return true; | 429 return true; |
| 430 case CSSPropertyTextDecorationColor: |
| 431 return RuntimeEnabledFeatures::css3TextDecorationsEnabled(); |
433 default: | 432 default: |
434 return false; | 433 return false; |
435 } | 434 } |
436 } | 435 } |
437 | 436 |
438 static bool parseColorValue(MutableStylePropertySet* declaration, CSSPropertyID
propertyId, const String& string, bool important, CSSParserMode cssParserMode) | 437 static bool parseColorValue(MutableStylePropertySet* declaration, CSSPropertyID
propertyId, const String& string, bool important, CSSParserMode cssParserMode) |
439 { | 438 { |
440 ASSERT(!string.isEmpty()); | 439 ASSERT(!string.isEmpty()); |
441 bool strict = isStrictParserMode(cssParserMode); | 440 bool strict = isStrictParserMode(cssParserMode); |
442 if (!isColorPropertyID(propertyId)) | 441 if (!isColorPropertyID(propertyId)) |
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1817 case CSSPropertyBackgroundColor: // <color> | inherit | 1816 case CSSPropertyBackgroundColor: // <color> | inherit |
1818 case CSSPropertyBorderTopColor: // <color> | inherit | 1817 case CSSPropertyBorderTopColor: // <color> | inherit |
1819 case CSSPropertyBorderRightColor: | 1818 case CSSPropertyBorderRightColor: |
1820 case CSSPropertyBorderBottomColor: | 1819 case CSSPropertyBorderBottomColor: |
1821 case CSSPropertyBorderLeftColor: | 1820 case CSSPropertyBorderLeftColor: |
1822 case CSSPropertyWebkitBorderStartColor: | 1821 case CSSPropertyWebkitBorderStartColor: |
1823 case CSSPropertyWebkitBorderEndColor: | 1822 case CSSPropertyWebkitBorderEndColor: |
1824 case CSSPropertyWebkitBorderBeforeColor: | 1823 case CSSPropertyWebkitBorderBeforeColor: |
1825 case CSSPropertyWebkitBorderAfterColor: | 1824 case CSSPropertyWebkitBorderAfterColor: |
1826 case CSSPropertyColor: // <color> | inherit | 1825 case CSSPropertyColor: // <color> | inherit |
1827 case CSSPropertyTextLineThroughColor: // CSS3 text decoration colors | 1826 case CSSPropertyTextDecorationColor: // CSS3 text decoration colors |
| 1827 case CSSPropertyTextLineThroughColor: |
1828 case CSSPropertyTextUnderlineColor: | 1828 case CSSPropertyTextUnderlineColor: |
1829 case CSSPropertyTextOverlineColor: | 1829 case CSSPropertyTextOverlineColor: |
1830 case CSSPropertyWebkitColumnRuleColor: | 1830 case CSSPropertyWebkitColumnRuleColor: |
1831 #if ENABLE(CSS3_TEXT) | |
1832 case CSSPropertyWebkitTextDecorationColor: | |
1833 #endif // CSS3_TEXT | |
1834 case CSSPropertyWebkitTextEmphasisColor: | 1831 case CSSPropertyWebkitTextEmphasisColor: |
1835 case CSSPropertyWebkitTextFillColor: | 1832 case CSSPropertyWebkitTextFillColor: |
1836 case CSSPropertyWebkitTextStrokeColor: | 1833 case CSSPropertyWebkitTextStrokeColor: |
| 1834 if (propId == CSSPropertyTextDecorationColor |
| 1835 && !RuntimeEnabledFeatures::css3TextDecorationsEnabled()) |
| 1836 return false; |
| 1837 |
1837 if (id == CSSValueWebkitText) | 1838 if (id == CSSValueWebkitText) |
1838 validPrimitive = true; // Always allow this, even when strict parsin
g is on, | 1839 validPrimitive = true; // Always allow this, even when strict parsin
g is on, |
1839 // since we use this in our UA sheets. | 1840 // since we use this in our UA sheets. |
1840 else if (id == CSSValueCurrentcolor) | 1841 else if (id == CSSValueCurrentcolor) |
1841 validPrimitive = true; | 1842 validPrimitive = true; |
1842 else if ((id >= CSSValueAqua && id <= CSSValueWindowtext) || id == CSSVa
lueMenu || | 1843 else if ((id >= CSSValueAqua && id <= CSSValueWindowtext) || id == CSSVa
lueMenu || |
1843 (id >= CSSValueWebkitFocusRingColor && id < CSSValueWebkitText && i
nQuirksMode())) { | 1844 (id >= CSSValueWebkitFocusRingColor && id < CSSValueWebkitText && i
nQuirksMode())) { |
1844 validPrimitive = true; | 1845 validPrimitive = true; |
1845 } else { | 1846 } else { |
1846 parsedValue = parseColor(); | 1847 parsedValue = parseColor(); |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2119 { | 2120 { |
2120 parsedValue = parseFontFamily(); | 2121 parsedValue = parseFontFamily(); |
2121 break; | 2122 break; |
2122 } | 2123 } |
2123 | 2124 |
2124 case CSSPropertyTextDecoration: | 2125 case CSSPropertyTextDecoration: |
2125 case CSSPropertyWebkitTextDecorationsInEffect: | 2126 case CSSPropertyWebkitTextDecorationsInEffect: |
2126 // none | [ underline || overline || line-through || blink ] | inherit | 2127 // none | [ underline || overline || line-through || blink ] | inherit |
2127 return parseTextDecoration(propId, important); | 2128 return parseTextDecoration(propId, important); |
2128 | 2129 |
2129 #if ENABLE(CSS3_TEXT) | 2130 case CSSPropertyTextDecorationLine: |
2130 case CSSPropertyWebkitTextDecorationLine: | |
2131 // none | [ underline || overline || line-through ] | inherit | 2131 // none | [ underline || overline || line-through ] | inherit |
2132 return parseTextDecoration(propId, important); | 2132 return parseTextDecoration(propId, important); |
2133 | 2133 |
2134 case CSSPropertyWebkitTextDecorationStyle: | 2134 case CSSPropertyTextDecorationStyle: |
2135 // solid | double | dotted | dashed | wavy | 2135 // solid | double | dotted | dashed | wavy |
2136 if (id == CSSValueSolid || id == CSSValueDouble || id == CSSValueDotted
|| id == CSSValueDashed || id == CSSValueWavy) | 2136 if (RuntimeEnabledFeatures::css3TextDecorationsEnabled() |
| 2137 && (id == CSSValueSolid || id == CSSValueDouble || id == CSSValueDot
ted || id == CSSValueDashed || id == CSSValueWavy)) |
2137 validPrimitive = true; | 2138 validPrimitive = true; |
2138 break; | 2139 break; |
2139 | 2140 |
| 2141 #if ENABLE(CSS3_TEXT) |
2140 case CSSPropertyWebkitTextUnderlinePosition: | 2142 case CSSPropertyWebkitTextUnderlinePosition: |
2141 // auto | alphabetic | under | 2143 // auto | alphabetic | under |
2142 return parseTextUnderlinePosition(important); | 2144 return parseTextUnderlinePosition(important); |
2143 #endif // CSS3_TEXT | 2145 #endif // CSS3_TEXT |
2144 | 2146 |
2145 case CSSPropertyZoom: // normal | reset | document | <number> | <pe
rcentage> | inherit | 2147 case CSSPropertyZoom: // normal | reset | document | <number> | <pe
rcentage> | inherit |
2146 if (id == CSSValueNormal || id == CSSValueReset || id == CSSValueDocumen
t) | 2148 if (id == CSSValueNormal || id == CSSValueReset || id == CSSValueDocumen
t) |
2147 validPrimitive = true; | 2149 validPrimitive = true; |
2148 else | 2150 else |
2149 validPrimitive = (!id && validUnit(value, FNumber | FPercent | FNonN
eg, CSSStrictMode)); | 2151 validPrimitive = (!id && validUnit(value, FNumber | FPercent | FNonN
eg, CSSStrictMode)); |
(...skipping 6628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8778 default: | 8780 default: |
8779 ASSERT_NOT_REACHED(); | 8781 ASSERT_NOT_REACHED(); |
8780 return false; | 8782 return false; |
8781 } | 8783 } |
8782 | 8784 |
8783 return value; | 8785 return value; |
8784 } | 8786 } |
8785 | 8787 |
8786 void CSSParser::addTextDecorationProperty(CSSPropertyID propId, PassRefPtr<CSSVa
lue> value, bool important) | 8788 void CSSParser::addTextDecorationProperty(CSSPropertyID propId, PassRefPtr<CSSVa
lue> value, bool important) |
8787 { | 8789 { |
8788 #if ENABLE(CSS3_TEXT) | |
8789 // The text-decoration-line property takes priority over text-decoration, un
less the latter has important priority set. | 8790 // The text-decoration-line property takes priority over text-decoration, un
less the latter has important priority set. |
8790 if (propId == CSSPropertyTextDecoration && !important && m_currentShorthand
== CSSPropertyInvalid) { | 8791 if (propId == CSSPropertyTextDecoration && !important && m_currentShorthand
== CSSPropertyInvalid) { |
8791 for (unsigned i = 0; i < m_parsedProperties.size(); ++i) { | 8792 for (unsigned i = 0; i < m_parsedProperties.size(); ++i) { |
8792 if (m_parsedProperties[i].id() == CSSPropertyWebkitTextDecorationLin
e) | 8793 if (m_parsedProperties[i].id() == CSSPropertyTextDecorationLine) |
8793 return; | 8794 return; |
8794 } | 8795 } |
8795 } | 8796 } |
8796 #endif // CSS3_TEXT | |
8797 addProperty(propId, value, important); | 8797 addProperty(propId, value, important); |
8798 } | 8798 } |
8799 | 8799 |
8800 bool CSSParser::parseTextDecoration(CSSPropertyID propId, bool important) | 8800 bool CSSParser::parseTextDecoration(CSSPropertyID propId, bool important) |
8801 { | 8801 { |
| 8802 if (propId == CSSPropertyTextDecorationLine |
| 8803 && !RuntimeEnabledFeatures::css3TextDecorationsEnabled()) |
| 8804 return false; |
| 8805 |
8802 CSSParserValue* value = m_valueList->current(); | 8806 CSSParserValue* value = m_valueList->current(); |
8803 if (value->id == CSSValueNone) { | 8807 if (value->id == CSSValueNone) { |
8804 addTextDecorationProperty(propId, cssValuePool().createIdentifierValue(C
SSValueNone), important); | 8808 addTextDecorationProperty(propId, cssValuePool().createIdentifierValue(C
SSValueNone), important); |
8805 m_valueList->next(); | 8809 m_valueList->next(); |
8806 return true; | 8810 return true; |
8807 } | 8811 } |
8808 | 8812 |
8809 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 8813 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
8810 bool isValid = true; | 8814 bool isValid = true; |
8811 while (isValid && value) { | 8815 while (isValid && value) { |
8812 switch (value->id) { | 8816 switch (value->id) { |
8813 case CSSValueBlink: | 8817 case CSSValueBlink: |
8814 #if ENABLE(CSS3_TEXT) | 8818 // Blink value is not accepted by text-decoration-line. |
8815 // Blink value is not accepted by -webkit-text-decoration-line. | 8819 isValid = propId != CSSPropertyTextDecorationLine; |
8816 isValid = propId != CSSPropertyWebkitTextDecorationLine; | |
8817 if (isValid) | 8820 if (isValid) |
8818 list->append(cssValuePool().createIdentifierValue(value->id)); | 8821 list->append(cssValuePool().createIdentifierValue(value->id)); |
8819 break; | 8822 break; |
8820 #endif // CSS3_TEXT | |
8821 case CSSValueUnderline: | 8823 case CSSValueUnderline: |
8822 case CSSValueOverline: | 8824 case CSSValueOverline: |
8823 case CSSValueLineThrough: | 8825 case CSSValueLineThrough: |
8824 list->append(cssValuePool().createIdentifierValue(value->id)); | 8826 list->append(cssValuePool().createIdentifierValue(value->id)); |
8825 break; | 8827 break; |
8826 default: | 8828 default: |
8827 isValid = false; | 8829 isValid = false; |
8828 break; | 8830 break; |
8829 } | 8831 } |
8830 if (isValid) | 8832 if (isValid) |
(...skipping 2923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11754 { | 11756 { |
11755 // The tokenizer checks for the construct of an+b. | 11757 // The tokenizer checks for the construct of an+b. |
11756 // However, since the {ident} rule precedes the {nth} rule, some of those | 11758 // However, since the {ident} rule precedes the {nth} rule, some of those |
11757 // tokens are identified as string literal. Furthermore we need to accept | 11759 // tokens are identified as string literal. Furthermore we need to accept |
11758 // "odd" and "even" which does not match to an+b. | 11760 // "odd" and "even" which does not match to an+b. |
11759 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 11761 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
11760 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 11762 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
11761 } | 11763 } |
11762 | 11764 |
11763 } | 11765 } |
OLD | NEW |