Generate isFooElement() functions from tagname data.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Sep 2013 20:10:11 +0000 (20:10 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Sep 2013 20:10:11 +0000 (20:10 +0000)
<https://webkit.org/b/120584>

Reviewed by Antti Koivisto.

Add a "generateTypeChecks" attribute that can be used in HTMLTagNames.in & friends.
If present, isFooElement() style helpers will be added to HTMLElementTypeChecks.h.
This also outputs an isElementOfType<T> check for the Element iterators.

Removed all the hand-written isFooElement() functions that only checked tag name.

* html/HTMLTagNames.in:
* svg/svgtags.in:

    Added "generateTypeChecks" attribute as appropriate.

* GNUmakefile.am:
* GNUmakefile.list.am:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.xcodeproj/project.pbxproj:

    Added to build systems based on how HTMLNames.h was done.
    We're just outputting an additional header file in the generated code directory
    so I suspect most ports will just pick this up automagically.

* dom/make_names.pl:
(defaultTagPropertyHash):
(printLicenseHeader):
(printTypeChecks):
(printTypeChecksHeaderFile):

    Generate a separate file for each namespace with isFooElement() helpers for
    elements with "generateTypeChecks" attribute set.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154965 268f45cc-cd09-0410-ab3c-d52691b4dbfc

41 files changed:
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.am
Source/WebCore/GNUmakefile.list.am
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/make_names.pl
Source/WebCore/html/HTMLAnchorElement.h
Source/WebCore/html/HTMLAreaElement.h
Source/WebCore/html/HTMLAudioElement.h
Source/WebCore/html/HTMLBaseElement.h
Source/WebCore/html/HTMLCanvasElement.h
Source/WebCore/html/HTMLElement.h
Source/WebCore/html/HTMLFieldSetElement.h
Source/WebCore/html/HTMLFormElement.h
Source/WebCore/html/HTMLFrameSetElement.h
Source/WebCore/html/HTMLImageElement.h
Source/WebCore/html/HTMLInputElement.h
Source/WebCore/html/HTMLLabelElement.h
Source/WebCore/html/HTMLLegendElement.h
Source/WebCore/html/HTMLMapElement.h
Source/WebCore/html/HTMLMeterElement.h
Source/WebCore/html/HTMLOptGroupElement.h
Source/WebCore/html/HTMLOptionElement.h
Source/WebCore/html/HTMLParamElement.h
Source/WebCore/html/HTMLProgressElement.h
Source/WebCore/html/HTMLScriptElement.h
Source/WebCore/html/HTMLSourceElement.h
Source/WebCore/html/HTMLStyleElement.h
Source/WebCore/html/HTMLTableElement.h
Source/WebCore/html/HTMLTableRowElement.h
Source/WebCore/html/HTMLTagNames.in
Source/WebCore/html/HTMLTextAreaElement.h
Source/WebCore/html/HTMLTitleElement.h
Source/WebCore/html/HTMLTrackElement.h
Source/WebCore/svg/SVGElement.h
Source/WebCore/svg/SVGFontElement.h
Source/WebCore/svg/SVGFontFaceElement.h
Source/WebCore/svg/SVGForeignObjectElement.h
Source/WebCore/svg/SVGImageElement.h
Source/WebCore/svg/SVGScriptElement.h
Source/WebCore/svg/svgtags.in

index ce691eb..8d1bb9a 100644 (file)
@@ -1,3 +1,39 @@
+2013-09-02  Andreas Kling  <akling@apple.com>
+
+        Generate isFooElement() functions from tagname data.
+        <https://webkit.org/b/120584>
+
+        Reviewed by Antti Koivisto.
+
+        Add a "generateTypeChecks" attribute that can be used in HTMLTagNames.in & friends.
+        If present, isFooElement() style helpers will be added to HTMLElementTypeChecks.h.
+        This also outputs an isElementOfType<T> check for the Element iterators.
+
+        Removed all the hand-written isFooElement() functions that only checked tag name.
+
+        * html/HTMLTagNames.in:
+        * svg/svgtags.in:
+
+            Added "generateTypeChecks" attribute as appropriate.
+
+        * GNUmakefile.am:
+        * GNUmakefile.list.am:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.xcodeproj/project.pbxproj:
+
+            Added to build systems based on how HTMLNames.h was done.
+            We're just outputting an additional header file in the generated code directory
+            so I suspect most ports will just pick this up automagically.
+
+        * dom/make_names.pl:
+        (defaultTagPropertyHash):
+        (printLicenseHeader):
+        (printTypeChecks):
+        (printTypeChecksHeaderFile):
+
+            Generate a separate file for each namespace with isFooElement() helpers for
+            elements with "generateTypeChecks" attribute set.
+
 2013-09-02  Darin Adler  <darin@apple.com>
 
         [Mac] No need for HardAutorelease, which is same as CFBridgingRelease
index 4d7e180..a4b88e9 100644 (file)
@@ -298,6 +298,7 @@ DerivedSources/WebCore/PlugInsResources.h: $(WebCore)/css/make-css-file-arrays.p
 DerivedSources/WebCore/JSHTMLElementWrapperFactory.cpp: DerivedSources/WebCore/HTMLElementFactory.cpp
 DerivedSources/WebCore/HTMLElementFactory.cpp: DerivedSources/WebCore/HTMLElementFactory.h
 DerivedSources/WebCore/HTMLElementFactory.h: DerivedSources/WebCore/HTMLNames.cpp
+DerivedSources/WebCore/HTMLElementTypeChecks.h: DerivedSources/WebCore/HTMLNames.h
 DerivedSources/WebCore/HTMLNames.cpp: DerivedSources/WebCore/HTMLNames.h
 DerivedSources/WebCore/HTMLNames.h: $(WebCore)/dom/make_names.pl $(WebCore)/bindings/scripts/Hasher.pm $(WebCore)/bindings/scripts/StaticString.pm $(WebCore)/html/HTMLTagNames.in $(WebCore)/html/HTMLAttributeNames.in
        $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/html/HTMLTagNames.in --attrs $(WebCore)/html/HTMLAttributeNames.in --extraDefines "$(feature_defines)" --factory --wrapperFactory --outputDir "$(GENSOURCES_WEBCORE)"
index eefc906..bdf7b72 100644 (file)
@@ -15,6 +15,7 @@ webcore_built_sources += \
        DerivedSources/WebCore/ExceptionInterfaces.h \
        DerivedSources/WebCore/HTMLElementFactory.cpp \
        DerivedSources/WebCore/HTMLElementFactory.h \
+       DerivedSources/WebCore/HTMLElementTypeChecks.h \
        DerivedSources/WebCore/HTMLEntityTable.cpp \
        DerivedSources/WebCore/HTMLNames.cpp \
        DerivedSources/WebCore/HTMLNames.h \
index 002b375..0b44d0d 100644 (file)
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\ExceptionHeaders.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\ExceptionInterfaces.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\HTMLElementFactory.h" />
+    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\HTMLElementTypeChecks.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\HTMLNames.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\InjectedScriptCanvasModuleSource.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\InjectedScriptSource.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\MathMLElementFactory.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\MathMLNames.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\SVGElementFactory.h" />
+    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\SVGElementTypeChecks.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\SVGNames.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\UserAgentStyleSheets.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\WebKitFontFamilyNames.h" />
   <ImportGroup Label="ExtensionTargets">
     <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
   </ImportGroup>
-</Project>
\ No newline at end of file
+</Project>
index da3ff28..3d846d3 100644 (file)
                B55D5AA4119131FC00BCC315 /* JSSQLTransactionSyncCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = B55D5AA2119131FC00BCC315 /* JSSQLTransactionSyncCallback.h */; };
                B55D5AA5119131FC00BCC315 /* JSSQLTransactionSyncCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B55D5AA3119131FC00BCC315 /* JSSQLTransactionSyncCallback.cpp */; };
                B55D5AA91191325000BCC315 /* JSSQLTransactionSyncCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B55D5AA71191325000BCC315 /* JSSQLTransactionSyncCustom.cpp */; };
