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, |
(...skipping 28 matching lines...) Expand all Loading... |
39 contextElement->addToPropertyMap(m_systemLanguage); | 39 contextElement->addToPropertyMap(m_systemLanguage); |
40 } | 40 } |
41 | 41 |
42 DEFINE_TRACE(SVGTests) | 42 DEFINE_TRACE(SVGTests) |
43 { | 43 { |
44 visitor->trace(m_requiredFeatures); | 44 visitor->trace(m_requiredFeatures); |
45 visitor->trace(m_requiredExtensions); | 45 visitor->trace(m_requiredExtensions); |
46 visitor->trace(m_systemLanguage); | 46 visitor->trace(m_systemLanguage); |
47 } | 47 } |
48 | 48 |
49 bool SVGTests::isValid(Document& document) const | 49 bool SVGTests::isValid() const |
50 { | 50 { |
51 // No need to check requiredFeatures since hasFeature always returns true. | 51 // No need to check requiredFeatures since hasFeature always returns true. |
52 | 52 |
53 if (m_systemLanguage->isSpecified()) { | 53 if (m_systemLanguage->isSpecified()) { |
54 bool matchFound = false; | 54 bool matchFound = false; |
55 | 55 |
56 const Vector<String>& systemLanguage = m_systemLanguage->value()->values
(); | 56 const Vector<String>& systemLanguage = m_systemLanguage->value()->values
(); |
57 for (const auto& value : systemLanguage) { | 57 for (const auto& value : systemLanguage) { |
58 if (value == defaultLanguage().string().substring(0, 2)) { | 58 if (value == defaultLanguage().string().substring(0, 2)) { |
59 matchFound = true; | 59 matchFound = true; |
60 break; | 60 break; |
61 } | 61 } |
62 } | 62 } |
63 | 63 |
64 if (!matchFound) | 64 if (!matchFound) |
65 return false; | 65 return false; |
66 } | 66 } |
67 | 67 |
68 if (!m_requiredExtensions->value()->values().isEmpty()) | 68 if (!m_requiredExtensions->value()->values().isEmpty()) |
69 return false; | 69 return false; |
70 | 70 |
71 return true; | 71 return true; |
72 } | 72 } |
73 | 73 |
74 bool SVGTests::parseAttribute(const QualifiedName& name, const AtomicString& val
ue) | |
75 { | |
76 // FIXME: Should handle exceptions here. | |
77 // This is safe as of now, as the current impl of SVGStringList::setValueAsS
tring never fails. | |
78 SVGParsingError parseError = NoError; | |
79 | |
80 if (name == SVGNames::requiredFeaturesAttr) | |
81 m_requiredFeatures->setBaseValueAsString(value, parseError); | |
82 else if (name == SVGNames::requiredExtensionsAttr) | |
83 m_requiredExtensions->setBaseValueAsString(value, parseError); | |
84 else if (name == SVGNames::systemLanguageAttr) | |
85 m_systemLanguage->setBaseValueAsString(value, parseError); | |
86 else | |
87 return false; | |
88 | |
89 ASSERT(parseError == NoError); | |
90 | |
91 return true; | |
92 } | |
93 | |
94 bool SVGTests::isKnownAttribute(const QualifiedName& attrName) | 74 bool SVGTests::isKnownAttribute(const QualifiedName& attrName) |
95 { | 75 { |
96 return attrName == SVGNames::requiredFeaturesAttr | 76 return attrName == SVGNames::requiredFeaturesAttr |
97 || attrName == SVGNames::requiredExtensionsAttr | 77 || attrName == SVGNames::requiredExtensionsAttr |
98 || attrName == SVGNames::systemLanguageAttr; | 78 || attrName == SVGNames::systemLanguageAttr; |
99 } | 79 } |
100 | 80 |
101 void SVGTests::addSupportedAttributes(HashSet<QualifiedName>& supportedAttribute
s) | |
102 { | |
103 supportedAttributes.add(SVGNames::requiredFeaturesAttr); | |
104 supportedAttributes.add(SVGNames::requiredExtensionsAttr); | |
105 supportedAttributes.add(SVGNames::systemLanguageAttr); | |
106 } | 81 } |
107 | |
108 } | |
OLD | NEW |