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

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

Issue 23685007: Have SVGURIReference API deal with Document references, not pointers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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/SVGRadialGradientElement.cpp ('k') | Source/core/svg/SVGTextPathElement.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) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // Remove active listeners and clear the text content. 160 // Remove active listeners and clear the text content.
161 m_targetListener->detach(); 161 m_targetListener->detach();
162 162
163 userAgentShadowRoot()->removeChildren(); 163 userAgentShadowRoot()->removeChildren();
164 164
165 if (!inDocument()) 165 if (!inDocument())
166 return; 166 return;
167 167
168 // Mark the referenced ID as pending. 168 // Mark the referenced ID as pending.
169 String id; 169 String id;
170 SVGURIReference::targetElementFromIRIString(hrefCurrentValue(), &document(), &id); 170 SVGURIReference::targetElementFromIRIString(hrefCurrentValue(), document(), &id);
171 if (!id.isEmpty()) 171 if (!id.isEmpty())
172 document().accessSVGExtensions()->addPendingResource(id, this); 172 document().accessSVGExtensions()->addPendingResource(id, this);
173 } 173 }
174 174
175 bool SVGTRefElement::isSupportedAttribute(const QualifiedName& attrName) 175 bool SVGTRefElement::isSupportedAttribute(const QualifiedName& attrName)
176 { 176 {
177 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 177 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
178 if (supportedAttributes.isEmpty()) 178 if (supportedAttributes.isEmpty())
179 SVGURIReference::addSupportedAttributes(supportedAttributes); 179 SVGURIReference::addSupportedAttributes(supportedAttributes);
180 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 180 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 void SVGTRefElement::buildPendingResource() 240 void SVGTRefElement::buildPendingResource()
241 { 241 {
242 // Remove any existing event listener. 242 // Remove any existing event listener.
243 m_targetListener->detach(); 243 m_targetListener->detach();
244 244
245 // If we're not yet in a document, this function will be called again from i nsertedInto(). 245 // If we're not yet in a document, this function will be called again from i nsertedInto().
246 if (!inDocument()) 246 if (!inDocument())
247 return; 247 return;
248 248
249 String id; 249 String id;
250 RefPtr<Element> target = SVGURIReference::targetElementFromIRIString(hrefCur rentValue(), &document(), &id); 250 RefPtr<Element> target = SVGURIReference::targetElementFromIRIString(hrefCur rentValue(), document(), &id);
251 if (!target.get()) { 251 if (!target.get()) {
252 if (id.isEmpty()) 252 if (id.isEmpty())
253 return; 253 return;
254 254
255 document().accessSVGExtensions()->addPendingResource(id, this); 255 document().accessSVGExtensions()->addPendingResource(id, this);
256 ASSERT(hasPendingResources()); 256 ASSERT(hasPendingResources());
257 return; 257 return;
258 } 258 }
259 259
260 // Don't set up event listeners if this is a shadow tree node. 260 // Don't set up event listeners if this is a shadow tree node.
(...skipping 15 matching lines...) Expand all
276 } 276 }
277 277
278 void SVGTRefElement::removedFrom(ContainerNode* rootParent) 278 void SVGTRefElement::removedFrom(ContainerNode* rootParent)
279 { 279 {
280 SVGElement::removedFrom(rootParent); 280 SVGElement::removedFrom(rootParent);
281 if (rootParent->inDocument()) 281 if (rootParent->inDocument())
282 m_targetListener->detach(); 282 m_targetListener->detach();
283 } 283 }
284 284
285 } 285 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGRadialGradientElement.cpp ('k') | Source/core/svg/SVGTextPathElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698