+               B562DB6017D3CD630010AF96 /* HTMLElementTypeChecks.h in Headers */ = {isa = PBXBuildFile; fileRef = B562DB5E17D3CD560010AF96 /* HTMLElementTypeChecks.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               B562DB6117D3CD660010AF96 /* SVGElementTypeChecks.h in Headers */ = {isa = PBXBuildFile; fileRef = B562DB5F17D3CD560010AF96 /* SVGElementTypeChecks.h */; settings = {ATTRIBUTES = (Private, ); }; };
                B58CEB6911913607002A6790 /* JSDatabaseSync.h in Headers */ = {isa = PBXBuildFile; fileRef = B58CEB6711913607002A6790 /* JSDatabaseSync.h */; };
                B58CEB6A11913607002A6790 /* JSDatabaseSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B58CEB6811913607002A6790 /* JSDatabaseSync.cpp */; };
                B58CEB6D1191361C002A6790 /* JSSQLTransactionSync.h in Headers */ = {isa = PBXBuildFile; fileRef = B58CEB6B1191361C002A6790 /* JSSQLTransactionSync.h */; };
                B55D5AA2119131FC00BCC315 /* JSSQLTransactionSyncCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLTransactionSyncCallback.h; sourceTree = "<group>"; };
                B55D5AA3119131FC00BCC315 /* JSSQLTransactionSyncCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLTransactionSyncCallback.cpp; sourceTree = "<group>"; };
                B55D5AA71191325000BCC315 /* JSSQLTransactionSyncCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLTransactionSyncCustom.cpp; sourceTree = "<group>"; };
+               B562DB5E17D3CD560010AF96 /* HTMLElementTypeChecks.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HTMLElementTypeChecks.h; sourceTree = "<group>"; };
+               B562DB5F17D3CD560010AF96 /* SVGElementTypeChecks.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGElementTypeChecks.h; sourceTree = "<group>"; };
                B58CEB6711913607002A6790 /* JSDatabaseSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDatabaseSync.h; sourceTree = "<group>"; };
                B58CEB6811913607002A6790 /* JSDatabaseSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDatabaseSync.cpp; sourceTree = "<group>"; };
                B58CEB6B1191361C002A6790 /* JSSQLTransactionSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLTransactionSync.h; sourceTree = "<group>"; };
                                9767CE0A145ABC13005E64DB /* ExceptionInterfaces.h */,
                                A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */,
                                A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */,
