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

Side by Side Diff: Source/core/svg/SVGForeignObjectElement.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) 2006 Apple Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@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_STRING(SVGForeignObjectElement, XLinkNames::hrefAttr, Href, href ) 40 DEFINE_ANIMATED_STRING(SVGForeignObjectElement, XLinkNames::hrefAttr, Href, href )
41 DEFINE_ANIMATED_BOOLEAN(SVGForeignObjectElement, SVGNames::externalResourcesRequ iredAttr, ExternalResourcesRequired, externalResourcesRequired) 41 DEFINE_ANIMATED_BOOLEAN(SVGForeignObjectElement, SVGNames::externalResourcesRequ iredAttr, ExternalResourcesRequired, externalResourcesRequired)
42 42
43 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGForeignObjectElement) 43 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGForeignObjectElement)
44 REGISTER_LOCAL_ANIMATED_PROPERTY(x) 44 REGISTER_LOCAL_ANIMATED_PROPERTY(x)
45 REGISTER_LOCAL_ANIMATED_PROPERTY(y) 45 REGISTER_LOCAL_ANIMATED_PROPERTY(y)
46 REGISTER_LOCAL_ANIMATED_PROPERTY(width) 46 REGISTER_LOCAL_ANIMATED_PROPERTY(width)
47 REGISTER_LOCAL_ANIMATED_PROPERTY(height) 47 REGISTER_LOCAL_ANIMATED_PROPERTY(height)
48 REGISTER_LOCAL_ANIMATED_PROPERTY(href) 48 REGISTER_LOCAL_ANIMATED_PROPERTY(href)
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 SVGForeignObjectElement::SVGForeignObjectElement(const QualifiedName& tag Name, Document* document) 53 inline SVGForeignObjectElement::SVGForeignObjectElement(const QualifiedName& tag Name, Document* document)
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 { 59 {
61 ASSERT(hasTagName(SVGNames::foreignObjectTag)); 60 ASSERT(hasTagName(SVGNames::foreignObjectTag));
62 ScriptWrappable::init(this); 61 ScriptWrappable::init(this);
63 registerAnimatedPropertiesForSVGForeignObjectElement(); 62 registerAnimatedPropertiesForSVGForeignObjectElement();
64 } 63 }
65 64
(...skipping 15 matching lines...) Expand all
81 supportedAttributes.add(SVGNames::heightAttr); 80 supportedAttributes.add(SVGNames::heightAttr);
82 } 81 }
83 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 82 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
84 } 83 }
85 84
86 void SVGForeignObjectElement::parseAttribute(const QualifiedName& name, const At omicString& value) 85 void SVGForeignObjectElement::parseAttribute(const QualifiedName& name, const At omicString& value)
87 { 86 {
88 SVGParsingError parseError = NoError; 87 SVGParsingError parseError = NoError;
89 88
90 if (!isSupportedAttribute(name)) 89 if (!isSupportedAttribute(name))
91 SVGStyledTransformableElement::parseAttribute(name, value); 90 SVGGraphicsElement::parseAttribute(name, value);
92 else if (name == SVGNames::xAttr) 91 else if (name == SVGNames::xAttr)
93 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); 92 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
94 else if (name == SVGNames::yAttr) 93 else if (name == SVGNames::yAttr)
95 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)) ; 94 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)) ;
96 else if (name == SVGNames::widthAttr) 95 else if (name == SVGNames::widthAttr)
97 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro r)); 96 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro r));
98 else if (name == SVGNames::heightAttr) 97 else if (name == SVGNames::heightAttr)
99 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr ror)); 98 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr ror));
100 else if (SVGTests::parseAttribute(name, value) 99 else if (SVGTests::parseAttribute(name, value)
101 || SVGLangSpace::parseAttribute(name, value) 100 || SVGLangSpace::parseAttribute(name, value)
102 || SVGExternalResourcesRequired::parseAttribute(name, value)) { 101 || SVGExternalResourcesRequired::parseAttribute(name, value)) {
103 } else 102 } else
104 ASSERT_NOT_REACHED(); 103 ASSERT_NOT_REACHED();
105 104
106 reportAttributeParsingError(parseError, name, value); 105 reportAttributeParsingError(parseError, name, value);
107 } 106 }
108 107
109 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) 108 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName)
110 { 109 {
111 if (!isSupportedAttribute(attrName)) { 110 if (!isSupportedAttribute(attrName)) {
112 SVGStyledTransformableElement::svgAttributeChanged(attrName); 111 SVGGraphicsElement::svgAttributeChanged(attrName);
113 return; 112 return;
114 } 113 }
115 114
116 SVGElementInstance::InvalidationGuard invalidationGuard(this); 115 SVGElementInstance::InvalidationGuard invalidationGuard(this);
117 116
118 bool isLengthAttribute = attrName == SVGNames::xAttr 117 bool isLengthAttribute = attrName == SVGNames::xAttr
119 || attrName == SVGNames::yAttr 118 || attrName == SVGNames::yAttr
120 || attrName == SVGNames::widthAttr 119 || attrName == SVGNames::widthAttr
121 || attrName == SVGNames::heightAttr; 120 || attrName == SVGNames::heightAttr;
122 121
(...skipping 30 matching lines...) Expand all
153 // to use parentElement() here. If that changes, this method should be updat ed to use 152 // to use parentElement() here. If that changes, this method should be updat ed to use
154 // parentOrShadowHostElement() instead. 153 // parentOrShadowHostElement() instead.
155 Element* ancestor = parentElement(); 154 Element* ancestor = parentElement();
156 while (ancestor && ancestor->isSVGElement()) { 155 while (ancestor && ancestor->isSVGElement()) {
157 if (ancestor->renderer() && ancestor->renderer()->isSVGHiddenContainer() ) 156 if (ancestor->renderer() && ancestor->renderer()->isSVGHiddenContainer() )
158 return false; 157 return false;
159 158
160 ancestor = ancestor->parentElement(); 159 ancestor = ancestor->parentElement();
161 } 160 }
162 161
163 return SVGStyledTransformableElement::rendererIsNeeded(context); 162 return SVGGraphicsElement::rendererIsNeeded(context);
164 } 163 }
165 164
166 bool SVGForeignObjectElement::selfHasRelativeLengths() const 165 bool SVGForeignObjectElement::selfHasRelativeLengths() const
167 { 166 {
168 return x().isRelative() 167 return x().isRelative()
169 || y().isRelative() 168 || y().isRelative()
170 || width().isRelative() 169 || width().isRelative()
171 || height().isRelative(); 170 || height().isRelative();
172 } 171 }
173 172
174 } 173 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698