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