+                               B562DB5E17D3CD560010AF96 /* HTMLElementTypeChecks.h */,
                                A8BC04911214F69600B5F122 /* HTMLEntityTable.cpp */,
                                A8D06B380A265DCD005E7203 /* HTMLNames.cpp */,
                                A8D06B370A265DCD005E7203 /* HTMLNames.h */,
                                53EF766A16530A61004CBE49 /* SettingsMacros.h */,
                                656581E609D1508D000E61D7 /* SVGElementFactory.cpp */,
                                656581E709D1508D000E61D7 /* SVGElementFactory.h */,
+                               B562DB5F17D3CD560010AF96 /* SVGElementTypeChecks.h */,
                                656581E809D1508D000E61D7 /* SVGNames.cpp */,
                                656581E909D1508D000E61D7 /* SVGNames.h */,
                                656581AE09D14EE6000E61D7 /* UserAgentStyleSheets.h */,
                                85909CDC0ACC7A7E00DF01F1 /* DOMCSSCharsetRuleInternal.h in Headers */,
                                85032DD90AA8C9BE007D3B7D /* DOMCSSFontFaceRule.h in Headers */,
                                85909CDD0ACC7A7E00DF01F1 /* DOMCSSFontFaceRuleInternal.h in Headers */,
+                               B562DB6117D3CD660010AF96 /* SVGElementTypeChecks.h in Headers */,
                                85032DDB0AA8C9BE007D3B7D /* DOMCSSImportRule.h in Headers */,
                                85909CDE0ACC7A7E00DF01F1 /* DOMCSSImportRuleInternal.h in Headers */,
                                85032DDD0AA8C9BE007D3B7D /* DOMCSSMediaRule.h in Headers */,
                                8C0E334F138A92C7008DA94F /* LevelDBWriteBatch.h in Headers */,
                                84730D911248F0B300D3A9C9 /* LightSource.h in Headers */,
                                B22279650D00BF220071B782 /* LinearGradientAttributes.h in Headers */,
+                               B562DB6017D3CD630010AF96 /* HTMLElementTypeChecks.h in Headers */,
                                A5ABB78713B904BC00F197E3 /* LineBreakIteratorPoolICU.h in Headers */,
                                AB31C91E10AE1B8E000C7B92 /* LineClampValue.h in Headers */,
                                89B5EAA211E8003D00F2367E /* LineEnding.h in Headers */,
index 4078241..f966ffb 100755 (executable)
@@ -155,12 +155,14 @@ die "You must specify a namespaceURI (e.g. http://www.w3.org/2000/svg)" unless $
 $parameters{namespacePrefix} = $parameters{namespace} unless $parameters{namespacePrefix};
 $parameters{fallbackJSInterfaceName} = $parameters{fallbackInterfaceName} unless $parameters{fallbackJSInterfaceName};
 
+my $typeChecksBasePath = "$outputDir/$parameters{namespace}ElementTypeChecks";
 my $namesBasePath = "$outputDir/$parameters{namespace}Names";
 my $factoryBasePath = "$outputDir/$parameters{namespace}ElementFactory";
 my $wrapperFactoryFileName = "$parameters{namespace}ElementWrapperFactory";
 
 printNamesHeaderFile("$namesBasePath.h");
 printNamesCppFile("$namesBasePath.cpp");
+printTypeChecksHeaderFile("$typeChecksBasePath.h");
 
 if ($printFactory) {
     printFactoryCppFile("$factoryBasePath.cpp");
@@ -187,7 +189,8 @@ sub defaultTagPropertyHash
         'wrapperOnlyIfMediaIsAvailable' => 0,
         'conditional' => 0,
         'contextConditional' => 0,
-        'runtimeConditional' => 0
+        'runtimeConditional' => 0,
+        'generateTypeChecks' => 0
     );
 }
 
@@ -586,7 +589,7 @@ sub printLicenseHeader
  *
  * This file was generated by the dom/make_names.pl script.
  *
- * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc.  All rights reserved.
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -613,6 +616,49 @@ sub printLicenseHeader
 ";
 }
 
+sub printTypeChecks
+{
+    my ($F, $namesRef) = @_;
+    my %names = %$namesRef;
+
+    for my $name (sort keys %names) {
+        if ($parsedTags{$name}{generateTypeChecks} != 1) {
+            next;
+        }
+
+        my $class = $parsedTags{$name}{interfaceName};
+        my $helper = "is$class";
+
+        print F "class $class;\n";
+        print F "inline bool $helper(const Element& element) { return element.hasTagName(".$parameters{namespace}."Names::".$name."Tag); }\n";
+        print F "inline bool $helper(const Element* element) { ASSERT(element); return $helper(*element); }\n";
+        print F "inline bool $helper(const Node* node) { ASSERT(node); return node->isElementNode() && $helper(toElement(node)); }\n";
+        print F "template <> inline bool isElementOfType<$class>(const Element* element) { return $helper(element); }\n";
+
+        print F "\n";
+    }
+}
+
+sub printTypeChecksHeaderFile
+{
+    my ($headerPath) = shift;
+    my $F;
+    open F, ">$headerPath";
+    printLicenseHeader($F);
+
+    print F "#ifndef ".$parameters{namespace}."ElementTypeChecks_h\n";
+    print F "#define ".$parameters{namespace}."ElementTypeChecks_h\n\n";
+    print F "#include \"".$parameters{namespace}."Names.h\"\n\n";
+    print F "namespace WebCore {\n\n";
+
+    printTypeChecks($F, \%allTags);
+
+    print F "}\n\n";
+    print F "#endif\n";
+
+    close F;
+}
+
 sub printNamesHeaderFile
 {
     my ($headerPath) = shift;
index cf46948..d4ad69b 100644 (file)
@@ -149,24 +149,12 @@ inline LinkHash HTMLAnchorElement::visitedLinkHash() const
     return m_cachedVisitedLinkHash; 
 }
 
