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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
614 return true; | 614 return true; |
615 break; | 615 break; |
616 case CSSPropertyTextRendering: // auto | optimizeSpeed | optimizeLegibility | geometricPrecision | 616 case CSSPropertyTextRendering: // auto | optimizeSpeed | optimizeLegibility | geometricPrecision |
617 if (valueID == CSSValueAuto || valueID == CSSValueOptimizespeed || value ID == CSSValueOptimizelegibility || valueID == CSSValueGeometricprecision) | 617 if (valueID == CSSValueAuto || valueID == CSSValueOptimizespeed || value ID == CSSValueOptimizelegibility || valueID == CSSValueGeometricprecision) |
618 return true; | 618 return true; |
619 break; | 619 break; |
620 case CSSPropertyTextTransform: // capitalize | uppercase | lowercase | none | inherit | 620 case CSSPropertyTextTransform: // capitalize | uppercase | lowercase | none | inherit |
621 if ((valueID >= CSSValueCapitalize && valueID <= CSSValueLowercase) || v alueID == CSSValueNone) | 621 if ((valueID >= CSSValueCapitalize && valueID <= CSSValueLowercase) || v alueID == CSSValueNone) |
622 return true; | 622 return true; |
623 break; | 623 break; |
624 case CSSPropertyTouchAction: // auto | none | |
625 if (RuntimeEnabledFeatures::cssTouchActionEnabled() && (valueID == CSSVa lueAuto || valueID == CSSValueNone)) | |
626 return true; | |
627 break; | |
628 case CSSPropertyTouchActionDelay: // none | script | 624 case CSSPropertyTouchActionDelay: // none | script |
629 if (RuntimeEnabledFeatures::cssTouchActionEnabled() && (valueID == CSSVa lueScript || valueID == CSSValueNone)) | 625 if (RuntimeEnabledFeatures::cssTouchActionEnabled() && (valueID == CSSVa lueScript || valueID == CSSValueNone)) |
630 return true; | 626 return true; |
631 break; | 627 break; |
632 case CSSPropertyVisibility: // visible | hidden | collapse | inherit | 628 case CSSPropertyVisibility: // visible | hidden | collapse | inherit |
633 if (valueID == CSSValueVisible || valueID == CSSValueHidden || valueID = = CSSValueCollapse) | 629 if (valueID == CSSValueVisible || valueID == CSSValueHidden || valueID = = CSSValueCollapse) |
634 return true; | 630 return true; |
635 break; | 631 break; |
636 case CSSPropertyWebkitAppearance: | 632 case CSSPropertyWebkitAppearance: |
637 if ((valueID >= CSSValueCheckbox && valueID <= CSSValueTextarea) || valu eID == CSSValueNone) | 633 if ((valueID >= CSSValueCheckbox && valueID <= CSSValueTextarea) || valu eID == CSSValueNone) |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
875 case CSSPropertyTextJustify: | 871 case CSSPropertyTextJustify: |
876 case CSSPropertyTextLineThroughMode: | 872 case CSSPropertyTextLineThroughMode: |
877 case CSSPropertyTextLineThroughStyle: | 873 case CSSPropertyTextLineThroughStyle: |
878 case CSSPropertyTextOverflow: | 874 case CSSPropertyTextOverflow: |
879 case CSSPropertyTextOverlineMode: | 875 case CSSPropertyTextOverlineMode: |
880 case CSSPropertyTextOverlineStyle: | 876 case CSSPropertyTextOverlineStyle: |
881 case CSSPropertyTextRendering: | 877 case CSSPropertyTextRendering: |
882 case CSSPropertyTextTransform: | 878 case CSSPropertyTextTransform: |
883 case CSSPropertyTextUnderlineMode: | 879 case CSSPropertyTextUnderlineMode: |
884 case CSSPropertyTextUnderlineStyle: | 880 case CSSPropertyTextUnderlineStyle: |
885 case CSSPropertyTouchAction: | |
886 case CSSPropertyTouchActionDelay: | 881 case CSSPropertyTouchActionDelay: |
887 case CSSPropertyVisibility: | 882 case CSSPropertyVisibility: |
888 case CSSPropertyWebkitAppearance: | 883 case CSSPropertyWebkitAppearance: |
889 case CSSPropertyWebkitBackfaceVisibility: | 884 case CSSPropertyWebkitBackfaceVisibility: |
890 case CSSPropertyWebkitBorderAfterStyle: | 885 case CSSPropertyWebkitBorderAfterStyle: |
891 case CSSPropertyWebkitBorderBeforeStyle: | 886 case CSSPropertyWebkitBorderBeforeStyle: |
892 case CSSPropertyWebkitBorderEndStyle: | 887 case CSSPropertyWebkitBorderEndStyle: |
893 case CSSPropertyWebkitBorderFit: | 888 case CSSPropertyWebkitBorderFit: |
894 case CSSPropertyWebkitBorderStartStyle: | 889 case CSSPropertyWebkitBorderStartStyle: |
895 case CSSPropertyWebkitBoxAlign: | 890 case CSSPropertyWebkitBoxAlign: |
(...skipping 1803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2699 m_valueList->next(); | 2694 m_valueList->next(); |
2700 } | 2695 } |
2701 break; | 2696 break; |
2702 case CSSPropertyShapeMargin: | 2697 case CSSPropertyShapeMargin: |
2703 case CSSPropertyShapePadding: | 2698 case CSSPropertyShapePadding: |
2704 validPrimitive = (RuntimeEnabledFeatures::cssShapesEnabled() && !id && v alidUnit(value, FLength | FNonNeg)); | 2699 validPrimitive = (RuntimeEnabledFeatures::cssShapesEnabled() && !id && v alidUnit(value, FLength | FNonNeg)); |
2705 break; | 2700 break; |
2706 case CSSPropertyShapeImageThreshold: | 2701 case CSSPropertyShapeImageThreshold: |
2707 validPrimitive = (RuntimeEnabledFeatures::cssShapesEnabled() && !id && v alidUnit(value, FNumber)); | 2702 validPrimitive = (RuntimeEnabledFeatures::cssShapesEnabled() && !id && v alidUnit(value, FNumber)); |
2708 break; | 2703 break; |
2704 | |
2705 case CSSPropertyTouchAction: | |
2706 // auto | none | (panX || panY) | |
Rick Byers
2013/12/06 21:44:04
indent comment
gnana
2013/12/10 18:24:37
Done.
| |
2707 return parseTouchAction(propId, important); | |
2708 | |
2709 case CSSPropertyBorderBottomStyle: | 2709 case CSSPropertyBorderBottomStyle: |
2710 case CSSPropertyBorderCollapse: | 2710 case CSSPropertyBorderCollapse: |
2711 case CSSPropertyBorderLeftStyle: | 2711 case CSSPropertyBorderLeftStyle: |
2712 case CSSPropertyBorderRightStyle: | 2712 case CSSPropertyBorderRightStyle: |
2713 case CSSPropertyBorderTopStyle: | 2713 case CSSPropertyBorderTopStyle: |
2714 case CSSPropertyBoxSizing: | 2714 case CSSPropertyBoxSizing: |
2715 case CSSPropertyCaptionSide: | 2715 case CSSPropertyCaptionSide: |
2716 case CSSPropertyClear: | 2716 case CSSPropertyClear: |
2717 case CSSPropertyDirection: | 2717 case CSSPropertyDirection: |
2718 case CSSPropertyDisplay: | 2718 case CSSPropertyDisplay: |
(...skipping 20 matching lines...) Expand all Loading... | |
2739 case CSSPropertyTextJustify: | 2739 case CSSPropertyTextJustify: |
2740 case CSSPropertyTextLineThroughMode: | 2740 case CSSPropertyTextLineThroughMode: |
2741 case CSSPropertyTextLineThroughStyle: | 2741 case CSSPropertyTextLineThroughStyle: |
2742 case CSSPropertyTextOverflow: | 2742 case CSSPropertyTextOverflow: |
2743 case CSSPropertyTextOverlineMode: | 2743 case CSSPropertyTextOverlineMode: |
2744 case CSSPropertyTextOverlineStyle: | 2744 case CSSPropertyTextOverlineStyle: |
2745 case CSSPropertyTextRendering: | 2745 case CSSPropertyTextRendering: |
2746 case CSSPropertyTextTransform: | 2746 case CSSPropertyTextTransform: |
2747 case CSSPropertyTextUnderlineMode: | 2747 case CSSPropertyTextUnderlineMode: |
2748 case CSSPropertyTextUnderlineStyle: | 2748 case CSSPropertyTextUnderlineStyle: |
2749 case CSSPropertyTouchAction: | |
2750 case CSSPropertyTouchActionDelay: | 2749 case CSSPropertyTouchActionDelay: |
2751 case CSSPropertyVariable: | 2750 case CSSPropertyVariable: |
2752 case CSSPropertyVisibility: | 2751 case CSSPropertyVisibility: |
2753 case CSSPropertyWebkitAppearance: | 2752 case CSSPropertyWebkitAppearance: |
2754 case CSSPropertyWebkitBackfaceVisibility: | 2753 case CSSPropertyWebkitBackfaceVisibility: |
2755 case CSSPropertyWebkitBorderAfterStyle: | 2754 case CSSPropertyWebkitBorderAfterStyle: |
2756 case CSSPropertyWebkitBorderBeforeStyle: | 2755 case CSSPropertyWebkitBorderBeforeStyle: |
2757 case CSSPropertyWebkitBorderEndStyle: | 2756 case CSSPropertyWebkitBorderEndStyle: |
2758 case CSSPropertyWebkitBorderFit: | 2757 case CSSPropertyWebkitBorderFit: |
2759 case CSSPropertyWebkitBorderStartStyle: | 2758 case CSSPropertyWebkitBorderStartStyle: |
(...skipping 6247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9007 break; | 9006 break; |
9008 } | 9007 } |
9009 default: | 9008 default: |
9010 ASSERT_NOT_REACHED(); | 9009 ASSERT_NOT_REACHED(); |
9011 return false; | 9010 return false; |
9012 } | 9011 } |
9013 | 9012 |
9014 return value; | 9013 return value; |
9015 } | 9014 } |
9016 | 9015 |
9016 void CSSParser::addTouchActionProperty(CSSPropertyID propId, PassRefPtr<CSSValue > value, bool important) | |
Rick Byers
2013/12/06 21:44:04
this looks like it's copied from a function dealin
gnana
2013/12/10 18:24:37
Done.
Removed this function and called addProperty
| |
9017 { | |
9018 if (propId == CSSPropertyTouchAction && !important && !inShorthand()) { | |
9019 for (unsigned i = 0; i < m_parsedProperties.size(); ++i) { | |
9020 if (m_parsedProperties[i].id() == CSSPropertyTouchAction) | |
9021 return; | |
9022 } | |
9023 } | |
9024 addProperty(propId, value, important); | |
9025 } | |
9026 | |
9027 bool CSSParser::parseTouchAction(CSSPropertyID propId, bool important) | |
9028 { | |
9029 if (propId == CSSPropertyTouchAction | |
9030 && !RuntimeEnabledFeatures::cssTouchActionEnabled()) | |
9031 return false; | |
9032 | |
9033 CSSParserValue* value = m_valueList->current(); | |
9034 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | |
9035 if (m_valueList->size() == 1 && value && (value->id == CSSValueAuto || value ->id == CSSValueNone)) { | |
9036 list->append(cssValuePool().createIdentifierValue(value->id)); | |
9037 addTouchActionProperty(propId, list.release(), important); | |
9038 m_valueList->next(); | |
9039 return true; | |
9040 } | |
9041 | |
9042 bool isValid = true; | |
9043 while (isValid && value) { | |
9044 switch (value->id) { | |
9045 case CSSValuePanX: | |
9046 case CSSValuePanY: | |
9047 list->append(cssValuePool().createIdentifierValue(value->id)); | |
Rick Byers
2013/12/06 21:44:04
You should check that a given value never occurs m
gnana
2013/12/10 18:24:37
Done.
| |
9048 break; | |
9049 default: | |
9050 isValid = false; | |
9051 break; | |
9052 } | |
9053 if (isValid) | |
9054 value = m_valueList->next(); | |
9055 } | |
9056 | |
9057 // Values are either valid or in shorthand scope. | |
9058 if (list->length() && isValid) { | |
9059 addTouchActionProperty(propId, list.release(), important); | |
9060 return true; | |
9061 } | |
9062 | |
9063 return false; | |
9064 } | |
9065 | |
9017 void CSSParser::addTextDecorationProperty(CSSPropertyID propId, PassRefPtr<CSSVa lue> value, bool important) | 9066 void CSSParser::addTextDecorationProperty(CSSPropertyID propId, PassRefPtr<CSSVa lue> value, bool important) |
9018 { | 9067 { |
9019 // The text-decoration-line property takes priority over text-decoration, un less the latter has important priority set. | 9068 // The text-decoration-line property takes priority over text-decoration, un less the latter has important priority set. |
9020 if (propId == CSSPropertyTextDecoration && !important && !inShorthand()) { | 9069 if (propId == CSSPropertyTextDecoration && !important && !inShorthand()) { |
9021 for (unsigned i = 0; i < m_parsedProperties.size(); ++i) { | 9070 for (unsigned i = 0; i < m_parsedProperties.size(); ++i) { |
9022 if (m_parsedProperties[i].id() == CSSPropertyTextDecorationLine) | 9071 if (m_parsedProperties[i].id() == CSSPropertyTextDecorationLine) |
9023 return; | 9072 return; |
9024 } | 9073 } |
9025 } | 9074 } |
9026 addProperty(propId, value, important); | 9075 addProperty(propId, value, important); |
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10409 { | 10458 { |
10410 // The tokenizer checks for the construct of an+b. | 10459 // The tokenizer checks for the construct of an+b. |
10411 // However, since the {ident} rule precedes the {nth} rule, some of those | 10460 // However, since the {ident} rule precedes the {nth} rule, some of those |
10412 // tokens are identified as string literal. Furthermore we need to accept | 10461 // tokens are identified as string literal. Furthermore we need to accept |
10413 // "odd" and "even" which does not match to an+b. | 10462 // "odd" and "even" which does not match to an+b. |
10414 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 10463 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
10415 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 10464 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
10416 } | 10465 } |
10417 | 10466 |
10418 } | 10467 } |
OLD | NEW |