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 | [pan-x || pan-y] |
| 2707 return parseTouchAction(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 bool CSSParser::parseTouchAction(bool important) |
| 9017 { |
| 9018 if (!RuntimeEnabledFeatures::cssTouchActionEnabled()) |
| 9019 return false; |
| 9020 |
| 9021 CSSParserValue* value = m_valueList->current(); |
| 9022 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 9023 if (m_valueList->size() == 1 && value && (value->id == CSSValueAuto || value
->id == CSSValueNone)) { |
| 9024 list->append(cssValuePool().createIdentifierValue(value->id)); |
| 9025 addProperty(CSSPropertyTouchAction, list.release(), important); |
| 9026 m_valueList->next(); |
| 9027 return true; |
| 9028 } |
| 9029 |
| 9030 bool isValid = true; |
| 9031 while (isValid && value) { |
| 9032 switch (value->id) { |
| 9033 case CSSValuePanX: |
| 9034 case CSSValuePanY: { |
| 9035 RefPtr<CSSValue> panValue = cssValuePool().createIdentifierValue(val
ue->id); |
| 9036 if (list->hasValue(panValue.get())) { |
| 9037 isValid = false; |
| 9038 break; |
| 9039 } |
| 9040 list->append(panValue.release()); |
| 9041 break; |
| 9042 } |
| 9043 default: |
| 9044 isValid = false; |
| 9045 break; |
| 9046 } |
| 9047 if (isValid) |
| 9048 value = m_valueList->next(); |
| 9049 } |
| 9050 |
| 9051 if (list->length() && isValid) { |
| 9052 addProperty(CSSPropertyTouchAction, list.release(), important); |
| 9053 return true; |
| 9054 } |
| 9055 |
| 9056 return false; |
| 9057 } |
| 9058 |
9017 void CSSParser::addTextDecorationProperty(CSSPropertyID propId, PassRefPtr<CSSVa
lue> value, bool important) | 9059 void CSSParser::addTextDecorationProperty(CSSPropertyID propId, PassRefPtr<CSSVa
lue> value, bool important) |
9018 { | 9060 { |
9019 // The text-decoration-line property takes priority over text-decoration, un
less the latter has important priority set. | 9061 // The text-decoration-line property takes priority over text-decoration, un
less the latter has important priority set. |
9020 if (propId == CSSPropertyTextDecoration && !important && !inShorthand()) { | 9062 if (propId == CSSPropertyTextDecoration && !important && !inShorthand()) { |
9021 for (unsigned i = 0; i < m_parsedProperties.size(); ++i) { | 9063 for (unsigned i = 0; i < m_parsedProperties.size(); ++i) { |
9022 if (m_parsedProperties[i].id() == CSSPropertyTextDecorationLine) | 9064 if (m_parsedProperties[i].id() == CSSPropertyTextDecorationLine) |
9023 return; | 9065 return; |
9024 } | 9066 } |
9025 } | 9067 } |
9026 addProperty(propId, value, important); | 9068 addProperty(propId, value, important); |
(...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10414 { | 10456 { |
10415 // The tokenizer checks for the construct of an+b. | 10457 // The tokenizer checks for the construct of an+b. |
10416 // However, since the {ident} rule precedes the {nth} rule, some of those | 10458 // However, since the {ident} rule precedes the {nth} rule, some of those |
10417 // tokens are identified as string literal. Furthermore we need to accept | 10459 // tokens are identified as string literal. Furthermore we need to accept |
10418 // "odd" and "even" which does not match to an+b. | 10460 // "odd" and "even" which does not match to an+b. |
10419 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 10461 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
10420 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 10462 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
10421 } | 10463 } |
10422 | 10464 |
10423 } | 10465 } |
OLD | NEW |