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

Side by Side Diff: Source/core/svg/SVGRectElement.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 29 matching lines...) Expand all
40 DEFINE_ANIMATED_BOOLEAN(SVGRectElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) 40 DEFINE_ANIMATED_BOOLEAN(SVGRectElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
41 41
42 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGRectElement) 42 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGRectElement)
43 REGISTER_LOCAL_ANIMATED_PROPERTY(x) 43 REGISTER_LOCAL_ANIMATED_PROPERTY(x)
44 REGISTER_LOCAL_ANIMATED_PROPERTY(y) 44 REGISTER_LOCAL_ANIMATED_PROPERTY(y)
45 REGISTER_LOCAL_ANIMATED_PROPERTY(width) 45 REGISTER_LOCAL_ANIMATED_PROPERTY(width)
46 REGISTER_LOCAL_ANIMATED_PROPERTY(height) 46 REGISTER_LOCAL_ANIMATED_PROPERTY(height)
47 REGISTER_LOCAL_ANIMATED_PROPERTY(rx) 47 REGISTER_LOCAL_ANIMATED_PROPERTY(rx)
48 REGISTER_LOCAL_ANIMATED_PROPERTY(ry) 48 REGISTER_LOCAL_ANIMATED_PROPERTY(ry)
49 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) 49 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
50 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledTransformableElement) 50 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
51 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests)
52 END_REGISTER_ANIMATED_PROPERTIES 51 END_REGISTER_ANIMATED_PROPERTIES
53 52
54 inline SVGRectElement::SVGRectElement(const QualifiedName& tagName, Document* do cument) 53 inline SVGRectElement::SVGRectElement(const QualifiedName& tagName, Document* do cument)
55 : SVGStyledTransformableElement(tagName, document) 54 : SVGGraphicsElement(tagName, document)
56 , m_x(LengthModeWidth) 55 , m_x(LengthModeWidth)
57 , m_y(LengthModeHeight) 56 , m_y(LengthModeHeight)
58 , m_width(LengthModeWidth) 57 , m_width(LengthModeWidth)
59 , m_height(LengthModeHeight) 58 , m_height(LengthModeHeight)
60 , m_rx(LengthModeWidth) 59 , m_rx(LengthModeWidth)
61 , m_ry(LengthModeHeight) 60 , m_ry(LengthModeHeight)
62 { 61 {
63 ASSERT(hasTagName(SVGNames::rectTag)); 62 ASSERT(hasTagName(SVGNames::rectTag));
64 ScriptWrappable::init(this); 63 ScriptWrappable::init(this);
65 registerAnimatedPropertiesForSVGRectElement(); 64 registerAnimatedPropertiesForSVGRectElement();
(...skipping 19 matching lines...) Expand all
85 supportedAttributes.add(SVGNames::ryAttr); 84 supportedAttributes.add(SVGNames::ryAttr);
86 } 85 }
87 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 86 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
88 } 87 }
89 88
90 void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value) 89 void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value)
91 { 90 {
92 SVGParsingError parseError = NoError; 91 SVGParsingError parseError = NoError;
93 92
94 if (!isSupportedAttribute(name)) 93 if (!isSupportedAttribute(name))
95 SVGStyledTransformableElement::parseAttribute(name, value); 94 SVGGraphicsElement::parseAttribute(name, value);
96 else if (name == SVGNames::xAttr) 95 else if (name == SVGNames::xAttr)
97 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); 96 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
98 else if (name == SVGNames::yAttr) 97 else if (name == SVGNames::yAttr)
99 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)) ; 98 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)) ;
100 else if (name == SVGNames::rxAttr) 99 else if (name == SVGNames::rxAttr)
101 setRxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); 100 setRxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
102 else if (name == SVGNames::ryAttr) 101 else if (name == SVGNames::ryAttr)
103 setRyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); 102 setRyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
104 else if (name == SVGNames::widthAttr) 103 else if (name == SVGNames::widthAttr)
105 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro r, ForbidNegativeLengths)); 104 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro r, ForbidNegativeLengths));
106 else if (name == SVGNames::heightAttr) 105 else if (name == SVGNames::heightAttr)
107 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr ror, ForbidNegativeLengths)); 106 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr ror, ForbidNegativeLengths));
108 else if (SVGTests::parseAttribute(name, value) 107 else if (SVGTests::parseAttribute(name, value)
109 || SVGLangSpace::parseAttribute(name, value) 108 || SVGLangSpace::parseAttribute(name, value)
110 || SVGExternalResourcesRequired::parseAttribute(name, value)) { 109 || SVGExternalResourcesRequired::parseAttribute(name, value)) {
111 } else 110 } else
112 ASSERT_NOT_REACHED(); 111 ASSERT_NOT_REACHED();
113 112
114 reportAttributeParsingError(parseError, name, value); 113 reportAttributeParsingError(parseError, name, value);
115 } 114 }
116 115
117 void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName) 116 void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName)
118 { 117 {
119 if (!isSupportedAttribute(attrName)) { 118 if (!isSupportedAttribute(attrName)) {
120 SVGStyledTransformableElement::svgAttributeChanged(attrName); 119 SVGGraphicsElement::svgAttributeChanged(attrName);
121 return; 120 return;
122 } 121 }
123 122
124 SVGElementInstance::InvalidationGuard invalidationGuard(this); 123 SVGElementInstance::InvalidationGuard invalidationGuard(this);
125 124
126 bool isLengthAttribute = attrName == SVGNames::xAttr 125 bool isLengthAttribute = attrName == SVGNames::xAttr
127 || attrName == SVGNames::yAttr 126 || attrName == SVGNames::yAttr
128 || attrName == SVGNames::widthAttr 127 || attrName == SVGNames::widthAttr
129 || attrName == SVGNames::heightAttr 128 || attrName == SVGNames::heightAttr
130 || attrName == SVGNames::rxAttr 129 || attrName == SVGNames::rxAttr
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 || rx().isRelative() 162 || rx().isRelative()
164 || ry().isRelative(); 163 || ry().isRelative();
165 } 164 }
166 165
167 RenderObject* SVGRectElement::createRenderer(RenderStyle*) 166 RenderObject* SVGRectElement::createRenderer(RenderStyle*)
168 { 167 {
169 return new (document()->renderArena()) RenderSVGRect(this); 168 return new (document()->renderArena()) RenderSVGRect(this);
170 } 169 }
171 170
172 } 171 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698