Commit 38baa376 authored by weinig's avatar weinig

WebCore:

        Reviewed by Adam Roben.

        <rdar://problem/5435940>
        The COM bindings for the DOM should be autogenerated like the other DOM bindings

        Initial commit of the autogeneration of the COM DOM Bindings.  No behavior change
        is being introduced in this patch and to insure that no conflicts arise, a temporary
        prefix of "GEN_" has been used for all the new classes.

        The build architecture for these bindings differs slightly from the other autogenerated
        bindings.  Instead of building in WebCore and migrating the resuting code to WebKit (as
        is done for the Objective-C bindigs currently), the IDLs and generation scripts are
        migrated to WebKit and built there.  This is done with a series of scripts and Makefiles.

        This commit includes:
            - Hand rolled root class/Interface GEN_DOMObject used to facilated object creation
              and ref-counting.
            - Generating all of the Core DOM and most of HTML and CSS
            - Generating Event, EventTarget, and EventListener

        * WebCore.vcproj/MigrateIDLAndScripts.make: Added.
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.vcproj/migrate-idls.sh: Added.
        * bindings/scripts/CodeGenerator.pm:
        * bindings/scripts/CodeGeneratorCOM.pm: Added.
        * dom/EventListener.h: Make the isWindowEvent parameter default to false
        to allow autogeneration based on the IDL.

WebKit/win:

        Reviewed by Adam Roben.

        <rdar://problem/5435940>
        The COM bindings for the DOM should be autogenerated like the other DOM bindings

        Initial commit of the autogeneration of the COM DOM Bindings.  No behavior change
        is being introduced in this patch and to insure that no conflicts arise, a temporary
        prefix of "GEN_" has been used for all the new classes.

        The build architecture for these bindings differs slightly from the other autogenerated
        bindings.  Instead of building in WebCore and migrating the resuting code to WebKit (as
        is done for the Objective-C bindigs currently), the IDLs and generation scripts are
        migrated to WebKit and built there.  This is done with a series of scripts and Makefiles.

        This commit includes:
            - Hand rolled root class/Interface GEN_DOMObject used to facilated object creation
              and ref-counting.
            - Generating all of the Core DOM and most of HTML and CSS
            - Generating Event, EventTarget, and EventListener

        * DOMCreateInstance.cpp: Added.
        (domWrapperCache):
        (getDOMWrapper):
        (setDOMWrapper):
        (removeDOMWrapper):
        (GEN_DOMNode::createInstance):
        (GEN_DOMImplementation::createInstance):
        (GEN_DOMCSSRule::createInstance):
        (GEN_DOMStyleSheet::createInstance):
        (GEN_DOMCSSValue::createInstance):
        * DOMCreateInstance.h: Added.
        Temporary location for createInstance/object caching methods.  This will be broken up
        into seperate files in the near future.

        * GEN_DOMObject.cpp: Added.
        (GEN_DOMObject::GEN_DOMObject):
        (GEN_DOMObject::~GEN_DOMObject):
        (GEN_DOMObject::QueryInterface):
        (GEN_DOMObject::AddRef):
        (GEN_DOMObject::Release):
        * GEN_DOMObject.h: Added.
        Hand rolled base class.

        * Interfaces/IGEN_DOMObject.idl: Added. 
        Hand rolled base interface.

        * WebKit.vcproj/DerivedSources.make: Added.
        * WebKit.vcproj/FixMIDLHeaders.pl: Added.
        This script is required because MIDL is producing un-buildable code due to
        circular dependencies.

        * WebKit.vcproj/Interfaces.vcproj:
        * WebKit.vcproj/WebKit.vcproj:
        * WebKit.vcproj/WebKitGUID.vcproj:
        * WebKit.vcproj/build-generated-files.sh: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@27655 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7489b5a6
