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

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

Issue 18060005: Let SVGElement handle SVGLangSpace attributes parsing (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
« no previous file with comments | « Source/core/svg/SVGFilterElement.cpp ('k') | Source/core/svg/SVGGElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 PassRefPtr<SVGForeignObjectElement> SVGForeignObjectElement::create(const Qualif iedName& tagName, Document* document) 65 PassRefPtr<SVGForeignObjectElement> SVGForeignObjectElement::create(const Qualif iedName& tagName, Document* document)
66 { 66 {
67 return adoptRef(new SVGForeignObjectElement(tagName, document)); 67 return adoptRef(new SVGForeignObjectElement(tagName, document));
68 } 68 }
69 69
70 bool SVGForeignObjectElement::isSupportedAttribute(const QualifiedName& attrName ) 70 bool SVGForeignObjectElement::isSupportedAttribute(const QualifiedName& attrName )
71 { 71 {
72 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 72 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
73 if (supportedAttributes.isEmpty()) { 73 if (supportedAttributes.isEmpty()) {
74 SVGLangSpace::addSupportedAttributes(supportedAttributes);
75 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes ); 74 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes );
76 supportedAttributes.add(SVGNames::xAttr); 75 supportedAttributes.add(SVGNames::xAttr);
77 supportedAttributes.add(SVGNames::yAttr); 76 supportedAttributes.add(SVGNames::yAttr);
78 supportedAttributes.add(SVGNames::widthAttr); 77 supportedAttributes.add(SVGNames::widthAttr);
79 supportedAttributes.add(SVGNames::heightAttr); 78 supportedAttributes.add(SVGNames::heightAttr);
80 } 79 }
81 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 80 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
82 } 81 }
83 82
84 void SVGForeignObjectElement::parseAttribute(const QualifiedName& name, const At omicString& value) 83 void SVGForeignObjectElement::parseAttribute(const QualifiedName& name, const At omicString& value)
85 { 84 {
86 SVGParsingError parseError = NoError; 85 SVGParsingError parseError = NoError;
87 86
88 if (!isSupportedAttribute(name)) 87 if (!isSupportedAttribute(name))
89 SVGGraphicsElement::parseAttribute(name, value); 88 SVGGraphicsElement::parseAttribute(name, value);
90 else if (name == SVGNames::xAttr) 89 else if (name == SVGNames::xAttr)
91 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); 90 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
92 else if (name == SVGNames::yAttr) 91 else if (name == SVGNames::yAttr)
93 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)) ; 92 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)) ;
94 else if (name == SVGNames::widthAttr) 93 else if (name == SVGNames::widthAttr)
95 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro r)); 94 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro r));
96 else if (name == SVGNames::heightAttr) 95 else if (name == SVGNames::heightAttr)
97 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr ror)); 96 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr ror));
98 else if (SVGLangSpace::parseAttribute(name, value) 97 else if (SVGExternalResourcesRequired::parseAttribute(name, value)) {
99 || SVGExternalResourcesRequired::parseAttribute(name, value)) {
100 } else 98 } else
101 ASSERT_NOT_REACHED(); 99 ASSERT_NOT_REACHED();
102 100
103 reportAttributeParsingError(parseError, name, value); 101 reportAttributeParsingError(parseError, name, value);
104 } 102 }
105 103
106 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) 104 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName)
107 { 105 {
108 if (!isSupportedAttribute(attrName)) { 106 if (!isSupportedAttribute(attrName)) {
109 SVGGraphicsElement::svgAttributeChanged(attrName); 107 SVGGraphicsElement::svgAttributeChanged(attrName);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 157
160 bool SVGForeignObjectElement::selfHasRelativeLengths() const 158 bool SVGForeignObjectElement::selfHasRelativeLengths() const
161 { 159 {
162 return x().isRelative() 160 return x().isRelative()
163 || y().isRelative() 161 || y().isRelative()
164 || width().isRelative() 162 || width().isRelative()
165 || height().isRelative(); 163 || height().isRelative();
166 } 164 }
167 165
168 } 166 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGFilterElement.cpp ('k') | Source/core/svg/SVGGElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698