-inline bool isHTMLAnchorElement(const Node* node)
-{
-    return node->hasTagName(HTMLNames::aTag);
-}
-
-inline bool isHTMLAnchorElement(const Element* element)
-{
-    return element->hasTagName(HTMLNames::aTag);
-}
-
 inline HTMLAnchorElement* toHTMLAnchorElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLAnchorElement(node));
     return static_cast<HTMLAnchorElement*>(node);
 }
 
-template <> inline bool isElementOfType<HTMLAnchorElement>(const Element* element) { return isHTMLAnchorElement(element); }
-
 // Functions shared with the other anchor elements (i.e., SVG).
 
 bool isEnterKeyKeydownEvent(Event*);
index 8ffc025..d6c2c3d 100644 (file)
@@ -70,18 +70,6 @@ private:
     Shape m_shape;
 };
 
-inline bool isHTMLAreaElement(const Node* node)
-{
-    return node->hasTagName(HTMLNames::areaTag);
-}
-
-inline bool isHTMLAreaElement(const Element* element)
-{
-    return element->hasTagName(HTMLNames::areaTag);
-}
-
-template <> inline bool isElementOfType<HTMLAreaElement>(const Element* element) { return isHTMLAreaElement(element); }
-
 inline HTMLAreaElement* toHTMLAreaElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLAreaElement(node));
index 07ca48d..8153b35 100644 (file)
@@ -43,16 +43,6 @@ private:
     HTMLAudioElement(const QualifiedName&, Document*, bool);
 };
 
-inline bool isHTMLAudioElement(Node* node)
-{
-    return node->hasTagName(HTMLNames::audioTag);
-}
-
-inline bool isHTMLAudioElement(Element* element)
-{
-    return element->hasTagName(HTMLNames::audioTag);
-}
-
 inline HTMLAudioElement* toHTMLAudioElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLAudioElement(node));
index 1a35f47..88ef7c7 100644 (file)
@@ -44,18 +44,6 @@ private:
     virtual void removedFrom(ContainerNode*) OVERRIDE;
 };
 
-inline bool isHTMLBaseElement(const Node* node)
-{
-    return node->hasTagName(HTMLNames::baseTag);
-}
-
-inline bool isHTMLBaseElement(const Element* element)
-{
-    return element->hasTagName(HTMLNames::baseTag);
-}
-
-template <> inline bool isElementOfType<HTMLBaseElement>(const Element* element) { return isHTMLBaseElement(element); }
-
 } // namespace
 
 #endif
index 658109d..2fcb00a 100644 (file)
@@ -188,11 +188,6 @@ private:
     mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platforms that have to copy the image buffer to render (and for CSSCanvasValue).
 };
 
-inline bool isHTMLCanvasElement(const Node* node)
-{
-    return node->hasTagName(HTMLNames::canvasTag);
-}
-
 inline const HTMLCanvasElement* toHTMLCanvasElement(const Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLCanvasElement(node));
index a6dbef2..4ff0001 100644 (file)
@@ -25,6 +25,8 @@
 
 #include "StyledElement.h"
 
+#include "HTMLElementTypeChecks.h"
+
 namespace WebCore {
 
 class DocumentFragment;
index 2c444bc..4a34ccc 100644 (file)
@@ -63,19 +63,6 @@ private:
     mutable uint64_t m_documentVersion;
 };
 
-inline bool isHTMLFieldSetElement(const Node* node)
-{
-    return node->isElementNode() && toElement(node)->hasTagName(HTMLNames::fieldsetTag);
-}
-
-inline bool isHTMLFieldSetElement(const Element* element)
-{
-    return element->hasTagName(HTMLNames::fieldsetTag);
-}
-
-template <> inline bool isElementOfType<HTMLFieldSetElement>(const Element* element) { return isHTMLFieldSetElement(element); }
-
-
 } // namespace
 
 #endif
index 9a7431a..61a5a4b 100644 (file)
@@ -166,16 +166,6 @@ private:
     bool m_wasDemoted;
 };
 
-inline bool isHTMLFormElement(Node* node)
-{
-    return node->hasTagName(HTMLNames::formTag);
-}
-
-inline bool isHTMLFormElement(Element* element)
-{
-    return element->hasTagName(HTMLNames::formTag);
-}
-
 inline HTMLFormElement* toHTMLFormElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLFormElement(node));
index 7dd931e..ac2a99d 100644 (file)
@@ -100,16 +100,6 @@ private:
     bool m_noresize;
 };
 
-inline bool isHTMLFrameSetElement(const Node* node)
-{
-    return node->hasTagName(HTMLNames::framesetTag);
-}
-
-inline bool isHTMLFrameSetElement(const Element* element)
-{
-    return element->hasTagName(HTMLNames::framesetTag);
-}
-
 inline HTMLFrameSetElement* toHTMLFrameSetElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLFrameSetElement(node));
