| 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 2446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2457 break; | 2457 break; |
| 2458 case CSSPropertyWebkitColumnSpan: // none | all | 1 (will be dropped in the
unprefixed property) | 2458 case CSSPropertyWebkitColumnSpan: // none | all | 1 (will be dropped in the
unprefixed property) |
| 2459 if (id == CSSValueAll || id == CSSValueNone) | 2459 if (id == CSSValueAll || id == CSSValueNone) |
| 2460 validPrimitive = true; | 2460 validPrimitive = true; |
| 2461 else | 2461 else |
| 2462 validPrimitive = validUnit(value, FNumber | FNonNeg) && value->fValu
e == 1; | 2462 validPrimitive = validUnit(value, FNumber | FNonNeg) && value->fValu
e == 1; |
| 2463 break; | 2463 break; |
| 2464 case CSSPropertyWebkitColumnWidth: // auto | <length> | 2464 case CSSPropertyWebkitColumnWidth: // auto | <length> |
| 2465 parsedValue = parseColumnWidth(); | 2465 parsedValue = parseColumnWidth(); |
| 2466 break; | 2466 break; |
| 2467 case CSSPropertyWillChange: |
| 2468 if (!RuntimeEnabledFeatures::cssWillChangeEnabled()) |
| 2469 return false; |
| 2470 return parseWillChange(important); |
| 2467 // End of CSS3 properties | 2471 // End of CSS3 properties |
| 2468 | 2472 |
| 2469 // Apple specific properties. These will never be standardized and are pure
ly to | 2473 // Apple specific properties. These will never be standardized and are pure
ly to |
| 2470 // support custom WebKit-based Apple applications. | 2474 // support custom WebKit-based Apple applications. |
| 2471 case CSSPropertyWebkitLineClamp: | 2475 case CSSPropertyWebkitLineClamp: |
| 2472 // When specifying number of lines, don't allow 0 as a valid value | 2476 // When specifying number of lines, don't allow 0 as a valid value |
| 2473 // When specifying either type of unit, require non-negative integers | 2477 // When specifying either type of unit, require non-negative integers |
| 2474 validPrimitive = (!id && (value->unit == CSSPrimitiveValue::CSS_PERCENTA
GE || value->fValue) && validUnit(value, FInteger | FPercent | FNonNeg, HTMLQuir
ksMode)); | 2478 validPrimitive = (!id && (value->unit == CSSPrimitiveValue::CSS_PERCENTA
GE || value->fValue) && validUnit(value, FInteger | FPercent | FNonNeg, HTMLQuir
ksMode)); |
| 2475 break; | 2479 break; |
| 2476 | 2480 |
| (...skipping 5881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8358 if (!isComma(arg)) | 8362 if (!isComma(arg)) |
| 8359 return 0; | 8363 return 0; |
| 8360 | 8364 |
| 8361 // Skip the comma and move on to the next argument. | 8365 // Skip the comma and move on to the next argument. |
| 8362 arg = functionArgs->next(); | 8366 arg = functionArgs->next(); |
| 8363 } | 8367 } |
| 8364 | 8368 |
| 8365 return imageSet.release(); | 8369 return imageSet.release(); |
| 8366 } | 8370 } |
| 8367 | 8371 |
| 8372 bool BisonCSSParser::parseWillChange(bool important) |
| 8373 { |
| 8374 ASSERT(RuntimeEnabledFeatures::cssWillChangeEnabled()); |
| 8375 |
| 8376 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated
(); |
| 8377 if (m_valueList->current()->id == CSSValueAuto) { |
| 8378 if (m_valueList->next()) |
| 8379 return false; |
| 8380 } |
| 8381 |
| 8382 CSSParserValue* currentValue; |
| 8383 bool expectComma = false; |
| 8384 |
| 8385 // Every comma-separated list of CSS_IDENTs is a valid will-change value, |
| 8386 // unless the list includes an explicitly disallowed CSS_IDENT. |
| 8387 while ((currentValue = m_valueList->current())) { |
| 8388 if (expectComma) { |
| 8389 if (!isComma(currentValue)) |
| 8390 return false; |
| 8391 expectComma = false; |
| 8392 m_valueList->next(); |
| 8393 continue; |
| 8394 } |
| 8395 |
| 8396 if (currentValue->unit != CSSPrimitiveValue::CSS_IDENT) |
| 8397 return false; |
| 8398 |
| 8399 if (CSSPropertyID property = cssPropertyID(currentValue->string)) { |
| 8400 if (property == CSSPropertyWillChange) |
| 8401 return false; |
| 8402 values->append(cssValuePool().createIdentifierValue(property)); |
| 8403 } else { |
| 8404 switch (currentValue->id) { |
| 8405 case CSSValueNone: |
| 8406 case CSSValueAll: |
| 8407 case CSSValueAuto: |
| 8408 case CSSValueDefault: |
| 8409 case CSSValueInitial: |
| 8410 case CSSValueInherit: |
| 8411 return false; |
| 8412 case CSSValueContents: |
| 8413 case CSSValueScrollPosition: |
| 8414 values->append(cssValuePool().createIdentifierValue(currentValue
->id)); |
| 8415 break; |
| 8416 default: |
| 8417 break; |
| 8418 } |
| 8419 } |
| 8420 expectComma = true; |
| 8421 m_valueList->next(); |
| 8422 } |
| 8423 |
| 8424 addProperty(CSSPropertyWillChange, values.release(), important); |
| 8425 return true; |
| 8426 } |
| 8427 |
| 8368 class TransformOperationInfo { | 8428 class TransformOperationInfo { |
| 8369 public: | 8429 public: |
| 8370 TransformOperationInfo(const CSSParserString& name) | 8430 TransformOperationInfo(const CSSParserString& name) |
| 8371 : m_type(CSSTransformValue::UnknownTransformOperation) | 8431 : m_type(CSSTransformValue::UnknownTransformOperation) |
| 8372 , m_argCount(1) | 8432 , m_argCount(1) |
| 8373 , m_allowSingleArgument(false) | 8433 , m_allowSingleArgument(false) |
| 8374 , m_unit(BisonCSSParser::FUnknown) | 8434 , m_unit(BisonCSSParser::FUnknown) |
| 8375 { | 8435 { |
| 8376 const UChar* characters; | 8436 const UChar* characters; |
| 8377 unsigned nameLength = name.length(); | 8437 unsigned nameLength = name.length(); |
| (...skipping 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10096 { | 10156 { |
| 10097 // The tokenizer checks for the construct of an+b. | 10157 // The tokenizer checks for the construct of an+b. |
| 10098 // However, since the {ident} rule precedes the {nth} rule, some of those | 10158 // However, since the {ident} rule precedes the {nth} rule, some of those |
| 10099 // tokens are identified as string literal. Furthermore we need to accept | 10159 // tokens are identified as string literal. Furthermore we need to accept |
| 10100 // "odd" and "even" which does not match to an+b. | 10160 // "odd" and "even" which does not match to an+b. |
| 10101 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 10161 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
| 10102 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 10162 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
| 10103 } | 10163 } |
| 10104 | 10164 |
| 10105 } | 10165 } |
| OLD | NEW |