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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 case CSSPropertyBorderTopColor: | 478 case CSSPropertyBorderTopColor: |
479 case CSSPropertyOutlineColor: | 479 case CSSPropertyOutlineColor: |
480 case CSSPropertyTextLineThroughColor: | 480 case CSSPropertyTextLineThroughColor: |
481 case CSSPropertyTextOverlineColor: | 481 case CSSPropertyTextOverlineColor: |
482 case CSSPropertyTextUnderlineColor: | 482 case CSSPropertyTextUnderlineColor: |
483 case CSSPropertyWebkitBorderAfterColor: | 483 case CSSPropertyWebkitBorderAfterColor: |
484 case CSSPropertyWebkitBorderBeforeColor: | 484 case CSSPropertyWebkitBorderBeforeColor: |
485 case CSSPropertyWebkitBorderEndColor: | 485 case CSSPropertyWebkitBorderEndColor: |
486 case CSSPropertyWebkitBorderStartColor: | 486 case CSSPropertyWebkitBorderStartColor: |
487 case CSSPropertyWebkitColumnRuleColor: | 487 case CSSPropertyWebkitColumnRuleColor: |
488 #if ENABLE(CSS3_TEXT) | |
489 case CSSPropertyWebkitTextDecorationColor: | 488 case CSSPropertyWebkitTextDecorationColor: |
490 #endif // CSS3_TEXT | |
491 case CSSPropertyWebkitTextEmphasisColor: | 489 case CSSPropertyWebkitTextEmphasisColor: |
492 case CSSPropertyWebkitTextFillColor: | 490 case CSSPropertyWebkitTextFillColor: |
493 case CSSPropertyWebkitTextStrokeColor: | 491 case CSSPropertyWebkitTextStrokeColor: |
494 return true; | 492 return true; |
495 default: | 493 default: |
496 return false; | 494 return false; |
497 } | 495 } |
498 } | 496 } |
499 | 497 |
500 static bool parseColorValue(StylePropertySet* declaration, CSSPropertyID propert
yId, const String& string, bool important, CSSParserMode cssParserMode) | 498 static bool parseColorValue(StylePropertySet* declaration, CSSPropertyID propert
yId, const String& string, bool important, CSSParserMode cssParserMode) |
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1877 case CSSPropertyBorderLeftColor: | 1875 case CSSPropertyBorderLeftColor: |
1878 case CSSPropertyWebkitBorderStartColor: | 1876 case CSSPropertyWebkitBorderStartColor: |
1879 case CSSPropertyWebkitBorderEndColor: | 1877 case CSSPropertyWebkitBorderEndColor: |
1880 case CSSPropertyWebkitBorderBeforeColor: | 1878 case CSSPropertyWebkitBorderBeforeColor: |
1881 case CSSPropertyWebkitBorderAfterColor: | 1879 case CSSPropertyWebkitBorderAfterColor: |
1882 case CSSPropertyColor: // <color> | inherit | 1880 case CSSPropertyColor: // <color> | inherit |
1883 case CSSPropertyTextLineThroughColor: // CSS3 text decoration colors | 1881 case CSSPropertyTextLineThroughColor: // CSS3 text decoration colors |
1884 case CSSPropertyTextUnderlineColor: | 1882 case CSSPropertyTextUnderlineColor: |
1885 case CSSPropertyTextOverlineColor: | 1883 case CSSPropertyTextOverlineColor: |
1886 case CSSPropertyWebkitColumnRuleColor: | 1884 case CSSPropertyWebkitColumnRuleColor: |
1887 #if ENABLE(CSS3_TEXT) | |
1888 case CSSPropertyWebkitTextDecorationColor: | 1885 case CSSPropertyWebkitTextDecorationColor: |
1889 #endif // CSS3_TEXT | |
1890 case CSSPropertyWebkitTextEmphasisColor: | 1886 case CSSPropertyWebkitTextEmphasisColor: |
1891 case CSSPropertyWebkitTextFillColor: | 1887 case CSSPropertyWebkitTextFillColor: |
1892 case CSSPropertyWebkitTextStrokeColor: | 1888 case CSSPropertyWebkitTextStrokeColor: |
| 1889 if (propId == CSSPropertyWebkitTextDecorationColor |
| 1890 && !RuntimeEnabledFeatures::css3TextDecorationsEnabled()) |
| 1891 return false; |
| 1892 |
1893 if (id == CSSValueWebkitText) | 1893 if (id == CSSValueWebkitText) |
1894 validPrimitive = true; // Always allow this, even when strict parsin
g is on, | 1894 validPrimitive = true; // Always allow this, even when strict parsin
g is on, |
1895 // since we use this in our UA sheets. | 1895 // since we use this in our UA sheets. |
1896 else if (id == CSSValueCurrentcolor) | 1896 else if (id == CSSValueCurrentcolor) |
1897 validPrimitive = true; | 1897 validPrimitive = true; |
1898 else if ((id >= CSSValueAqua && id <= CSSValueWindowtext) || id == CSSVa
lueMenu || | 1898 else if ((id >= CSSValueAqua && id <= CSSValueWindowtext) || id == CSSVa
lueMenu || |
1899 (id >= CSSValueWebkitFocusRingColor && id < CSSValueWebkitText && i
nQuirksMode())) { | 1899 (id >= CSSValueWebkitFocusRingColor && id < CSSValueWebkitText && i
nQuirksMode())) { |
1900 validPrimitive = true; | 1900 validPrimitive = true; |
1901 } else { | 1901 } else { |
1902 parsedValue = parseColor(); | 1902 parsedValue = parseColor(); |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2175 { | 2175 { |
2176 parsedValue = parseFontFamily(); | 2176 parsedValue = parseFontFamily(); |
2177 break; | 2177 break; |
2178 } | 2178 } |
2179 | 2179 |
2180 case CSSPropertyTextDecoration: | 2180 case CSSPropertyTextDecoration: |
2181 case CSSPropertyWebkitTextDecorationsInEffect: | 2181 case CSSPropertyWebkitTextDecorationsInEffect: |
2182 // none | [ underline || overline || line-through || blink ] | inherit | 2182 // none | [ underline || overline || line-through || blink ] | inherit |
2183 return parseTextDecoration(propId, important); | 2183 return parseTextDecoration(propId, important); |
2184 | 2184 |
2185 #if ENABLE(CSS3_TEXT) | |
2186 case CSSPropertyWebkitTextDecorationLine: | 2185 case CSSPropertyWebkitTextDecorationLine: |
| 2186 if (!RuntimeEnabledFeatures::css3TextDecorationsEnabled()) |
| 2187 return false; |
2187 // none | [ underline || overline || line-through ] | inherit | 2188 // none | [ underline || overline || line-through ] | inherit |
2188 return parseTextDecoration(propId, important); | 2189 return parseTextDecoration(propId, important); |
2189 | 2190 |
2190 case CSSPropertyWebkitTextDecorationStyle: | 2191 case CSSPropertyWebkitTextDecorationStyle: |
| 2192 if (!RuntimeEnabledFeatures::css3TextDecorationsEnabled()) |
| 2193 return false; |
2191 // solid | double | dotted | dashed | wavy | 2194 // solid | double | dotted | dashed | wavy |
2192 if (id == CSSValueSolid || id == CSSValueDouble || id == CSSValueDotted
|| id == CSSValueDashed || id == CSSValueWavy) | 2195 if (id == CSSValueSolid || id == CSSValueDouble || id == CSSValueDotted
|| id == CSSValueDashed || id == CSSValueWavy) |
2193 validPrimitive = true; | 2196 validPrimitive = true; |
2194 break; | 2197 break; |
2195 | 2198 |
2196 case CSSPropertyWebkitTextUnderlinePosition: | 2199 case CSSPropertyWebkitTextUnderlinePosition: |
| 2200 if (!RuntimeEnabledFeatures::css3TextDecorationsEnabled()) |
| 2201 return false; |
2197 // auto | alphabetic | under | 2202 // auto | alphabetic | under |
2198 return parseTextUnderlinePosition(important); | 2203 return parseTextUnderlinePosition(important); |
2199 #endif // CSS3_TEXT | |
2200 | 2204 |
2201 case CSSPropertyZoom: // normal | reset | document | <number> | <pe
rcentage> | inherit | 2205 case CSSPropertyZoom: // normal | reset | document | <number> | <pe
rcentage> | inherit |
2202 if (id == CSSValueNormal || id == CSSValueReset || id == CSSValueDocumen
t) | 2206 if (id == CSSValueNormal || id == CSSValueReset || id == CSSValueDocumen
t) |
2203 validPrimitive = true; | 2207 validPrimitive = true; |
2204 else | 2208 else |
2205 validPrimitive = (!id && validUnit(value, FNumber | FPercent | FNonN
eg, CSSStrictMode)); | 2209 validPrimitive = (!id && validUnit(value, FNumber | FPercent | FNonN
eg, CSSStrictMode)); |
2206 break; | 2210 break; |
2207 | 2211 |
2208 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. | 2212 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. |
2209 if (m_inFilterRule) | 2213 if (m_inFilterRule) |
(...skipping 6598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8808 default: | 8812 default: |
8809 ASSERT_NOT_REACHED(); | 8813 ASSERT_NOT_REACHED(); |
8810 return false; | 8814 return false; |
8811 } | 8815 } |
8812 | 8816 |
8813 return value; | 8817 return value; |
8814 } | 8818 } |
8815 | 8819 |
8816 void CSSParser::addTextDecorationProperty(CSSPropertyID propId, PassRefPtr<CSSVa
lue> value, bool important) | 8820 void CSSParser::addTextDecorationProperty(CSSPropertyID propId, PassRefPtr<CSSVa
lue> value, bool important) |
8817 { | 8821 { |
8818 #if ENABLE(CSS3_TEXT) | |
8819 // The text-decoration-line property takes priority over text-decoration, un
less the latter has important priority set. | 8822 // The text-decoration-line property takes priority over text-decoration, un
less the latter has important priority set. |
8820 if (propId == CSSPropertyTextDecoration && !important && m_currentShorthand
== CSSPropertyInvalid) { | 8823 if (propId == CSSPropertyTextDecoration && !important && m_currentShorthand
== CSSPropertyInvalid) { |
8821 for (unsigned i = 0; i < m_parsedProperties.size(); ++i) { | 8824 for (unsigned i = 0; i < m_parsedProperties.size(); ++i) { |
8822 if (m_parsedProperties[i].id() == CSSPropertyWebkitTextDecorationLin
e) | 8825 if (m_parsedProperties[i].id() == CSSPropertyWebkitTextDecorationLin
e) |
8823 return; | 8826 return; |
8824 } | 8827 } |
8825 } | 8828 } |
8826 #endif // CSS3_TEXT | |
8827 addProperty(propId, value, important); | 8829 addProperty(propId, value, important); |
8828 } | 8830 } |
8829 | 8831 |
8830 bool CSSParser::parseTextDecoration(CSSPropertyID propId, bool important) | 8832 bool CSSParser::parseTextDecoration(CSSPropertyID propId, bool important) |
8831 { | 8833 { |
8832 CSSParserValue* value = m_valueList->current(); | 8834 CSSParserValue* value = m_valueList->current(); |
8833 if (value->id == CSSValueNone) { | 8835 if (value->id == CSSValueNone) { |
8834 addTextDecorationProperty(propId, cssValuePool().createIdentifierValue(C
SSValueNone), important); | 8836 addTextDecorationProperty(propId, cssValuePool().createIdentifierValue(C
SSValueNone), important); |
8835 m_valueList->next(); | 8837 m_valueList->next(); |
8836 return true; | 8838 return true; |
8837 } | 8839 } |
8838 | 8840 |
8839 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 8841 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
8840 bool isValid = true; | 8842 bool isValid = true; |
8841 while (isValid && value) { | 8843 while (isValid && value) { |
8842 switch (value->id) { | 8844 switch (value->id) { |
8843 case CSSValueBlink: | 8845 case CSSValueBlink: |
8844 #if ENABLE(CSS3_TEXT) | |
8845 // Blink value is not accepted by -webkit-text-decoration-line. | 8846 // Blink value is not accepted by -webkit-text-decoration-line. |
8846 isValid = propId != CSSPropertyWebkitTextDecorationLine; | 8847 isValid = propId != CSSPropertyWebkitTextDecorationLine; |
8847 if (isValid) | 8848 if (isValid) |
8848 list->append(cssValuePool().createIdentifierValue(value->id)); | 8849 list->append(cssValuePool().createIdentifierValue(value->id)); |
8849 break; | 8850 break; |
8850 #endif // CSS3_TEXT | |
8851 case CSSValueUnderline: | 8851 case CSSValueUnderline: |
8852 case CSSValueOverline: | 8852 case CSSValueOverline: |
8853 case CSSValueLineThrough: | 8853 case CSSValueLineThrough: |
8854 list->append(cssValuePool().createIdentifierValue(value->id)); | 8854 list->append(cssValuePool().createIdentifierValue(value->id)); |
8855 break; | 8855 break; |
8856 default: | 8856 default: |
8857 isValid = false; | 8857 isValid = false; |
8858 break; | 8858 break; |
8859 } | 8859 } |
8860 if (isValid) | 8860 if (isValid) |
8861 value = m_valueList->next(); | 8861 value = m_valueList->next(); |
8862 } | 8862 } |
8863 | 8863 |
8864 if (list->length() && isValid) { | 8864 if (list->length() && isValid) { |
8865 addTextDecorationProperty(propId, list.release(), important); | 8865 addTextDecorationProperty(propId, list.release(), important); |
8866 return true; | 8866 return true; |
8867 } | 8867 } |
8868 | 8868 |
8869 return false; | 8869 return false; |
8870 } | 8870 } |
8871 | 8871 |
8872 #if ENABLE(CSS3_TEXT) | |
8873 bool CSSParser::parseTextUnderlinePosition(bool important) | 8872 bool CSSParser::parseTextUnderlinePosition(bool important) |
8874 { | 8873 { |
8875 // The text-underline-position property has sintax "auto | alphabetic | [ un
der || [ left | right ] ]". | 8874 // The text-underline-position property has sintax "auto | alphabetic | [ un
der || [ left | right ] ]". |
8876 // However, values 'left' and 'right' are not implemented yet, so we will pa
rse sintax | 8875 // However, values 'left' and 'right' are not implemented yet, so we will pa
rse sintax |
8877 // "auto | alphabetic | under" for now. | 8876 // "auto | alphabetic | under" for now. |
8878 CSSParserValue* value = m_valueList->current(); | 8877 CSSParserValue* value = m_valueList->current(); |
8879 switch (value->id) { | 8878 switch (value->id) { |
8880 case CSSValueAuto: | 8879 case CSSValueAuto: |
8881 case CSSValueAlphabetic: | 8880 case CSSValueAlphabetic: |
8882 case CSSValueUnder: | 8881 case CSSValueUnder: |
8883 if (m_valueList->next()) | 8882 if (m_valueList->next()) |
8884 return false; | 8883 return false; |
8885 | 8884 |
8886 addProperty(CSSPropertyWebkitTextUnderlinePosition, cssValuePool().creat
eIdentifierValue(value->id), important); | 8885 addProperty(CSSPropertyWebkitTextUnderlinePosition, cssValuePool().creat
eIdentifierValue(value->id), important); |
8887 return true; | 8886 return true; |
8888 } | 8887 } |
8889 return false; | 8888 return false; |
8890 } | 8889 } |
8891 #endif // CSS3_TEXT | |
8892 | 8890 |
8893 bool CSSParser::parseTextEmphasisStyle(bool important) | 8891 bool CSSParser::parseTextEmphasisStyle(bool important) |
8894 { | 8892 { |
8895 unsigned valueListSize = m_valueList->size(); | 8893 unsigned valueListSize = m_valueList->size(); |
8896 | 8894 |
8897 RefPtr<CSSPrimitiveValue> fill; | 8895 RefPtr<CSSPrimitiveValue> fill; |
8898 RefPtr<CSSPrimitiveValue> shape; | 8896 RefPtr<CSSPrimitiveValue> shape; |
8899 | 8897 |
8900 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { | 8898 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { |
8901 if (value->unit == CSSPrimitiveValue::CSS_STRING) { | 8899 if (value->unit == CSSPrimitiveValue::CSS_STRING) { |
(...skipping 2775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11677 { | 11675 { |
11678 // The tokenizer checks for the construct of an+b. | 11676 // The tokenizer checks for the construct of an+b. |
11679 // However, since the {ident} rule precedes the {nth} rule, some of those | 11677 // However, since the {ident} rule precedes the {nth} rule, some of those |
11680 // tokens are identified as string literal. Furthermore we need to accept | 11678 // tokens are identified as string literal. Furthermore we need to accept |
11681 // "odd" and "even" which does not match to an+b. | 11679 // "odd" and "even" which does not match to an+b. |
11682 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 11680 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
11683 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 11681 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
11684 } | 11682 } |
11685 | 11683 |
11686 } | 11684 } |
OLD | NEW |