diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 4e63f0a..74f0e51 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,14 @@ +2011-07-12 Tom Zakrajsek + + Reviewed by NOBODY (OOPS!). + + Created tests for HTMLUnknownElement interface. + https://bugs.webkit.org/show_bug.cgi?id=41841. + + * fast/html/script-tests/unknown-tag.js: Added. + (isBogusTag): + * fast/html/unknown-tag.html: Added. + 2011-07-12 Joseph Pecoraro ApplicationCache update should not immediately fail when reaching per-origin quota diff --git a/LayoutTests/fast/html/script-tests/unknown-tag.js b/LayoutTests/fast/html/script-tests/unknown-tag.js new file mode 100644 index 0000000..cc89e33 --- /dev/null +++ b/LayoutTests/fast/html/script-tests/unknown-tag.js @@ -0,0 +1,83 @@ +description('Test HTMLUnknownElement'); + +// These tags are required by the HTML spec +var validTags = [ + "a", "abbr", "acronym", "address", "applet", "area", + "article", "aside", "b", "base", "basefont", "bdo", + "bgsound", "big", "blockquote", "body", "br", "button", + "canvas", "caption", "center", "cite", "code", "col", + "colgroup", "command", "dd", "del", + "dfn", "dir", "div", "dl", "dt", "em", "embed", "fieldset", + "figcaption", "figure", "font", "footer", "form", "frame", + "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "head", + "header", "hgroup", "hr", "html", "i", "iframe", "image", + "img", "input", "ins", "isindex", "kbd", "keygen", "label", + "layer", "legend", "li", "link", "listing", "map", "mark", + "marquee", "menu", "meta", "nav", "nobr", + "noembed", "noframes", "nolayer", "noscript", "object", + "ol", "optgroup", "option", "output", "p", "param", + "plaintext", "pre", "q", "rp", "rt", "ruby", + "s", "samp", "script", "section", "select", "small", + "span", "strike", "strong", "style", "sub", + "sup", "table", "tbody", "td", "textarea", + "tfoot", "th", "thead", "title", "tr", "tt", "u", + "ul", "var", "wbr", "xmp" +]; + +// These are not tested, since we don't know if they're supported. +var conditionalTags = [ + "audio", "datalist", "details", "meter", "progress", + "source", "summary", "track", "video" +]; + +// These tags are manufactured and should not be recognized by any browser +var bogusTags = [ + "foo1", "foo2", "foo3", "foo4", "foo5", + "foo6", "foo7", "foo8", "foo9"]; + +var allTags = validTags.concat(bogusTags); + +function isBogusTag (tag) { + for (var k in bogusTags) { + var bogusTag = bogusTags[k]; + if (tag == bogusTag) { + return true; + } + } + return false; +} + +var DynamicElements = new Array(); + +for (var k in allTags) { + var tag = allTags[k]; + DynamicElements[tag] = document.createElement(tag); +} + +for (var element in DynamicElements) { + shouldBeTrue("DynamicElements[\"" + element + "\"]" + " instanceof HTMLElement"); + if (isBogusTag(element)) { + shouldBeTrue("DynamicElements[\"" + element + "\"]" + " instanceof HTMLUnknownElement"); + } else { + shouldBeFalse("DynamicElements[\"" + element + "\"]" + " instanceof HTMLUnknownElement"); + } +} + +var staticElements = new Array(); + +for (var k in allTags) { + var tag = allTags[k]; + staticElements[tag] = document.getElementsByTagName(tag)[0]; +} + +for (var staticElement in staticElements) { + if (staticElements[staticElement]) { + if (isBogusTag(staticElement)) { + shouldBeTrue("staticElements[\"" + staticElement + "\"]" + " instanceof HTMLUnknownElement"); + } else { + shouldBeFalse("staticElements[\"" + staticElement + "\"]" + " instanceof HTMLUnknownElement"); + } + } +} + +var successfullyParsed = true; diff --git a/LayoutTests/fast/html/unknown-tag.html b/LayoutTests/fast/html/unknown-tag.html new file mode 100644 index 0000000..f8aa208 --- /dev/null +++ b/LayoutTests/fast/html/unknown-tag.html @@ -0,0 +1,37 @@ + + + + + + + +

+

+ This test verifies the following: +

    +
  1. The HTMLUnknownElement + interface is used for HTML elements that are not defined by the HTML5 + specification (or other applicable specifications). +
  2. The HTMLUnknownElement + interface is not used for HTML elements that are defined + by the HTML5 specification (or other applicable specifications). +