2007-11-04 Sam Weinig <sam@webkit.org>
Reviewed by Adam Roben.
<rdar://problem/5435940>
The COM bindings for the DOM should be autogenerated like the other DOM bindings
Initial commit of the autogeneration of the COM DOM Bindings. No behavior change
is being introduced in this patch and to insure that no conflicts arise, a temporary
prefix of "GEN_" has been used for all the new classes.
The build architecture for these bindings differs slightly from the other autogenerated
bindings. Instead of building in WebCore and migrating the resuting code to WebKit (as
is done for the Objective-C bindigs currently), the IDLs and generation scripts are
migrated to WebKit and built there. This is done with a series of scripts and Makefiles.
This commit includes:
- Hand rolled root class/Interface GEN_DOMObject used to facilated object creation
and ref-counting.
- Generating all of the Core DOM and most of HTML and CSS
- Generating Event, EventTarget, and EventListener
* WebCore.vcproj/MigrateIDLAndScripts.make: Added.
* WebCore.vcproj/WebCore.vcproj:
* WebCore.vcproj/migrate-idls.sh: Added.
* bindings/scripts/CodeGenerator.pm:
* bindings/scripts/CodeGeneratorCOM.pm: Added.
* dom/EventListener.h: Make the isWindowEvent parameter default to false
to allow autogeneration based on the IDL.
2007-11-09 Tristan O'Tierney <tristan@apple.com>
Reviewed by Timothy Hatcher.
......
# Copyright (C) 2007 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
# its contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.PHONY : all
all : \
$(WEBKIT_OUTPUT)/Node.idl \
$(WEBKIT_OUTPUT)/Attr.idl \
$(WEBKIT_OUTPUT)/Element.idl \
$(WEBKIT_OUTPUT)/NodeList.idl \
$(WEBKIT_OUTPUT)/Document.idl \
$(WEBKIT_OUTPUT)/CharacterData.idl \
$(WEBKIT_OUTPUT)/CDATASection.idl \
$(WEBKIT_OUTPUT)/Comment.idl \
$(WEBKIT_OUTPUT)/Text.idl \
$(WEBKIT_OUTPUT)/DocumentFragment.idl \
$(WEBKIT_OUTPUT)/DocumentType.idl \
$(WEBKIT_OUTPUT)/DOMImplementation.idl \
$(WEBKIT_OUTPUT)/Entity.idl \
$(WEBKIT_OUTPUT)/EntityReference.idl \
$(WEBKIT_OUTPUT)/NamedNodeMap.idl \
$(WEBKIT_OUTPUT)/Notation.idl \
$(WEBKIT_OUTPUT)/ProcessingInstruction.idl \
\
$(WEBKIT_OUTPUT)/HTMLAnchorElement.idl \
$(WEBKIT_OUTPUT)/HTMLAppletElement.idl \
$(WEBKIT_OUTPUT)/HTMLAreaElement.idl \
$(WEBKIT_OUTPUT)/HTMLBRElement.idl \
$(WEBKIT_OUTPUT)/HTMLBaseElement.idl \
$(WEBKIT_OUTPUT)/HTMLBaseFontElement.idl \
$(WEBKIT_OUTPUT)/HTMLBlockquoteElement.idl \
$(WEBKIT_OUTPUT)/HTMLBodyElement.idl \
$(WEBKIT_OUTPUT)/HTMLButtonElement.idl \
$(WEBKIT_OUTPUT)/HTMLCollection.idl \
$(WEBKIT_OUTPUT)/HTMLDListElement.idl \
$(WEBKIT_OUTPUT)/HTMLDirectoryElement.idl \
$(WEBKIT_OUTPUT)/HTMLDivElement.idl \
$(WEBKIT_OUTPUT)/HTMLDocument.idl \
$(WEBKIT_OUTPUT)/HTMLElement.idl \
$(WEBKIT_OUTPUT)/HTMLEmbedElement.idl \
$(WEBKIT_OUTPUT)/HTMLFieldSetElement.idl \
$(WEBKIT_OUTPUT)/HTMLFontElement.idl \
$(WEBKIT_OUTPUT)/HTMLFormElement.idl \
$(WEBKIT_OUTPUT)/HTMLFrameElement.idl \
$(WEBKIT_OUTPUT)/HTMLFrameSetElement.idl \
$(WEBKIT_OUTPUT)/HTMLHRElement.idl \
$(WEBKIT_OUTPUT)/HTMLHeadElement.idl \
$(WEBKIT_OUTPUT)/HTMLHeadingElement.idl \
$(WEBKIT_OUTPUT)/HTMLHtmlElement.idl \
$(WEBKIT_OUTPUT)/HTMLIFrameElement.idl \
$(WEBKIT_OUTPUT)/HTMLImageElement.idl \
$(WEBKIT_OUTPUT)/HTMLInputElement.idl \
$(WEBKIT_OUTPUT)/HTMLIsIndexElement.idl \
$(WEBKIT_OUTPUT)/HTMLLIElement.idl \
$(WEBKIT_OUTPUT)/HTMLLabelElement.idl \
$(WEBKIT_OUTPUT)/HTMLLegendElement.idl \
$(WEBKIT_OUTPUT)/HTMLLinkElement.idl \
$(WEBKIT_OUTPUT)/HTMLMapElement.idl \
$(WEBKIT_OUTPUT)/HTMLMarqueeElement.idl \
$(WEBKIT_OUTPUT)/HTMLMenuElement.idl \
$(WEBKIT_OUTPUT)/HTMLMetaElement.idl \
$(WEBKIT_OUTPUT)/HTMLModElement.idl \
$(WEBKIT_OUTPUT)/HTMLOListElement.idl \
$(WEBKIT_OUTPUT)/HTMLObjectElement.idl \
$(WEBKIT_OUTPUT)/HTMLOptGroupElement.idl \
$(WEBKIT_OUTPUT)/HTMLOptionElement.idl \
$(WEBKIT_OUTPUT)/HTMLOptionsCollection.idl \
$(WEBKIT_OUTPUT)/HTMLParagraphElement.idl \
$(WEBKIT_OUTPUT)/HTMLParamElement.idl \
$(WEBKIT_OUTPUT)/HTMLPreElement.idl \
$(WEBKIT_OUTPUT)/HTMLQuoteElement.idl \
$(WEBKIT_OUTPUT)/HTMLScriptElement.idl \
$(WEBKIT_OUTPUT)/HTMLSelectElement.idl \
$(WEBKIT_OUTPUT)/HTMLStyleElement.idl \
$(WEBKIT_OUTPUT)/HTMLTableCaptionElement.idl \
$(WEBKIT_OUTPUT)/HTMLTableCellElement.idl \
$(WEBKIT_OUTPUT)/HTMLTableColElement.idl \
$(WEBKIT_OUTPUT)/HTMLTableElement.idl \
$(WEBKIT_OUTPUT)/HTMLTableRowElement.idl \
$(WEBKIT_OUTPUT)/HTMLTableSectionElement.idl \
$(WEBKIT_OUTPUT)/HTMLTextAreaElement.idl \
$(WEBKIT_OUTPUT)/HTMLTitleElement.idl \
$(WEBKIT_OUTPUT)/HTMLUListElement.idl \
\
$(WEBKIT_OUTPUT)/CSSCharsetRule.idl \
$(WEBKIT_OUTPUT)/CSSFontFaceRule.idl \
$(WEBKIT_OUTPUT)/CSSImportRule.idl \
$(WEBKIT_OUTPUT)/CSSMediaRule.idl \
$(WEBKIT_OUTPUT)/CSSPageRule.idl \
$(WEBKIT_OUTPUT)/CSSPrimitiveValue.idl \
$(WEBKIT_OUTPUT)/CSSRule.idl \
$(WEBKIT_OUTPUT)/CSSRuleList.idl \
$(WEBKIT_OUTPUT)/CSSStyleDeclaration.idl \
$(WEBKIT_OUTPUT)/CSSStyleRule.idl \
$(WEBKIT_OUTPUT)/CSSStyleSheet.idl \
$(WEBKIT_OUTPUT)/CSSUnknownRule.idl \
$(WEBKIT_OUTPUT)/CSSValue.idl \
$(WEBKIT_OUTPUT)/CSSValueList.idl \
$(WEBKIT_OUTPUT)/Counter.idl \
$(WEBKIT_OUTPUT)/MediaList.idl \
$(WEBKIT_OUTPUT)/Rect.idl \
$(WEBKIT_OUTPUT)/StyleSheet.idl \
$(WEBKIT_OUTPUT)/StyleSheetList.idl \
\
$(WEBKIT_OUTPUT)/Event.idl \
$(WEBKIT_OUTPUT)/EventTarget.idl \
$(WEBKIT_OUTPUT)/EventListener.idl \
\
$(WEBKIT_OUTPUT)/CodeGenerator.pm \
$(WEBKIT_OUTPUT)/CodeGeneratorCOM.pm \
$(WEBKIT_OUTPUT)/IDLParser.pm \
$(WEBKIT_OUTPUT)/IDLStructure.pm \
$(WEBKIT_OUTPUT)/generate-bindings.pl \
#
# $(WEBKIT_OUTPUT)/CanvasGradient.idl \
# $(WEBKIT_OUTPUT)/CanvasPattern.idl \
# $(WEBKIT_OUTPUT)/CanvasRenderingContext2D.idl \
# $(WEBKIT_OUTPUT)/HTMLCanvasElement.idl \
# $(WEBKIT_OUTPUT)/RGBColor.idl \
MIGRATE_CMD = cp $< $@
# Migrate core/event IDLs
$(WEBKIT_OUTPUT)/% : $(WEBCORE)/dom/%
$(MIGRATE_CMD)
# Migrate html IDLs
$(WEBKIT_OUTPUT)/% : $(WEBCORE)/html/%
$(MIGRATE_CMD)
# Migrate css IDLs
$(WEBKIT_OUTPUT)/% : $(WEBCORE)/css/%
$(MIGRATE_CMD)
# Migrate generation scripts
$(WEBKIT_OUTPUT)/% : $(WEBCORE)/bindings/scripts/%
$(MIGRATE_CMD)
......@@ -26,7 +26,7 @@
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;touch &quot;$(WebKitOutputDir)\tmp.cpp&quot;&#x0D;&#x0A;cl /analyze /nologo /c &quot;$(WebKitOutputDir)\tmp.cpp&quot; 2&gt;&amp;1 | findstr D9040&#x0D;&#x0A;if ERRORLEVEL 0 set EnablePREfast=&quot;false&quot; else set EnablePREfast=&quot;true&quot;&#x0D;&#x0A;if ERRORLEVEL 0 set AnalyzeWithLargeStack=&quot;&quot; AnalyzeWithLargeStack=&quot;/analyze:65536&quot;&#x0D;&#x0A;bash build-generated-files.sh &quot;$(WebKitOutputDir)&quot; &quot;$(WebKitLibrariesDir)&quot;&#x0D;&#x0A;"
CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;touch &quot;$(WebKitOutputDir)\tmp.cpp&quot;&#x0D;&#x0A;cl /analyze /nologo /c &quot;$(WebKitOutputDir)\tmp.cpp&quot; 2&gt;&amp;1 | findstr D9040&#x0D;&#x0A;if ERRORLEVEL 0 set EnablePREfast=&quot;false&quot; else set EnablePREfast=&quot;true&quot;&#x0D;&#x0A;if ERRORLEVEL 0 set AnalyzeWithLargeStack=&quot;&quot; AnalyzeWithLargeStack=&quot;/analyze:65536&quot;&#x0D;&#x0A;bash build-generated-files.sh &quot;$(WebKitOutputDir)&quot; &quot;$(WebKitLibrariesDir)&quot;&#x0D;&#x0A;bash migrate-idls.sh &quot;$(WebKitOutputDir)/obj/WebKit/DOMInterfaces&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
......@@ -101,7 +101,7 @@
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;touch &quot;$(WebKitOutputDir)\tmp.cpp&quot;&#x0D;&#x0A;cl /analyze /nologo /c &quot;$(WebKitOutputDir)\tmp.cpp&quot; 2&gt;&amp;1 | findstr D9040&#x0D;&#x0A;if ERRORLEVEL 0 set EnablePREfast=&quot;false&quot; else set EnablePREfast=&quot;true&quot;&#x0D;&#x0A;if ERRORLEVEL 0 set AnalyzeWithLargeStack=&quot;&quot; AnalyzeWithLargeStack=&quot;/analyze:65536&quot;&#x0D;&#x0A;bash build-generated-files.sh &quot;$(WebKitOutputDir)&quot; &quot;$(WebKitLibrariesDir)&quot;&#x0D;&#x0A;"
CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;touch &quot;$(WebKitOutputDir)\tmp.cpp&quot;&#x0D;&#x0A;cl /analyze /nologo /c &quot;$(WebKitOutputDir)\tmp.cpp&quot; 2&gt;&amp;1 | findstr D9040&#x0D;&#x0A;if ERRORLEVEL 0 set EnablePREfast=&quot;false&quot; else set EnablePREfast=&quot;true&quot;&#x0D;&#x0A;if ERRORLEVEL 0 set AnalyzeWithLargeStack=&quot;&quot; AnalyzeWithLargeStack=&quot;/analyze:65536&quot;&#x0D;&#x0A;bash build-generated-files.sh &quot;$(WebKitOutputDir)&quot; &quot;$(WebKitLibrariesDir)&quot;&#x0D;&#x0A;bash migrate-idls.sh &quot;$(WebKitOutputDir)/obj/WebKit/DOMInterfaces&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
......@@ -172,7 +172,7 @@
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;touch &quot;$(WebKitOutputDir)\tmp.cpp&quot;&#x0D;&#x0A;cl /analyze /nologo /c &quot;$(WebKitOutputDir)\tmp.cpp&quot; 2&gt;&amp;1 | findstr D9040&#x0D;&#x0A;if ERRORLEVEL 0 set EnablePREfast=&quot;false&quot; else set EnablePREfast=&quot;true&quot;&#x0D;&#x0A;if ERRORLEVEL 0 set AnalyzeWithLargeStack=&quot;&quot; AnalyzeWithLargeStack=&quot;/analyze:65536&quot;&#x0D;&#x0A;bash build-generated-files.sh &quot;$(WebKitOutputDir)&quot; &quot;$(WebKitLibrariesDir)&quot;&#x0D;&#x0A;"
CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;touch &quot;$(WebKitOutputDir)\tmp.cpp&quot;&#x0D;&#x0A;cl /analyze /nologo /c &quot;$(WebKitOutputDir)\tmp.cpp&quot; 2&gt;&amp;1 | findstr D9040&#x0D;&#x0A;if ERRORLEVEL 0 set EnablePREfast=&quot;false&quot; else set EnablePREfast=&quot;true&quot;&#x0D;&#x0A;if ERRORLEVEL 0 set AnalyzeWithLargeStack=&quot;&quot; AnalyzeWithLargeStack=&quot;/analyze:65536&quot;&#x0D;&#x0A;bash build-generated-files.sh &quot;$(WebKitOutputDir)&quot; &quot;$(WebKitLibrariesDir)&quot;&#x0D;&#x0A;bash migrate-idls.sh &quot;$(WebKitOutputDir)/obj/WebKit/DOMInterfaces&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
......
#!/usr/bin/bash
# Copyright (C) 2007 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of Apple puter, Inc. ("Apple") nor the names of
# its contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
NUMCPUS=`../../WebKitTools/Scripts/num-cpus`
mkdir -p "$1"
XSRCROOT="`pwd`/.."
XSRCROOT=`realpath "$XSRCROOT"`
# Do a little dance to get the path into 8.3 form to make it safe for gnu make
# http://bugzilla.opendarwin.org/show_bug.cgi?id=8173
XSRCROOT=`cygpath -m -s "$XSRCROOT"`
XSRCROOT=`cygpath -u "$XSRCROOT"`
export XSRCROOT
export SOURCE_ROOT=$XSRCROOT
XDSTROOT="$1"
export XDSTROOT
# Do a little dance to get the path into 8.3 form to make it safe for gnu make
# http://bugzilla.opendarwin.org/show_bug.cgi?id=8173
XDSTROOT=`cygpath -m -s "$XDSTROOT"`
XDSTROOT=`cygpath -u "$XDSTROOT"`
export XDSTROOT
export WEBCORE=$XSRCROOT
export WEBKIT_OUTPUT=$XDSTROOT
make -f "$WEBCORE/WebCore.vcproj/MigrateIDLandScripts.make" -j ${NUMCPUS} || exit 1
......@@ -180,6 +180,89 @@ sub AddMethodsConstantsAndAttributesFromParentClasses
}
}
sub GetMethodsAndAttributesFromParentClasses
{
# For the passed interface, recursively parse all parent
# IDLs in order to find out all inherited properties/methods.
my $object = shift;
my $dataNode = shift;
my @parents = @{$dataNode->parents};
return if @{$dataNode->parents} == 0;
my @parentList = ();
foreach (@{$dataNode->parents}) {
my $interface = $object->StripModule($_);
if ($interface eq "EventTargetNode") {
$interface = "Node";
}
# Step #1: Find the IDL file associated with 'interface'
$endCondition = 0;
$foundFilename = "";
foreach (@{$useDirectories}) {
$object->ScanDirectory("${interface}.idl", $_, $_, 0) if $foundFilename eq "";
}
die("Could NOT find specified parent interface \"$interface\"!\n") if $foundFilename eq "";
print " | |> Parsing parent IDL \"$foundFilename\" for interface \"$interface\"\n" if $verbose;
# Step #2: Parse the found IDL file (in quiet mode).
my $parser = IDLParser->new(1);
my $document = $parser->Parse($foundFilename, $defines);
foreach my $class (@{$document->classes}) {
# Step #3: Enter recursive parent search
push(@parentList, GetMethodsAndAttributesFromParentClasses($object, $class));
# Step #4: Collect constants & functions & attributes of this parent-class
# print " | |> -> Inheriting $functionsMax functions amd $attributesMax attributes...\n | |>\n" if $verbose;
my $hash = {
"name" => $class->name,
"functions" => $class->functions,
"attributes" => $class->attributes
};
# Step #5: Concatenate data
unshift(@parentList, $hash);
}
}
return @parentList;
}
sub ParseInterface
{
my ($object, $interfaceName) = @_;
# Step #1: Find the IDL file associated with 'interface'
$endCondition = 0;
$foundFilename = "";
foreach (@{$useDirectories}) {
$object->ScanDirectory("${interfaceName}.idl", $_, $_, 0) if $foundFilename eq "";
}
die "Could NOT find specified parent interface \"$interfaceName\"!\n" if $foundFilename eq "";
print " | |> Parsing parent IDL \"$foundFilename\" for interface \"$interfaceName\"\n" if $verbose;
# Step #2: Parse the found IDL file (in quiet mode).
my $parser = IDLParser->new(1);
my $document = $parser->Parse($foundFilename, $defines);
foreach my $interface (@{$document->classes}) {
return $interface if $interface->name eq $interfaceName;
}
die "Interface definition not found";
}
# Helpers for all CodeGenerator***.pm modules
sub IsPodType
{
......@@ -242,10 +325,13 @@ sub ScanDirectory
if ($sourceRoot) {
$thisDir = "$sourceRoot/$directory";
} else {
$thisDir = "$directory";
$thisDir = $directory;
}
opendir(DIR, $thisDir) or die "[ERROR] Can't open directory $thisDir: \"$!\"\n";
if (!opendir(DIR, $thisDir)) {
opendir(DIR, $directory) or die "[ERROR] Can't open directory $thisDir or $directory: \"$!\"\n";
$thisDir = $directory;
}
my @names = readdir(DIR) or die "[ERROR] Cant't read directory $thisDir \"$!\"\n";
closedir(DIR);
......
This diff is collapsed.
......@@ -30,7 +30,7 @@ namespace WebCore {
class EventListener : public Shared<EventListener> {
public:
virtual ~EventListener() { }
virtual void handleEvent(Event*, bool isWindowEvent) = 0;
virtual void handleEvent(Event*, bool isWindowEvent = false) = 0;
virtual bool isHTMLEventListener() const { return false; }
};
......
2007-11-04 Sam Weinig <sam@webkit.org>
Reviewed by Adam Roben.
<rdar://problem/5435940>
The COM bindings for the DOM should be autogenerated like the other DOM bindings
Initial commit of the autogeneration of the COM DOM Bindings. No behavior change
is being introduced in this patch and to insure that no conflicts arise, a temporary
prefix of "GEN_" has been used for all the new classes.
The build architecture for these bindings differs slightly from the other autogenerated
bindings. Instead of building in WebCore and migrating the resuting code to WebKit (as
is done for the Objective-C bindigs currently), the IDLs and generation scripts are
migrated to WebKit and built there. This is done with a series of scripts and Makefiles.
This commit includes:
- Hand rolled root class/Interface GEN_DOMObject used to facilated object creation
and ref-counting.
- Generating all of the Core DOM and most of HTML and CSS
- Generating Event, EventTarget, and EventListener
* DOMCreateInstance.cpp: Added.
(domWrapperCache):
(getDOMWrapper):
(setDOMWrapper):
(removeDOMWrapper):
(GEN_DOMNode::createInstance):
(GEN_DOMImplementation::createInstance):
(GEN_DOMCSSRule::createInstance):
(GEN_DOMStyleSheet::createInstance):
(GEN_DOMCSSValue::createInstance):
* DOMCreateInstance.h: Added.
Temporary location for createInstance/object caching methods. This will be broken up
into seperate files in the near future.
* GEN_DOMObject.cpp: Added.
(GEN_DOMObject::GEN_DOMObject):
(GEN_DOMObject::~GEN_DOMObject):
(GEN_DOMObject::QueryInterface):
(GEN_DOMObject::AddRef):
(GEN_DOMObject::Release):
* GEN_DOMObject.h: Added.
Hand rolled base class.
* Interfaces/IGEN_DOMObject.idl: Added.
Hand rolled base interface.
* WebKit.vcproj/DerivedSources.make: Added.
* WebKit.vcproj/FixMIDLHeaders.pl: Added.
This script is required because MIDL is producing un-buildable code due to
circular dependencies.
* WebKit.vcproj/Interfaces.vcproj:
* WebKit.vcproj/WebKit.vcproj:
* WebKit.vcproj/WebKitGUID.vcproj:
* WebKit.vcproj/build-generated-files.sh: Added.
2007-11-08 Kevin McCullough <kmccullough@apple.com>
Reviewed by Adam.
......
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// This file is a temporary hack to implement the createInstance methods for
// the COM DOM bindings.
#include "config.h"
#include "DOMCreateInstance.h"
#include "GEN_DOMNode.h"
#include "GEN_DOMElement.h"
#include "GEN_DOMDocument.h"
#include "GEN_DOMAttr.h"
#include "GEN_DOMText.h"
#include "GEN_DOMCDATASection.h"
#include "GEN_DOMEntityReference.h"
#include "GEN_DOMEntity.h"
#include "GEN_DOMProcessingInstruction.h"
#include "GEN_DOMComment.h"
#include "GEN_DOMHTMLElement.h"
#include "GEN_DOMHTMLDocument.h"
#include "GEN_DOMHTMLCollection.h"
#include "GEN_DOMDocumentType.h"
#include "GEN_DOMDocumentFragment.h"
#include "GEN_DOMNotation.h"
#include "GEN_DOMCSSCharsetRule.h"
#include "GEN_DOMCSSFontFaceRule.h"
#include "GEN_DOMCSSImportRule.h"
#include "GEN_DOMCSSMediaRule.h"
#include "GEN_DOMCSSPageRule.h"
#include "GEN_DOMCSSPrimitiveValue.h"
#include "GEN_DOMCSSRule.h"
#include "GEN_DOMCSSRuleList.h"
#include "GEN_DOMCSSStyleDeclaration.h"
#include "GEN_DOMCSSStyleRule.h"
#include "GEN_DOMCSSStyleSheet.h"
#include "GEN_DOMCSSValueList.h"
#include "GEN_DOMStyleSheet.h"
#include "GEN_DOMDOMImplementation.h"
#include "GEN_DOMNamedNodeMap.h"
#include "GEN_DOMNodeList.h"
#include "GEN_DOMCounter.h"
#include "GEN_DOMCSSRuleList.h"
#include "GEN_DOMCSSStyleDeclaration.h"
#include "GEN_DOMMediaList.h"
#include "GEN_DOMRect.h"
#include "GEN_DOMStyleSheet.h"
#include "GEN_DOMStyleSheetList.h"
#include "GEN_DOMEvent.h"
#include "GEN_DOMEventListener.h"
#include "GEN_DOMEvent.h"
#include <wtf/HashMap.h>
#pragma warning(push, 0)
#include <WebCore/Node.h>
#include <WebCore/Element.h>
#include <WebCore/Document.h>
#include <WebCore/Attr.h>
#include <WebCore/Text.h>
#include <WebCore/COMPtr.h>
#include <WebCore/CDATASection.h>
#include <WebCore/EntityReference.h>
#include <WebCore/Entity.h>
#include <WebCore/ProcessingInstruction.h>
#include <WebCore/Comment.h>
#include <WebCore/HTMLDocument.h>
#include <WebCore/HTMLElement.h>
#include <WebCore/HTMLCollection.h>
#include <WebCore/DocumentType.h>
#include <WebCore/DocumentFragment.h>
#include <WebCore/Notation.h>
#include <WebCore/CSSCharsetRule.h>
#include <WebCore/CSSFontFaceRule.h>
#include <WebCore/CSSImportRule.h>
#include <WebCore/CSSMediaRule.h>
#include <WebCore/CSSPageRule.h>
#include <WebCore/CSSPrimitiveValue.h>
#include <WebCore/CSSRule.h>
#include <WebCore/CSSRuleList.h>
#include <WebCore/CSSStyleDeclaration.h>
#include <WebCore/CSSStyleRule.h>
#include <WebCore/CSSStyleSheet.h>
#include <WebCore/CSSValueList.h>
#include <WebCore/StyleSheet.h>
#include <WebCore/DOMImplementation.h>
#include <WebCore/NamedNodeMap.h>
#include <WebCore/NodeList.h>
#include <WebCore/Counter.h>
#include <WebCore/CSSRuleList.h>
#include <WebCore/CSSStyleDeclaration.h>
#include <WebCore/MediaList.h>
#include <WebCore/Rect.h>
#include <WebCore/StyleSheet.h>
#include <WebCore/StyleSheetList.h>
#include <WebCore/Event.h>
#include <WebCore/EventListener.h>
#pragma warning(pop)
typedef HashMap<void*, GEN_DOMObject*> DOMWrapperCache;
static DOMWrapperCache& domWrapperCache()
{
static DOMWrapperCache cache;
return cache;
}
GEN_DOMObject* getDOMWrapper(void* objectHandle)
{
return domWrapperCache().get(objectHandle);
}
void setDOMWrapper(void* objectHandle, GEN_DOMObject* wrapper)
{
domWrapperCache().set(objectHandle, wrapper);
}
void removeDOMWrapper(void* objectHandle)
{
domWrapperCache().remove(objectHandle);
}
#define COM_DOM_PREFIX(Type) GEN_DOM##Type
#define CREATE_ONLY_SELF(Type) \
COM_DOM_PREFIX(Type)* COM_DOM_PREFIX(Type)::createInstance(WebCore::Type* impl) \
{ \
if (!impl) \
return 0; \
if (GEN_DOMObject* cachedInstance = getDOMWrapper(impl)) { \
cachedInstance->AddRef(); \
return static_cast<COM_DOM_PREFIX(Type)*>(cachedInstance); \
} \
COMPtr<COM_DOM_PREFIX(Type)> comDOMObject = new COM_DOM_PREFIX(Type)(impl); \
setDOMWrapper(impl, comDOMObject.get()); \
return comDOMObject.releaseRef(); \
} \
// Core
GEN_DOMNode* GEN_DOMNode::createInstance(WebCore::Node* node)
{
if (!node)
return 0;
if (GEN_DOMObject* cachedInstance = getDOMWrapper(node)) {
cachedInstance->AddRef();
return static_cast<GEN_DOMNode*>(cachedInstance);
}
COMPtr<GEN_DOMNode> domNode;
switch (node->nodeType()) {
case WebCore::Node::ELEMENT_NODE:
// FIXME: add support for creating subclasses of HTMLElement.
// FIXME: add support for creating SVGElements and its subclasses.
if (node->isHTMLElement())
domNode = new GEN_DOMHTMLElement(static_cast<WebCore::HTMLElement*>(node));
else
domNode = new GEN_DOMElement(static_cast<WebCore::Element*>(node));
break;