@@ -122,8 +112,6 @@ inline const HTMLFrameSetElement* toHTMLFrameSetElement(const Node* node)
     return static_cast<const HTMLFrameSetElement*>(node);
 }
 
-template <> inline bool isElementOfType<HTMLFrameSetElement>(const Element* element) { return isHTMLFrameSetElement(element); }
-
 } // namespace WebCore
 
 #endif // HTMLFrameSetElement_h
index 9f713cc..248e6c2 100644 (file)
@@ -115,16 +115,6 @@ private:
     AtomicString m_bestFitImageURL;
 };
 
-inline bool isHTMLImageElement(Node* node)
-{
-    return node->hasTagName(HTMLNames::imgTag);
-}
-
-inline bool isHTMLImageElement(Element* element)
-{
-    return element->hasTagName(HTMLNames::imgTag);
-}
-
 inline HTMLImageElement* toHTMLImageElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLImageElement(node));
index 5b7660b..1d787b7 100644 (file)
@@ -443,16 +443,6 @@ private:
 #endif
 };
 
-inline bool isHTMLInputElement(const Node* node)
-{
-    return node->hasTagName(HTMLNames::inputTag);
-}
-
-inline bool isHTMLInputElement(const Element* element)
-{
-    return element->hasTagName(HTMLNames::inputTag);
-}
-
 inline HTMLInputElement* toHTMLInputElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLInputElement(node));
index ab31583..90a3691 100644 (file)
@@ -55,18 +55,6 @@ private:
     virtual void focus(bool restorePreviousSelection, FocusDirection) OVERRIDE;
 };
 
-inline bool isHTMLLabelElement(const Node* node)
-{
-    return node->hasTagName(HTMLNames::labelTag);
-}
-
-inline bool isHTMLLabelElement(const Element* element)
-{
-    return element->hasTagName(HTMLNames::labelTag);
-}
-
-template <> inline bool isElementOfType<HTMLLabelElement>(const Element* element) { return isHTMLLabelElement(element); }
-
 inline HTMLLabelElement* toHTMLLabelElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLLabelElement(node));
index 583172a..dcc0d38 100644 (file)
@@ -45,18 +45,6 @@ private:
     virtual HTMLFormElement* virtualForm() const OVERRIDE;
 };
 
-inline bool isHTMLLegendElement(const Node* node)
-{
-    return node->hasTagName(HTMLNames::legendTag);
-}
-
-inline bool isHTMLLegendElement(const Element* element)
-{
-    return element->hasTagName(HTMLNames::legendTag);
-}
-
-template <> inline bool isElementOfType<HTMLLegendElement>(const Element* element) { return isHTMLLegendElement(element); }
-
 } //namespace
 
 #endif
index 22b8b4a..8f62741 100644 (file)
@@ -54,16 +54,6 @@ private:
     AtomicString m_name;
 };
 
-inline bool isHTMLMapElement(Node* node)
-{
-    return node->hasTagName(HTMLNames::mapTag);
-}
-
-inline bool isHTMLMapElement(Element* element)
-{
-    return element->hasTagName(HTMLNames::mapTag);
-}
-
 inline HTMLMapElement* toHTMLMapElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLMapElement(node));
index 5d136f2..ce74607 100644 (file)
@@ -82,11 +82,6 @@ private:
     RefPtr<MeterValueElement> m_value;
 };
 
-inline bool isHTMLMeterElement(Node* node)
-{
-    return node->hasTagName(HTMLNames::meterTag);
-}
-
 inline HTMLMeterElement* toHTMLMeterElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLMeterElement(node));
index 593197e..330eb71 100644 (file)
@@ -63,16 +63,6 @@ private:
     RefPtr<RenderStyle> m_style;
 };
 
-inline bool isHTMLOptGroupElement(const Node* node)
-{
-    return node->hasTagName(HTMLNames::optgroupTag);
-}
-
-inline bool isHTMLOptGroupElement(const Element* element)
-{
-    return element->hasTagName(HTMLNames::optgroupTag);
-}
-
 inline HTMLOptGroupElement* toHTMLOptGroupElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLOptGroupElement(node));
index 364e533..2762dbe 100644 (file)
@@ -95,16 +95,6 @@ private:
     RefPtr<RenderStyle> m_style;
 };
 
-inline bool isHTMLOptionElement(const Node* node)
-{
-    return node->hasTagName(HTMLNames::optionTag);
-}
-
-inline bool isHTMLOptionElement(const Element* element)
-{
-    return element->hasTagName(HTMLNames::optionTag);
-}
-
 inline HTMLOptionElement* toHTMLOptionElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLOptionElement(node));
index b6595d6..ed091ab 100644 (file)
@@ -40,23 +40,9 @@ private:
     HTMLParamElement(const QualifiedName&, Document*);
 
     virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
-
     virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
 };
 
-inline bool isHTMLParamElement(const Node* node)
-{
-    return node->hasTagName(HTMLNames::paramTag);
-}
-
-inline bool isHTMLParamElement(const Element* element)
-{
-    return element->hasTagName(HTMLNames::paramTag);
-}
-
-template <> inline bool isElementOfType<HTMLParamElement>(const Element* element) { return isHTMLParamElement(element); }
-
-
 } // namespace WebCore
 
 #endif
