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