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

Unified Diff: Source/core/svg/SVGURIReference.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/svg/SVGURIReference.h ('k') | Source/core/svg/SVGUseElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGURIReference.cpp
diff --git a/Source/core/svg/SVGURIReference.cpp b/Source/core/svg/SVGURIReference.cpp
index 270e2616102ec742236294c2f59c973e9400788c..4152c151c322f5ddf0cd5dd711d623007daa7490 100644
--- a/Source/core/svg/SVGURIReference.cpp
+++ b/Source/core/svg/SVGURIReference.cpp
@@ -43,23 +43,21 @@ bool SVGURIReference::isKnownAttribute(const QualifiedName& attrName)
return attrName.matches(XLinkNames::hrefAttr);
}
-String SVGURIReference::fragmentIdentifierFromIRIString(const String& url, Document* document)
+String SVGURIReference::fragmentIdentifierFromIRIString(const String& url, const Document& document)
{
- ASSERT(document);
size_t start = url.find('#');
if (start == notFound)
return emptyString();
- KURL base = start ? KURL(document->baseURI(), url.substring(0, start)) : document->baseURI();
- if (equalIgnoringFragmentIdentifier(base, document->url()))
+ KURL base = start ? KURL(document.baseURI(), url.substring(0, start)) : document.baseURI();
+ if (equalIgnoringFragmentIdentifier(base, document.url()))
return url.substring(start + 1);
return emptyString();
}
-static inline KURL urlFromIRIStringWithFragmentIdentifier(const String& url, Document* document, String& fragmentIdentifier)
+static inline KURL urlFromIRIStringWithFragmentIdentifier(const String& url, const Document& document, String& fragmentIdentifier)
{
- ASSERT(document);
size_t startOfFragmentIdentifier = url.find('#');
if (startOfFragmentIdentifier == notFound)
return KURL();
@@ -67,14 +65,14 @@ static inline KURL urlFromIRIStringWithFragmentIdentifier(const String& url, Doc
// Exclude the '#' character when determining the fragmentIdentifier.
fragmentIdentifier = url.substring(startOfFragmentIdentifier + 1);
if (startOfFragmentIdentifier) {
- KURL base(document->baseURI(), url.substring(0, startOfFragmentIdentifier));
+ KURL base(document.baseURI(), url.substring(0, startOfFragmentIdentifier));
return KURL(base, url.substring(startOfFragmentIdentifier));
}
- return KURL(document->baseURI(), url.substring(startOfFragmentIdentifier));
+ return KURL(document.baseURI(), url.substring(startOfFragmentIdentifier));
}
-Element* SVGURIReference::targetElementFromIRIString(const String& iri, Document* document, String* fragmentIdentifier, Document* externalDocument)
+Element* SVGURIReference::targetElementFromIRIString(const String& iri, const Document& document, String* fragmentIdentifier, Document* externalDocument)
{
// If there's no fragment identifier contained within the IRI string, we can't lookup an element.
String id;
@@ -98,7 +96,7 @@ Element* SVGURIReference::targetElementFromIRIString(const String& iri, Document
if (isExternalURIReference(iri, document))
return 0;
- return document->getElementById(id);
+ return document.getElementById(id);
}
void SVGURIReference::addSupportedAttributes(HashSet<QualifiedName>& supportedAttributes)
« no previous file with comments | « Source/core/svg/SVGURIReference.h ('k') | Source/core/svg/SVGUseElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698