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 7648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7659 ASSERT(value); | 7659 ASSERT(value); |
7660 | 7660 |
7661 CSSValueID id = value->id; | 7661 CSSValueID id = value->id; |
7662 | 7662 |
7663 bool validPrimitive = false; | 7663 bool validPrimitive = false; |
7664 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; | 7664 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; |
7665 | 7665 |
7666 switch (propId) { | 7666 switch (propId) { |
7667 /* The comment to the right defines all valid value of these | 7667 /* The comment to the right defines all valid value of these |
7668 * properties as defined in SVG 1.1, Appendix N. Property index */ | 7668 * properties as defined in SVG 1.1, Appendix N. Property index */ |
7669 case CSSPropertyAlignmentBaseline: | |
7670 // auto | baseline | before-edge | text-before-edge | middle | | |
7671 // central | after-edge | text-after-edge | ideographic | alphabetic | | |
7672 // hanging | mathematical | inherit | |
7673 if (id == CSSValueAuto || id == CSSValueBaseline || id == CSSValueMiddle | |
7674 || (id >= CSSValueBeforeEdge && id <= CSSValueMathematical)) | |
7675 validPrimitive = true; | |
7676 break; | |
7677 | |
7678 case CSSPropertyBaselineShift: | 7669 case CSSPropertyBaselineShift: |
7679 // baseline | super | sub | <percentage> | <length> | inherit | 7670 // baseline | super | sub | <percentage> | <length> | inherit |
7680 if (id == CSSValueBaseline || id == CSSValueSub || id == CSSValueSuper) | 7671 if (id == CSSValueBaseline || id == CSSValueSub || id == CSSValueSuper) |
7681 validPrimitive = true; | 7672 validPrimitive = true; |
7682 else | 7673 else |
7683 validPrimitive = validUnit(value, FLength | FPercent, SVGAttributeMo
de); | 7674 validPrimitive = validUnit(value, FLength | FPercent, SVGAttributeMo
de); |
7684 break; | 7675 break; |
7685 | 7676 |
7686 case CSSPropertyDominantBaseline: | |
7687 // auto | use-script | no-change | reset-size | ideographic | | |
7688 // alphabetic | hanging | mathematical | central | middle | | |
7689 // text-after-edge | text-before-edge | inherit | |
7690 if (id == CSSValueAuto || id == CSSValueMiddle | |
7691 || (id >= CSSValueUseScript && id <= CSSValueResetSize) | |
7692 || (id >= CSSValueCentral && id <= CSSValueMathematical)) | |
7693 validPrimitive = true; | |
7694 break; | |
7695 | |
7696 case CSSPropertyEnableBackground: | 7677 case CSSPropertyEnableBackground: |
7697 // accumulate | new [x] [y] [width] [height] | inherit | 7678 // accumulate | new [x] [y] [width] [height] | inherit |
7698 if (id == CSSValueAccumulate) // TODO : new | 7679 if (id == CSSValueAccumulate) // TODO : new |
7699 validPrimitive = true; | 7680 validPrimitive = true; |
7700 break; | 7681 break; |
7701 | 7682 |
7702 case CSSPropertyClipPath: | 7683 case CSSPropertyClipPath: |
7703 case CSSPropertyFilter: | 7684 case CSSPropertyFilter: |
7704 case CSSPropertyMarkerStart: | 7685 case CSSPropertyMarkerStart: |
7705 case CSSPropertyMarkerMid: | 7686 case CSSPropertyMarkerMid: |
7706 case CSSPropertyMarkerEnd: | 7687 case CSSPropertyMarkerEnd: |
7707 case CSSPropertyMask: | 7688 case CSSPropertyMask: |
7708 if (id == CSSValueNone) { | 7689 if (id == CSSValueNone) { |
7709 validPrimitive = true; | 7690 validPrimitive = true; |
7710 } else if (value->unit == CSSPrimitiveValue::CSS_URI) { | 7691 } else if (value->unit == CSSPrimitiveValue::CSS_URI) { |
7711 parsedValue = CSSPrimitiveValue::create(value->string, CSSPrimitiveV
alue::CSS_URI); | 7692 parsedValue = CSSPrimitiveValue::create(value->string, CSSPrimitiveV
alue::CSS_URI); |
7712 if (parsedValue) | 7693 if (parsedValue) |
7713 m_valueList->next(); | 7694 m_valueList->next(); |
7714 } | 7695 } |
7715 break; | 7696 break; |
7716 | 7697 |
7717 case CSSPropertyClipRule: // nonzero | evenodd | inherit | |
7718 case CSSPropertyFillRule: | |
7719 if (id == CSSValueNonzero || id == CSSValueEvenodd) | |
7720 validPrimitive = true; | |
7721 break; | |
7722 | |
7723 case CSSPropertyStrokeMiterlimit: // <miterlimit> | inherit | 7698 case CSSPropertyStrokeMiterlimit: // <miterlimit> | inherit |
7724 validPrimitive = validUnit(value, FNumber | FNonNeg, SVGAttributeMode); | 7699 validPrimitive = validUnit(value, FNumber | FNonNeg, SVGAttributeMode); |
7725 break; | 7700 break; |
7726 | 7701 |
7727 case CSSPropertyStrokeLinejoin: // miter | round | bevel | inherit | |
7728 if (id == CSSValueMiter || id == CSSValueRound || id == CSSValueBevel) | |
7729 validPrimitive = true; | |
7730 break; | |
7731 | |
7732 case CSSPropertyStrokeLinecap: // butt | round | square | inherit | |
7733 if (id == CSSValueButt || id == CSSValueRound || id == CSSValueSquare) | |
7734 validPrimitive = true; | |
7735 break; | |
7736 | |
7737 case CSSPropertyStrokeOpacity: // <opacity-value> | inherit | 7702 case CSSPropertyStrokeOpacity: // <opacity-value> | inherit |
7738 case CSSPropertyFillOpacity: | 7703 case CSSPropertyFillOpacity: |
7739 case CSSPropertyStopOpacity: | 7704 case CSSPropertyStopOpacity: |
7740 case CSSPropertyFloodOpacity: | 7705 case CSSPropertyFloodOpacity: |
7741 validPrimitive = validUnit(value, FNumber | FPercent, SVGAttributeMode); | 7706 validPrimitive = validUnit(value, FNumber | FPercent, SVGAttributeMode); |
7742 break; | 7707 break; |
7743 | 7708 |
7744 case CSSPropertyShapeRendering: | |
7745 // auto | optimizeSpeed | crispEdges | geometricPrecision | inherit | |
7746 if (id == CSSValueAuto || id == CSSValueOptimizeSpeed | |
7747 || id == CSSValueCrispEdges || id == CSSValueGeometricPrecision) | |
7748 validPrimitive = true; | |
7749 break; | |
7750 | |
7751 case CSSPropertyColorRendering: // optimizeQuality | inherit | |
7752 if (id == CSSValueAuto || id == CSSValueOptimizeSpeed | |
7753 || id == CSSValueOptimizeQuality) | |
7754 validPrimitive = true; | |
7755 break; | |
7756 | |
7757 case CSSPropertyBufferedRendering: // auto | dynamic | static | |
7758 if (id == CSSValueAuto || id == CSSValueDynamic || id == CSSValueStatic) | |
7759 validPrimitive = true; | |
7760 break; | |
7761 | |
7762 case CSSPropertyColorInterpolation: // auto | sRGB | linearRGB | inherit | |
7763 case CSSPropertyColorInterpolationFilters: | |
7764 if (id == CSSValueAuto || id == CSSValueSRGB || id == CSSValueLinearRGB) | |
7765 validPrimitive = true; | |
7766 break; | |
7767 | |
7768 /* Start of supported CSS properties with validation. This is needed for par
seShortHand to work | 7709 /* Start of supported CSS properties with validation. This is needed for par
seShortHand to work |
7769 * correctly and allows optimization in applyRule(..) | 7710 * correctly and allows optimization in applyRule(..) |
7770 */ | 7711 */ |
7771 | 7712 |
7772 case CSSPropertyTextAnchor: // start | middle | end | inherit | |
7773 if (id == CSSValueStart || id == CSSValueMiddle || id == CSSValueEnd) | |
7774 validPrimitive = true; | |
7775 break; | |
7776 | |
7777 case CSSPropertyGlyphOrientationVertical: // auto | <angle> | inherit | 7713 case CSSPropertyGlyphOrientationVertical: // auto | <angle> | inherit |
7778 if (id == CSSValueAuto) { | 7714 if (id == CSSValueAuto) { |
7779 validPrimitive = true; | 7715 validPrimitive = true; |
7780 break; | 7716 break; |
7781 } | 7717 } |
7782 /* fallthrough intentional */ | 7718 /* fallthrough intentional */ |
7783 case CSSPropertyGlyphOrientationHorizontal: // <angle> (restricted to _deg_
per SVG 1.1 spec) | inherit | 7719 case CSSPropertyGlyphOrientationHorizontal: // <angle> (restricted to _deg_
per SVG 1.1 spec) | inherit |
7784 if (value->unit == CSSPrimitiveValue::CSS_DEG || value->unit == CSSPrimi
tiveValue::CSS_NUMBER) { | 7720 if (value->unit == CSSPrimitiveValue::CSS_DEG || value->unit == CSSPrimi
tiveValue::CSS_NUMBER) { |
7785 parsedValue = CSSPrimitiveValue::create(value->fValue, CSSPrimitiveV
alue::CSS_DEG); | 7721 parsedValue = CSSPrimitiveValue::create(value->fValue, CSSPrimitiveV
alue::CSS_DEG); |
7786 | 7722 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7827 | 7763 |
7828 break; | 7764 break; |
7829 | 7765 |
7830 case CSSPropertyPaintOrder: | 7766 case CSSPropertyPaintOrder: |
7831 if (m_valueList->size() == 1 && id == CSSValueNormal) | 7767 if (m_valueList->size() == 1 && id == CSSValueNormal) |
7832 validPrimitive = true; | 7768 validPrimitive = true; |
7833 else if ((parsedValue = parsePaintOrder())) | 7769 else if ((parsedValue = parsePaintOrder())) |
7834 m_valueList->next(); | 7770 m_valueList->next(); |
7835 break; | 7771 break; |
7836 | 7772 |
7837 case CSSPropertyVectorEffect: // none | non-scaling-stroke | inherit | |
7838 if (id == CSSValueNone || id == CSSValueNonScalingStroke) | |
7839 validPrimitive = true; | |
7840 break; | |
7841 | |
7842 case CSSPropertyWritingMode: | |
7843 // lr-tb | rl_tb | tb-rl | lr | rl | tb | inherit | |
7844 if (id == CSSValueLrTb || id == CSSValueRlTb || id == CSSValueTbRl || id
== CSSValueLr || id == CSSValueRl || id == CSSValueTb) | |
7845 validPrimitive = true; | |
7846 break; | |
7847 | |
7848 case CSSPropertyStrokeWidth: // <length> | inherit | 7773 case CSSPropertyStrokeWidth: // <length> | inherit |
7849 case CSSPropertyStrokeDashoffset: | 7774 case CSSPropertyStrokeDashoffset: |
7850 case CSSPropertyCx: | 7775 case CSSPropertyCx: |
7851 case CSSPropertyCy: | 7776 case CSSPropertyCy: |
7852 case CSSPropertyX: | 7777 case CSSPropertyX: |
7853 case CSSPropertyY: | 7778 case CSSPropertyY: |
7854 case CSSPropertyR: | 7779 case CSSPropertyR: |
7855 case CSSPropertyRx: | 7780 case CSSPropertyRx: |
7856 case CSSPropertyRy: | 7781 case CSSPropertyRy: |
7857 validPrimitive = validUnit(value, FLength | FPercent, SVGAttributeMode); | 7782 validPrimitive = validUnit(value, FLength | FPercent, SVGAttributeMode); |
7858 break; | 7783 break; |
7859 case CSSPropertyStrokeDasharray: // none | <dasharray> | inherit | 7784 case CSSPropertyStrokeDasharray: // none | <dasharray> | inherit |
7860 if (id == CSSValueNone) | 7785 if (id == CSSValueNone) |
7861 validPrimitive = true; | 7786 validPrimitive = true; |
7862 else | 7787 else |
7863 parsedValue = parseSVGStrokeDasharray(); | 7788 parsedValue = parseSVGStrokeDasharray(); |
7864 break; | 7789 break; |
7865 | 7790 |
7866 case CSSPropertyMaskType: // luminance | alpha | inherit | |
7867 if (id == CSSValueLuminance || id == CSSValueAlpha) | |
7868 validPrimitive = true; | |
7869 break; | |
7870 | |
7871 /* shorthand properties */ | 7791 /* shorthand properties */ |
7872 case CSSPropertyMarker: { | 7792 case CSSPropertyMarker: { |
7873 ShorthandScope scope(this, propId); | 7793 ShorthandScope scope(this, propId); |
7874 CSSPropertyParser::ImplicitScope implicitScope(this); | 7794 CSSPropertyParser::ImplicitScope implicitScope(this); |
7875 if (!parseValue(CSSPropertyMarkerStart, important)) | 7795 if (!parseValue(CSSPropertyMarkerStart, important)) |
7876 return false; | 7796 return false; |
7877 if (m_valueList->current()) { | 7797 if (m_valueList->current()) { |
7878 rollbackLastProperties(1); | 7798 rollbackLastProperties(1); |
7879 return false; | 7799 return false; |
7880 } | 7800 } |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8232 } | 8152 } |
8233 } | 8153 } |
8234 | 8154 |
8235 if (!list->length()) | 8155 if (!list->length()) |
8236 return nullptr; | 8156 return nullptr; |
8237 | 8157 |
8238 return list.release(); | 8158 return list.release(); |
8239 } | 8159 } |
8240 | 8160 |
8241 } // namespace blink | 8161 } // namespace blink |
OLD | NEW |