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

Side by Side Diff: Source/core/svg/SVGEllipseElement.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, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 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 25 matching lines...) Expand all
36 DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::rxAttr, Rx, rx) 36 DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::rxAttr, Rx, rx)
37 DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::ryAttr, Ry, ry) 37 DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::ryAttr, Ry, ry)
38 DEFINE_ANIMATED_BOOLEAN(SVGEllipseElement, SVGNames::externalResourcesRequiredAt tr, ExternalResourcesRequired, externalResourcesRequired) 38 DEFINE_ANIMATED_BOOLEAN(SVGEllipseElement, SVGNames::externalResourcesRequiredAt tr, ExternalResourcesRequired, externalResourcesRequired)
39 39
40 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGEllipseElement) 40 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGEllipseElement)
41 REGISTER_LOCAL_ANIMATED_PROPERTY(cx) 41 REGISTER_LOCAL_ANIMATED_PROPERTY(cx)
42 REGISTER_LOCAL_ANIMATED_PROPERTY(cy) 42 REGISTER_LOCAL_ANIMATED_PROPERTY(cy)
43 REGISTER_LOCAL_ANIMATED_PROPERTY(rx) 43 REGISTER_LOCAL_ANIMATED_PROPERTY(rx)
44 REGISTER_LOCAL_ANIMATED_PROPERTY(ry) 44 REGISTER_LOCAL_ANIMATED_PROPERTY(ry)
45 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) 45 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
46 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledTransformableElement) 46 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
47 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests)
48 END_REGISTER_ANIMATED_PROPERTIES 47 END_REGISTER_ANIMATED_PROPERTIES
49 48
50 inline SVGEllipseElement::SVGEllipseElement(const QualifiedName& tagName, Docume nt* document) 49 inline SVGEllipseElement::SVGEllipseElement(const QualifiedName& tagName, Docume nt* document)
51 : SVGStyledTransformableElement(tagName, document) 50 : SVGGraphicsElement(tagName, document)
52 , m_cx(LengthModeWidth) 51 , m_cx(LengthModeWidth)
53 , m_cy(LengthModeHeight) 52 , m_cy(LengthModeHeight)
54 , m_rx(LengthModeWidth) 53 , m_rx(LengthModeWidth)
55 , m_ry(LengthModeHeight) 54 , m_ry(LengthModeHeight)
56 { 55 {
57 ASSERT(hasTagName(SVGNames::ellipseTag)); 56 ASSERT(hasTagName(SVGNames::ellipseTag));
58 ScriptWrappable::init(this); 57 ScriptWrappable::init(this);
59 registerAnimatedPropertiesForSVGEllipseElement(); 58 registerAnimatedPropertiesForSVGEllipseElement();
60 } 59 }
61 60
(...skipping 15 matching lines...) Expand all
77 supportedAttributes.add(SVGNames::ryAttr); 76 supportedAttributes.add(SVGNames::ryAttr);
78 } 77 }
79 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 78 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
80 } 79 }
81 80
82 void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value) 81 void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value)
83 { 82 {
84 SVGParsingError parseError = NoError; 83 SVGParsingError parseError = NoError;
85 84
86 if (!isSupportedAttribute(name)) 85 if (!isSupportedAttribute(name))
87 SVGStyledTransformableElement::parseAttribute(name, value); 86 SVGGraphicsElement::parseAttribute(name, value);
88 else if (name == SVGNames::cxAttr) 87 else if (name == SVGNames::cxAttr)
89 setCxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)) ; 88 setCxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)) ;
90 else if (name == SVGNames::cyAttr) 89 else if (name == SVGNames::cyAttr)
91 setCyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError) ); 90 setCyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError) );
92 else if (name == SVGNames::rxAttr) 91 else if (name == SVGNames::rxAttr)
93 setRxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); 92 setRxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
94 else if (name == SVGNames::ryAttr) 93 else if (name == SVGNames::ryAttr)
95 setRyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); 94 setRyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
96 else if (SVGTests::parseAttribute(name, value) 95 else if (SVGTests::parseAttribute(name, value)
97 || SVGLangSpace::parseAttribute(name, value) 96 || SVGLangSpace::parseAttribute(name, value)
98 || SVGExternalResourcesRequired::parseAttribute(name, value)) { 97 || SVGExternalResourcesRequired::parseAttribute(name, value)) {
99 } else 98 } else
100 ASSERT_NOT_REACHED(); 99 ASSERT_NOT_REACHED();
101 100
102 reportAttributeParsingError(parseError, name, value); 101 reportAttributeParsingError(parseError, name, value);
103 } 102 }
104 103
105 void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName) 104 void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName)
106 { 105 {
107 if (!isSupportedAttribute(attrName)) { 106 if (!isSupportedAttribute(attrName)) {
108 SVGStyledTransformableElement::svgAttributeChanged(attrName); 107 SVGGraphicsElement::svgAttributeChanged(attrName);
109 return; 108 return;
110 } 109 }
111 110
112 SVGElementInstance::InvalidationGuard invalidationGuard(this); 111 SVGElementInstance::InvalidationGuard invalidationGuard(this);
113 112
114 bool isLengthAttribute = attrName == SVGNames::cxAttr 113 bool isLengthAttribute = attrName == SVGNames::cxAttr
115 || attrName == SVGNames::cyAttr 114 || attrName == SVGNames::cyAttr
116 || attrName == SVGNames::rxAttr 115 || attrName == SVGNames::rxAttr
117 || attrName == SVGNames::ryAttr; 116 || attrName == SVGNames::ryAttr;
118 117
(...skipping 28 matching lines...) Expand all
147 || rx().isRelative() 146 || rx().isRelative()
148 || ry().isRelative(); 147 || ry().isRelative();
149 } 148 }
150 149
151 RenderObject* SVGEllipseElement::createRenderer(RenderStyle*) 150 RenderObject* SVGEllipseElement::createRenderer(RenderStyle*)
152 { 151 {
153 return new (document()->renderArena()) RenderSVGEllipse(this); 152 return new (document()->renderArena()) RenderSVGEllipse(this);
154 } 153 }
155 154
156 } 155 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698