OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) 2010 Apple Inc. All rights reserved. | 5 * Copyright (C) 2010 Apple Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 namespace WebCore { | 52 namespace WebCore { |
53 | 53 |
54 using namespace HTMLNames; | 54 using namespace HTMLNames; |
55 | 55 |
56 // Animated property definitions | 56 // Animated property definitions |
57 DEFINE_ANIMATED_STRING(SVGAElement, SVGNames::targetAttr, SVGTarget, svgTarget) | 57 DEFINE_ANIMATED_STRING(SVGAElement, SVGNames::targetAttr, SVGTarget, svgTarget) |
58 DEFINE_ANIMATED_STRING(SVGAElement, XLinkNames::hrefAttr, Href, href) | 58 DEFINE_ANIMATED_STRING(SVGAElement, XLinkNames::hrefAttr, Href, href) |
59 DEFINE_ANIMATED_BOOLEAN(SVGAElement, SVGNames::externalResourcesRequiredAttr, Ex
ternalResourcesRequired, externalResourcesRequired) | 59 DEFINE_ANIMATED_BOOLEAN(SVGAElement, SVGNames::externalResourcesRequiredAttr, Ex
ternalResourcesRequired, externalResourcesRequired) |
60 | 60 |
61 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGAElement) | 61 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGAElement) |
62 REGISTER_LOCAL_ANIMATED_PROPERTY(svgTarget) | 62 REGISTER_LOCAL_ANIMATED_PROPERTY(svgTarget) |
63 REGISTER_LOCAL_ANIMATED_PROPERTY(href) | 63 REGISTER_LOCAL_ANIMATED_PROPERTY(href) |
64 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | 64 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) |
65 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledTransformableElement) | 65 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) |
66 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) | |
67 END_REGISTER_ANIMATED_PROPERTIES | 66 END_REGISTER_ANIMATED_PROPERTIES |
68 | 67 |
69 inline SVGAElement::SVGAElement(const QualifiedName& tagName, Document* document
) | 68 inline SVGAElement::SVGAElement(const QualifiedName& tagName, Document* document
) |
70 : SVGStyledTransformableElement(tagName, document) | 69 : SVGGraphicsElement(tagName, document) |
71 { | 70 { |
72 ASSERT(hasTagName(SVGNames::aTag)); | 71 ASSERT(hasTagName(SVGNames::aTag)); |
73 ScriptWrappable::init(this); | 72 ScriptWrappable::init(this); |
74 registerAnimatedPropertiesForSVGAElement(); | 73 registerAnimatedPropertiesForSVGAElement(); |
75 } | 74 } |
76 | 75 |
77 PassRefPtr<SVGAElement> SVGAElement::create(const QualifiedName& tagName, Docume
nt* document) | 76 PassRefPtr<SVGAElement> SVGAElement::create(const QualifiedName& tagName, Docume
nt* document) |
78 { | 77 { |
79 return adoptRef(new SVGAElement(tagName, document)); | 78 return adoptRef(new SVGAElement(tagName, document)); |
80 } | 79 } |
(...skipping 18 matching lines...) Expand all Loading... |
99 SVGLangSpace::addSupportedAttributes(supportedAttributes); | 98 SVGLangSpace::addSupportedAttributes(supportedAttributes); |
100 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | 99 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); |
101 supportedAttributes.add(SVGNames::targetAttr); | 100 supportedAttributes.add(SVGNames::targetAttr); |
102 } | 101 } |
103 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 102 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
104 } | 103 } |
105 | 104 |
106 void SVGAElement::parseAttribute(const QualifiedName& name, const AtomicString&
value) | 105 void SVGAElement::parseAttribute(const QualifiedName& name, const AtomicString&
value) |
107 { | 106 { |
108 if (!isSupportedAttribute(name)) { | 107 if (!isSupportedAttribute(name)) { |
109 SVGStyledTransformableElement::parseAttribute(name, value); | 108 SVGGraphicsElement::parseAttribute(name, value); |
110 return; | 109 return; |
111 } | 110 } |
112 | 111 |
113 if (name == SVGNames::targetAttr) { | 112 if (name == SVGNames::targetAttr) { |
114 setSVGTargetBaseValue(value); | 113 setSVGTargetBaseValue(value); |
115 return; | 114 return; |
116 } | 115 } |
117 | 116 |
118 if (SVGURIReference::parseAttribute(name, value)) | 117 if (SVGURIReference::parseAttribute(name, value)) |
119 return; | 118 return; |
120 if (SVGTests::parseAttribute(name, value)) | 119 if (SVGTests::parseAttribute(name, value)) |
121 return; | 120 return; |
122 if (SVGLangSpace::parseAttribute(name, value)) | 121 if (SVGLangSpace::parseAttribute(name, value)) |
123 return; | 122 return; |
124 if (SVGExternalResourcesRequired::parseAttribute(name, value)) | 123 if (SVGExternalResourcesRequired::parseAttribute(name, value)) |
125 return; | 124 return; |
126 | 125 |
127 ASSERT_NOT_REACHED(); | 126 ASSERT_NOT_REACHED(); |
128 } | 127 } |
129 | 128 |
130 void SVGAElement::svgAttributeChanged(const QualifiedName& attrName) | 129 void SVGAElement::svgAttributeChanged(const QualifiedName& attrName) |
131 { | 130 { |
132 if (!isSupportedAttribute(attrName)) { | 131 if (!isSupportedAttribute(attrName)) { |
133 SVGStyledTransformableElement::svgAttributeChanged(attrName); | 132 SVGGraphicsElement::svgAttributeChanged(attrName); |
134 return; | 133 return; |
135 } | 134 } |
136 | 135 |
137 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 136 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
138 | 137 |
139 // Unlike other SVG*Element classes, SVGAElement only listens to SVGURIRefer
ence changes | 138 // Unlike other SVG*Element classes, SVGAElement only listens to SVGURIRefer
ence changes |
140 // as none of the other properties changes the linking behaviour for our <a>
element. | 139 // as none of the other properties changes the linking behaviour for our <a>
element. |
141 if (SVGURIReference::isKnownAttribute(attrName)) { | 140 if (SVGURIReference::isKnownAttribute(attrName)) { |
142 bool wasLink = isLink(); | 141 bool wasLink = isLink(); |
143 setIsLink(!href().isNull()); | 142 setIsLink(!href().isNull()); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 event->setDefaultHandled(); | 184 event->setDefaultHandled(); |
186 | 185 |
187 Frame* frame = document()->frame(); | 186 Frame* frame = document()->frame(); |
188 if (!frame) | 187 if (!frame) |
189 return; | 188 return; |
190 frame->loader()->urlSelected(document()->completeURL(url), target, e
vent, false, MaybeSendReferrer); | 189 frame->loader()->urlSelected(document()->completeURL(url), target, e
vent, false, MaybeSendReferrer); |
191 return; | 190 return; |
192 } | 191 } |
193 } | 192 } |
194 | 193 |
195 SVGStyledTransformableElement::defaultEventHandler(event); | 194 SVGGraphicsElement::defaultEventHandler(event); |
196 } | 195 } |
197 | 196 |
198 bool SVGAElement::supportsFocus() const | 197 bool SVGAElement::supportsFocus() const |
199 { | 198 { |
200 if (rendererIsEditable()) | 199 if (rendererIsEditable()) |
201 return SVGStyledTransformableElement::supportsFocus(); | 200 return SVGGraphicsElement::supportsFocus(); |
202 return true; | 201 return true; |
203 } | 202 } |
204 | 203 |
205 bool SVGAElement::rendererIsFocusable() const | 204 bool SVGAElement::rendererIsFocusable() const |
206 { | 205 { |
207 if (renderer() && renderer()->absoluteClippedOverflowRect().isEmpty()) | 206 if (renderer() && renderer()->absoluteClippedOverflowRect().isEmpty()) |
208 return false; | 207 return false; |
209 | 208 |
210 return SVGElement::rendererIsFocusable(); | 209 return SVGElement::rendererIsFocusable(); |
211 } | 210 } |
212 | 211 |
213 bool SVGAElement::isURLAttribute(const Attribute& attribute) const | 212 bool SVGAElement::isURLAttribute(const Attribute& attribute) const |
214 { | 213 { |
215 return attribute.name().localName() == hrefAttr || SVGStyledTransformableEle
ment::isURLAttribute(attribute); | 214 return attribute.name().localName() == hrefAttr || SVGGraphicsElement::isURL
Attribute(attribute); |
216 } | 215 } |
217 | 216 |
218 bool SVGAElement::isMouseFocusable() const | 217 bool SVGAElement::isMouseFocusable() const |
219 { | 218 { |
220 return false; | 219 return false; |
221 } | 220 } |
222 | 221 |
223 bool SVGAElement::isKeyboardFocusable(KeyboardEvent*) const | 222 bool SVGAElement::isKeyboardFocusable(KeyboardEvent*) const |
224 { | 223 { |
225 if (!isFocusable()) | 224 if (!isFocusable()) |
(...skipping 12 matching lines...) Expand all Loading... |
238 // The 'a' element may contain any element that its parent may contain, exce
pt itself. | 237 // The 'a' element may contain any element that its parent may contain, exce
pt itself. |
239 if (childContext.node()->hasTagName(SVGNames::aTag)) | 238 if (childContext.node()->hasTagName(SVGNames::aTag)) |
240 return false; | 239 return false; |
241 if (parentNode() && parentNode()->isSVGElement()) | 240 if (parentNode() && parentNode()->isSVGElement()) |
242 return parentNode()->childShouldCreateRenderer(childContext); | 241 return parentNode()->childShouldCreateRenderer(childContext); |
243 | 242 |
244 return SVGElement::childShouldCreateRenderer(childContext); | 243 return SVGElement::childShouldCreateRenderer(childContext); |
245 } | 244 } |
246 | 245 |
247 } // namespace WebCore | 246 } // namespace WebCore |
OLD | NEW |