| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 #include "CSSImageSetValue.h" | 95 #include "CSSImageSetValue.h" |
| 96 #endif | 96 #endif |
| 97 | 97 |
| 98 #if ENABLE(CSS_FILTERS) | 98 #if ENABLE(CSS_FILTERS) |
| 99 #include "WebKitCSSFilterValue.h" | 99 #include "WebKitCSSFilterValue.h" |
| 100 #if ENABLE(SVG) | 100 #if ENABLE(SVG) |
| 101 #include "WebKitCSSSVGDocumentValue.h" | 101 #include "WebKitCSSSVGDocumentValue.h" |
| 102 #endif | 102 #endif |
| 103 #endif | 103 #endif |
| 104 | 104 |
| 105 #if ENABLE(CSS_SHADERS) | |
| 106 #include "WebKitCSSArrayFunctionValue.h" | 105 #include "WebKitCSSArrayFunctionValue.h" |
| 107 #include "WebKitCSSMixFunctionValue.h" | 106 #include "WebKitCSSMixFunctionValue.h" |
| 108 #include "WebKitCSSShaderValue.h" | 107 #include "WebKitCSSShaderValue.h" |
| 109 #endif | |
| 110 | 108 |
| 111 #define YYDEBUG 0 | 109 #define YYDEBUG 0 |
| 112 | 110 |
| 113 #if YYDEBUG > 0 | 111 #if YYDEBUG > 0 |
| 114 extern int cssyydebug; | 112 extern int cssyydebug; |
| 115 #endif | 113 #endif |
| 116 | 114 |
| 117 extern int cssyyparse(WebCore::CSSParser*); | 115 extern int cssyyparse(WebCore::CSSParser*); |
| 118 | 116 |
| 119 using namespace std; | 117 using namespace std; |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 , m_supportsCondition(false) | 302 , m_supportsCondition(false) |
| 305 #endif | 303 #endif |
| 306 , m_selectorListForParseSelector(0) | 304 , m_selectorListForParseSelector(0) |
| 307 , m_numParsedPropertiesBeforeMarginBox(INVALID_NUM_PARSED_PROPERTIES) | 305 , m_numParsedPropertiesBeforeMarginBox(INVALID_NUM_PARSED_PROPERTIES) |
| 308 , m_inParseShorthand(0) | 306 , m_inParseShorthand(0) |
| 309 , m_currentShorthand(CSSPropertyInvalid) | 307 , m_currentShorthand(CSSPropertyInvalid) |
| 310 , m_implicitShorthand(false) | 308 , m_implicitShorthand(false) |
| 311 , m_hasFontFaceOnlyValues(false) | 309 , m_hasFontFaceOnlyValues(false) |
| 312 , m_hadSyntacticallyValidCSSRule(false) | 310 , m_hadSyntacticallyValidCSSRule(false) |
| 313 , m_logErrors(false) | 311 , m_logErrors(false) |
| 314 #if ENABLE(CSS_SHADERS) | |
| 315 , m_inFilterRule(false) | 312 , m_inFilterRule(false) |
| 316 #endif | |
| 317 , m_defaultNamespace(starAtom) | 313 , m_defaultNamespace(starAtom) |
| 318 , m_parsedTextPrefixLength(0) | 314 , m_parsedTextPrefixLength(0) |
| 319 , m_propertyRange(UINT_MAX, UINT_MAX) | 315 , m_propertyRange(UINT_MAX, UINT_MAX) |
| 320 , m_ruleSourceDataResult(0) | 316 , m_ruleSourceDataResult(0) |
| 321 , m_parsingMode(NormalMode) | 317 , m_parsingMode(NormalMode) |
| 322 , m_is8BitSource(false) | 318 , m_is8BitSource(false) |
| 323 , m_currentCharacter8(0) | 319 , m_currentCharacter8(0) |
| 324 , m_currentCharacter16(0) | 320 , m_currentCharacter16(0) |
| 325 , m_length(0) | 321 , m_length(0) |
| 326 , m_token(0) | 322 , m_token(0) |
| (...skipping 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2281 #endif // CSS3_TEXT | 2277 #endif // CSS3_TEXT |
| 2282 | 2278 |
| 2283 case CSSPropertyZoom: // normal | reset | document | <number> | <pe
rcentage> | inherit | 2279 case CSSPropertyZoom: // normal | reset | document | <number> | <pe
rcentage> | inherit |
| 2284 if (id == CSSValueNormal || id == CSSValueReset || id == CSSValueDocumen
t) | 2280 if (id == CSSValueNormal || id == CSSValueReset || id == CSSValueDocumen
t) |
| 2285 validPrimitive = true; | 2281 validPrimitive = true; |
| 2286 else | 2282 else |
| 2287 validPrimitive = (!id && validUnit(value, FNumber | FPercent | FNonN
eg, CSSStrictMode)); | 2283 validPrimitive = (!id && validUnit(value, FNumber | FPercent | FNonN
eg, CSSStrictMode)); |
| 2288 break; | 2284 break; |
| 2289 | 2285 |
| 2290 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. | 2286 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. |
| 2291 #if ENABLE(CSS_SHADERS) | |
| 2292 if (m_inFilterRule) | 2287 if (m_inFilterRule) |
| 2293 return parseFilterRuleSrc(); | 2288 return parseFilterRuleSrc(); |
| 2294 #endif | |
| 2295 return parseFontFaceSrc(); | 2289 return parseFontFaceSrc(); |
| 2296 | 2290 |
| 2297 case CSSPropertyUnicodeRange: | 2291 case CSSPropertyUnicodeRange: |
| 2298 return parseFontFaceUnicodeRange(); | 2292 return parseFontFaceUnicodeRange(); |
| 2299 | 2293 |
| 2300 /* CSS3 properties */ | 2294 /* CSS3 properties */ |
| 2301 | 2295 |
| 2302 case CSSPropertyBorderImage: { | 2296 case CSSPropertyBorderImage: { |
| 2303 RefPtr<CSSValue> result; | 2297 RefPtr<CSSValue> result; |
| 2304 return parseBorderImage(propId, result, important); | 2298 return parseBorderImage(propId, result, important); |
| (...skipping 5862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8167 else if (equalIgnoringCase(name, "brightness(")) | 8161 else if (equalIgnoringCase(name, "brightness(")) |
| 8168 filterType = WebKitCSSFilterValue::BrightnessFilterOperation; | 8162 filterType = WebKitCSSFilterValue::BrightnessFilterOperation; |
| 8169 else if (equalIgnoringCase(name, "contrast(")) | 8163 else if (equalIgnoringCase(name, "contrast(")) |
| 8170 filterType = WebKitCSSFilterValue::ContrastFilterOperation; | 8164 filterType = WebKitCSSFilterValue::ContrastFilterOperation; |
| 8171 else if (equalIgnoringCase(name, "blur(")) | 8165 else if (equalIgnoringCase(name, "blur(")) |
| 8172 filterType = WebKitCSSFilterValue::BlurFilterOperation; | 8166 filterType = WebKitCSSFilterValue::BlurFilterOperation; |
| 8173 else if (equalIgnoringCase(name, "drop-shadow(")) { | 8167 else if (equalIgnoringCase(name, "drop-shadow(")) { |
| 8174 filterType = WebKitCSSFilterValue::DropShadowFilterOperation; | 8168 filterType = WebKitCSSFilterValue::DropShadowFilterOperation; |
| 8175 maximumArgumentCount = 4; // x-offset, y-offset, blur-radius, color --
spread and inset style not allowed. | 8169 maximumArgumentCount = 4; // x-offset, y-offset, blur-radius, color --
spread and inset style not allowed. |
| 8176 } | 8170 } |
| 8177 #if ENABLE(CSS_SHADERS) | |
| 8178 else if (equalIgnoringCase(name, "custom(")) | 8171 else if (equalIgnoringCase(name, "custom(")) |
| 8179 filterType = WebKitCSSFilterValue::CustomFilterOperation; | 8172 filterType = WebKitCSSFilterValue::CustomFilterOperation; |
| 8180 #endif | |
| 8181 } | 8173 } |
| 8182 | 8174 |
| 8183 #if ENABLE(CSS_SHADERS) | |
| 8184 static bool acceptCommaOperator(CSSParserValueList* argsList) | 8175 static bool acceptCommaOperator(CSSParserValueList* argsList) |
| 8185 { | 8176 { |
| 8186 if (CSSParserValue* arg = argsList->current()) { | 8177 if (CSSParserValue* arg = argsList->current()) { |
| 8187 if (!isComma(arg)) | 8178 if (!isComma(arg)) |
| 8188 return false; | 8179 return false; |
| 8189 argsList->next(); | 8180 argsList->next(); |
| 8190 } | 8181 } |
| 8191 return true; | 8182 return true; |
| 8192 } | 8183 } |
| 8193 | 8184 |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8590 { | 8581 { |
| 8591 RefPtr<StyleRuleFilter> rule = StyleRuleFilter::create(filterName); | 8582 RefPtr<StyleRuleFilter> rule = StyleRuleFilter::create(filterName); |
| 8592 rule->setProperties(createStylePropertySet()); | 8583 rule->setProperties(createStylePropertySet()); |
| 8593 clearProperties(); | 8584 clearProperties(); |
| 8594 StyleRuleFilter* result = rule.get(); | 8585 StyleRuleFilter* result = rule.get(); |
| 8595 m_parsedRules.append(rule.release()); | 8586 m_parsedRules.append(rule.release()); |
| 8596 processAndAddNewRuleToSourceTreeIfNeeded(); | 8587 processAndAddNewRuleToSourceTreeIfNeeded(); |
| 8597 return result; | 8588 return result; |
| 8598 } | 8589 } |
| 8599 | 8590 |
| 8600 #endif // ENABLE(CSS_SHADERS) | |
| 8601 | 8591 |
| 8602 PassRefPtr<WebKitCSSFilterValue> CSSParser::parseBuiltinFilterArguments(CSSParse
rValueList* args, WebKitCSSFilterValue::FilterOperationType filterType) | 8592 PassRefPtr<WebKitCSSFilterValue> CSSParser::parseBuiltinFilterArguments(CSSParse
rValueList* args, WebKitCSSFilterValue::FilterOperationType filterType) |
| 8603 { | 8593 { |
| 8604 RefPtr<WebKitCSSFilterValue> filterValue = WebKitCSSFilterValue::create(filt
erType); | 8594 RefPtr<WebKitCSSFilterValue> filterValue = WebKitCSSFilterValue::create(filt
erType); |
| 8605 ASSERT(args); | 8595 ASSERT(args); |
| 8606 | 8596 |
| 8607 switch (filterType) { | 8597 switch (filterType) { |
| 8608 case WebKitCSSFilterValue::GrayscaleFilterOperation: | 8598 case WebKitCSSFilterValue::GrayscaleFilterOperation: |
| 8609 case WebKitCSSFilterValue::SepiaFilterOperation: | 8599 case WebKitCSSFilterValue::SepiaFilterOperation: |
| 8610 case WebKitCSSFilterValue::SaturateFilterOperation: | 8600 case WebKitCSSFilterValue::SaturateFilterOperation: |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8713 #endif | 8703 #endif |
| 8714 } else { | 8704 } else { |
| 8715 const CSSParserString name = value->function->name; | 8705 const CSSParserString name = value->function->name; |
| 8716 unsigned maximumArgumentCount = 1; | 8706 unsigned maximumArgumentCount = 1; |
| 8717 | 8707 |
| 8718 filterInfoForName(name, filterType, maximumArgumentCount); | 8708 filterInfoForName(name, filterType, maximumArgumentCount); |
| 8719 | 8709 |
| 8720 if (filterType == WebKitCSSFilterValue::UnknownFilterOperation) | 8710 if (filterType == WebKitCSSFilterValue::UnknownFilterOperation) |
| 8721 return 0; | 8711 return 0; |
| 8722 | 8712 |
| 8723 #if ENABLE(CSS_SHADERS) | |
| 8724 if (filterType == WebKitCSSFilterValue::CustomFilterOperation) { | 8713 if (filterType == WebKitCSSFilterValue::CustomFilterOperation) { |
| 8725 // Make sure parsing fails if custom filters are disabled. | 8714 // Make sure parsing fails if custom filters are disabled. |
| 8726 if (!m_context.isCSSCustomFilterEnabled) | 8715 if (!m_context.isCSSCustomFilterEnabled) |
| 8727 return 0; | 8716 return 0; |
| 8728 | 8717 |
| 8729 RefPtr<WebKitCSSFilterValue> filterValue = parseCustomFilterFunc
tion(value); | 8718 RefPtr<WebKitCSSFilterValue> filterValue = parseCustomFilterFunc
tion(value); |
| 8730 if (!filterValue) | 8719 if (!filterValue) |
| 8731 return 0; | 8720 return 0; |
| 8732 list->append(filterValue.release()); | 8721 list->append(filterValue.release()); |
| 8733 continue; | 8722 continue; |
| 8734 } | 8723 } |
| 8735 #endif | |
| 8736 CSSParserValueList* args = value->function->args.get(); | 8724 CSSParserValueList* args = value->function->args.get(); |
| 8737 if (!args) | 8725 if (!args) |
| 8738 return 0; | 8726 return 0; |
| 8739 | 8727 |
| 8740 RefPtr<WebKitCSSFilterValue> filterValue = parseBuiltinFilterArgumen
ts(args, filterType); | 8728 RefPtr<WebKitCSSFilterValue> filterValue = parseBuiltinFilterArgumen
ts(args, filterType); |
| 8741 if (!filterValue) | 8729 if (!filterValue) |
| 8742 return 0; | 8730 return 0; |
| 8743 | 8731 |
| 8744 list->append(filterValue); | 8732 list->append(filterValue); |
| 8745 } | 8733 } |
| (...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10327 case 15: | 10315 case 15: |
| 10328 if (hasEscape) | 10316 if (hasEscape) |
| 10329 return; | 10317 return; |
| 10330 | 10318 |
| 10331 #if ENABLE(CSS_REGIONS) | 10319 #if ENABLE(CSS_REGIONS) |
| 10332 if (isASCIIAlphaCaselessEqual(name[14], 'n') && isEqualToCSSIdentifi
er(name + 2, "webkit-regio")) { | 10320 if (isASCIIAlphaCaselessEqual(name[14], 'n') && isEqualToCSSIdentifi
er(name + 2, "webkit-regio")) { |
| 10333 m_token = WEBKIT_REGION_RULE_SYM; | 10321 m_token = WEBKIT_REGION_RULE_SYM; |
| 10334 return; | 10322 return; |
| 10335 } | 10323 } |
| 10336 #endif | 10324 #endif |
| 10337 #if ENABLE(CSS_SHADERS) | |
| 10338 if (isASCIIAlphaCaselessEqual(name[14], 'r') && isEqualToCSSIdentifi
er(name + 2, "webkit-filte")) { | 10325 if (isASCIIAlphaCaselessEqual(name[14], 'r') && isEqualToCSSIdentifi
er(name + 2, "webkit-filte")) { |
| 10339 m_token = WEBKIT_FILTER_RULE_SYM; | 10326 m_token = WEBKIT_FILTER_RULE_SYM; |
| 10340 return; | 10327 return; |
| 10341 } | 10328 } |
| 10342 #endif | |
| 10343 return; | 10329 return; |
| 10344 | 10330 |
| 10345 case 17: | 10331 case 17: |
| 10346 if (hasEscape) | 10332 if (hasEscape) |
| 10347 return; | 10333 return; |
| 10348 | 10334 |
| 10349 if (isASCIIAlphaCaselessEqual(name[16], 'r') && isEqualToCSSIdentifi
er(name + 2, "webkit-selecto")) | 10335 if (isASCIIAlphaCaselessEqual(name[16], 'r') && isEqualToCSSIdentifi
er(name + 2, "webkit-selecto")) |
| 10350 m_token = WEBKIT_SELECTOR_SYM; | 10336 m_token = WEBKIT_SELECTOR_SYM; |
| 10351 #if ENABLE(CSS_DEVICE_ADAPTATION) | 10337 #if ENABLE(CSS_DEVICE_ADAPTATION) |
| 10352 else if (isASCIIAlphaCaselessEqual(name[16], 't') && isEqualToCSSIde
ntifier(name + 2, "webkit-viewpor")) | 10338 else if (isASCIIAlphaCaselessEqual(name[16], 't') && isEqualToCSSIde
ntifier(name + 2, "webkit-viewpor")) |
| (...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11960 { | 11946 { |
| 11961 // The tokenizer checks for the construct of an+b. | 11947 // The tokenizer checks for the construct of an+b. |
| 11962 // However, since the {ident} rule precedes the {nth} rule, some of those | 11948 // However, since the {ident} rule precedes the {nth} rule, some of those |
| 11963 // tokens are identified as string literal. Furthermore we need to accept | 11949 // tokens are identified as string literal. Furthermore we need to accept |
| 11964 // "odd" and "even" which does not match to an+b. | 11950 // "odd" and "even" which does not match to an+b. |
| 11965 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 11951 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
| 11966 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 11952 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
| 11967 } | 11953 } |
| 11968 | 11954 |
| 11969 } | 11955 } |
| OLD | NEW |