OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2008 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 * | 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 AtomicString SVGURIReference::fragmentIdentifierFromIRIString(const String& urlS
tring, const TreeScope& treeScope) | 59 AtomicString SVGURIReference::fragmentIdentifierFromIRIString(const String& urlS
tring, const TreeScope& treeScope) |
60 { | 60 { |
61 const Document& document = treeScope.document(); | 61 const Document& document = treeScope.document(); |
62 | 62 |
63 KURL url = document.completeURL(urlString); | 63 KURL url = document.completeURL(urlString); |
64 if (!url.hasFragmentIdentifier() || !equalIgnoringFragmentIdentifier(url, do
cument.url())) | 64 if (!url.hasFragmentIdentifier() || !equalIgnoringFragmentIdentifier(url, do
cument.url())) |
65 return emptyAtom; | 65 return emptyAtom; |
66 return AtomicString(url.fragmentIdentifier()); | 66 return AtomicString(url.fragmentIdentifier()); |
67 } | 67 } |
68 | 68 |
69 Element* SVGURIReference::targetElementFromIRIString(const String& urlString, co
nst TreeScope& treeScope, AtomicString* fragmentIdentifier, Document* externalDo
cument) | 69 Element* SVGURIReference::targetElementFromIRIString(const String& urlString, co
nst TreeScope& treeScope, AtomicString* fragmentIdentifier) |
70 { | 70 { |
71 const Document& document = treeScope.document(); | 71 const Document& document = treeScope.document(); |
72 | 72 |
73 KURL url = document.completeURL(urlString); | 73 KURL url = document.completeURL(urlString); |
74 if (!url.hasFragmentIdentifier()) | 74 if (!url.hasFragmentIdentifier() || !equalIgnoringFragmentIdentifier(url, do
cument.url())) |
75 return nullptr; | 75 return nullptr; |
76 | |
77 AtomicString id(url.fragmentIdentifier()); | 76 AtomicString id(url.fragmentIdentifier()); |
78 if (fragmentIdentifier) | 77 if (fragmentIdentifier) |
79 *fragmentIdentifier = id; | 78 *fragmentIdentifier = id; |
80 | |
81 if (externalDocument) { | |
82 // Enforce that the referenced url matches the url of the document that
we've loaded for it! | |
83 ASSERT(equalIgnoringFragmentIdentifier(url, externalDocument->url())); | |
84 return externalDocument->getElementById(id); | |
85 } | |
86 | |
87 // Exit early if the referenced url is external, and we have no externalDocu
ment given. | |
88 if (!equalIgnoringFragmentIdentifier(url, document.url())) | |
89 return nullptr; | |
90 | |
91 return treeScope.getElementById(id); | 79 return treeScope.getElementById(id); |
92 } | 80 } |
93 | 81 |
94 } // namespace blink | 82 } // namespace blink |
OLD | NEW |