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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGURIReference.cpp

Issue 1681553002: Add support for 'href' (w/o XLink NS) for various SVG elements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove invalid assert. Created 4 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
OLDNEW
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,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 */ 19 */
20 20
21 #include "core/svg/SVGURIReference.h" 21 #include "core/svg/SVGURIReference.h"
22 22
23 #include "core/XLinkNames.h"
24 #include "core/svg/SVGElement.h" 23 #include "core/svg/SVGElement.h"
25 #include "platform/weborigin/KURL.h" 24 #include "platform/weborigin/KURL.h"
26 25
27 namespace blink { 26 namespace blink {
28 27
29 SVGURIReference::SVGURIReference(SVGElement* element) 28 SVGURIReference::SVGURIReference(SVGElement* element)
30 : m_href(SVGAnimatedString::create(element, XLinkNames::hrefAttr, SVGString: :create())) 29 : m_href(SVGAnimatedHref::create(element))
31 { 30 {
32 ASSERT(element); 31 ASSERT(element);
33 element->addToPropertyMap(m_href); 32 m_href->addToPropertyMap(element);
34 } 33 }
35 34
36 DEFINE_TRACE(SVGURIReference) 35 DEFINE_TRACE(SVGURIReference)
37 { 36 {
38 visitor->trace(m_href); 37 visitor->trace(m_href);
39 } 38 }
40 39
41 bool SVGURIReference::isKnownAttribute(const QualifiedName& attrName) 40 bool SVGURIReference::isKnownAttribute(const QualifiedName& attrName)
42 { 41 {
43 return attrName.matches(XLinkNames::hrefAttr); 42 return SVGAnimatedHref::isKnownAttribute(attrName);
44 } 43 }
45 44
46 AtomicString SVGURIReference::fragmentIdentifierFromIRIString(const String& url, const TreeScope& treeScope) 45 AtomicString SVGURIReference::fragmentIdentifierFromIRIString(const String& url, const TreeScope& treeScope)
47 { 46 {
48 size_t start = url.find('#'); 47 size_t start = url.find('#');
49 if (start == kNotFound) 48 if (start == kNotFound)
50 return emptyAtom; 49 return emptyAtom;
51 50
52 const Document& document = treeScope.document(); 51 const Document& document = treeScope.document();
53 KURL base = start ? KURL(document.baseURI(), url.substring(0, start)) : docu ment.baseURI(); 52 KURL base = start ? KURL(document.baseURI(), url.substring(0, start)) : docu ment.baseURI();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 97 }
99 98
100 // Exit early if the referenced url is external, and we have no externalDocu ment given. 99 // Exit early if the referenced url is external, and we have no externalDocu ment given.
101 if (isExternalURIReference(iri, document)) 100 if (isExternalURIReference(iri, document))
102 return nullptr; 101 return nullptr;
103 102
104 return treeScope.getElementById(id); 103 return treeScope.getElementById(id);
105 } 104 }
106 105
107 } // namespace blink 106 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698