Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGTests.cpp

Issue 2741463002: Remove SVGTests.requiredFeatures attribute
Patch Set: rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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. 57 // No need to check requiredFeatures since hasFeature always returns true.
fs 2017/03/23 16:55:43 Nit: Remove this comment (and the blank line follo
67 58
68 if (m_systemLanguage->isSpecified()) { 59 if (m_systemLanguage->isSpecified()) {
69 bool matchFound = false; 60 bool matchFound = false;
70 for (const auto& value : m_systemLanguage->value()->values()) { 61 for (const auto& value : m_systemLanguage->value()->values()) {
71 if (value.length() == 2 && defaultLanguage().startsWith(value)) { 62 if (value.length() == 2 && defaultLanguage().startsWith(value)) {
72 matchFound = true; 63 matchFound = true;
73 break; 64 break;
74 } 65 }
75 } 66 }
76 if (!matchFound) 67 if (!matchFound)
77 return false; 68 return false;
78 } 69 }
79 70
80 if (!m_requiredExtensions->value()->values().isEmpty()) 71 if (!m_requiredExtensions->value()->values().isEmpty())
81 return false; 72 return false;
82 73
83 return true; 74 return true;
84 } 75 }
85 76
86 bool SVGTests::isKnownAttribute(const QualifiedName& attrName) { 77 bool SVGTests::isKnownAttribute(const QualifiedName& attrName) {
87 return attrName == SVGNames::requiredFeaturesAttr || 78 return attrName == SVGNames::requiredExtensionsAttr ||
88 attrName == SVGNames::requiredExtensionsAttr ||
89 attrName == SVGNames::systemLanguageAttr; 79 attrName == SVGNames::systemLanguageAttr;
90 } 80 }
91 81
92 } // namespace blink 82 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698