OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007, 2008 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 blink { | 30 namespace blink { |
31 | 31 |
32 inline SVGGElement::SVGGElement(Document& document, ConstructionType constructio
nType) | 32 inline SVGGElement::SVGGElement(Document& document, ConstructionType constructio
nType) |
33 : SVGGraphicsElement(SVGNames::gTag, document, constructionType) | 33 : SVGGraphicsElement(SVGNames::gTag, document, constructionType) |
34 { | 34 { |
35 ScriptWrappable::init(this); | 35 ScriptWrappable::init(this); |
36 } | 36 } |
37 | 37 |
38 DEFINE_NODE_FACTORY(SVGGElement) | 38 DEFINE_NODE_FACTORY(SVGGElement) |
39 | 39 |
40 bool SVGGElement::isSupportedAttribute(const QualifiedName& attrName) | |
41 { | |
42 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | |
43 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | |
44 } | |
45 | |
46 void SVGGElement::parseAttribute(const QualifiedName& name, const AtomicString&
value) | |
47 { | |
48 if (!isSupportedAttribute(name)) { | |
49 SVGGraphicsElement::parseAttribute(name, value); | |
50 return; | |
51 } | |
52 | |
53 ASSERT_NOT_REACHED(); | |
54 } | |
55 | |
56 void SVGGElement::svgAttributeChanged(const QualifiedName& attrName) | |
57 { | |
58 if (!isSupportedAttribute(attrName)) { | |
59 SVGGraphicsElement::svgAttributeChanged(attrName); | |
60 return; | |
61 } | |
62 | |
63 SVGElement::InvalidationGuard invalidationGuard(this); | |
64 | |
65 if (RenderObject* renderer = this->renderer()) | |
66 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | |
67 } | |
68 | |
69 RenderObject* SVGGElement::createRenderer(RenderStyle* style) | 40 RenderObject* SVGGElement::createRenderer(RenderStyle* style) |
70 { | 41 { |
71 // SVG 1.1 testsuite explicitely uses constructs like <g display="none"><lin
earGradient> | 42 // SVG 1.1 testsuite explicitely uses constructs like <g display="none"><lin
earGradient> |
72 // We still have to create renderers for the <g> & <linearGradient> element,
though the | 43 // We still have to create renderers for the <g> & <linearGradient> element,
though the |
73 // subtree may be hidden - we only want the resource renderers to exist so t
hey can be | 44 // subtree may be hidden - we only want the resource renderers to exist so t
hey can be |
74 // referenced from somewhere else. | 45 // referenced from somewhere else. |
75 if (style->display() == NONE) | 46 if (style->display() == NONE) |
76 return new RenderSVGHiddenContainer(this); | 47 return new RenderSVGHiddenContainer(this); |
77 | 48 |
78 return new RenderSVGTransformableContainer(this); | 49 return new RenderSVGTransformableContainer(this); |
79 } | 50 } |
80 | 51 |
81 bool SVGGElement::rendererIsNeeded(const RenderStyle&) | 52 bool SVGGElement::rendererIsNeeded(const RenderStyle&) |
82 { | 53 { |
83 // Unlike SVGElement::rendererIsNeeded(), we still create renderers, even if | 54 // Unlike SVGElement::rendererIsNeeded(), we still create renderers, even if |
84 // display is set to 'none' - which is special to SVG <g> container elements
. | 55 // display is set to 'none' - which is special to SVG <g> container elements
. |
85 return parentOrShadowHostElement() && parentOrShadowHostElement()->isSVGElem
ent(); | 56 return parentOrShadowHostElement() && parentOrShadowHostElement()->isSVGElem
ent(); |
86 } | 57 } |
87 | 58 |
88 } | 59 } |
OLD | NEW |