Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: Source/core/svg/SVGGElement.cpp

Issue 18053005: Introduce SVGGraphicsElement IDL interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 17 matching lines...) Expand all
28 #include "core/rendering/svg/RenderSVGTransformableContainer.h" 28 #include "core/rendering/svg/RenderSVGTransformableContainer.h"
29 #include "core/svg/SVGElementInstance.h" 29 #include "core/svg/SVGElementInstance.h"
30 30
31 namespace WebCore { 31 namespace WebCore {
32 32
33 // Animated property definitions 33 // Animated property definitions
34 DEFINE_ANIMATED_BOOLEAN(SVGGElement, SVGNames::externalResourcesRequiredAttr, Ex ternalResourcesRequired, externalResourcesRequired) 34 DEFINE_ANIMATED_BOOLEAN(SVGGElement, SVGNames::externalResourcesRequiredAttr, Ex ternalResourcesRequired, externalResourcesRequired)
35 35
36 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGElement) 36 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGElement)
37 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) 37 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
38 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledTransformableElement) 38 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
39 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests)
40 END_REGISTER_ANIMATED_PROPERTIES 39 END_REGISTER_ANIMATED_PROPERTIES
41 40
42 SVGGElement::SVGGElement(const QualifiedName& tagName, Document* document, Const ructionType constructionType) 41 SVGGElement::SVGGElement(const QualifiedName& tagName, Document* document, Const ructionType constructionType)
43 : SVGStyledTransformableElement(tagName, document, constructionType) 42 : SVGGraphicsElement(tagName, document, constructionType)
44 { 43 {
45 ASSERT(hasTagName(SVGNames::gTag)); 44 ASSERT(hasTagName(SVGNames::gTag));
46 ScriptWrappable::init(this); 45 ScriptWrappable::init(this);
47 registerAnimatedPropertiesForSVGGElement(); 46 registerAnimatedPropertiesForSVGGElement();
48 } 47 }
49 48
50 PassRefPtr<SVGGElement> SVGGElement::create(const QualifiedName& tagName, Docume nt* document) 49 PassRefPtr<SVGGElement> SVGGElement::create(const QualifiedName& tagName, Docume nt* document)
51 { 50 {
52 return adoptRef(new SVGGElement(tagName, document)); 51 return adoptRef(new SVGGElement(tagName, document));
53 } 52 }
54 53
55 bool SVGGElement::isSupportedAttribute(const QualifiedName& attrName) 54 bool SVGGElement::isSupportedAttribute(const QualifiedName& attrName)
56 { 55 {
57 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 56 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
58 if (supportedAttributes.isEmpty()) { 57 if (supportedAttributes.isEmpty()) {
59 SVGTests::addSupportedAttributes(supportedAttributes); 58 SVGTests::addSupportedAttributes(supportedAttributes);
60 SVGLangSpace::addSupportedAttributes(supportedAttributes); 59 SVGLangSpace::addSupportedAttributes(supportedAttributes);
61 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes ); 60 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes );
62 } 61 }
63 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 62 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
64 } 63 }
65 64
66 void SVGGElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 65 void SVGGElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
67 { 66 {
68 if (!isSupportedAttribute(name)) { 67 if (!isSupportedAttribute(name)) {
69 SVGStyledTransformableElement::parseAttribute(name, value); 68 SVGGraphicsElement::parseAttribute(name, value);
70 return; 69 return;
71 } 70 }
72 71
73 if (SVGTests::parseAttribute(name, value)) 72 if (SVGTests::parseAttribute(name, value))
74 return; 73 return;
75 if (SVGLangSpace::parseAttribute(name, value)) 74 if (SVGLangSpace::parseAttribute(name, value))
76 return; 75 return;
77 if (SVGExternalResourcesRequired::parseAttribute(name, value)) 76 if (SVGExternalResourcesRequired::parseAttribute(name, value))
78 return; 77 return;
79 78
80 ASSERT_NOT_REACHED(); 79 ASSERT_NOT_REACHED();
81 } 80 }
82 81
83 void SVGGElement::svgAttributeChanged(const QualifiedName& attrName) 82 void SVGGElement::svgAttributeChanged(const QualifiedName& attrName)
84 { 83 {
85 if (!isSupportedAttribute(attrName)) { 84 if (!isSupportedAttribute(attrName)) {
86 SVGStyledTransformableElement::svgAttributeChanged(attrName); 85 SVGGraphicsElement::svgAttributeChanged(attrName);
87 return; 86 return;
88 } 87 }
89 88
90 SVGElementInstance::InvalidationGuard invalidationGuard(this); 89 SVGElementInstance::InvalidationGuard invalidationGuard(this);
91 90
92 if (SVGTests::handleAttributeChange(this, attrName)) 91 if (SVGTests::handleAttributeChange(this, attrName))
93 return; 92 return;
94 93
95 if (RenderObject* renderer = this->renderer()) 94 if (RenderObject* renderer = this->renderer())
96 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); 95 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
(...skipping 12 matching lines...) Expand all
109 } 108 }
110 109
111 bool SVGGElement::rendererIsNeeded(const NodeRenderingContext&) 110 bool SVGGElement::rendererIsNeeded(const NodeRenderingContext&)
112 { 111 {
113 // Unlike SVGStyledElement::rendererIsNeeded(), we still create renderers, e ven if 112 // Unlike SVGStyledElement::rendererIsNeeded(), we still create renderers, e ven if
114 // display is set to 'none' - which is special to SVG <g> container elements . 113 // display is set to 'none' - which is special to SVG <g> container elements .
115 return parentOrShadowHostElement() && parentOrShadowHostElement()->isSVGElem ent(); 114 return parentOrShadowHostElement() && parentOrShadowHostElement()->isSVGElem ent();
116 } 115 }
117 116
118 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698