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 2829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2840 case CSSPropertyWebkitUserSelect: | 2840 case CSSPropertyWebkitUserSelect: |
2841 case CSSPropertyWebkitWrapFlow: | 2841 case CSSPropertyWebkitWrapFlow: |
2842 case CSSPropertyWebkitWrapThrough: | 2842 case CSSPropertyWebkitWrapThrough: |
2843 case CSSPropertyWebkitWritingMode: | 2843 case CSSPropertyWebkitWritingMode: |
2844 case CSSPropertyWhiteSpace: | 2844 case CSSPropertyWhiteSpace: |
2845 case CSSPropertyWordBreak: | 2845 case CSSPropertyWordBreak: |
2846 case CSSPropertyWordWrap: | 2846 case CSSPropertyWordWrap: |
2847 // These properties should be handled before in isValidKeywordPropertyAn
dValue(). | 2847 // These properties should be handled before in isValidKeywordPropertyAn
dValue(). |
2848 ASSERT_NOT_REACHED(); | 2848 ASSERT_NOT_REACHED(); |
2849 return false; | 2849 return false; |
2850 // Properties bellow are validated inside parseViewportProperty, because we | 2850 // Properties below are validated inside parseViewportProperty, because we |
2851 // check for parser state inViewportScope. We need to invalidate if someone | 2851 // check for parser state inViewportScope. We need to invalidate if someone |
2852 // adds them outside a @viewport rule. | 2852 // adds them outside a @viewport rule. |
2853 case CSSPropertyMaxZoom: | 2853 case CSSPropertyMaxZoom: |
2854 case CSSPropertyMinZoom: | 2854 case CSSPropertyMinZoom: |
2855 case CSSPropertyOrientation: | 2855 case CSSPropertyOrientation: |
2856 case CSSPropertyUserZoom: | 2856 case CSSPropertyUserZoom: |
| 2857 case CSSPropertyInternalPriority: |
2857 validPrimitive = false; | 2858 validPrimitive = false; |
2858 break; | 2859 break; |
2859 default: | 2860 default: |
2860 return parseSVGValue(propId, important); | 2861 return parseSVGValue(propId, important); |
2861 } | 2862 } |
2862 | 2863 |
2863 if (validPrimitive) { | 2864 if (validPrimitive) { |
2864 parsedValue = parseValidPrimitive(id, value); | 2865 parsedValue = parseValidPrimitive(id, value); |
2865 m_valueList->next(); | 2866 m_valueList->next(); |
2866 } | 2867 } |
(...skipping 8736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11603 m_sourceDataHandler->startEndUnknownRule(); | 11604 m_sourceDataHandler->startEndUnknownRule(); |
11604 } | 11605 } |
11605 | 11606 |
11606 unsigned CSSParser::safeUserStringTokenOffset() | 11607 unsigned CSSParser::safeUserStringTokenOffset() |
11607 { | 11608 { |
11608 return min(tokenStartOffset(), static_cast<unsigned>(m_length - 1 - m_parsed
TextSuffixLength)) - m_parsedTextPrefixLength; | 11609 return min(tokenStartOffset(), static_cast<unsigned>(m_length - 1 - m_parsed
TextSuffixLength)) - m_parsedTextPrefixLength; |
11609 } | 11610 } |
11610 | 11611 |
11611 StyleRuleBase* CSSParser::createViewportRule() | 11612 StyleRuleBase* CSSParser::createViewportRule() |
11612 { | 11613 { |
11613 if (!RuntimeEnabledFeatures::cssViewportEnabled()) | |
11614 return 0; | |
11615 | |
11616 m_allowImportRules = m_allowNamespaceDeclarations = false; | 11614 m_allowImportRules = m_allowNamespaceDeclarations = false; |
11617 | 11615 |
11618 RefPtr<StyleRuleViewport> rule = StyleRuleViewport::create(); | 11616 RefPtr<StyleRuleViewport> rule = StyleRuleViewport::create(); |
11619 | 11617 |
11620 rule->setProperties(createStylePropertySet()); | 11618 rule->setProperties(createStylePropertySet()); |
11621 clearProperties(); | 11619 clearProperties(); |
11622 | 11620 |
11623 StyleRuleViewport* result = rule.get(); | 11621 StyleRuleViewport* result = rule.get(); |
11624 m_parsedRules.append(rule.release()); | 11622 m_parsedRules.append(rule.release()); |
11625 endRuleBody(); | 11623 endRuleBody(); |
11626 | 11624 |
11627 return result; | 11625 return result; |
11628 } | 11626 } |
11629 | 11627 |
11630 bool CSSParser::parseViewportProperty(CSSPropertyID propId, bool important) | 11628 bool CSSParser::parseViewportProperty(CSSPropertyID propId, bool important) |
11631 { | 11629 { |
11632 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled()); | |
11633 | |
11634 CSSParserValue* value = m_valueList->current(); | 11630 CSSParserValue* value = m_valueList->current(); |
11635 if (!value) | 11631 if (!value) |
11636 return false; | 11632 return false; |
11637 | 11633 |
11638 CSSValueID id = value->id; | 11634 CSSValueID id = value->id; |
11639 bool validPrimitive = false; | 11635 bool validPrimitive = false; |
11640 | 11636 |
11641 switch (propId) { | 11637 switch (propId) { |
| 11638 case CSSPropertyInternalPriority: |
| 11639 if (id == CSSValueAuto) |
| 11640 validPrimitive = true; |
| 11641 else |
| 11642 validPrimitive = (!id && validUnit(value, FNumber | FNonNeg)); |
| 11643 break; |
11642 case CSSPropertyMinWidth: // auto | extend-to-zoom | <length> | <percentage> | 11644 case CSSPropertyMinWidth: // auto | extend-to-zoom | <length> | <percentage> |
11643 case CSSPropertyMaxWidth: | 11645 case CSSPropertyMaxWidth: |
11644 case CSSPropertyMinHeight: | 11646 case CSSPropertyMinHeight: |
11645 case CSSPropertyMaxHeight: | 11647 case CSSPropertyMaxHeight: |
11646 if (id == CSSValueAuto || id == CSSValueInternalExtendToZoom) | 11648 if (id == CSSValueAuto || id == CSSValueInternalExtendToZoom) |
11647 validPrimitive = true; | 11649 validPrimitive = true; |
11648 else | 11650 else |
11649 validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonN
eg)); | 11651 validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonN
eg)); |
11650 break; | 11652 break; |
11651 case CSSPropertyWidth: // shorthand | 11653 case CSSPropertyWidth: // shorthand |
(...skipping 30 matching lines...) Expand all Loading... |
11682 addProperty(propId, parsedValue.release(), important); | 11684 addProperty(propId, parsedValue.release(), important); |
11683 return true; | 11685 return true; |
11684 } | 11686 } |
11685 } | 11687 } |
11686 | 11688 |
11687 return false; | 11689 return false; |
11688 } | 11690 } |
11689 | 11691 |
11690 bool CSSParser::parseViewportShorthand(CSSPropertyID propId, CSSPropertyID first
, CSSPropertyID second, bool important) | 11692 bool CSSParser::parseViewportShorthand(CSSPropertyID propId, CSSPropertyID first
, CSSPropertyID second, bool important) |
11691 { | 11693 { |
11692 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled()); | |
11693 unsigned numValues = m_valueList->size(); | 11694 unsigned numValues = m_valueList->size(); |
11694 | 11695 |
11695 if (numValues > 2) | 11696 if (numValues > 2) |
11696 return false; | 11697 return false; |
11697 | 11698 |
11698 ShorthandScope scope(this, propId); | 11699 ShorthandScope scope(this, propId); |
11699 | 11700 |
11700 if (!parseViewportProperty(first, important)) | 11701 if (!parseViewportProperty(first, important)) |
11701 return false; | 11702 return false; |
11702 | 11703 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11947 { | 11948 { |
11948 // The tokenizer checks for the construct of an+b. | 11949 // The tokenizer checks for the construct of an+b. |
11949 // However, since the {ident} rule precedes the {nth} rule, some of those | 11950 // However, since the {ident} rule precedes the {nth} rule, some of those |
11950 // tokens are identified as string literal. Furthermore we need to accept | 11951 // tokens are identified as string literal. Furthermore we need to accept |
11951 // "odd" and "even" which does not match to an+b. | 11952 // "odd" and "even" which does not match to an+b. |
11952 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 11953 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
11953 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 11954 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
11954 } | 11955 } |
11955 | 11956 |
11956 } | 11957 } |
OLD | NEW |