2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
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.
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.
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.
26 #include "Attribute.h"
27 #include "DOMImplementation.h"
29 #include "SVGElement.h"
31 #include "SVGStringList.h"
43 SVGStringList* SVGTests::requiredFeatures() const
46 m_features = SVGStringList::create(SVGNames::requiredFeaturesAttr);
48 return m_features.get();
51 SVGStringList* SVGTests::requiredExtensions() const
54 m_extensions = SVGStringList::create(SVGNames::requiredExtensionsAttr);
56 return m_extensions.get();
59 SVGStringList* SVGTests::systemLanguage() const
61 if (!m_systemLanguage)
62 m_systemLanguage = SVGStringList::create(SVGNames::systemLanguageAttr);
64 return m_systemLanguage.get();
67 bool SVGTests::hasExtension(const String&) const
72 bool SVGTests::isValid() const
77 for (unsigned long i = 0; i < m_features->numberOfItems(); i++) {
78 String value = m_features->getItem(i, ec);
79 if (value.isEmpty() || !DOMImplementation::hasFeature(value, String()))
84 if (m_systemLanguage) {
85 for (unsigned long i = 0; i < m_systemLanguage->numberOfItems(); i++)
86 if (m_systemLanguage->getItem(i, ec) != defaultLanguage().substring(0, 2))
90 if (m_extensions && m_extensions->numberOfItems() > 0)
96 bool SVGTests::parseMappedAttribute(Attribute* attr)
98 if (attr->name() == SVGNames::requiredFeaturesAttr) {
99 requiredFeatures()->reset(attr->value());
101 } else if (attr->name() == SVGNames::requiredExtensionsAttr) {
102 requiredExtensions()->reset(attr->value());
104 } else if (attr->name() == SVGNames::systemLanguageAttr) {
105 systemLanguage()->reset(attr->value());
112 bool SVGTests::isKnownAttribute(const QualifiedName& attrName)
114 return (attrName == SVGNames::requiredFeaturesAttr ||
115 attrName == SVGNames::requiredExtensionsAttr ||
116 attrName == SVGNames::systemLanguageAttr);
121 #endif // ENABLE(SVG)