| 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, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 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 "config.h" | 21 #include "config.h" |
| 22 | 22 |
| 23 #include "core/svg/SVGTests.h" | 23 #include "core/svg/SVGTests.h" |
| 24 | 24 |
| 25 #include "core/SVGNames.h" | 25 #include "core/SVGNames.h" |
| 26 #include "core/dom/DOMImplementation.h" | 26 #include "core/dom/DOMImplementation.h" |
| 27 #include "core/frame/UseCounter.h" |
| 28 #include "core/svg/SVGElement.h" |
| 27 #include "platform/Language.h" | 29 #include "platform/Language.h" |
| 28 #include "core/svg/SVGElement.h" | |
| 29 | 30 |
| 30 namespace blink { | 31 namespace blink { |
| 31 | 32 |
| 32 SVGTests::SVGTests(SVGElement* contextElement) | 33 SVGTests::SVGTests(SVGElement* contextElement) |
| 33 : m_requiredFeatures(SVGStaticStringList::create(contextElement, SVGNames::r
equiredFeaturesAttr)) | 34 : m_requiredFeatures(SVGStaticStringList::create(contextElement, SVGNames::r
equiredFeaturesAttr)) |
| 34 , m_requiredExtensions(SVGStaticStringList::create(contextElement, SVGNames:
:requiredExtensionsAttr)) | 35 , m_requiredExtensions(SVGStaticStringList::create(contextElement, SVGNames:
:requiredExtensionsAttr)) |
| 35 , m_systemLanguage(SVGStaticStringList::create(contextElement, SVGNames::sys
temLanguageAttr)) | 36 , m_systemLanguage(SVGStaticStringList::create(contextElement, SVGNames::sys
temLanguageAttr)) |
| 36 { | 37 { |
| 37 ASSERT(contextElement); | 38 ASSERT(contextElement); |
| 38 | 39 |
| 39 contextElement->addToPropertyMap(m_requiredFeatures); | 40 contextElement->addToPropertyMap(m_requiredFeatures); |
| 40 contextElement->addToPropertyMap(m_requiredExtensions); | 41 contextElement->addToPropertyMap(m_requiredExtensions); |
| 41 contextElement->addToPropertyMap(m_systemLanguage); | 42 contextElement->addToPropertyMap(m_systemLanguage); |
| 42 } | 43 } |
| 43 | 44 |
| 44 bool SVGTests::hasExtension(const String&) | 45 bool SVGTests::hasExtension(const String&) |
| 45 { | 46 { |
| 46 // FIXME: Implement me! | 47 // FIXME: Implement me! |
| 47 return false; | 48 return false; |
| 48 } | 49 } |
| 49 | 50 |
| 50 bool SVGTests::isValid() const | 51 bool SVGTests::isValid(Document& document) const |
| 51 { | 52 { |
| 52 if (m_requiredFeatures->isSpecified()) { | 53 if (m_requiredFeatures->isSpecified()) { |
| 53 const Vector<String>& requiredFeatures = m_requiredFeatures->value()->va
lues(); | 54 const Vector<String>& requiredFeatures = m_requiredFeatures->value()->va
lues(); |
| 54 Vector<String>::const_iterator it = requiredFeatures.begin(); | 55 Vector<String>::const_iterator it = requiredFeatures.begin(); |
| 55 Vector<String>::const_iterator itEnd = requiredFeatures.end(); | 56 Vector<String>::const_iterator itEnd = requiredFeatures.end(); |
| 56 for (; it != itEnd; ++it) { | 57 for (; it != itEnd; ++it) { |
| 57 if (it->isEmpty() || !DOMImplementation::hasFeature(*it, String())) | 58 if (it->isEmpty()) |
| 58 return false; | 59 return false; |
| 60 if (!DOMImplementation::hasFeature(*it, String())) { |
| 61 UseCounter::count(document, UseCounter::DOMImplementationHasFeat
ureReturnFalseInternal); |
| 62 return false; |
| 63 } |
| 59 } | 64 } |
| 60 } | 65 } |
| 61 | 66 |
| 62 if (m_systemLanguage->isSpecified()) { | 67 if (m_systemLanguage->isSpecified()) { |
| 63 bool matchFound = false; | 68 bool matchFound = false; |
| 64 | 69 |
| 65 const Vector<String>& systemLanguage = m_systemLanguage->value()->values
(); | 70 const Vector<String>& systemLanguage = m_systemLanguage->value()->values
(); |
| 66 Vector<String>::const_iterator it = systemLanguage.begin(); | 71 Vector<String>::const_iterator it = systemLanguage.begin(); |
| 67 Vector<String>::const_iterator itEnd = systemLanguage.end(); | 72 Vector<String>::const_iterator itEnd = systemLanguage.end(); |
| 68 for (; it != itEnd; ++it) { | 73 for (; it != itEnd; ++it) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } | 115 } |
| 111 | 116 |
| 112 void SVGTests::addSupportedAttributes(HashSet<QualifiedName>& supportedAttribute
s) | 117 void SVGTests::addSupportedAttributes(HashSet<QualifiedName>& supportedAttribute
s) |
| 113 { | 118 { |
| 114 supportedAttributes.add(SVGNames::requiredFeaturesAttr); | 119 supportedAttributes.add(SVGNames::requiredFeaturesAttr); |
| 115 supportedAttributes.add(SVGNames::requiredExtensionsAttr); | 120 supportedAttributes.add(SVGNames::requiredExtensionsAttr); |
| 116 supportedAttributes.add(SVGNames::systemLanguageAttr); | 121 supportedAttributes.add(SVGNames::systemLanguageAttr); |
| 117 } | 122 } |
| 118 | 123 |
| 119 } | 124 } |
| OLD | NEW |