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 18 matching lines...) Expand all Loading... |
29 #include "wtf/Assertions.h" | 29 #include "wtf/Assertions.h" |
30 | 30 |
31 namespace WebCore { | 31 namespace WebCore { |
32 | 32 |
33 // Animated property definitions | 33 // Animated property definitions |
34 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::xAttr, X, x) | 34 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::xAttr, X, x) |
35 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::yAttr, Y, y) | 35 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::yAttr, Y, y) |
36 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::widthAttr, Width, widt
h) | 36 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::widthAttr, Width, widt
h) |
37 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::heightAttr, Height, he
ight) | 37 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::heightAttr, Height, he
ight) |
38 DEFINE_ANIMATED_STRING(SVGForeignObjectElement, XLinkNames::hrefAttr, Href, href
) | 38 DEFINE_ANIMATED_STRING(SVGForeignObjectElement, XLinkNames::hrefAttr, Href, href
) |
39 DEFINE_ANIMATED_BOOLEAN(SVGForeignObjectElement, SVGNames::externalResourcesRequ
iredAttr, ExternalResourcesRequired, externalResourcesRequired) | |
40 | 39 |
41 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGForeignObjectElement) | 40 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGForeignObjectElement) |
42 REGISTER_LOCAL_ANIMATED_PROPERTY(x) | 41 REGISTER_LOCAL_ANIMATED_PROPERTY(x) |
43 REGISTER_LOCAL_ANIMATED_PROPERTY(y) | 42 REGISTER_LOCAL_ANIMATED_PROPERTY(y) |
44 REGISTER_LOCAL_ANIMATED_PROPERTY(width) | 43 REGISTER_LOCAL_ANIMATED_PROPERTY(width) |
45 REGISTER_LOCAL_ANIMATED_PROPERTY(height) | 44 REGISTER_LOCAL_ANIMATED_PROPERTY(height) |
46 REGISTER_LOCAL_ANIMATED_PROPERTY(href) | 45 REGISTER_LOCAL_ANIMATED_PROPERTY(href) |
47 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | |
48 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) | 46 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) |
49 END_REGISTER_ANIMATED_PROPERTIES | 47 END_REGISTER_ANIMATED_PROPERTIES |
50 | 48 |
51 inline SVGForeignObjectElement::SVGForeignObjectElement(Document& document) | 49 inline SVGForeignObjectElement::SVGForeignObjectElement(Document& document) |
52 : SVGGraphicsElement(SVGNames::foreignObjectTag, document) | 50 : SVGGraphicsElement(SVGNames::foreignObjectTag, document) |
53 , m_x(LengthModeWidth) | 51 , m_x(LengthModeWidth) |
54 , m_y(LengthModeHeight) | 52 , m_y(LengthModeHeight) |
55 , m_width(LengthModeWidth) | 53 , m_width(LengthModeWidth) |
56 , m_height(LengthModeHeight) | 54 , m_height(LengthModeHeight) |
57 { | 55 { |
58 ScriptWrappable::init(this); | 56 ScriptWrappable::init(this); |
59 registerAnimatedPropertiesForSVGForeignObjectElement(); | 57 registerAnimatedPropertiesForSVGForeignObjectElement(); |
60 } | 58 } |
61 | 59 |
62 PassRefPtr<SVGForeignObjectElement> SVGForeignObjectElement::create(Document& do
cument) | 60 PassRefPtr<SVGForeignObjectElement> SVGForeignObjectElement::create(Document& do
cument) |
63 { | 61 { |
64 return adoptRef(new SVGForeignObjectElement(document)); | 62 return adoptRef(new SVGForeignObjectElement(document)); |
65 } | 63 } |
66 | 64 |
67 bool SVGForeignObjectElement::isSupportedAttribute(const QualifiedName& attrName
) | 65 bool SVGForeignObjectElement::isSupportedAttribute(const QualifiedName& attrName
) |
68 { | 66 { |
69 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 67 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
70 if (supportedAttributes.isEmpty()) { | 68 if (supportedAttributes.isEmpty()) { |
71 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | |
72 supportedAttributes.add(SVGNames::xAttr); | 69 supportedAttributes.add(SVGNames::xAttr); |
73 supportedAttributes.add(SVGNames::yAttr); | 70 supportedAttributes.add(SVGNames::yAttr); |
74 supportedAttributes.add(SVGNames::widthAttr); | 71 supportedAttributes.add(SVGNames::widthAttr); |
75 supportedAttributes.add(SVGNames::heightAttr); | 72 supportedAttributes.add(SVGNames::heightAttr); |
76 } | 73 } |
77 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 74 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
78 } | 75 } |
79 | 76 |
80 void SVGForeignObjectElement::parseAttribute(const QualifiedName& name, const At
omicString& value) | 77 void SVGForeignObjectElement::parseAttribute(const QualifiedName& name, const At
omicString& value) |
81 { | 78 { |
82 SVGParsingError parseError = NoError; | 79 SVGParsingError parseError = NoError; |
83 | 80 |
84 if (!isSupportedAttribute(name)) | 81 if (!isSupportedAttribute(name)) |
85 SVGGraphicsElement::parseAttribute(name, value); | 82 SVGGraphicsElement::parseAttribute(name, value); |
86 else if (name == SVGNames::xAttr) | 83 else if (name == SVGNames::xAttr) |
87 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); | 84 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); |
88 else if (name == SVGNames::yAttr) | 85 else if (name == SVGNames::yAttr) |
89 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError))
; | 86 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError))
; |
90 else if (name == SVGNames::widthAttr) | 87 else if (name == SVGNames::widthAttr) |
91 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro
r)); | 88 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro
r)); |
92 else if (name == SVGNames::heightAttr) | 89 else if (name == SVGNames::heightAttr) |
93 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr
ror)); | 90 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr
ror)); |
94 else if (SVGExternalResourcesRequired::parseAttribute(name, value)) { | 91 else |
95 } else | |
96 ASSERT_NOT_REACHED(); | 92 ASSERT_NOT_REACHED(); |
97 | 93 |
98 reportAttributeParsingError(parseError, name, value); | 94 reportAttributeParsingError(parseError, name, value); |
99 } | 95 } |
100 | 96 |
101 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) | 97 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) |
102 { | 98 { |
103 if (!isSupportedAttribute(attrName)) { | 99 if (!isSupportedAttribute(attrName)) { |
104 SVGGraphicsElement::svgAttributeChanged(attrName); | 100 SVGGraphicsElement::svgAttributeChanged(attrName); |
105 return; | 101 return; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 150 |
155 bool SVGForeignObjectElement::selfHasRelativeLengths() const | 151 bool SVGForeignObjectElement::selfHasRelativeLengths() const |
156 { | 152 { |
157 return xCurrentValue().isRelative() | 153 return xCurrentValue().isRelative() |
158 || yCurrentValue().isRelative() | 154 || yCurrentValue().isRelative() |
159 || widthCurrentValue().isRelative() | 155 || widthCurrentValue().isRelative() |
160 || heightCurrentValue().isRelative(); | 156 || heightCurrentValue().isRelative(); |
161 } | 157 } |
162 | 158 |
163 } | 159 } |
OLD | NEW |