index 60c0faa..39ff23d 100644 (file)
@@ -69,12 +69,6 @@ private:
     ProgressValueElement* m_value;
 };
 
-inline bool isHTMLProgressElement(Node* node)
-{
-    ASSERT(node);
-    return node->hasTagName(HTMLNames::progressTag);
-}
-
 inline HTMLProgressElement* toHTMLProgressElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLProgressElement(node));
index eeb66c7..e33d158 100644 (file)
@@ -67,11 +67,6 @@ private:
     virtual PassRefPtr<Element> cloneElementWithoutAttributesAndChildren();
 };
 
-inline bool isHTMLScriptElement(Node* node)
-{
-    return node->hasTagName(HTMLNames::scriptTag);
-}
-
 inline HTMLScriptElement* toHTMLScriptElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(HTMLNames::scriptTag));
index fc922bc..dc1821f 100644 (file)
@@ -57,19 +57,6 @@ private:
     Timer<HTMLSourceElement> m_errorEventTimer;
 };
 
-inline bool isHTMLSourceElement(const Node* node)
-{
-    return node->hasTagName(HTMLNames::sourceTag);
-}
-
-inline bool isHTMLSourceElement(const Element* element)
-{
-    return element->hasTagName(HTMLNames::sourceTag);
-}
-
-template <> inline bool isElementOfType<HTMLSourceElement>(const Element* element) { return isHTMLSourceElement(element); }
-
-
 } //namespace
 
 #endif
index 548ea9f..920dea5 100644 (file)
@@ -93,24 +93,12 @@ private:
     ScopedStyleRegistrationState m_scopedStyleRegistrationState;
 };
 
-inline bool isHTMLStyleElement(const Node* node)
-{
-    return node->hasTagName(HTMLNames::styleTag);
-}
-
-inline bool isHTMLStyleElement(const Element* element)
-{
-    return element->hasTagName(HTMLNames::styleTag);
-}
-
 inline HTMLStyleElement* toHTMLStyleElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLStyleElement(node));
     return static_cast<HTMLStyleElement*>(node);
 }
 
-template <> inline bool isElementOfType<HTMLStyleElement>(const Element* element) { return isHTMLStyleElement(element); }
-
 } //namespace
 
 #endif
index ec21401..0d76ab5 100644 (file)
@@ -100,16 +100,6 @@ private:
     RefPtr<StylePropertySet> m_sharedCellStyle;
 };
 
-inline bool isHTMLTableElement(const Node* node)
-{
-    return node->hasTagName(HTMLNames::tableTag);
-}
-
-inline bool isHTMLTableElement(const Element* element)
-{
-    return element->hasTagName(HTMLNames::tableTag);
-}
-
 inline HTMLTableElement* toHTMLTableElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLTableElement(node));
index bed751c..53ef4f3 100644 (file)
@@ -51,18 +51,6 @@ private:
     HTMLTableRowElement(const QualifiedName&, Document*);
 };
 
-inline bool isHTMLTableRowElement(const Node* node)
-{
-    return node->hasTagName(HTMLNames::trTag);
-}
-
-inline bool isHTMLTableRowElement(const Element* element)
-{
-    return element->hasTagName(HTMLNames::trTag);
-}
-
-template<> inline bool isElementOfType<HTMLTableRowElement>(const Element* element) { return isHTMLTableRowElement(element); }
-
 inline HTMLTableRowElement* toHTMLTableRowElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLTableRowElement(node));
index f2d4e50..4661524 100644 (file)
@@ -3,17 +3,17 @@ namespacePrefix="xhtml"
 namespaceURI="http://www.w3.org/1999/xhtml"
 fallbackInterfaceName="HTMLUnknownElement"
 
-a interfaceName=HTMLAnchorElement
+a interfaceName=HTMLAnchorElement, generateTypeChecks
 abbr interfaceName=HTMLElement
 acronym interfaceName=HTMLElement
 address interfaceName=HTMLElement
 applet constructorNeedsCreatedByParser
-area
+area generateTypeChecks
 article interfaceName=HTMLElement
 aside interfaceName=HTMLElement
-audio wrapperOnlyIfMediaIsAvailable, conditional=VIDEO, constructorNeedsCreatedByParser
+audio wrapperOnlyIfMediaIsAvailable, conditional=VIDEO, constructorNeedsCreatedByParser, generateTypeChecks
 b interfaceName=HTMLElement
-base
+base generateTypeChecks
 basefont interfaceName=HTMLBaseFontElement
 bdi interfaceName=HTMLBDIElement, JSInterfaceName=HTMLElement
 bdo interfaceName=HTMLElement
@@ -23,7 +23,7 @@ blockquote interfaceName=HTMLQuoteElement
 body
 br interfaceName=HTMLBRElement
 button constructorNeedsFormElement
-canvas
+canvas generateTypeChecks
 caption interfaceName=HTMLTableCaptionElement
 center interfaceName=HTMLElement
 cite interfaceName=HTMLElement
@@ -44,14 +44,14 @@ dl interfaceName=HTMLDListElement
 dt interfaceName=HTMLElement
 em interfaceName=HTMLElement
 embed constructorNeedsCreatedByParser
