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

Unified Diff: Source/core/dom/DOMImplementation.cpp

Issue 20738002: Make DOMImplementation::hasFeature() behave according to specification (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Without the binaries so that the try bots are happy Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/svg/dynamic-updates/script-tests/SVGUseElement-svgdom-requiredFeatures.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/DOMImplementation.cpp
diff --git a/Source/core/dom/DOMImplementation.cpp b/Source/core/dom/DOMImplementation.cpp
index cee7eb3584fd01b89211fae4f99985f2d058cf3e..91640a4819cb5e710b0f258cfd3e183747f70feb 100644
--- a/Source/core/dom/DOMImplementation.cpp
+++ b/Source/core/dom/DOMImplementation.cpp
@@ -63,7 +63,7 @@ static void addString(FeatureSet& set, const char* string)
set.add(string);
}
-static bool isSVG10Feature(const String &feature, const String &version)
+static bool isSupportedSVG10Feature(const String& feature, const String& version)
{
if (!version.isEmpty() && version != "1.0")
return false;
@@ -92,7 +92,7 @@ static bool isSVG10Feature(const String &feature, const String &version)
&& svgFeatures.contains(feature.right(feature.length() - 8));
}
-static bool isSVG11Feature(const String &feature, const String &version)
+static bool isSupportedSVG11Feature(const String& feature, const String& version)
{
if (!version.isEmpty() && version != "1.1")
return false;
@@ -159,50 +159,6 @@ static bool isSVG11Feature(const String &feature, const String &version)
&& svgFeatures.contains(feature.right(feature.length() - 35));
}
-static bool isEvents2Feature(const String &feature, const String &version)
-{
- if (!version.isEmpty() && version != "2.0")
- return false;
-
- static bool initialized = false;
- DEFINE_STATIC_LOCAL(FeatureSet, events2Features, ());
- if (!initialized) {
- addString(events2Features, "Events");
- addString(events2Features, "HTMLEvents");
- addString(events2Features, "MouseEvents");
- addString(events2Features, "MutationEvents");
- addString(events2Features, "UIEvents");
- initialized = true;
- }
- return events2Features.contains(feature);
-}
-
-static bool isEvents3Feature(const String &feature, const String &version)
-{
- if (!version.isEmpty() && version != "3.0")
- return false;
-
- static bool initialized = false;
- DEFINE_STATIC_LOCAL(FeatureSet, events3Features, ());
- if (!initialized) {
- // FIXME: We probably support many of these features.
-// addString(events3Features, "CompositionEvents");
-// addString(events3Features, "Events");
-// addString(events3Features, "FocusEvents");
-// addString(events3Features, "HTMLEvents");
-// addString(events3Features, "KeyboardEvents");
-// addString(events3Features, "MouseEvents");
-// addString(events3Features, "MutationEvents");
-// addString(events3Features, "MutationNameEvents");
- addString(events3Features, "TextEvents");
-// addString(events3Features, "UIEvents");
-// addString(events3Features, "WheelEvents");
- initialized = true;
- }
- // FIXME: We do not yet support Events 3 "extended feature strings".
- return events3Features.contains(feature);
-}
-
DOMImplementation::DOMImplementation(Document* document)
: m_document(document)
{
@@ -211,29 +167,13 @@ DOMImplementation::DOMImplementation(Document* document)
bool DOMImplementation::hasFeature(const String& feature, const String& version)
{
- String lower = feature.lower();
- if (lower == "core" || lower == "html" || lower == "xml" || lower == "xhtml")
- return version.isEmpty() || version == "1.0" || version == "2.0";
- if (lower == "css"
- || lower == "css2"
- || lower == "range"
- || lower == "stylesheets"
- || lower == "traversal"
- || lower == "views")
- return version.isEmpty() || version == "2.0";
- if (isEvents2Feature(feature, version))
- return true;
- if (lower == "xpath")
- return version.isEmpty() || version == "3.0";
- if (isEvents3Feature(feature, version))
- return true;
-
- if (isSVG11Feature(feature, version))
- return true;
- if (isSVG10Feature(feature, version))
- return true;
-
- return false;
+ if (feature.startsWith("http://www.w3.org/TR/SVG", false)
+ || feature.startsWith("org.w3c.dom.svg", false)
+ || feature.startsWith("org.w3c.svg", false)) {
+ // FIXME: SVG 2.0 support?
+ return isSupportedSVG10Feature(feature, version) || isSupportedSVG11Feature(feature, version);
+ }
+ return true;
}
PassRefPtr<DocumentType> DOMImplementation::createDocumentType(const String& qualifiedName,
« no previous file with comments | « LayoutTests/svg/dynamic-updates/script-tests/SVGUseElement-svgdom-requiredFeatures.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698