OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "wtf/Assertions.h" | 30 #include "wtf/Assertions.h" |
31 | 31 |
32 namespace WebCore { | 32 namespace WebCore { |
33 | 33 |
34 // Animated property definitions | 34 // Animated property definitions |
35 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::xAttr, X, x) | 35 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::xAttr, X, x) |
36 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::yAttr, Y, y) | 36 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::yAttr, Y, y) |
37 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::widthAttr, Width, widt
h) | 37 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::widthAttr, Width, widt
h) |
38 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::heightAttr, Height, he
ight) | 38 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::heightAttr, Height, he
ight) |
39 DEFINE_ANIMATED_STRING(SVGForeignObjectElement, XLinkNames::hrefAttr, Href, href
) | 39 DEFINE_ANIMATED_STRING(SVGForeignObjectElement, XLinkNames::hrefAttr, Href, href
) |
40 DEFINE_ANIMATED_BOOLEAN(SVGForeignObjectElement, SVGNames::externalResourcesRequ
iredAttr, ExternalResourcesRequired, externalResourcesRequired) | |
41 | 40 |
42 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGForeignObjectElement) | 41 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGForeignObjectElement) |
43 REGISTER_LOCAL_ANIMATED_PROPERTY(x) | 42 REGISTER_LOCAL_ANIMATED_PROPERTY(x) |
44 REGISTER_LOCAL_ANIMATED_PROPERTY(y) | 43 REGISTER_LOCAL_ANIMATED_PROPERTY(y) |
45 REGISTER_LOCAL_ANIMATED_PROPERTY(width) | 44 REGISTER_LOCAL_ANIMATED_PROPERTY(width) |
46 REGISTER_LOCAL_ANIMATED_PROPERTY(height) | 45 REGISTER_LOCAL_ANIMATED_PROPERTY(height) |
47 REGISTER_LOCAL_ANIMATED_PROPERTY(href) | 46 REGISTER_LOCAL_ANIMATED_PROPERTY(href) |
48 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | |
49 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) | 47 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) |
50 END_REGISTER_ANIMATED_PROPERTIES | 48 END_REGISTER_ANIMATED_PROPERTIES |
51 | 49 |
52 inline SVGForeignObjectElement::SVGForeignObjectElement(const QualifiedName& tag
Name, Document& document) | 50 inline SVGForeignObjectElement::SVGForeignObjectElement(const QualifiedName& tag
Name, Document& document) |
53 : SVGGraphicsElement(tagName, document) | 51 : SVGGraphicsElement(tagName, document) |
54 , m_x(LengthModeWidth) | 52 , m_x(LengthModeWidth) |
55 , m_y(LengthModeHeight) | 53 , m_y(LengthModeHeight) |
56 , m_width(LengthModeWidth) | 54 , m_width(LengthModeWidth) |
57 , m_height(LengthModeHeight) | 55 , m_height(LengthModeHeight) |
58 { | 56 { |
59 ASSERT(hasTagName(SVGNames::foreignObjectTag)); | 57 ASSERT(hasTagName(SVGNames::foreignObjectTag)); |
60 ScriptWrappable::init(this); | 58 ScriptWrappable::init(this); |
61 registerAnimatedPropertiesForSVGForeignObjectElement(); | 59 registerAnimatedPropertiesForSVGForeignObjectElement(); |
62 } | 60 } |
63 | 61 |
64 PassRefPtr<SVGForeignObjectElement> SVGForeignObjectElement::create(const Qualif
iedName& tagName, Document& document) | 62 PassRefPtr<SVGForeignObjectElement> SVGForeignObjectElement::create(const Qualif
iedName& tagName, Document& document) |
65 { | 63 { |
66 return adoptRef(new SVGForeignObjectElement(tagName, document)); | 64 return adoptRef(new SVGForeignObjectElement(tagName, document)); |
67 } | 65 } |
68 | 66 |
69 bool SVGForeignObjectElement::isSupportedAttribute(const QualifiedName& attrName
) | 67 bool SVGForeignObjectElement::isSupportedAttribute(const QualifiedName& attrName
) |
70 { | 68 { |
71 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 69 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
72 if (supportedAttributes.isEmpty()) { | 70 if (supportedAttributes.isEmpty()) { |
73 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | |
74 supportedAttributes.add(SVGNames::xAttr); | 71 supportedAttributes.add(SVGNames::xAttr); |
75 supportedAttributes.add(SVGNames::yAttr); | 72 supportedAttributes.add(SVGNames::yAttr); |
76 supportedAttributes.add(SVGNames::widthAttr); | 73 supportedAttributes.add(SVGNames::widthAttr); |
77 supportedAttributes.add(SVGNames::heightAttr); | 74 supportedAttributes.add(SVGNames::heightAttr); |
78 } | 75 } |
79 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 76 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
80 } | 77 } |
81 | 78 |
82 void SVGForeignObjectElement::parseAttribute(const QualifiedName& name, const At
omicString& value) | 79 void SVGForeignObjectElement::parseAttribute(const QualifiedName& name, const At
omicString& value) |
83 { | 80 { |
84 SVGParsingError parseError = NoError; | 81 SVGParsingError parseError = NoError; |
85 | 82 |
86 if (!isSupportedAttribute(name)) | 83 if (!isSupportedAttribute(name)) |
87 SVGGraphicsElement::parseAttribute(name, value); | 84 SVGGraphicsElement::parseAttribute(name, value); |
88 else if (name == SVGNames::xAttr) | 85 else if (name == SVGNames::xAttr) |
89 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); | 86 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); |
90 else if (name == SVGNames::yAttr) | 87 else if (name == SVGNames::yAttr) |
91 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError))
; | 88 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError))
; |
92 else if (name == SVGNames::widthAttr) | 89 else if (name == SVGNames::widthAttr) |
93 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro
r)); | 90 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro
r)); |
94 else if (name == SVGNames::heightAttr) | 91 else if (name == SVGNames::heightAttr) |
95 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr
ror)); | 92 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr
ror)); |
96 else if (SVGExternalResourcesRequired::parseAttribute(name, value)) { | 93 else |
97 } else | |
98 ASSERT_NOT_REACHED(); | 94 ASSERT_NOT_REACHED(); |
99 | 95 |
100 reportAttributeParsingError(parseError, name, value); | 96 reportAttributeParsingError(parseError, name, value); |
101 } | 97 } |
102 | 98 |
103 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) | 99 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) |
104 { | 100 { |
105 if (!isSupportedAttribute(attrName)) { | 101 if (!isSupportedAttribute(attrName)) { |
106 SVGGraphicsElement::svgAttributeChanged(attrName); | 102 SVGGraphicsElement::svgAttributeChanged(attrName); |
107 return; | 103 return; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 152 |
157 bool SVGForeignObjectElement::selfHasRelativeLengths() const | 153 bool SVGForeignObjectElement::selfHasRelativeLengths() const |
158 { | 154 { |
159 return xCurrentValue().isRelative() | 155 return xCurrentValue().isRelative() |
160 || yCurrentValue().isRelative() | 156 || yCurrentValue().isRelative() |
161 || widthCurrentValue().isRelative() | 157 || widthCurrentValue().isRelative() |
162 || heightCurrentValue().isRelative(); | 158 || heightCurrentValue().isRelative(); |
163 } | 159 } |
164 | 160 |
165 } | 161 } |
OLD | NEW |