| 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 2820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2831 case CSSPropertyWebkitUserSelect: | 2831 case CSSPropertyWebkitUserSelect: |
| 2832 case CSSPropertyWebkitWrapFlow: | 2832 case CSSPropertyWebkitWrapFlow: |
| 2833 case CSSPropertyWebkitWrapThrough: | 2833 case CSSPropertyWebkitWrapThrough: |
| 2834 case CSSPropertyWebkitWritingMode: | 2834 case CSSPropertyWebkitWritingMode: |
| 2835 case CSSPropertyWhiteSpace: | 2835 case CSSPropertyWhiteSpace: |
| 2836 case CSSPropertyWordBreak: | 2836 case CSSPropertyWordBreak: |
| 2837 case CSSPropertyWordWrap: | 2837 case CSSPropertyWordWrap: |
| 2838 // These properties should be handled before in isValidKeywordPropertyAn
dValue(). | 2838 // These properties should be handled before in isValidKeywordPropertyAn
dValue(). |
| 2839 ASSERT_NOT_REACHED(); | 2839 ASSERT_NOT_REACHED(); |
| 2840 return false; | 2840 return false; |
| 2841 // Properties bellow are validated inside parseViewportProperty, because we | 2841 // Properties below are validated inside parseViewportProperty, because we |
| 2842 // check for parser state inViewportScope. We need to invalidate if someone | 2842 // check for parser state inViewportScope. We need to invalidate if someone |
| 2843 // adds them outside a @viewport rule. | 2843 // adds them outside a @viewport rule. |
| 2844 case CSSPropertyMaxZoom: | 2844 case CSSPropertyMaxZoom: |
| 2845 case CSSPropertyMinZoom: | 2845 case CSSPropertyMinZoom: |
| 2846 case CSSPropertyOrientation: | 2846 case CSSPropertyOrientation: |
| 2847 case CSSPropertyUserZoom: | 2847 case CSSPropertyUserZoom: |
| 2848 case CSSPropertyInternalPriority: |
| 2848 validPrimitive = false; | 2849 validPrimitive = false; |
| 2849 break; | 2850 break; |
| 2850 default: | 2851 default: |
| 2851 return parseSVGValue(propId, important); | 2852 return parseSVGValue(propId, important); |
| 2852 } | 2853 } |
| 2853 | 2854 |
| 2854 if (validPrimitive) { | 2855 if (validPrimitive) { |
| 2855 parsedValue = parseValidPrimitive(id, value); | 2856 parsedValue = parseValidPrimitive(id, value); |
| 2856 m_valueList->next(); | 2857 m_valueList->next(); |
| 2857 } | 2858 } |
| (...skipping 8541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11399 m_sourceDataHandler->startEndUnknownRule(); | 11400 m_sourceDataHandler->startEndUnknownRule(); |
| 11400 } | 11401 } |
| 11401 | 11402 |
| 11402 unsigned CSSParser::safeUserStringTokenOffset() | 11403 unsigned CSSParser::safeUserStringTokenOffset() |
| 11403 { | 11404 { |
| 11404 return min(tokenStartOffset(), static_cast<unsigned>(m_length - 1 - m_parsed
TextSuffixLength)) - m_parsedTextPrefixLength; | 11405 return min(tokenStartOffset(), static_cast<unsigned>(m_length - 1 - m_parsed
TextSuffixLength)) - m_parsedTextPrefixLength; |
| 11405 } | 11406 } |
| 11406 | 11407 |
| 11407 StyleRuleBase* CSSParser::createViewportRule() | 11408 StyleRuleBase* CSSParser::createViewportRule() |
| 11408 { | 11409 { |
| 11409 if (!RuntimeEnabledFeatures::cssViewportEnabled()) | |
| 11410 return 0; | |
| 11411 | |
| 11412 m_allowImportRules = m_allowNamespaceDeclarations = false; | 11410 m_allowImportRules = m_allowNamespaceDeclarations = false; |
| 11413 | 11411 |
| 11414 RefPtr<StyleRuleViewport> rule = StyleRuleViewport::create(); | 11412 RefPtr<StyleRuleViewport> rule = StyleRuleViewport::create(); |
| 11415 | 11413 |
| 11416 rule->setProperties(createStylePropertySet()); | 11414 rule->setProperties(createStylePropertySet()); |
| 11417 clearProperties(); | 11415 clearProperties(); |
| 11418 | 11416 |
| 11419 StyleRuleViewport* result = rule.get(); | 11417 StyleRuleViewport* result = rule.get(); |
| 11420 m_parsedRules.append(rule.release()); | 11418 m_parsedRules.append(rule.release()); |
| 11421 endRuleBody(); | 11419 endRuleBody(); |
| 11422 | 11420 |
| 11423 return result; | 11421 return result; |
| 11424 } | 11422 } |
| 11425 | 11423 |
| 11426 bool CSSParser::parseViewportProperty(CSSPropertyID propId, bool important) | 11424 bool CSSParser::parseViewportProperty(CSSPropertyID propId, bool important) |
| 11427 { | 11425 { |
| 11428 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled()); | |
| 11429 | |
| 11430 CSSParserValue* value = m_valueList->current(); | 11426 CSSParserValue* value = m_valueList->current(); |
| 11431 if (!value) | 11427 if (!value) |
| 11432 return false; | 11428 return false; |
| 11433 | 11429 |
| 11434 CSSValueID id = value->id; | 11430 CSSValueID id = value->id; |
| 11435 bool validPrimitive = false; | 11431 bool validPrimitive = false; |
| 11436 | 11432 |
| 11437 switch (propId) { | 11433 switch (propId) { |
| 11438 case CSSPropertyMinWidth: // auto | <length> | <percentage> | 11434 case CSSPropertyInternalPriority: |
| 11439 case CSSPropertyMaxWidth: | 11435 if (id == CSSValueAuto) |
| 11436 validPrimitive = true; |
| 11437 else |
| 11438 validPrimitive = (!id && validUnit(value, FNumber | FNonNeg)); |
| 11439 break; |
| 11440 case CSSPropertyMinWidth: // auto | extend-to-zoom | <length> | <percentage> |
| 11441 if (id == CSSValueExtendToZoom) { |
| 11442 validPrimitive = true; |
| 11443 break; |
| 11444 } |
| 11445 case CSSPropertyMaxWidth: // auto | <length> | <percentage> |
| 11440 case CSSPropertyMinHeight: | 11446 case CSSPropertyMinHeight: |
| 11441 case CSSPropertyMaxHeight: | 11447 case CSSPropertyMaxHeight: |
| 11442 if (id == CSSValueAuto) | 11448 if (id == CSSValueAuto) |
| 11443 validPrimitive = true; | 11449 validPrimitive = true; |
| 11444 else | 11450 else |
| 11445 validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonN
eg)); | 11451 validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonN
eg)); |
| 11446 break; | 11452 break; |
| 11447 case CSSPropertyWidth: // shorthand | 11453 case CSSPropertyWidth: // shorthand |
| 11448 return parseViewportShorthand(propId, CSSPropertyMinWidth, CSSPropertyMa
xWidth, important); | 11454 return parseViewportShorthand(propId, CSSPropertyMinWidth, CSSPropertyMa
xWidth, important); |
| 11449 case CSSPropertyHeight: | 11455 case CSSPropertyHeight: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 11478 addProperty(propId, parsedValue.release(), important); | 11484 addProperty(propId, parsedValue.release(), important); |
| 11479 return true; | 11485 return true; |
| 11480 } | 11486 } |
| 11481 } | 11487 } |
| 11482 | 11488 |
| 11483 return false; | 11489 return false; |
| 11484 } | 11490 } |
| 11485 | 11491 |
| 11486 bool CSSParser::parseViewportShorthand(CSSPropertyID propId, CSSPropertyID first
, CSSPropertyID second, bool important) | 11492 bool CSSParser::parseViewportShorthand(CSSPropertyID propId, CSSPropertyID first
, CSSPropertyID second, bool important) |
| 11487 { | 11493 { |
| 11488 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled()); | |
| 11489 unsigned numValues = m_valueList->size(); | 11494 unsigned numValues = m_valueList->size(); |
| 11490 | 11495 |
| 11491 if (numValues > 2) | 11496 if (numValues > 2) |
| 11492 return false; | 11497 return false; |
| 11493 | 11498 |
| 11494 ShorthandScope scope(this, propId); | 11499 ShorthandScope scope(this, propId); |
| 11495 | 11500 |
| 11496 if (!parseViewportProperty(first, important)) | 11501 if (!parseViewportProperty(first, important)) |
| 11497 return false; | 11502 return false; |
| 11498 | 11503 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11743 { | 11748 { |
| 11744 // The tokenizer checks for the construct of an+b. | 11749 // The tokenizer checks for the construct of an+b. |
| 11745 // However, since the {ident} rule precedes the {nth} rule, some of those | 11750 // However, since the {ident} rule precedes the {nth} rule, some of those |
| 11746 // tokens are identified as string literal. Furthermore we need to accept | 11751 // tokens are identified as string literal. Furthermore we need to accept |
| 11747 // "odd" and "even" which does not match to an+b. | 11752 // "odd" and "even" which does not match to an+b. |
| 11748 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 11753 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
| 11749 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 11754 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
| 11750 } | 11755 } |
| 11751 | 11756 |
| 11752 } | 11757 } |
| OLD | NEW |