-fieldset interfaceName=HTMLFieldSetElement, constructorNeedsFormElement
+fieldset interfaceName=HTMLFieldSetElement, constructorNeedsFormElement, generateTypeChecks
 figcaption interfaceName=HTMLElement
 figure interfaceName=HTMLElement
 font
 footer interfaceName=HTMLElement
-form
+form generateTypeChecks
 frame
-frameset interfaceName=HTMLFrameSetElement
+frameset interfaceName=HTMLFrameSetElement, generateTypeChecks
 h1 interfaceName=HTMLHeadingElement
 h2 interfaceName=HTMLHeadingElement
 h3 interfaceName=HTMLHeadingElement
@@ -66,25 +66,25 @@ html
 i interfaceName=HTMLElement
 iframe interfaceName=HTMLIFrameElement
 image interfaceName=HTMLElement
-img interfaceName=HTMLImageElement, constructorNeedsFormElement
-input constructorNeedsFormElement, constructorNeedsCreatedByParser
+img interfaceName=HTMLImageElement, constructorNeedsFormElement, generateTypeChecks
+input constructorNeedsFormElement, constructorNeedsCreatedByParser, generateTypeChecks
 ins interfaceName=HTMLModElement
 isindex interfaceName=HTMLUnknownElement
 kbd interfaceName=HTMLElement
 keygen constructorNeedsFormElement
-label
+label generateTypeChecks
 layer interfaceName=HTMLElement
-legend
+legend generateTypeChecks
 li interfaceName=HTMLLIElement
 link constructorNeedsCreatedByParser
 listing interfaceName=HTMLPreElement
 main interfaceName=HTMLElement
-map
+map generateTypeChecks
 mark interfaceName=HTMLElement
 marquee
 menu
 meta
-meter interfaceName=HTMLMeterElement, conditional=METER_ELEMENT
+meter interfaceName=HTMLMeterElement, conditional=METER_ELEMENT, generateTypeChecks
 nav interfaceName=HTMLElement
 nobr interfaceName=HTMLElement
 noembed interfaceName=HTMLElement
@@ -92,43 +92,43 @@ noframes interfaceName=HTMLElement
 nolayer interfaceName=HTMLElement
 object constructorNeedsFormElement, constructorNeedsCreatedByParser
 ol interfaceName=HTMLOListElement
-optgroup interfaceName=HTMLOptGroupElement
-option
+optgroup interfaceName=HTMLOptGroupElement, generateTypeChecks
+option generateTypeChecks
 output constructorNeedsFormElement
 p interfaceName=HTMLParagraphElement
-param
+param generateTypeChecks
 plaintext interfaceName=HTMLElement
 pre
-progress interfaceName=HTMLProgressElement, conditional=PROGRESS_ELEMENT
+progress interfaceName=HTMLProgressElement, conditional=PROGRESS_ELEMENT, generateTypeChecks
 q interfaceName=HTMLQuoteElement
 rp interfaceName=HTMLElement
 rt interfaceName=HTMLElement
 ruby interfaceName=HTMLElement
 s interfaceName=HTMLElement
 samp interfaceName=HTMLElement
-script constructorNeedsCreatedByParser
+script constructorNeedsCreatedByParser, generateTypeChecks
 section interfaceName=HTMLElement
 select constructorNeedsFormElement
 small interfaceName=HTMLElement
-source wrapperOnlyIfMediaIsAvailable, conditional=VIDEO
+source wrapperOnlyIfMediaIsAvailable, conditional=VIDEO, generateTypeChecks
 span
 strike interfaceName=HTMLElement
 strong interfaceName=HTMLElement
-style constructorNeedsCreatedByParser
+style constructorNeedsCreatedByParser, generateTypeChecks
 sub interfaceName=HTMLElement
 summary interfaceName=HTMLSummaryElement, JSInterfaceName=HTMLElement, conditional=DETAILS_ELEMENT
 sup interfaceName=HTMLElement
-table
+table generateTypeChecks
 tbody interfaceName=HTMLTableSectionElement
 td interfaceName=HTMLTableCellElement
 template conditional=TEMPLATE_ELEMENT
-textarea interfaceName=HTMLTextAreaElement, constructorNeedsFormElement
+textarea interfaceName=HTMLTextAreaElement, constructorNeedsFormElement, generateTypeChecks
 tfoot interfaceName=HTMLTableSectionElement
 th interfaceName=HTMLTableCellElement
 thead interfaceName=HTMLTableSectionElement
-title
-tr interfaceName=HTMLTableRowElement
-track wrapperOnlyIfMediaIsAvailable, conditional=VIDEO_TRACK
+title generateTypeChecks
+tr interfaceName=HTMLTableRowElement, generateTypeChecks
+track wrapperOnlyIfMediaIsAvailable, conditional=VIDEO_TRACK, generateTypeChecks
 tt interfaceName=HTMLElement
 u interfaceName=HTMLElement
 ul interfaceName=HTMLUListElement
index fbf85ba..6755118 100644 (file)
@@ -127,16 +127,6 @@ private:
     mutable bool m_wasModifiedByUser;
 };
 