+

+

+
+ + + + + +

+

+

+

+
+
+ + + + + diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt index bb38be2..ec8b6c0 100644 --- a/Source/WebCore/CMakeLists.txt +++ b/Source/WebCore/CMakeLists.txt @@ -271,6 +271,7 @@ SET(WebCore_IDL_FILES html/HTMLTitleElement.idl html/HTMLTrackElement.idl html/HTMLUListElement.idl + html/HTMLUnknownElement.idl html/HTMLVideoElement.idl html/ImageData.idl html/MediaError.idl diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index afe45e1..c8596d6 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,27 @@ +2011-07-12 Tom Zakrajsek + + Reviewed by NOBODY (OOPS!). + + Add HTMLUnknownElement interface as defined in http://www.w3.org/TR/html5/elements.html#elements-in-the-dom. + https://bugs.webkit.org/show_bug.cgi?id=41841 + + Test: fast/html/unknown-tag.html + + * CMakeLists.txt: + * CodeGenerators.pri: + * DerivedSources.make: + * WebCore.gypi: + * WebCore.xcodeproj/project.pbxproj: + * dom/make_names.pl: + * html/HTMLTagNames.in: + * html/HTMLUnknownElement.h: Added. + (WebCore::HTMLUnknownElement::create): + (WebCore::HTMLUnknownElement::HTMLUnknownElement): + * html/HTMLUnknownElement.idl: Added. + * mathml/mathtags.in: + * page/DOMWindow.idl: + * svg/svgtags.in: + 2011-07-12 Simon Fraser Clean up some RenderLayerCompositor code relating to scroll and root layers diff --git a/Source/WebCore/CodeGenerators.pri b/Source/WebCore/CodeGenerators.pri index 1b7829a..6aec250 100644 --- a/Source/WebCore/CodeGenerators.pri +++ b/Source/WebCore/CodeGenerators.pri @@ -313,6 +313,7 @@ IDL_BINDINGS += \ html/HTMLTitleElement.idl \ html/HTMLTrackElement.idl \ html/HTMLUListElement.idl \ + html/HTMLUnknownElement.idl \ html/HTMLVideoElement.idl \ html/ImageData.idl \ html/MediaError.idl \ diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make index ad0f996..ac28aae 100644 --- a/Source/WebCore/DerivedSources.make +++ b/Source/WebCore/DerivedSources.make @@ -277,6 +277,7 @@ DOM_CLASSES = \ HTMLTitleElement \ HTMLTrackElement \ HTMLUListElement \ + HTMLUnknownElement \ HTMLVideoElement \ IDBAny \ IDBCursor \ diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi index 5df6f0e..7ddc890 100644 --- a/Source/WebCore/WebCore.gypi +++ b/Source/WebCore/WebCore.gypi @@ -1305,6 +1305,7 @@ 'html/HTMLTitleElement.idl', 'html/HTMLTrackElement.idl', 'html/HTMLUListElement.idl', + 'html/HTMLUnknownElement.idl', 'html/HTMLVideoElement.idl', 'html/ImageData.idl', 'html/MediaError.idl', @@ -3028,6 +3029,7 @@ 'html/HTMLTrackElement.h', 'html/HTMLUListElement.cpp', 'html/HTMLUListElement.h', + 'html/HTMLUnknownElement.h', 'html/HTMLVideoElement.cpp', 'html/HTMLVideoElement.h', 'html/HTMLViewSourceDocument.cpp', @@ -7420,6 +7422,8 @@ '<(PRODUCT_DIR)/DerivedSources/WebCore/JSHTMLTitleElement.h', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSHTMLUListElement.cpp', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSHTMLUListElement.h', + '<(PRODUCT_DIR)/DerivedSources/WebCore/JSHTMLUnknownElement.cpp', + '<(PRODUCT_DIR)/DerivedSources/WebCore/JSHTMLUnknownElement.h', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSHTMLVideoElement.cpp', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSHTMLVideoElement.h', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSHashChangeEvent.cpp', diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index 1323d29..090a2d0 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -1615,6 +1615,8 @@ 6E21C6C21126339900A7BE02 /* GraphicsContext3DCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E21C6C11126339900A7BE02 /* GraphicsContext3DCG.cpp */; }; 6E47E66010B7944B00B186C8 /* WebGLGetInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E47E65E10B7944B00B186C8 /* WebGLGetInfo.cpp */; }; 6E47E66110B7944B00B186C8 /* WebGLGetInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E47E65F10B7944B00B186C8 /* WebGLGetInfo.h */; }; + 6E4ABCD4138EA0B70071D291 /* JSHTMLUnknownElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E4ABCD2138EA0B70071D291 /* JSHTMLUnknownElement.cpp */; }; + 6E4ABCD5138EA0B70071D291 /* JSHTMLUnknownElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E4ABCD3138EA0B70071D291 /* JSHTMLUnknownElement.h */; }; 6E4E91AC10F7FB3100A2779C /* CanvasContextAttributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E4E91A710F7FB3100A2779C /* CanvasContextAttributes.cpp */; }; 6E4E91AD10F7FB3100A2779C /* CanvasContextAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E4E91A810F7FB3100A2779C /* CanvasContextAttributes.h */; }; 6E4E91AE10F7FB3100A2779C /* WebGLContextAttributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E4E91A910F7FB3100A2779C /* WebGLContextAttributes.cpp */; }; @@ -8173,6 +8175,8 @@ 6E21C6C11126339900A7BE02 /* GraphicsContext3DCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContext3DCG.cpp; sourceTree = ""; }; 6E47E65E10B7944B00B186C8 /* WebGLGetInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLGetInfo.cpp; path = canvas/WebGLGetInfo.cpp; sourceTree = ""; }; 6E47E65F10B7944B00B186C8 /* WebGLGetInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLGetInfo.h; path = canvas/WebGLGetInfo.h; sourceTree = ""; }; + 6E4ABCD2138EA0B70071D291 /* JSHTMLUnknownElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLUnknownElement.cpp; sourceTree = ""; }; + 6E4ABCD3138EA0B70071D291 /* JSHTMLUnknownElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLUnknownElement.h; sourceTree = ""; }; 6E4E91A710F7FB3100A2779C /* CanvasContextAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CanvasContextAttributes.cpp; path = canvas/CanvasContextAttributes.cpp; sourceTree = ""; }; 6E4E91A810F7FB3100A2779C /* CanvasContextAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CanvasContextAttributes.h; path = canvas/CanvasContextAttributes.h; sourceTree = ""; }; 6E4E91A910F7FB3100A2779C /* WebGLContextAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLContextAttributes.cpp; path = canvas/WebGLContextAttributes.cpp; sourceTree = ""; }; @@ -16699,6 +16703,8 @@ A80E7B020A19D606007FB8C5 /* JSHTMLTitleElement.h */, 1A85B20E0A1B258700D8C87C /* JSHTMLUListElement.cpp */, 1A85B20F0A1B258700D8C87C /* JSHTMLUListElement.h */, + 6E4ABCD2138EA0B70071D291 /* JSHTMLUnknownElement.cpp */, + 6E4ABCD3138EA0B70071D291 /* JSHTMLUnknownElement.h */, E446140E0CD6826900FADA75 /* JSHTMLVideoElement.cpp */, E446140F0CD6826900FADA75 /* JSHTMLVideoElement.h */, A77979240D6B9E64003851B9 /* JSImageData.cpp */, @@ -23123,6 +23129,7 @@ E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */, 977E2E0F12F0FC9C00C13379 /* XSSAuditor.h in Headers */, FD537353137B651800008DCE /* ZeroPole.h in Headers */, + 6E4ABCD5138EA0B70071D291 /* JSHTMLUnknownElement.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -25895,6 +25902,7 @@ E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */, 977E2E0E12F0FC9C00C13379 /* XSSAuditor.cpp in Sources */, FD537352137B651800008DCE /* ZeroPole.cpp in Sources */, + 6E4ABCD4138EA0B70071D291 /* JSHTMLUnknownElement.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/WebCore/dom/make_names.pl b/Source/WebCore/dom/make_names.pl index f258e91..4797573 100755 --- a/Source/WebCore/dom/make_names.pl +++ b/Source/WebCore/dom/make_names.pl @@ -146,7 +146,8 @@ sub defaultParametersHash 'namespaceURI' => '', 'guardFactoryWith' => '', 'tagsNullNamespace' => 0, - 'attrsNullNamespace' => 0 + 'attrsNullNamespace' => 0, + 'fallbackInterfaceName' => '' ); } @@ -268,14 +269,12 @@ sub usesDefaultWrapper return $tagName eq $parameters{namespace} . "Element"; } -# Build a direct mapping from the tags to the Element to create, excluding -# Element that have not constructor. +# Build a direct mapping from the tags to the Element to create. sub buildConstructorMap { my %tagConstructorMap = (); for my $tagName (keys %enabledTags) { my $interfaceName = $enabledTags{$tagName}{interfaceName}; - next if (usesDefaultWrapper($interfaceName)); if ($enabledTags{$tagName}{mapToTagName}) { die "Cannot handle multiple mapToTagName for $tagName\n" if $enabledTags{$enabledTags{$tagName}{mapToTagName}}{mapToTagName}; @@ -605,6 +604,7 @@ sub printJSElementIncludes print F "#include \"${wrapperFactoryType}${JSInterfaceName}.h\"\n"; } + print F "#include \"${wrapperFactoryType}$parameters{fallbackInterfaceName}.h\"\n"; } sub printElementIncludes @@ -623,6 +623,7 @@ sub printElementIncludes print F "#include \"${interfaceName}.h\"\n"; } + print F "#include \"$parameters{fallbackInterfaceName}.h\"\n"; } sub printConditionalElementIncludes @@ -762,6 +763,7 @@ printFunctionInits($F, \%tagConstructorMap); print F "}\n"; + print F "\nPassRefPtr<$parameters{namespace}Element> $parameters{namespace}ElementFactory::create$parameters{namespace}Element(const QualifiedName& qName, Document* document"; print F ", HTMLFormElement* formElement" if $parameters{namespace} eq "HTML"; print F ", bool createdByParser)\n{\n"; @@ -798,7 +800,7 @@ if ($parameters{namespace} eq "HTML") { print F " return function(qName, document, createdByParser);\n"; } -print F " return $parameters{namespace}Element::create(qName, document);\n"; +print F " return $parameters{fallbackInterfaceName}::create(qName, document);\n"; print F < create(const QualifiedName& tagName, Document* document) + { + return adoptRef(new HTMLUnknownElement(tagName, document)); + } + +private: + HTMLUnknownElement(const QualifiedName& tagName, Document* document) + : HTMLElement(tagName, document) + { + } +}; + +} // namespace + +#endif diff --git a/Source/WebCore/html/HTMLUnknownElement.idl b/Source/WebCore/html/HTMLUnknownElement.idl new file mode 100644 index 0000000..4db4b22 --- /dev/null +++ b/Source/WebCore/html/HTMLUnknownElement.idl @@ -0,0 +1,6 @@ +module html { + + interface HTMLUnknownElement : HTMLElement { + }; + +} diff --git a/Source/WebCore/mathml/mathtags.in b/Source/WebCore/mathml/mathtags.in index b2dcb93..3a2db35 100644 --- a/Source/WebCore/mathml/mathtags.in +++ b/Source/WebCore/mathml/mathtags.in @@ -1,6 +1,7 @@ namespace="MathML" namespaceURI="http://www.w3.org/1998/Math/MathML" guardFactoryWith="ENABLE(MATHML)" +fallbackInterfaceName="MathMLElement" math mfrac interfaceName=MathMLInlineContainerElement diff --git a/Source/WebCore/page/DOMWindow.idl b/Source/WebCore/page/DOMWindow.idl index 8267b16..465fbb3 100644 --- a/Source/WebCore/page/DOMWindow.idl +++ b/Source/WebCore/page/DOMWindow.idl @@ -478,6 +478,7 @@ module window { attribute HTMLCollectionConstructor HTMLCollection; attribute HTMLAllCollectionConstructor HTMLAllCollection; + attribute HTMLUnknownElementConstructor HTMLUnknownElement; attribute [CustomGetter] HTMLImageElementConstructor Image; // Usable with new operator attribute [CustomGetter] HTMLOptionElementConstructor Option; // Usable with new operator diff --git a/Source/WebCore/svg/svgtags.in b/Source/WebCore/svg/svgtags.in index aa636cc..8328833 100644 --- a/Source/WebCore/svg/svgtags.in +++ b/Source/WebCore/svg/svgtags.in @@ -1,6 +1,7 @@ namespace="SVG" namespaceURI="http://www.w3.org/2000/svg" guardFactoryWith="ENABLE(SVG)" +fallbackInterfaceName="SVGElement" a #if ENABLE_SVG_FONTS