| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@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 namespace WebCore { | 29 namespace WebCore { |
| 30 | 30 |
| 31 // Animated property definitions | 31 // Animated property definitions |
| 32 DEFINE_ANIMATED_BOOLEAN(SVGSwitchElement, SVGNames::externalResourcesRequiredAtt
r, ExternalResourcesRequired, externalResourcesRequired) | 32 DEFINE_ANIMATED_BOOLEAN(SVGSwitchElement, SVGNames::externalResourcesRequiredAtt
r, ExternalResourcesRequired, externalResourcesRequired) |
| 33 | 33 |
| 34 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSwitchElement) | 34 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSwitchElement) |
| 35 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | 35 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) |
| 36 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) | 36 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) |
| 37 END_REGISTER_ANIMATED_PROPERTIES | 37 END_REGISTER_ANIMATED_PROPERTIES |
| 38 | 38 |
| 39 inline SVGSwitchElement::SVGSwitchElement(const QualifiedName& tagName, Document
& document) | 39 inline SVGSwitchElement::SVGSwitchElement(Document& document) |
| 40 : SVGGraphicsElement(tagName, document) | 40 : SVGGraphicsElement(SVGNames::switchTag, document) |
| 41 { | 41 { |
| 42 ASSERT(hasTagName(SVGNames::switchTag)); | |
| 43 ScriptWrappable::init(this); | 42 ScriptWrappable::init(this); |
| 44 registerAnimatedPropertiesForSVGSwitchElement(); | 43 registerAnimatedPropertiesForSVGSwitchElement(); |
| 45 | 44 |
| 46 UseCounter::count(document, UseCounter::SVGSwitchElement); | 45 UseCounter::count(document, UseCounter::SVGSwitchElement); |
| 47 } | 46 } |
| 48 | 47 |
| 49 PassRefPtr<SVGSwitchElement> SVGSwitchElement::create(const QualifiedName& tagNa
me, Document& document) | 48 PassRefPtr<SVGSwitchElement> SVGSwitchElement::create(Document& document) |
| 50 { | 49 { |
| 51 return adoptRef(new SVGSwitchElement(tagName, document)); | 50 return adoptRef(new SVGSwitchElement(document)); |
| 52 } | 51 } |
| 53 | 52 |
| 54 bool SVGSwitchElement::childShouldCreateRenderer(const Node& child) const | 53 bool SVGSwitchElement::childShouldCreateRenderer(const Node& child) const |
| 55 { | 54 { |
| 56 // FIXME: This function does not do what the comment below implies it does. | 55 // FIXME: This function does not do what the comment below implies it does. |
| 57 // It will create a renderer for any valid SVG element children, not just th
e first one. | 56 // It will create a renderer for any valid SVG element children, not just th
e first one. |
| 58 for (Node* node = firstChild(); node; node = node->nextSibling()) { | 57 for (Node* node = firstChild(); node; node = node->nextSibling()) { |
| 59 if (!node->isSVGElement()) | 58 if (!node->isSVGElement()) |
| 60 continue; | 59 continue; |
| 61 | 60 |
| 62 SVGElement* element = toSVGElement(node); | 61 SVGElement* element = toSVGElement(node); |
| 63 if (!element || !element->isValid()) | 62 if (!element || !element->isValid()) |
| 64 continue; | 63 continue; |
| 65 | 64 |
| 66 return node == &child; // Only allow this child if it's the first valid
child | 65 return node == &child; // Only allow this child if it's the first valid
child |
| 67 } | 66 } |
| 68 | 67 |
| 69 return false; | 68 return false; |
| 70 } | 69 } |
| 71 | 70 |
| 72 RenderObject* SVGSwitchElement::createRenderer(RenderStyle*) | 71 RenderObject* SVGSwitchElement::createRenderer(RenderStyle*) |
| 73 { | 72 { |
| 74 return new RenderSVGTransformableContainer(this); | 73 return new RenderSVGTransformableContainer(this); |
| 75 } | 74 } |
| 76 | 75 |
| 77 } | 76 } |
| OLD | NEW |