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

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

Issue 169103002: Drop [LegacyImplementedInBaseClass] from SVGURIReference IDL interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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, 2008, 2009 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Rob Buis <buis@kde.org>
4 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> 4 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 22 matching lines...) Expand all
33 namespace WebCore { 33 namespace WebCore {
34 34
35 // Animated property definitions 35 // Animated property definitions
36 36
37 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGImageElement) 37 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGImageElement)
38 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) 38 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
39 END_REGISTER_ANIMATED_PROPERTIES 39 END_REGISTER_ANIMATED_PROPERTIES
40 40
41 inline SVGImageElement::SVGImageElement(Document& document) 41 inline SVGImageElement::SVGImageElement(Document& document)
42 : SVGGraphicsElement(SVGNames::imageTag, document) 42 : SVGGraphicsElement(SVGNames::imageTag, document)
43 , SVGURIReference(this)
43 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len gthModeWidth))) 44 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len gthModeWidth)))
44 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len gthModeHeight))) 45 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len gthModeHeight)))
45 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr eate(LengthModeWidth))) 46 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr eate(LengthModeWidth)))
46 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength:: create(LengthModeHeight))) 47 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength:: create(LengthModeHeight)))
47 , m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create(this, SVGName s::preserveAspectRatioAttr, SVGPreserveAspectRatio::create())) 48 , m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create(this, SVGName s::preserveAspectRatioAttr, SVGPreserveAspectRatio::create()))
48 , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::cr eate()))
49 , m_imageLoader(this) 49 , m_imageLoader(this)
50 { 50 {
51 ScriptWrappable::init(this); 51 ScriptWrappable::init(this);
52 52
53 addToPropertyMap(m_x); 53 addToPropertyMap(m_x);
54 addToPropertyMap(m_y); 54 addToPropertyMap(m_y);
55 addToPropertyMap(m_width); 55 addToPropertyMap(m_width);
56 addToPropertyMap(m_height); 56 addToPropertyMap(m_height);
57 57
58 addToPropertyMap(m_preserveAspectRatio); 58 addToPropertyMap(m_preserveAspectRatio);
59 addToPropertyMap(m_href);
60 registerAnimatedPropertiesForSVGImageElement(); 59 registerAnimatedPropertiesForSVGImageElement();
61 } 60 }
62 61
63 PassRefPtr<SVGImageElement> SVGImageElement::create(Document& document) 62 PassRefPtr<SVGImageElement> SVGImageElement::create(Document& document)
64 { 63 {
65 return adoptRef(new SVGImageElement(document)); 64 return adoptRef(new SVGImageElement(document));
66 } 65 }
67 66
68 bool SVGImageElement::currentFrameHasSingleSecurityOrigin() const 67 bool SVGImageElement::currentFrameHasSingleSecurityOrigin() const
69 { 68 {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 else if (name == SVGNames::widthAttr) 104 else if (name == SVGNames::widthAttr)
106 addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, value); 105 addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, value);
107 else if (name == SVGNames::heightAttr) 106 else if (name == SVGNames::heightAttr)
108 addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, value) ; 107 addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, value) ;
109 } 108 }
110 109
111 void SVGImageElement::parseAttribute(const QualifiedName& name, const AtomicStri ng& value) 110 void SVGImageElement::parseAttribute(const QualifiedName& name, const AtomicStri ng& value)
112 { 111 {
113 SVGParsingError parseError = NoError; 112 SVGParsingError parseError = NoError;
114 113
115 if (!isSupportedAttribute(name)) 114 if (!isSupportedAttribute(name)) {
116 SVGGraphicsElement::parseAttribute(name, value); 115 SVGGraphicsElement::parseAttribute(name, value);
117 else if (name == SVGNames::xAttr) 116 } else if (name == SVGNames::xAttr) {
118 m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError); 117 m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError);
119 else if (name == SVGNames::yAttr) 118 } else if (name == SVGNames::yAttr) {
120 m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError); 119 m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError);
121 else if (name == SVGNames::widthAttr) 120 } else if (name == SVGNames::widthAttr) {
122 m_width->setBaseValueAsString(value, ForbidNegativeLengths, parseError); 121 m_width->setBaseValueAsString(value, ForbidNegativeLengths, parseError);
123 else if (name == SVGNames::heightAttr) 122 } else if (name == SVGNames::heightAttr) {
124 m_height->setBaseValueAsString(value, ForbidNegativeLengths, parseError) ; 123 m_height->setBaseValueAsString(value, ForbidNegativeLengths, parseError) ;
125 else if (name == SVGNames::preserveAspectRatioAttr) 124 } else if (name == SVGNames::preserveAspectRatioAttr) {
126 m_preserveAspectRatio->setBaseValueAsString(value, parseError); 125 m_preserveAspectRatio->setBaseValueAsString(value, parseError);
127 else if (name.matches(XLinkNames::hrefAttr)) 126 } else if (SVGURIReference::parseAttribute(name, value, parseError)) {
128 m_href->setBaseValueAsString(value, parseError); 127 } else {
129 else
130 ASSERT_NOT_REACHED(); 128 ASSERT_NOT_REACHED();
129 }
131 130
132 reportAttributeParsingError(parseError, name, value); 131 reportAttributeParsingError(parseError, name, value);
133 } 132 }
134 133
135 void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName) 134 void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName)
136 { 135 {
137 if (!isSupportedAttribute(attrName)) { 136 if (!isSupportedAttribute(attrName)) {
138 SVGGraphicsElement::svgAttributeChanged(attrName); 137 SVGGraphicsElement::svgAttributeChanged(attrName);
139 return; 138 return;
140 } 139 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 if (!rootParent->inDocument()) 207 if (!rootParent->inDocument())
209 return InsertionDone; 208 return InsertionDone;
210 // Update image loader, as soon as we're living in the tree. 209 // Update image loader, as soon as we're living in the tree.
211 // We can only resolve base URIs properly, after that! 210 // We can only resolve base URIs properly, after that!
212 m_imageLoader.updateFromElement(); 211 m_imageLoader.updateFromElement();
213 return InsertionDone; 212 return InsertionDone;
214 } 213 }
215 214
216 const AtomicString SVGImageElement::imageSourceURL() const 215 const AtomicString SVGImageElement::imageSourceURL() const
217 { 216 {
218 return AtomicString(m_href->currentValue()->value()); 217 return AtomicString(hrefString());
219 } 218 }
220 219
221 void SVGImageElement::didMoveToNewDocument(Document& oldDocument) 220 void SVGImageElement::didMoveToNewDocument(Document& oldDocument)
222 { 221 {
223 m_imageLoader.elementDidMoveToNewDocument(); 222 m_imageLoader.elementDidMoveToNewDocument();
224 SVGGraphicsElement::didMoveToNewDocument(oldDocument); 223 SVGGraphicsElement::didMoveToNewDocument(oldDocument);
225 } 224 }
226 225
227 } 226 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698