OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2005 Alexander Kellett <lypanov@kde.org> | 4 * Copyright (C) 2005 Alexander Kellett <lypanov@kde.org> |
5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
6 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 namespace WebCore { | 31 namespace WebCore { |
32 | 32 |
33 // Animated property definitions | 33 // Animated property definitions |
34 DEFINE_ANIMATED_ENUMERATION(SVGMaskElement, SVGNames::maskUnitsAttr, MaskUnits,
maskUnits, SVGUnitTypes::SVGUnitType) | 34 DEFINE_ANIMATED_ENUMERATION(SVGMaskElement, SVGNames::maskUnitsAttr, MaskUnits,
maskUnits, SVGUnitTypes::SVGUnitType) |
35 DEFINE_ANIMATED_ENUMERATION(SVGMaskElement, SVGNames::maskContentUnitsAttr, Mask
ContentUnits, maskContentUnits, SVGUnitTypes::SVGUnitType) | 35 DEFINE_ANIMATED_ENUMERATION(SVGMaskElement, SVGNames::maskContentUnitsAttr, Mask
ContentUnits, maskContentUnits, SVGUnitTypes::SVGUnitType) |
36 DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::xAttr, X, x) | 36 DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::xAttr, X, x) |
37 DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::yAttr, Y, y) | 37 DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::yAttr, Y, y) |
38 DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::widthAttr, Width, width) | 38 DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::widthAttr, Width, width) |
39 DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::heightAttr, Height, height) | 39 DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::heightAttr, Height, height) |
40 DEFINE_ANIMATED_BOOLEAN(SVGMaskElement, SVGNames::externalResourcesRequiredAttr,
ExternalResourcesRequired, externalResourcesRequired) | |
41 | 40 |
42 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMaskElement) | 41 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMaskElement) |
43 REGISTER_LOCAL_ANIMATED_PROPERTY(maskUnits) | 42 REGISTER_LOCAL_ANIMATED_PROPERTY(maskUnits) |
44 REGISTER_LOCAL_ANIMATED_PROPERTY(maskContentUnits) | 43 REGISTER_LOCAL_ANIMATED_PROPERTY(maskContentUnits) |
45 REGISTER_LOCAL_ANIMATED_PROPERTY(x) | 44 REGISTER_LOCAL_ANIMATED_PROPERTY(x) |
46 REGISTER_LOCAL_ANIMATED_PROPERTY(y) | 45 REGISTER_LOCAL_ANIMATED_PROPERTY(y) |
47 REGISTER_LOCAL_ANIMATED_PROPERTY(width) | 46 REGISTER_LOCAL_ANIMATED_PROPERTY(width) |
48 REGISTER_LOCAL_ANIMATED_PROPERTY(height) | 47 REGISTER_LOCAL_ANIMATED_PROPERTY(height) |
49 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | |
50 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) | 48 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) |
51 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) | 49 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) |
52 END_REGISTER_ANIMATED_PROPERTIES | 50 END_REGISTER_ANIMATED_PROPERTIES |
53 | 51 |
54 inline SVGMaskElement::SVGMaskElement(Document& document) | 52 inline SVGMaskElement::SVGMaskElement(Document& document) |
55 : SVGElement(SVGNames::maskTag, document) | 53 : SVGElement(SVGNames::maskTag, document) |
56 , m_maskUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) | 54 , m_maskUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) |
57 , m_maskContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) | 55 , m_maskContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) |
58 , m_x(LengthModeWidth, "-10%") | 56 , m_x(LengthModeWidth, "-10%") |
59 , m_y(LengthModeHeight, "-10%") | 57 , m_y(LengthModeHeight, "-10%") |
60 , m_width(LengthModeWidth, "120%") | 58 , m_width(LengthModeWidth, "120%") |
61 , m_height(LengthModeHeight, "120%") | 59 , m_height(LengthModeHeight, "120%") |
62 { | 60 { |
63 // Spec: If the x/y attribute is not specified, the effect is as if a value
of "-10%" were specified. | 61 // Spec: If the x/y attribute is not specified, the effect is as if a value
of "-10%" were specified. |
64 // Spec: If the width/height attribute is not specified, the effect is as if
a value of "120%" were specified. | 62 // Spec: If the width/height attribute is not specified, the effect is as if
a value of "120%" were specified. |
65 ScriptWrappable::init(this); | 63 ScriptWrappable::init(this); |
66 registerAnimatedPropertiesForSVGMaskElement(); | 64 registerAnimatedPropertiesForSVGMaskElement(); |
67 } | 65 } |
68 | 66 |
69 PassRefPtr<SVGMaskElement> SVGMaskElement::create(Document& document) | 67 PassRefPtr<SVGMaskElement> SVGMaskElement::create(Document& document) |
70 { | 68 { |
71 return adoptRef(new SVGMaskElement(document)); | 69 return adoptRef(new SVGMaskElement(document)); |
72 } | 70 } |
73 | 71 |
74 bool SVGMaskElement::isSupportedAttribute(const QualifiedName& attrName) | 72 bool SVGMaskElement::isSupportedAttribute(const QualifiedName& attrName) |
75 { | 73 { |
76 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 74 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
77 if (supportedAttributes.isEmpty()) { | 75 if (supportedAttributes.isEmpty()) { |
78 SVGTests::addSupportedAttributes(supportedAttributes); | 76 SVGTests::addSupportedAttributes(supportedAttributes); |
79 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | |
80 supportedAttributes.add(SVGNames::maskUnitsAttr); | 77 supportedAttributes.add(SVGNames::maskUnitsAttr); |
81 supportedAttributes.add(SVGNames::maskContentUnitsAttr); | 78 supportedAttributes.add(SVGNames::maskContentUnitsAttr); |
82 supportedAttributes.add(SVGNames::xAttr); | 79 supportedAttributes.add(SVGNames::xAttr); |
83 supportedAttributes.add(SVGNames::yAttr); | 80 supportedAttributes.add(SVGNames::yAttr); |
84 supportedAttributes.add(SVGNames::widthAttr); | 81 supportedAttributes.add(SVGNames::widthAttr); |
85 supportedAttributes.add(SVGNames::heightAttr); | 82 supportedAttributes.add(SVGNames::heightAttr); |
86 } | 83 } |
87 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 84 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
88 } | 85 } |
89 | 86 |
(...skipping 14 matching lines...) Expand all Loading... |
104 setMaskContentUnitsBaseValue(propertyValue); | 101 setMaskContentUnitsBaseValue(propertyValue); |
105 return; | 102 return; |
106 } else if (name == SVGNames::xAttr) | 103 } else if (name == SVGNames::xAttr) |
107 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); | 104 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); |
108 else if (name == SVGNames::yAttr) | 105 else if (name == SVGNames::yAttr) |
109 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError))
; | 106 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError))
; |
110 else if (name == SVGNames::widthAttr) | 107 else if (name == SVGNames::widthAttr) |
111 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro
r)); | 108 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro
r)); |
112 else if (name == SVGNames::heightAttr) | 109 else if (name == SVGNames::heightAttr) |
113 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr
ror)); | 110 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr
ror)); |
114 else if (SVGTests::parseAttribute(name, value) | 111 else if (SVGTests::parseAttribute(name, value)) { |
115 || SVGExternalResourcesRequired::parseAttribute(name, value)) { | |
116 } else | 112 } else |
117 ASSERT_NOT_REACHED(); | 113 ASSERT_NOT_REACHED(); |
118 | 114 |
119 reportAttributeParsingError(parseError, name, value); | 115 reportAttributeParsingError(parseError, name, value); |
120 } | 116 } |
121 | 117 |
122 void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) | 118 void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) |
123 { | 119 { |
124 if (!isSupportedAttribute(attrName)) { | 120 if (!isSupportedAttribute(attrName)) { |
125 SVGElement::svgAttributeChanged(attrName); | 121 SVGElement::svgAttributeChanged(attrName); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 153 |
158 bool SVGMaskElement::selfHasRelativeLengths() const | 154 bool SVGMaskElement::selfHasRelativeLengths() const |
159 { | 155 { |
160 return xCurrentValue().isRelative() | 156 return xCurrentValue().isRelative() |
161 || yCurrentValue().isRelative() | 157 || yCurrentValue().isRelative() |
162 || widthCurrentValue().isRelative() | 158 || widthCurrentValue().isRelative() |
163 || heightCurrentValue().isRelative(); | 159 || heightCurrentValue().isRelative(); |
164 } | 160 } |
165 | 161 |
166 } | 162 } |
OLD | NEW |