| 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 8227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8238 return 0; | 8238 return 0; |
| 8239 | 8239 |
| 8240 unsigned numArgs = argsList->size(); | 8240 unsigned numArgs = argsList->size(); |
| 8241 if (numArgs < 1 || numArgs > 3) | 8241 if (numArgs < 1 || numArgs > 3) |
| 8242 return 0; | 8242 return 0; |
| 8243 | 8243 |
| 8244 RefPtr<CSSMixFunctionValue> mixFunction = CSSMixFunctionValue::create(); | 8244 RefPtr<CSSMixFunctionValue> mixFunction = CSSMixFunctionValue::create(); |
| 8245 | 8245 |
| 8246 bool hasBlendMode = false; | 8246 bool hasBlendMode = false; |
| 8247 bool hasAlphaCompositing = false; | 8247 bool hasAlphaCompositing = false; |
| 8248 CSSParserValue* arg; | 8248 |
| 8249 while ((arg = argsList->current())) { | 8249 for (CSSParserValue* arg = argsList->current(); arg; arg = argsList->next())
{ |
| 8250 RefPtr<CSSValue> value; | 8250 RefPtr<CSSValue> value; |
| 8251 | 8251 |
| 8252 unsigned argNumber = argsList->currentIndex(); | 8252 unsigned argNumber = argsList->currentIndex(); |
| 8253 if (!argNumber) { | 8253 if (!argNumber) { |
| 8254 if (arg->unit == CSSPrimitiveValue::CSS_URI) { | 8254 if (arg->unit == CSSPrimitiveValue::CSS_URI) { |
| 8255 KURL shaderURL = completeURL(arg->string); | 8255 KURL shaderURL = completeURL(arg->string); |
| 8256 value = CSSShaderValue::create(shaderURL.string()); | 8256 value = CSSShaderValue::create(shaderURL.string()); |
| 8257 } | 8257 } |
| 8258 } else if (argNumber == 1 || argNumber == 2) { | 8258 } else if (argNumber == 1 || argNumber == 2) { |
| 8259 if (!hasBlendMode && isBlendMode(arg->id)) { | 8259 if (!hasBlendMode && isBlendMode(arg->id)) { |
| 8260 hasBlendMode = true; | 8260 hasBlendMode = true; |
| 8261 value = cssValuePool().createIdentifierValue(arg->id); | 8261 value = cssValuePool().createIdentifierValue(arg->id); |
| 8262 } else if (!hasAlphaCompositing && isCompositeOperator(arg->id)) { | 8262 } else if (!hasAlphaCompositing && isCompositeOperator(arg->id)) { |
| 8263 hasAlphaCompositing = true; | 8263 hasAlphaCompositing = true; |
| 8264 value = cssValuePool().createIdentifierValue(arg->id); | 8264 value = cssValuePool().createIdentifierValue(arg->id); |
| 8265 } | 8265 } |
| 8266 } | 8266 } |
| 8267 | 8267 |
| 8268 if (!value) | 8268 if (!value) |
| 8269 return 0; | 8269 return 0; |
| 8270 | 8270 |
| 8271 mixFunction->append(value.release()); | 8271 mixFunction->append(value.release()); |
| 8272 | |
| 8273 arg = argsList->next(); | |
| 8274 } | 8272 } |
| 8275 | 8273 |
| 8276 return mixFunction; | 8274 return mixFunction; |
| 8277 } | 8275 } |
| 8278 | 8276 |
| 8279 PassRefPtr<CSSValueList> CSSParser::parseCustomFilterParameters(CSSParserValueLi
st* argsList) | 8277 PassRefPtr<CSSValueList> CSSParser::parseCustomFilterParameters(CSSParserValueLi
st* argsList) |
| 8280 { | 8278 { |
| 8281 // | 8279 // |
| 8282 // params: [<param-def>[,<param-def>*]] | 8280 // params: [<param-def>[,<param-def>*]] |
| 8283 // param-def: <param-name>wsp<param-value> | 8281 // param-def: <param-name>wsp<param-value> |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8418 CSSParserValueList* argsList = value->function->args.get(); | 8416 CSSParserValueList* argsList = value->function->args.get(); |
| 8419 if (!argsList) | 8417 if (!argsList) |
| 8420 return 0; | 8418 return 0; |
| 8421 | 8419 |
| 8422 RefPtr<CSSFilterValue> filterValue = CSSFilterValue::create(CSSFilterValue::
CustomFilterOperation); | 8420 RefPtr<CSSFilterValue> filterValue = CSSFilterValue::create(CSSFilterValue::
CustomFilterOperation); |
| 8423 | 8421 |
| 8424 // 1. Parse the shader URLs: <vertex-shader>[wsp<fragment-shader>] | 8422 // 1. Parse the shader URLs: <vertex-shader>[wsp<fragment-shader>] |
| 8425 RefPtr<CSSValueList> shadersList = CSSValueList::createSpaceSeparated(); | 8423 RefPtr<CSSValueList> shadersList = CSSValueList::createSpaceSeparated(); |
| 8426 bool hadAtLeastOneCustomShader = false; | 8424 bool hadAtLeastOneCustomShader = false; |
| 8427 CSSParserValue* arg; | 8425 CSSParserValue* arg; |
| 8428 while ((arg = argsList->current())) { | 8426 for (arg = argsList->current(); arg; arg = argsList->next()) { |
| 8429 RefPtr<CSSValue> value; | 8427 RefPtr<CSSValue> value; |
| 8430 if (arg->id == CSSValueNone) | 8428 if (arg->id == CSSValueNone) |
| 8431 value = cssValuePool().createIdentifierValue(CSSValueNone); | 8429 value = cssValuePool().createIdentifierValue(CSSValueNone); |
| 8432 else if (arg->unit == CSSPrimitiveValue::CSS_URI) { | 8430 else if (arg->unit == CSSPrimitiveValue::CSS_URI) { |
| 8433 KURL shaderURL = completeURL(arg->string); | 8431 KURL shaderURL = completeURL(arg->string); |
| 8434 value = CSSShaderValue::create(shaderURL.string()); | 8432 value = CSSShaderValue::create(shaderURL.string()); |
| 8435 hadAtLeastOneCustomShader = true; | 8433 hadAtLeastOneCustomShader = true; |
| 8436 } else if (argsList->currentIndex() == 1 && arg->unit == CSSParserValue:
:Function) { | 8434 } else if (argsList->currentIndex() == 1 && arg->unit == CSSParserValue:
:Function) { |
| 8437 if (!(value = parseMixFunction(arg))) | 8435 if (!(value = parseMixFunction(arg))) |
| 8438 return 0; | 8436 return 0; |
| 8439 hadAtLeastOneCustomShader = true; | 8437 hadAtLeastOneCustomShader = true; |
| 8440 } | 8438 } |
| 8441 | 8439 |
| 8442 if (!value) | 8440 if (!value) |
| 8443 break; | 8441 break; |
| 8444 shadersList->append(value.release()); | 8442 shadersList->append(value.release()); |
| 8445 argsList->next(); | |
| 8446 } | 8443 } |
| 8447 | 8444 |
| 8448 if (!shadersList->length() || !hadAtLeastOneCustomShader || shadersList->len
gth() > 2 || !acceptCommaOperator(argsList)) | 8445 if (!shadersList->length() || !hadAtLeastOneCustomShader || shadersList->len
gth() > 2 || !acceptCommaOperator(argsList)) |
| 8449 return 0; | 8446 return 0; |
| 8450 | 8447 |
| 8451 filterValue->append(shadersList.release()); | 8448 filterValue->append(shadersList.release()); |
| 8452 | 8449 |
| 8453 // 2. Parse the mesh size <vertex-mesh> | 8450 // 2. Parse the mesh size <vertex-mesh> |
| 8454 RefPtr<CSSValueList> meshSizeList = CSSValueList::createSpaceSeparated(); | 8451 RefPtr<CSSValueList> meshSizeList = CSSValueList::createSpaceSeparated(); |
| 8455 | 8452 |
| 8456 while ((arg = argsList->current())) { | 8453 for (arg = argsList->current(); arg; arg = argsList->next()) { |
| 8457 if (!validUnit(arg, FInteger | FNonNeg, CSSStrictMode)) | 8454 if (!validUnit(arg, FInteger | FNonNeg, CSSStrictMode)) |
| 8458 break; | 8455 break; |
| 8459 int integerValue = clampToInteger(arg->fValue); | 8456 int integerValue = clampToInteger(arg->fValue); |
| 8460 // According to the specification we can only accept positive non-zero v
alues. | 8457 // According to the specification we can only accept positive non-zero v
alues. |
| 8461 if (integerValue < 1) | 8458 if (integerValue < 1) |
| 8462 return 0; | 8459 return 0; |
| 8463 meshSizeList->append(cssValuePool().createValue(integerValue, CSSPrimiti
veValue::CSS_NUMBER)); | 8460 meshSizeList->append(cssValuePool().createValue(integerValue, CSSPrimiti
veValue::CSS_NUMBER)); |
| 8464 argsList->next(); | |
| 8465 } | 8461 } |
| 8466 | 8462 |
| 8467 if (meshSizeList->length() > 2) | 8463 if (meshSizeList->length() > 2) |
| 8468 return 0; | 8464 return 0; |
| 8469 | 8465 |
| 8470 // FIXME: For legacy content, we accept the mesh box types. We don't do anyt
hing else with them. | 8466 // FIXME: For legacy content, we accept the mesh box types. We don't do anyt
hing else with them. |
| 8471 // Eventually, we'll remove them completely. | 8467 // Eventually, we'll remove them completely. |
| 8472 // https://bugs.webkit.org/show_bug.cgi?id=103778 | 8468 // https://bugs.webkit.org/show_bug.cgi?id=103778 |
| 8473 if ((arg = argsList->current()) && (arg->id == CSSValueBorderBox || arg->id
== CSSValuePaddingBox | 8469 if ((arg = argsList->current()) && (arg->id == CSSValueBorderBox || arg->id
== CSSValuePaddingBox |
| 8474 || arg->id == CSSValueContentBox || arg->id == CSSValueFilterBox)) | 8470 || arg->id == CSSValueContentBox || arg->id == CSSValueFilterBox)) |
| (...skipping 3331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11806 { | 11802 { |
| 11807 // The tokenizer checks for the construct of an+b. | 11803 // The tokenizer checks for the construct of an+b. |
| 11808 // However, since the {ident} rule precedes the {nth} rule, some of those | 11804 // However, since the {ident} rule precedes the {nth} rule, some of those |
| 11809 // tokens are identified as string literal. Furthermore we need to accept | 11805 // tokens are identified as string literal. Furthermore we need to accept |
| 11810 // "odd" and "even" which does not match to an+b. | 11806 // "odd" and "even" which does not match to an+b. |
| 11811 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 11807 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
| 11812 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 11808 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
| 11813 } | 11809 } |
| 11814 | 11810 |
| 11815 } | 11811 } |
| OLD | NEW |