| 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 "core/svg/SVGTests.h" | 21 #include "core/svg/SVGTests.h" |
| 22 | 22 |
| 23 #include "core/SVGNames.h" | 23 #include "core/SVGNames.h" |
| 24 #include "core/svg/SVGElement.h" | 24 #include "core/svg/SVGElement.h" |
| 25 #include "core/svg/SVGStaticStringList.h" |
| 25 #include "platform/Language.h" | 26 #include "platform/Language.h" |
| 26 | 27 |
| 27 namespace blink { | 28 namespace blink { |
| 28 | 29 |
| 29 SVGTests::SVGTests(SVGElement* contextElement) | 30 SVGTests::SVGTests(SVGElement* contextElement) |
| 30 : m_requiredFeatures(SVGStaticStringList::create(contextElement, SVGNames::r
equiredFeaturesAttr)) | 31 : m_requiredFeatures(SVGStaticStringList::create(contextElement, SVGNames::r
equiredFeaturesAttr)) |
| 31 , m_requiredExtensions(SVGStaticStringList::create(contextElement, SVGNames:
:requiredExtensionsAttr)) | 32 , m_requiredExtensions(SVGStaticStringList::create(contextElement, SVGNames:
:requiredExtensionsAttr)) |
| 32 , m_systemLanguage(SVGStaticStringList::create(contextElement, SVGNames::sys
temLanguageAttr)) | 33 , m_systemLanguage(SVGStaticStringList::create(contextElement, SVGNames::sys
temLanguageAttr)) |
| 33 { | 34 { |
| 34 ASSERT(contextElement); | 35 ASSERT(contextElement); |
| 35 | 36 |
| 36 contextElement->addToPropertyMap(m_requiredFeatures); | 37 contextElement->addToPropertyMap(m_requiredFeatures); |
| 37 contextElement->addToPropertyMap(m_requiredExtensions); | 38 contextElement->addToPropertyMap(m_requiredExtensions); |
| 38 contextElement->addToPropertyMap(m_systemLanguage); | 39 contextElement->addToPropertyMap(m_systemLanguage); |
| 39 } | 40 } |
| 40 | 41 |
| 41 DEFINE_TRACE(SVGTests) | 42 DEFINE_TRACE(SVGTests) |
| 42 { | 43 { |
| 43 visitor->trace(m_requiredFeatures); | 44 visitor->trace(m_requiredFeatures); |
| 44 visitor->trace(m_requiredExtensions); | 45 visitor->trace(m_requiredExtensions); |
| 45 visitor->trace(m_systemLanguage); | 46 visitor->trace(m_systemLanguage); |
| 46 } | 47 } |
| 47 | 48 |
| 49 SVGStringListTearOff* SVGTests::requiredFeatures() |
| 50 { |
| 51 return m_requiredFeatures->tearOff(); |
| 52 } |
| 53 |
| 54 SVGStringListTearOff* SVGTests::requiredExtensions() |
| 55 { |
| 56 return m_requiredExtensions->tearOff(); |
| 57 } |
| 58 |
| 59 SVGStringListTearOff* SVGTests::systemLanguage() |
| 60 { |
| 61 return m_systemLanguage->tearOff(); |
| 62 } |
| 63 |
| 48 bool SVGTests::isValid() const | 64 bool SVGTests::isValid() const |
| 49 { | 65 { |
| 50 // No need to check requiredFeatures since hasFeature always returns true. | 66 // No need to check requiredFeatures since hasFeature always returns true. |
| 51 | 67 |
| 52 if (m_systemLanguage->isSpecified()) { | 68 if (m_systemLanguage->isSpecified()) { |
| 53 bool matchFound = false; | 69 bool matchFound = false; |
| 54 for (const auto& value : m_systemLanguage->value()->values()) { | 70 for (const auto& value : m_systemLanguage->value()->values()) { |
| 55 if (value.length() == 2 && defaultLanguage().startsWith(value)) { | 71 if (value.length() == 2 && defaultLanguage().startsWith(value)) { |
| 56 matchFound = true; | 72 matchFound = true; |
| 57 break; | 73 break; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 68 } | 84 } |
| 69 | 85 |
| 70 bool SVGTests::isKnownAttribute(const QualifiedName& attrName) | 86 bool SVGTests::isKnownAttribute(const QualifiedName& attrName) |
| 71 { | 87 { |
| 72 return attrName == SVGNames::requiredFeaturesAttr | 88 return attrName == SVGNames::requiredFeaturesAttr |
| 73 || attrName == SVGNames::requiredExtensionsAttr | 89 || attrName == SVGNames::requiredExtensionsAttr |
| 74 || attrName == SVGNames::systemLanguageAttr; | 90 || attrName == SVGNames::systemLanguageAttr; |
| 75 } | 91 } |
| 76 | 92 |
| 77 } // namespace blink | 93 } // namespace blink |
| OLD | NEW |