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

Side by Side Diff: Source/core/dom/DOMImplementation.cpp

Issue 1108293002: Make DOMImplementation.hasFeature() always return true. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: windows compilefix attempt Created 5 years, 7 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
« no previous file with comments | « Source/core/dom/DOMImplementation.h ('k') | Source/core/dom/DOMImplementation.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 * Copyright (C) 2006 Samuel Weinig (sam@webkit.org) 6 * Copyright (C) 2006 Samuel Weinig (sam@webkit.org)
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "core/page/Page.h" 54 #include "core/page/Page.h"
55 #include "platform/ContentType.h" 55 #include "platform/ContentType.h"
56 #include "platform/MIMETypeRegistry.h" 56 #include "platform/MIMETypeRegistry.h"
57 #include "platform/graphics/Image.h" 57 #include "platform/graphics/Image.h"
58 #include "platform/plugins/PluginData.h" 58 #include "platform/plugins/PluginData.h"
59 #include "platform/weborigin/SecurityOrigin.h" 59 #include "platform/weborigin/SecurityOrigin.h"
60 #include "wtf/StdLibExtras.h" 60 #include "wtf/StdLibExtras.h"
61 61
62 namespace blink { 62 namespace blink {
63 63
64 typedef HashSet<String, CaseFoldingHash> FeatureSet;
65
66 static void addString(FeatureSet& set, const char* string)
67 {
68 set.add(string);
69 }
70
71 static bool isSupportedSVG10Feature(const String& feature, const String& version )
72 {
73 if (!version.isEmpty() && version != "1.0")
74 return false;
75
76 static bool initialized = false;
77 DEFINE_STATIC_LOCAL(FeatureSet, svgFeatures, ());
78 if (!initialized) {
79 addString(svgFeatures, "svg");
80 addString(svgFeatures, "svg.static");
81 // addString(svgFeatures, "svg.animation");
82 // addString(svgFeatures, "svg.dynamic");
83 // addString(svgFeatures, "svg.dom.animation");
84 // addString(svgFeatures, "svg.dom.dynamic");
85 addString(svgFeatures, "dom");
86 addString(svgFeatures, "dom.svg");
87 addString(svgFeatures, "dom.svg.static");
88 // addString(svgFeatures, "svg.all");
89 // addString(svgFeatures, "dom.svg.all");
90 initialized = true;
91 }
92 return feature.startsWith("org.w3c.", TextCaseInsensitive)
93 && svgFeatures.contains(feature.right(feature.length() - 8));
94 }
95
96 static bool isSupportedSVG11Feature(const String& feature, const String& version )
97 {
98 if (!version.isEmpty() && version != "1.1")
99 return false;
100
101 static bool initialized = false;
102 DEFINE_STATIC_LOCAL(FeatureSet, svgFeatures, ());
103 if (!initialized) {
104 // Sadly, we cannot claim to implement any of the SVG 1.1 generic featur e sets
105 // lack of Font and Filter support.
106 // http://bugs.webkit.org/show_bug.cgi?id=15480
107 addString(svgFeatures, "SVG");
108 addString(svgFeatures, "SVGDOM");
109 addString(svgFeatures, "SVG-static");
110 addString(svgFeatures, "SVGDOM-static");
111 addString(svgFeatures, "SVG-animation");
112 addString(svgFeatures, "SVGDOM-animation");
113 // addString(svgFeatures, "SVG-dynamic);
114 // addString(svgFeatures, "SVGDOM-dynamic);
115 addString(svgFeatures, "CoreAttribute");
116 addString(svgFeatures, "Structure");
117 addString(svgFeatures, "BasicStructure");
118 addString(svgFeatures, "ContainerAttribute");
119 addString(svgFeatures, "ConditionalProcessing");
120 addString(svgFeatures, "Image");
121 addString(svgFeatures, "Style");
122 addString(svgFeatures, "ViewportAttribute");
123 addString(svgFeatures, "Shape");
124 addString(svgFeatures, "Text");
125 addString(svgFeatures, "BasicText");
126 addString(svgFeatures, "PaintAttribute");
127 addString(svgFeatures, "BasicPaintAttribute");
128 addString(svgFeatures, "OpacityAttribute");
129 addString(svgFeatures, "GraphicsAttribute");
130 addString(svgFeatures, "BaseGraphicsAttribute");
131 addString(svgFeatures, "Marker");
132 // addString(svgFeatures, "ColorProfile");
133 addString(svgFeatures, "Gradient");
134 addString(svgFeatures, "Pattern");
135 addString(svgFeatures, "Clip");
136 addString(svgFeatures, "BasicClip");
137 addString(svgFeatures, "Mask");
138 addString(svgFeatures, "Filter");
139 addString(svgFeatures, "BasicFilter");
140 addString(svgFeatures, "DocumentEventsAttribute");
141 addString(svgFeatures, "GraphicalEventsAttribute");
142 // addString(svgFeatures, "AnimationEventsAttribute");
143 addString(svgFeatures, "Cursor");
144 addString(svgFeatures, "Hyperlinking");
145 addString(svgFeatures, "XlinkAttribute");
146 addString(svgFeatures, "View");
147 addString(svgFeatures, "Script");
148 addString(svgFeatures, "Animation");
149 addString(svgFeatures, "Extensibility");
150 initialized = true;
151 }
152 return feature.startsWith("http://www.w3.org/tr/svg11/feature#", TextCaseIns ensitive)
153 && svgFeatures.contains(feature.right(feature.length() - 35));
154 }
155
156 DOMImplementation::DOMImplementation(Document& document) 64 DOMImplementation::DOMImplementation(Document& document)
157 : m_document(document) 65 : m_document(document)
158 { 66 {
159 } 67 }
160 68
161 bool DOMImplementation::hasFeature(const String& feature, const String& version)
162 {
163 if (feature.startsWith("http://www.w3.org/TR/SVG", TextCaseInsensitive)
164 || feature.startsWith("org.w3c.dom.svg", TextCaseInsensitive)
165 || feature.startsWith("org.w3c.svg", TextCaseInsensitive)) {
166 // FIXME: SVG 2.0 support?
167 return isSupportedSVG10Feature(feature, version) || isSupportedSVG11Feat ure(feature, version);
168 }
169 return true;
170 }
171
172 bool DOMImplementation::hasFeatureForBindings(const String& feature, const Strin g& version)
173 {
174 if (!hasFeature(feature, version)) {
175 UseCounter::countDeprecation(m_document, UseCounter::DOMImplementationHa sFeatureReturnFalse);
176 return false;
177 }
178 return true;
179 }
180
181 PassRefPtrWillBeRawPtr<DocumentType> DOMImplementation::createDocumentType(const AtomicString& qualifiedName, 69 PassRefPtrWillBeRawPtr<DocumentType> DOMImplementation::createDocumentType(const AtomicString& qualifiedName,
182 const String& publicId, const String& systemId, ExceptionState& exceptionSta te) 70 const String& publicId, const String& systemId, ExceptionState& exceptionSta te)
183 { 71 {
184 AtomicString prefix, localName; 72 AtomicString prefix, localName;
185 if (!Document::parseQualifiedName(qualifiedName, prefix, localName, exceptio nState)) 73 if (!Document::parseQualifiedName(qualifiedName, prefix, localName, exceptio nState))
186 return nullptr; 74 return nullptr;
187 75
188 return DocumentType::create(m_document, qualifiedName, publicId, systemId); 76 return DocumentType::create(m_document, qualifiedName, publicId, systemId);
189 } 77 }
190 78
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 256
369 return HTMLDocument::create(init); 257 return HTMLDocument::create(init);
370 } 258 }
371 259
372 DEFINE_TRACE(DOMImplementation) 260 DEFINE_TRACE(DOMImplementation)
373 { 261 {
374 visitor->trace(m_document); 262 visitor->trace(m_document);
375 } 263 }
376 264
377 } 265 }
OLDNEW
« no previous file with comments | « Source/core/dom/DOMImplementation.h ('k') | Source/core/dom/DOMImplementation.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698