1/* 2 * Copyright (C) 2004, 2005, 2008, 2009 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 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 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21#ifndef SVGURIReference_h 22#define SVGURIReference_h 23 24#if ENABLE(SVG) 25#include "Document.h" 26#include "XLinkNames.h" 27 28namespace WebCore { 29 30class Attribute; 31class Element; 32 33class SVGURIReference { 34public: 35 virtual ~SVGURIReference() { } 36 37 bool parseAttribute(const QualifiedName&, const AtomicString&); 38 bool isKnownAttribute(const QualifiedName&); 39 void addSupportedAttributes(HashSet<QualifiedName>&); 40 41 static String fragmentIdentifierFromIRIString(const String&, Document*); 42 static Element* targetElementFromIRIString(const String&, Document*, String* = 0, Document* = 0); 43 44 static inline bool isExternalURIReference(const String& uri, Document* document) 45 { 46 // Fragment-only URIs are always internal 47 if (uri.startsWith('#')) 48 return false; 49 50 // If the URI matches our documents URL, we're dealing with a local reference. 51 ASSERT(document); 52 KURL url = document->completeURL(uri); 53 return !equalIgnoringFragmentIdentifier(url, document->url()); 54 } 55 56protected: 57 virtual void setHrefBaseValue(const String&, const bool validValue = true) = 0; 58}; 59 60} // namespace WebCore 61 62#endif // ENABLE(SVG) 63#endif // SVGURIReference_h 64