-inline bool isHTMLTextAreaElement(Node* node)
-{
-    return node->hasTagName(HTMLNames::textareaTag);
-}
-
-inline bool isHTMLTextAreaElement(Element* element)
-{
-    return element->hasTagName(HTMLNames::textareaTag);
-}
-
 inline HTMLTextAreaElement* toHTMLTextAreaElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLTextAreaElement(node));
index ddf6da7..b694e36 100644 (file)
@@ -46,24 +46,12 @@ private:
     StringWithDirection m_title;
 };
 
-inline bool isHTMLTitleElement(const Node* node)
-{
-    return node->hasTagName(HTMLNames::titleTag);
-}
-
-inline bool isHTMLTitleElement(const Element* element)
-{
-    return element->hasTagName(HTMLNames::titleTag);
-}
-
 inline HTMLTitleElement* toHTMLTitleElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLTitleElement(node));
     return static_cast<HTMLTitleElement*>(node);
 }
 
-template <> inline bool isElementOfType<HTMLTitleElement>(const Element* element) { return isHTMLTitleElement(element); }
-
 } //namespace
 
 #endif
index c793b34..9d8eb3b 100644 (file)
@@ -97,19 +97,6 @@ private:
     Timer<HTMLTrackElement> m_loadTimer;
 };
 
-inline bool isHTMLTrackElement(const Node* node)
-{
-    return node->hasTagName(HTMLNames::trackTag);
-}
-
-inline bool isHTMLTrackElement(const Element* element)
-{
-    return element->hasTagName(HTMLNames::trackTag);
-}
-
-template <> inline bool isElementOfType<HTMLTrackElement>(const Element* element) { return isHTMLTrackElement(element); }
-
-
 }
 
 #endif
index 76bde70..b13f025 100644 (file)
@@ -26,6 +26,7 @@
 #if ENABLE(SVG)
 #include "CSSPropertyNames.h"
 #include "SVGAnimatedString.h"
+#include "SVGElementTypeChecks.h"
 #include "SVGLangSpace.h"
 #include "SVGLocatable.h"
 #include "SVGParsingError.h"
index 01fe6c2..0681a67 100644 (file)
@@ -89,11 +89,6 @@ private:
     bool m_isGlyphCacheValid;
 };
 
-inline bool isSVGFontElement(const Node* node)
-{
-    return node->hasTagName(SVGNames::fontTag);
-}
-
 inline SVGFontElement* toSVGFontElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isSVGFontElement(node));
index dab4290..6e7d8e6 100644 (file)
@@ -67,18 +67,6 @@ private:
     SVGFontElement* m_fontElement;
 };
 
-inline bool isSVGFontFaceElement(const Node* node)
-{
-    return node->hasTagName(SVGNames::font_faceTag);
-}
-
-inline bool isSVGFontFaceElement(const Element* element)
-{
-    return element->hasTagName(SVGNames::font_faceTag);
-}
-
-template <> inline bool isElementOfType<SVGFontFaceElement>(const Element* element) { return isSVGFontFaceElement(element); }
-
 inline SVGFontFaceElement* toSVGFontFaceElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isSVGFontFaceElement(node));
index b0dc620..8936308 100644 (file)
@@ -59,19 +59,6 @@ private:
     END_DECLARE_ANIMATED_PROPERTIES
 };
 
-inline bool isSVGForeignObjectElement(const Node* node)
-{
-    return node->hasTagName(SVGNames::foreignObjectTag);
-}
-
-inline bool isSVGForeignObjectElement(const Element* element)
-{
-    return element->hasTagName(SVGNames::foreignObjectTag);
-}
-
-template <> inline bool isElementOfType<SVGForeignObjectElement>(const Element* element) { return isSVGForeignObjectElement(element); }
-
-
 } // namespace WebCore
 
 #endif // ENABLE(SVG)
index 9cd5793..9134f1b 100644 (file)
@@ -77,11 +77,6 @@ private:
     SVGImageLoader m_imageLoader;
 };
 
-inline bool isSVGImageElement(const Node* node)
-{
-    return node->hasTagName(SVGNames::imageTag);
-}
-
 inline SVGImageElement* toSVGImageElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || isSVGImageElement(node));
index e6254c5..caa0982 100644 (file)
@@ -88,11 +88,6 @@ private:
     Timer<SVGElement> m_svgLoadEventTimer;
 };
 
-inline bool isSVGScriptElement(Node* node)
-{
-    return node->hasTagName(SVGNames::scriptTag);
-}
-
 inline SVGScriptElement* toSVGScriptElement(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::scriptTag));
index 7db4814..c406311 100644 (file)
@@ -53,21 +53,21 @@ feTurbulence
 filter
 #endif
 #if ENABLE_SVG_FONTS
-font
-font_face
+font generateTypeChecks
+font_face generateTypeChecks
 font_face_format
 font_face_name
 font_face_src
 font_face_uri
 #endif
-foreignObject
+foreignObject generateTypeChecks
 g
 #if ENABLE_SVG_FONTS
 glyph
 glyphRef
 hkern interfaceName=SVGHKernElement
 #endif
-image
+image generateTypeChecks
 line
 linearGradient
 marker
@@ -83,7 +83,7 @@ polygon
 polyline
 radialGradient
 rect
-script constructorNeedsCreatedByParser
+script constructorNeedsCreatedByParser, generateTypeChecks
 stop
 style constructorNeedsCreatedByParser
 svg interfaceName=SVGSVGElement