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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 PassRefPtr<SVGForeignObjectElement> SVGForeignObjectElement::create(const Qualif
iedName& tagName, Document* document) | 65 PassRefPtr<SVGForeignObjectElement> SVGForeignObjectElement::create(const Qualif
iedName& tagName, Document* document) |
66 { | 66 { |
67 return adoptRef(new SVGForeignObjectElement(tagName, document)); | 67 return adoptRef(new SVGForeignObjectElement(tagName, document)); |
68 } | 68 } |
69 | 69 |
70 bool SVGForeignObjectElement::isSupportedAttribute(const QualifiedName& attrName
) | 70 bool SVGForeignObjectElement::isSupportedAttribute(const QualifiedName& attrName
) |
71 { | 71 { |
72 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 72 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
73 if (supportedAttributes.isEmpty()) { | 73 if (supportedAttributes.isEmpty()) { |
74 SVGTests::addSupportedAttributes(supportedAttributes); | |
75 SVGLangSpace::addSupportedAttributes(supportedAttributes); | 74 SVGLangSpace::addSupportedAttributes(supportedAttributes); |
76 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | 75 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); |
77 supportedAttributes.add(SVGNames::xAttr); | 76 supportedAttributes.add(SVGNames::xAttr); |
78 supportedAttributes.add(SVGNames::yAttr); | 77 supportedAttributes.add(SVGNames::yAttr); |
79 supportedAttributes.add(SVGNames::widthAttr); | 78 supportedAttributes.add(SVGNames::widthAttr); |
80 supportedAttributes.add(SVGNames::heightAttr); | 79 supportedAttributes.add(SVGNames::heightAttr); |
81 } | 80 } |
82 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 81 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
83 } | 82 } |
84 | 83 |
85 void SVGForeignObjectElement::parseAttribute(const QualifiedName& name, const At
omicString& value) | 84 void SVGForeignObjectElement::parseAttribute(const QualifiedName& name, const At
omicString& value) |
86 { | 85 { |
87 SVGParsingError parseError = NoError; | 86 SVGParsingError parseError = NoError; |
88 | 87 |
89 if (!isSupportedAttribute(name)) | 88 if (!isSupportedAttribute(name)) |
90 SVGGraphicsElement::parseAttribute(name, value); | 89 SVGGraphicsElement::parseAttribute(name, value); |
91 else if (name == SVGNames::xAttr) | 90 else if (name == SVGNames::xAttr) |
92 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); | 91 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); |
93 else if (name == SVGNames::yAttr) | 92 else if (name == SVGNames::yAttr) |
94 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError))
; | 93 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError))
; |
95 else if (name == SVGNames::widthAttr) | 94 else if (name == SVGNames::widthAttr) |
96 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro
r)); | 95 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro
r)); |
97 else if (name == SVGNames::heightAttr) | 96 else if (name == SVGNames::heightAttr) |
98 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr
ror)); | 97 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr
ror)); |
99 else if (SVGTests::parseAttribute(name, value) | 98 else if (SVGLangSpace::parseAttribute(name, value) |
100 || SVGLangSpace::parseAttribute(name, value) | |
101 || SVGExternalResourcesRequired::parseAttribute(name, value)) { | 99 || SVGExternalResourcesRequired::parseAttribute(name, value)) { |
102 } else | 100 } else |
103 ASSERT_NOT_REACHED(); | 101 ASSERT_NOT_REACHED(); |
104 | 102 |
105 reportAttributeParsingError(parseError, name, value); | 103 reportAttributeParsingError(parseError, name, value); |
106 } | 104 } |
107 | 105 |
108 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) | 106 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) |
109 { | 107 { |
110 if (!isSupportedAttribute(attrName)) { | 108 if (!isSupportedAttribute(attrName)) { |
111 SVGGraphicsElement::svgAttributeChanged(attrName); | 109 SVGGraphicsElement::svgAttributeChanged(attrName); |
112 return; | 110 return; |
113 } | 111 } |
114 | 112 |
115 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 113 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
116 | 114 |
117 bool isLengthAttribute = attrName == SVGNames::xAttr | 115 bool isLengthAttribute = attrName == SVGNames::xAttr |
118 || attrName == SVGNames::yAttr | 116 || attrName == SVGNames::yAttr |
119 || attrName == SVGNames::widthAttr | 117 || attrName == SVGNames::widthAttr |
120 || attrName == SVGNames::heightAttr; | 118 || attrName == SVGNames::heightAttr; |
121 | 119 |
122 if (isLengthAttribute) | 120 if (isLengthAttribute) |
123 updateRelativeLengthsInformation(); | 121 updateRelativeLengthsInformation(); |
124 | 122 |
125 if (SVGTests::handleAttributeChange(this, attrName)) | |
126 return; | |
127 | |
128 if (RenderObject* renderer = this->renderer()) | 123 if (RenderObject* renderer = this->renderer()) |
129 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 124 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
130 } | 125 } |
131 | 126 |
132 RenderObject* SVGForeignObjectElement::createRenderer(RenderStyle*) | 127 RenderObject* SVGForeignObjectElement::createRenderer(RenderStyle*) |
133 { | 128 { |
134 return new (document()->renderArena()) RenderSVGForeignObject(this); | 129 return new (document()->renderArena()) RenderSVGForeignObject(this); |
135 } | 130 } |
136 | 131 |
137 bool SVGForeignObjectElement::childShouldCreateRenderer(const NodeRenderingConte
xt& childContext) const | 132 bool SVGForeignObjectElement::childShouldCreateRenderer(const NodeRenderingConte
xt& childContext) const |
(...skipping 26 matching lines...) Expand all Loading... |
164 | 159 |
165 bool SVGForeignObjectElement::selfHasRelativeLengths() const | 160 bool SVGForeignObjectElement::selfHasRelativeLengths() const |
166 { | 161 { |
167 return x().isRelative() | 162 return x().isRelative() |
168 || y().isRelative() | 163 || y().isRelative() |
169 || width().isRelative() | 164 || width().isRelative() |
170 || height().isRelative(); | 165 || height().isRelative(); |
171 } | 166 } |
172 | 167 |
173 } | 168 } |
OLD | NEW |