WebCore:
authorweinig <weinig@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Sep 2006 03:30:49 +0000 (03:30 +0000)
committerweinig <weinig@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Sep 2006 03:30:49 +0000 (03:30 +0000)
        Reviewed by Tim H.

        Patch for http://bugzilla.opendarwin.org/show_bug.cgi?id=10870
        Auto-generate DOMNode for the Objective-C bindings

        * DerivedSources.make:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/objc/DOM.mm:
        (-[DOMNode boundingBox]):
        (-[DOMNode lineBoxRects]):
        * bindings/objc/DOMEvents.h:
        * bindings/objc/DOMExtensions.h:
        * bindings/objc/DOMNode.h: Removed.
        * bindings/objc/DOMNode.mm: Removed.
        * bindings/objc/PublicDOMInterfaces.h:
        * bindings/scripts/CodeGeneratorObjC.pm:
        * dom/Node.idl:

WebKit:

        Reviewed by Tim H.

        Patch for http://bugzilla.opendarwin.org/show_bug.cgi?id=10870
        Auto-generate DOMNode for the Objective-C bindings

        * MigrateHeaders.make:

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

13 files changed:
WebCore/ChangeLog
WebCore/DerivedSources.make
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/objc/DOM.mm
WebCore/bindings/objc/DOMEvents.h
WebCore/bindings/objc/DOMExtensions.h
WebCore/bindings/objc/DOMNode.h [deleted file]
WebCore/bindings/objc/DOMNode.mm [deleted file]
WebCore/bindings/objc/PublicDOMInterfaces.h
WebCore/bindings/scripts/CodeGeneratorObjC.pm
WebCore/dom/Node.idl
WebKit/ChangeLog
WebKit/MigrateHeaders.make

index 76db5c77ed78bbe9d3e05c3d14d6bac1be1de157..23b66925ce8a2f256ea94cab1fd351e25a3d49a9 100644 (file)
@@ -1,3 +1,23 @@
+2006-09-15  Sam Weinig  <sam.weinig@gmail.com>
+
+        Reviewed by Tim H.
+
+        Patch for http://bugzilla.opendarwin.org/show_bug.cgi?id=10870
+        Auto-generate DOMNode for the Objective-C bindings
+
+        * DerivedSources.make:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/objc/DOM.mm:
+        (-[DOMNode boundingBox]):
+        (-[DOMNode lineBoxRects]):
+        * bindings/objc/DOMEvents.h:
+        * bindings/objc/DOMExtensions.h:
+        * bindings/objc/DOMNode.h: Removed.
+        * bindings/objc/DOMNode.mm: Removed.
+        * bindings/objc/PublicDOMInterfaces.h:
+        * bindings/scripts/CodeGeneratorObjC.pm:
+        * dom/Node.idl:
+
 2006-09-15  Timothy Hatcher  <timothy@apple.com>
 
         Reviewed by Justin.
index 4a869fb594e88bc573f6de133d7266b8e5d3103b..c60fa37fb08ebe5e93fa1f444b2e09d024672c94 100644 (file)
@@ -128,6 +128,7 @@ all : \
     DOMMouseEvent.h \
     DOMMutationEvent.h \
     DOMNamedNodeMap.h \
+    DOMNode.h \
     DOMNodeIterator.h \
     DOMNodeList.h \
     DOMNotation.h \
index fbaa2fb4bceaa83150d310d632b8c36e2e54db8e..c044de8f001bd83c7dae39ea8576c8513a8b0023 100644 (file)
                852B9E880AA79C47002ADA6E /* DOMHTMLAppletElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 852B9E840AA79C47002ADA6E /* DOMHTMLAppletElement.mm */; };
                852B9E890AA79C47002ADA6E /* DOMHTMLOptionElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 852B9E850AA79C47002ADA6E /* DOMHTMLOptionElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
                852B9E8A0AA79C47002ADA6E /* DOMHTMLOptionElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 852B9E860AA79C47002ADA6E /* DOMHTMLOptionElement.mm */; };
+               853BF4DB0ABB6B55008647BB /* DOMNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 853BF4D90ABB6B55008647BB /* DOMNode.h */; };
+               853BF4DC0ABB6B55008647BB /* DOMNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 853BF4DA0ABB6B55008647BB /* DOMNode.mm */; };
+               853BF4EB0ABB6E97008647BB /* DOMNodePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 853BF4EA0ABB6E97008647BB /* DOMNodePrivate.h */; };
+               853BF4EC0ABB6EB9008647BB /* DOMNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 853BF4D90ABB6B55008647BB /* DOMNode.h */; };
+               853BF4ED0ABB6EB9008647BB /* DOMNodePrivate.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 853BF4EA0ABB6E97008647BB /* DOMNodePrivate.h */; };
                854FE7300A2297BE0058D7AD /* NodeFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 854FE7260A2297BE0058D7AD /* NodeFilter.cpp */; };
                854FE7310A2297BE0058D7AD /* NodeFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 854FE7270A2297BE0058D7AD /* NodeFilter.h */; };
                854FE7320A2297BE0058D7AD /* NodeFilterCondition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 854FE7280A2297BE0058D7AD /* NodeFilterCondition.cpp */; };
                85526CD20AB0B7D9000302EA /* DOMTreeWalker.h in Headers */ = {isa = PBXBuildFile; fileRef = 85526CD00AB0B7D9000302EA /* DOMTreeWalker.h */; };
                85526CD30AB0B7DA000302EA /* DOMTreeWalker.mm in Sources */ = {isa = PBXBuildFile; fileRef = 85526CD10AB0B7D9000302EA /* DOMTreeWalker.mm */; };
                85526D050AB0B979000302EA /* DOMTreeWalker.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 85526CD00AB0B7D9000302EA /* DOMTreeWalker.h */; };
-               856C89FC0A90F068005C687B /* DOMNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 856C89FA0A90F068005C687B /* DOMNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               856C89FD0A90F068005C687B /* DOMNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 856C89FB0A90F068005C687B /* DOMNode.mm */; };
                856C8AE40A912649005C687B /* DOMObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 856C8AE20A912649005C687B /* DOMObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
                856C8AE50A912649005C687B /* DOMObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 856C8AE30A912649005C687B /* DOMObject.mm */; };
                8575DF7E0AA6127E00F5DBB5 /* DOMHTMLStyleElement.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 859A9C450AA5E3BD00B694B2 /* DOMHTMLStyleElement.h */; };
                        dstPath = Versions/A/PrivateHeaders;
                        dstSubfolderSpec = 1;
                        files = (
+                               853BF4EC0ABB6EB9008647BB /* DOMNode.h in CopyFiles */,
+                               853BF4ED0ABB6EB9008647BB /* DOMNodePrivate.h in CopyFiles */,
                                85E9E0A80AB3A11900069CD0 /* DOMXPathExpression.h in CopyFiles */,
                                85E9E0A90AB3A11900069CD0 /* DOMXPathExpressionPrivate.h in CopyFiles */,
                                85E9E0AA0AB3A11900069CD0 /* DOMXPathNSResolver.h in CopyFiles */,
                852B9E840AA79C47002ADA6E /* DOMHTMLAppletElement.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMHTMLAppletElement.mm; sourceTree = "<group>"; };
                852B9E850AA79C47002ADA6E /* DOMHTMLOptionElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMHTMLOptionElement.h; sourceTree = "<group>"; };
                852B9E860AA79C47002ADA6E /* DOMHTMLOptionElement.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMHTMLOptionElement.mm; sourceTree = "<group>"; };
+               853BF4D90ABB6B55008647BB /* DOMNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMNode.h; sourceTree = "<group>"; };
+               853BF4DA0ABB6B55008647BB /* DOMNode.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMNode.mm; sourceTree = "<group>"; };
+               853BF4EA0ABB6E97008647BB /* DOMNodePrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMNodePrivate.h; sourceTree = "<group>"; };
                854FE7260A2297BE0058D7AD /* NodeFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = NodeFilter.cpp; sourceTree = "<group>"; };
                854FE7270A2297BE0058D7AD /* NodeFilter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NodeFilter.h; sourceTree = "<group>"; };
                854FE7280A2297BE0058D7AD /* NodeFilterCondition.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = NodeFilterCondition.cpp; sourceTree = "<group>"; };
                855542970AA4938800BA89F2 /* HTMLIFrameElement.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = HTMLIFrameElement.idl; sourceTree = "<group>"; };
                855542980AA4938800BA89F2 /* HTMLObjectElement.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = HTMLObjectElement.idl; sourceTree = "<group>"; };
                855542990AA4938800BA89F2 /* HTMLSelectElement.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = HTMLSelectElement.idl; sourceTree = "<group>"; };
-               856C89FA0A90F068005C687B /* DOMNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DOMNode.h; sourceTree = "<group>"; };
-               856C89FB0A90F068005C687B /* DOMNode.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMNode.mm; sourceTree = "<group>"; };
                856C8AE20A912649005C687B /* DOMObject.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMObject.h; sourceTree = "<group>"; };
                856C8AE30A912649005C687B /* DOMObject.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMObject.mm; sourceTree = "<group>"; };
                857E0B230AB043460036E447 /* DOMMouseEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMMouseEvent.h; sourceTree = "<group>"; };
                854F12AC0A8EBC18000940B5 /* Core */ = {
                        isa = PBXGroup;
                        children = (
-                               856C89FA0A90F068005C687B /* DOMNode.h */,
-                               856C89FB0A90F068005C687B /* DOMNode.mm */,
                                856C8AE20A912649005C687B /* DOMObject.h */,
                                856C8AE30A912649005C687B /* DOMObject.mm */,
                        );
                                1CFCEEE10AACC6C000348750 /* DOMNamedNodeMapPrivate.h */,
                                8518DD760A9CF31B0091B7A6 /* DOMNamedNodeMap.h */,
                                8518DD770A9CF31B0091B7A6 /* DOMNamedNodeMap.mm */,
+                               853BF4EA0ABB6E97008647BB /* DOMNodePrivate.h */,
+                               853BF4D90ABB6B55008647BB /* DOMNode.h */,
+                               853BF4DA0ABB6B55008647BB /* DOMNode.mm */,
                                85ACAA890A9B759C00671E90 /* DOMNodeList.h */,
                                85ACAA8A0A9B759C00671E90 /* DOMNodeList.mm */,
                                85CA96E80A9624E900690CCF /* DOMNotation.h */,
                                BCAA90A00A7EB03A008B1229 /* PlatformScrollBar.h in Headers */,
                                85EC9AFA0A71A2C600EEEAED /* FontData.h in Headers */,
                                85EC9AFB0A71A2C600EEEAED /* Language.h in Headers */,
-                               856C89FC0A90F068005C687B /* DOMNode.h in Headers */,
                                856C8AE40A912649005C687B /* DOMObject.h in Headers */,
                                85CA96B80A9621A600690CCF /* DOMEntity.h in Headers */,
                                85CA96EA0A9624E900690CCF /* DOMNotation.h in Headers */,
                                B222F6990AB771950022EFAD /* JSSVGAngle.h in Headers */,
                                B222F69D0AB771B80022EFAD /* JSSVGElement.h in Headers */,
                                B20111080AB7740500DB0E68 /* JSSVGAElement.h in Headers */,
+                               853BF4DB0ABB6B55008647BB /* DOMNode.h in Headers */,
+                               853BF4EB0ABB6E97008647BB /* DOMNodePrivate.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
-                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
                        productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
                        projectDirPath = "";
                        projectRoot = "";
-                       shouldCheckCompatibility = 1;
                        targets = (
                                93F198A508245E59001E9ABC /* WebCore */,
                                DD041FBE09D9DDBE0010AF2A /* Derived Sources */,
                                BCAA90C30A7EBA60008B1229 /* ScrollBar.cpp in Sources */,
                                93B0FD8A0A759BED0080AD44 /* StringImplMac.mm in Sources */,
                                93B0FD8B0A759BED0080AD44 /* StringMac.mm in Sources */,
-                               856C89FD0A90F068005C687B /* DOMNode.mm in Sources */,
                                856C8AE50A912649005C687B /* DOMObject.mm in Sources */,
                                85CA96B90A9621A600690CCF /* DOMEntity.mm in Sources */,
                                85CA96EB0A9624E900690CCF /* DOMNotation.mm in Sources */,
                                B222F6980AB771950022EFAD /* JSSVGAngle.cpp in Sources */,
                                B222F69C0AB771B80022EFAD /* JSSVGElement.cpp in Sources */,
                                B20111070AB7740500DB0E68 /* JSSVGAElement.cpp in Sources */,
+                               853BF4DC0ABB6B55008647BB /* DOMNode.mm in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index c4ba0e5031656bbff19eb36f1b6eb4abfc082cfa..a7130dc595dc12a94d7b70ed0f52b95cc3b694fa 100644 (file)
@@ -399,6 +399,33 @@ static Class elementClass(const AtomicString& tagName)
 
 @end
 
+@implementation DOMNode (DOMNodeExtensions)
+
+- (NSRect)boundingBox
+{
+    WebCore::RenderObject *renderer = [self _node]->renderer();
+    if (renderer)
+        return renderer->absoluteBoundingBoxRect();
+    return NSZeroRect;
+}
+
+- (NSArray *)lineBoxRects
+{
+    WebCore::RenderObject *renderer = [self _node]->renderer();
+    if (renderer) {
+        Vector<WebCore::IntRect> rects;
+        renderer->lineBoxRects(rects);
+        size_t size = rects.size();
+        NSMutableArray *results = [NSMutableArray arrayWithCapacity:size];
+        for (size_t i = 0; i < size; ++i)
+            [results addObject:[NSValue valueWithRect:rects[i]]];
+        return results;
+    }
+    return nil;
+}
+
+@end
+
 // FIXME: this should be auto-genenerate in DOMNode.mm
 @implementation DOMNode (DOMEventTarget)
 
index 4a3952aeaec659f40aa28ff711a270427c74ad64..8c715611cfea38b6c8bf5d11c0923ee908ae8841 100644 (file)
@@ -48,3 +48,6 @@ enum DOMEventExceptionCode {
 @interface DOMKeyboardEvent (NonStandardAdditions)
 - (BOOL)getModifierState:(NSString *)keyIdentifierArg;
 @end
+
+@interface DOMNode (DOMEventTarget) <DOMEventTarget>
+@end
index 7b2358e4095946c12cfaf26cc68d48bf0f556d95..0f9853e6891b7d046004c5b9cbf4a39aff547f97 100644 (file)
 
 @class NSImage;
 
+@interface DOMNode (DOMNodeExtensions)
+- (NSRect)boundingBox;
+- (NSArray *)lineBoxRects;
+@end
+
 @interface DOMDocument (DOMDocumentCSSExtensions)
 - (DOMCSSRuleList *)getMatchedCSSRules:(DOMElement *)elt :(NSString *)pseudoElt;
 @end
diff --git a/WebCore/bindings/objc/DOMNode.h b/WebCore/bindings/objc/DOMNode.h
deleted file mode 100644 (file)
index ccdb630..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2004, 2006 Apple Computer, Inc.  All rights reserved.
- * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 COMPUTER, INC. OR
- * 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. 
- */
-
-#import <WebCore/DOMObject.h>
-#import <WebCore/DOMEventTarget.h>
-
-@class DOMDocument; 
-@class DOMNamedNodeMap;
-@class DOMNodeList;
-
-// DOM node types
-enum {
-    DOM_ELEMENT_NODE                  = 1,
-    DOM_ATTRIBUTE_NODE                = 2,
-    DOM_TEXT_NODE                     = 3,
-    DOM_CDATA_SECTION_NODE            = 4,
-    DOM_ENTITY_REFERENCE_NODE         = 5,
-    DOM_ENTITY_NODE                   = 6,
-    DOM_PROCESSING_INSTRUCTION_NODE   = 7,
-    DOM_COMMENT_NODE                  = 8,
-    DOM_DOCUMENT_NODE                 = 9,
-    DOM_DOCUMENT_TYPE_NODE            = 10,
-    DOM_DOCUMENT_FRAGMENT_NODE        = 11,
-    DOM_NOTATION_NODE                 = 12
-};
-
-@interface DOMNode : DOMObject
-- (NSString *)nodeName;
-- (NSString *)nodeValue;
-- (void)setNodeValue:(NSString *)string;
-- (unsigned short)nodeType;
-- (DOMNode *)parentNode;
-- (DOMNodeList *)childNodes;
-- (DOMNode *)firstChild;
-- (DOMNode *)lastChild;
-- (DOMNode *)previousSibling;
-- (DOMNode *)nextSibling;
-- (DOMNamedNodeMap *)attributes;
-- (DOMDocument *)ownerDocument;
-- (DOMNode *)insertBefore:(DOMNode *)newChild :(DOMNode *)refChild;
-- (DOMNode *)replaceChild:(DOMNode *)newChild :(DOMNode *)oldChild;
-- (DOMNode *)removeChild:(DOMNode *)oldChild;
-- (DOMNode *)appendChild:(DOMNode *)newChild;
-- (BOOL)hasChildNodes;
-- (DOMNode *)cloneNode:(BOOL)deep;
-- (void)normalize;
-- (BOOL)isSupported:(NSString *)feature :(NSString *)version;
-- (NSString *)namespaceURI;
-- (NSString *)prefix;
-- (void)setPrefix:(NSString *)prefix;
-- (NSString *)localName;
-- (BOOL)hasAttributes;
-- (BOOL)isSameNode:(DOMNode *)other;
-- (BOOL)isEqualNode:(DOMNode *)other;
-- (NSString *)textContent;
-- (void)setTextContent:(NSString *)text;
-@end
-
-@interface DOMNode (DOMNodeExtensions)
-- (NSRect)boundingBox;
-- (NSArray *)lineBoxRects;
-@end
-
-@interface DOMNode (DOMEventTarget) <DOMEventTarget>
-@end
diff --git a/WebCore/bindings/objc/DOMNode.mm b/WebCore/bindings/objc/DOMNode.mm
deleted file mode 100644 (file)
index 960b3d4..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Copyright (C) 2004-2006 Apple Computer, Inc.  All rights reserved.
- * Copyright (C) 2006 James G. Speth <speth@end.com>
- * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 COMPUTER, INC. OR
- * 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. 
- */
-
-#import "config.h"
-#import "DOMNode.h"
-
-#import "AtomicString.h"
-#import "DOMDocument.h"
-#import "DOMInternal.h"
-#import "DOMNamedNodeMap.h"
-#import "DOMNodeList.h"
-#import "IntRect.h"
-#import "NamedAttrMap.h"
-#import "NamedNodeMap.h"
-#import "Node.h"
-#import "NodeList.h"
-#import "PlatformString.h"
-#import "RenderObject.h"
-#import <wtf/Assertions.h>
-#import <wtf/Vector.h>
-
-@implementation DOMNode
-
-#define IMPL reinterpret_cast<WebCore::Node*>(_internal)
-
-- (void)dealloc
-{
-    if (_internal)
-        IMPL->deref();
-    [super dealloc];
-}
-
-- (void)finalize
-{
-    if (_internal)
-        IMPL->deref();
-    [super finalize];
-}
-
-- (NSString *)nodeName
-{
-    return IMPL->nodeName();
-}
-
-- (NSString *)nodeValue
-{
-    // Documentation says we can raise a DOMSTRING_SIZE_ERR.
-    // However, the lower layer does not report that error up to us.
-    return IMPL->nodeValue();
-}
-
-- (void)setNodeValue:(NSString *)string
-{
-    ASSERT(string);
-    
-    WebCore::ExceptionCode ec = 0;
-    IMPL->setNodeValue(string, ec);
-    raiseOnDOMError(ec);
-}
-
-- (unsigned short)nodeType
-{
-    return IMPL->nodeType();
-}
-
-- (DOMNode *)parentNode
-{
-    return [DOMNode _nodeWith:IMPL->parentNode()];
-}
-
-- (DOMNodeList *)childNodes
-{
-    return [DOMNodeList _nodeListWith:IMPL->childNodes().get()];
-}
-
-- (DOMNode *)firstChild
-{
-    return [DOMNode _nodeWith:IMPL->firstChild()];
-}
-
-- (DOMNode *)lastChild
-{
-    return [DOMNode _nodeWith:IMPL->lastChild()];
-}
-
-- (DOMNode *)previousSibling
-{
-    return [DOMNode _nodeWith:IMPL->previousSibling()];
-}
-
-- (DOMNode *)nextSibling
-{
-    return [DOMNode _nodeWith:IMPL->nextSibling()];
-}
-
-- (DOMNamedNodeMap *)attributes
-{
-    return [DOMNamedNodeMap _namedNodeMapWith:IMPL->attributes()];
-}
-
-- (DOMDocument *)ownerDocument
-{
-    return [DOMDocument _documentWith:IMPL->document()];
-}
-
-- (DOMNode *)insertBefore:(DOMNode *)newChild :(DOMNode *)refChild
-{
-    ASSERT(newChild);
-    ASSERT(refChild);
-
-    WebCore::ExceptionCode ec = 0;
-    if (IMPL->insertBefore([newChild _node], [refChild _node], ec))
-        return newChild;
-    raiseOnDOMError(ec);
-    return nil;
-}
-
-- (DOMNode *)replaceChild:(DOMNode *)newChild :(DOMNode *)oldChild
-{
-    ASSERT(newChild);
-    ASSERT(oldChild);
-
-    WebCore::ExceptionCode ec = 0;
-    if (IMPL->replaceChild([newChild _node], [oldChild _node], ec))
-        return oldChild;
-    raiseOnDOMError(ec);
-    return nil;
-}
-
-- (DOMNode *)removeChild:(DOMNode *)oldChild
-{
-    ASSERT(oldChild);
-
-    WebCore::ExceptionCode ec = 0;
-    if (IMPL->removeChild([oldChild _node], ec))
-        return oldChild;
-    raiseOnDOMError(ec);
-    return nil;
-}
-
-- (DOMNode *)appendChild:(DOMNode *)newChild
-{
-    ASSERT(newChild);
-
-    WebCore::ExceptionCode ec = 0;
-    if (IMPL->appendChild([newChild _node], ec))
-        return newChild;
-    raiseOnDOMError(ec);
-    return nil;
-}
-
-- (BOOL)hasChildNodes
-{
-    return IMPL->hasChildNodes();
-}
-
-- (DOMNode *)cloneNode:(BOOL)deep
-{
-    return [DOMNode _nodeWith:IMPL->cloneNode(deep).get()];
-}
-
-- (void)normalize
-{
-    IMPL->normalize();
-}
-
-- (BOOL)isSupported:(NSString *)feature :(NSString *)version
-{
-    ASSERT(feature);
-    ASSERT(version);
-
-    return IMPL->isSupported(feature, version);
-}
-
-- (NSString *)namespaceURI
-{
-    return IMPL->namespaceURI();
-}
-
-- (NSString *)prefix
-{
-    return IMPL->prefix();
-}
-
-- (void)setPrefix:(NSString *)prefix
-{
-    ASSERT(prefix);
-
-    WebCore::ExceptionCode ec = 0;
-    IMPL->setPrefix(prefix, ec);
-    raiseOnDOMError(ec);
-}
-
-- (NSString *)localName
-{
-    return IMPL->localName();
-}
-
-- (BOOL)hasAttributes
-{
-    return IMPL->hasAttributes();
-}
-
-- (BOOL)isSameNode:(DOMNode *)other
-{
-    return IMPL->isSameNode([other _node]);
-}
-
-- (BOOL)isEqualNode:(DOMNode *)other
-{
-    return IMPL->isEqualNode([other _node]);
-}
-
-- (BOOL)isDefaultNamespace:(NSString *)namespaceURI
-{
-    return IMPL->isDefaultNamespace(namespaceURI);
-}
-
-- (NSString *)lookupPrefix:(NSString *)namespaceURI
-{
-    return IMPL->lookupPrefix(namespaceURI);
-}
-
-- (NSString *)lookupNamespaceURI:(NSString *)prefix
-{
-    return IMPL->lookupNamespaceURI(prefix);
-}
-
-- (NSString *)textContent
-{
-    return IMPL->textContent();
-}
-
-- (void)setTextContent:(NSString *)text
-{
-    WebCore::ExceptionCode ec = 0;
-    IMPL->setTextContent(text, ec);
-    raiseOnDOMError(ec);
-}
-
-@end
-
-@implementation DOMNode (DOMNodeExtensions)
-
-- (NSRect)boundingBox
-{
-    WebCore::RenderObject *renderer = IMPL->renderer();
-    if (renderer)
-        return renderer->absoluteBoundingBoxRect();
-    return NSZeroRect;
-}
-
-- (NSArray *)lineBoxRects
-{
-    WebCore::RenderObject *renderer = IMPL->renderer();
-    if (renderer) {
-        Vector<WebCore::IntRect> rects;
-        renderer->lineBoxRects(rects);
-        size_t size = rects.size();
-        NSMutableArray *results = [NSMutableArray arrayWithCapacity:size];
-        for (size_t i = 0; i < size; ++i)
-            [results addObject:[NSValue valueWithRect:rects[i]]];
-        return results;
-    }
-    return nil;
-}
-
-@end
index 34a8dcd342b5c612631a0963377ab02f9fa10886..d6c8fd057e1a2bf114bef4c217e7dcc032e6d365 100644 (file)
 //- (DOMNode *)removeNamedItemNS:(NSString *)namespaceURI localName:(NSString *)localName;
 @end
 
+@interface DOMNode : DOMObject
+@property(readonly) NSString *nodeName;
+@property NSString *nodeValue;
+@property(readonly) unsigned short nodeType;
+@property(readonly) DOMNode *parentNode;
+@property(readonly) DOMNodeList *childNodes;
+@property(readonly) DOMNode *firstChild;
+@property(readonly) DOMNode *lastChild;
+@property(readonly) DOMNode *previousSibling;
+@property(readonly) DOMNode *nextSibling;
+@property(readonly) DOMNamedNodeMap *attributes;
+@property(readonly) DOMDocument *ownerDocument;
+@property(readonly) NSString *namespaceURI;
+@property NSString *prefix;
+@property(readonly) NSString *localName;
+@property NSString *textContent;
+- (DOMNode *)insertBefore:(DOMNode *)newChild :(DOMNode *)refChild;
+//- (DOMNode *)insertBefore:(DOMNode *)newChild refChild:(DOMNode *)refChild;
+- (DOMNode *)replaceChild:(DOMNode *)newChild :(DOMNode *)oldChild;
+//- (DOMNode *)replaceChild:(DOMNode *)newChild oldChild:(DOMNode *)oldChild;
+- (DOMNode *)removeChild:(DOMNode *)oldChild;
+- (DOMNode *)appendChild:(DOMNode *)newChild;
+- (BOOL)hasChildNodes;
+- (DOMNode *)cloneNode:(BOOL)deep;
+- (void)normalize;
+- (BOOL)isSupported:(NSString *)feature :(NSString *)version;
+//- (BOOL)isSupported:(NSString *)feature version:(NSString *)version;
+- (BOOL)hasAttributes;
+- (BOOL)isSameNode:(DOMNode *)other;
+- (BOOL)isEqualNode:(DOMNode *)other;
+@end
+
 @interface DOMNodeList : DOMObject
 @property(readonly) unsigned length;
 - (DOMNode *)item:(unsigned)index;
index 393cc5c013411f17999b89ebf8967d3642af9708..bb9ffcaec3df02460aefaec545674b3d23cb2704 100644 (file)
@@ -392,13 +392,6 @@ sub AddIncludesForType
         return;
     }
 
-    # Temp DOMXPath.h
-    if ($type eq "XPathExpression" or $type eq "XPathNSResolver" or $type eq "XPathResult") {
-        $implIncludes{"DOMXPath.h"} = 1;
-        $implIncludes{"$type.h"} = 1;
-        return;
-    }
-
     # Temp DOMImplementationFront.h
     if ($type eq "DOMImplementation") {
         $implIncludes{"DOMImplementationFront.h"} = 1;
@@ -408,14 +401,17 @@ sub AddIncludesForType
 
     if ($type eq "EventTarget") {
         $implIncludes{"DOM$type.h"} = 1;
+        $implIncludes{"EventTargetNode.h"} = 1;
         return;
     }
 
     # FIXME: for some reason it won't compile without both CSSStyleDeclaration.h
     # and CSSMutableStyleDeclaration.h
-    if ($type eq "CSSStyleDeclaration") {
-        $implIncludes{"CSSMutableStyleDeclaration.h"} = 1;
-    }
+    $implIncludes{"CSSMutableStyleDeclaration.h"} = 1 if $type eq "CSSStyleDeclaration";
+
+    # FIXME: for some reason it won't compile without both NamedNodeMap.h
+    # and NamedAttrMap.h
+    $implIncludes{"NamedAttrMap.h"} = 1 if $type eq "NamedNodeMap";
 
     # Default, include the same named file (the implementation) and the same name prefixed with "DOM". 
     $implIncludes{"$type.h"} = 1;
@@ -892,6 +888,7 @@ sub GenerateImplementation
                 push(@parameterNames, $implGetter);
                 $needsCustom{"XPathNSResolver"} = $paramName if $idlType eq "XPathNSResolver";
                 $needsCustom{"EventTarget"} = $paramName if $idlType eq "EventTarget";
+                $needsCustom{"NodeToReturn"} = $paramName if $param->extendedAttributes->{"Return"};
 
                 unless ($codeGenerator->IsPrimitiveType($idlType) or IsStringType($idlType)) {
                     push(@needsAssert, "    ASSERT($paramName);\n");
@@ -926,7 +923,6 @@ sub GenerateImplementation
                 push(@functionContent, "    WebCore::EventTargetNode* ${paramName}EventTarget = (${paramName}Node && ${paramName}Node->isEventTargetNode()) ? static_cast<WebCore::EventTargetNode*>(${paramName}Node) : 0;\n\n");
                 $implIncludes{"DOMNode.h"} = 1;
                 $implIncludes{"Node.h"} = 1;
-                $implIncludes{"EventTargetNode.h"} = 1;
             }
 
             push(@parameterNames, "ec") if $raisesExceptions;
@@ -942,6 +938,21 @@ sub GenerateImplementation
                 } else {
                     push(@functionContent, "    $content;\n");
                 }
+            } elsif (defined $needsCustom{"NodeToReturn"}) {
+                # Special case the insertBefore, replaceChild, removeChild 
+                # and appendChild functions from DOMNode 
+                my $toReturn = $needsCustom{"NodeToReturn"};
+                if ($raisesExceptions) {
+                    push(@functionContent, "    $exceptionInit\n");
+                    push(@functionContent, "    if ($content)\n");
+                    push(@functionContent, "        return $toReturn;\n");
+                    push(@functionContent, "    $exceptionRaiseOnError\n");
+                    push(@functionContent, "    return nil;\n");
+                } else {
+                    push(@functionContent, "    if ($content)\n");
+                    push(@functionContent, "        return $toReturn;\n");
+                    push(@functionContent, "    return nil;\n");
+                }
             } else {
                 my $typeMaker = GetObjCTypeMaker($function->signature->type);
                 unless ($typeMaker eq "") {
@@ -1031,7 +1042,7 @@ sub GenerateImplementation
             push(@implContent, "- (id)$initWithImplName:($implClassNameWithNamespace *)impl\n");
             push(@implContent, "{\n");
             push(@implContent, "    [super _init];\n");
-            push(@implContent, "    _internal = DOM_cast<DOMObjectInternal*>(impl);\n");
+            push(@implContent, "    _internal = reinterpret_cast<DOMObjectInternal*>(impl);\n");
             push(@implContent, "    impl->ref();\n");
             push(@implContent, "    addDOMWrapper(self, impl);\n");
             push(@implContent, "    return self;\n");
index 46e1801e82cea92c84ea4e56dc5b73ec4e00fd47..028d1b9b48380a8f6e6e7670fc3855920a0077ba 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
 
 module core {
 
-    interface [LegacyParent=KJS::DOMNode, GenerateConstructor] Node {
-
-        // DOM Level 2 Core
-        
+    interface [LegacyParent=KJS::DOMNode, GenerateConstructor, ObjCNoInternal] Node {        
         // NodeType
         const unsigned short      ELEMENT_NODE                   = 1;
         const unsigned short      ATTRIBUTE_NODE                 = 2;
@@ -36,5 +34,82 @@ module core {
         const unsigned short      DOCUMENT_TYPE_NODE             = 10;
         const unsigned short      DOCUMENT_FRAGMENT_NODE         = 11;
         const unsigned short      NOTATION_NODE                  = 12;
+
+#if !defined(LANGUAGE_JAVASCRIPT)
+        readonly attribute DOMString        nodeName;
+
+                 // FIXME: the spec says this can also raise on retrieval.
+                 attribute DOMString        nodeValue
+                     setter raises(DOMException);
+
+        readonly attribute unsigned short   nodeType;
+        readonly attribute Node             parentNode;
+        readonly attribute NodeList         childNodes;
+        readonly attribute Node             firstChild;
+        readonly attribute Node             lastChild;
+        readonly attribute Node             previousSibling;
+        readonly attribute Node             nextSibling;
+        readonly attribute NamedNodeMap     attributes;
+        readonly attribute Document         ownerDocument;
+
+        [OldStyleObjC] Node insertBefore(in [Return] Node newChild, 
+                                         in Node refChild)
+            raises(DOMException);
+        [OldStyleObjC] Node replaceChild(in Node newChild, 
+                                         in [Return] Node oldChild)
+            raises(DOMException);
+        Node               removeChild(in [Return] Node oldChild)
+            raises(DOMException);
+        Node               appendChild(in [Return] Node newChild)
+            raises(DOMException);
+        boolean            hasChildNodes();
+        Node               cloneNode(in boolean deep);
+        void               normalize();
+
+        // Introduced in DOM Level 2:
+
+        [OldStyleObjC] boolean isSupported(in DOMString feature, 
+                                           in DOMString version);
+        readonly attribute DOMString        namespaceURI;
+                 attribute DOMString        prefix
+                     setter raises(DOMException);
+        readonly attribute DOMString        localName;
+        boolean            hasAttributes();
+
+        // Introduced in DOM Level 3:
+
+                 // FIXME: the spec says this can also raise on retrieval.
+                 attribute DOMString       textContent
+                     setter raises(DOMException);
+
+        boolean            isSameNode(in Node other);
+        boolean            isEqualNode(in Node other);
+        DOMString          lookupPrefix(in DOMString namespaceURI);
+        boolean            isDefaultNamespace(in DOMString namespaceURI);
+        DOMString          lookupNamespaceURI(in DOMString prefix);
+
+#if !defined(LANGUAGE_OBJECTIVE_C)
+        readonly attribute DOMString       baseURI;
+
+        // DocumentPosition
+        const unsigned short      DOCUMENT_POSITION_DISCONNECTED = 0x01;
+        const unsigned short      DOCUMENT_POSITION_PRECEDING    = 0x02;
+        const unsigned short      DOCUMENT_POSITION_FOLLOWING    = 0x04;
+        const unsigned short      DOCUMENT_POSITION_CONTAINS     = 0x08;
+        const unsigned short      DOCUMENT_POSITION_CONTAINED_BY = 0x10;
+        const unsigned short      DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
+
+        unsigned short     compareDocumentPosition(in Node other)
+            raises(DOMException);
+
+        DOMObject          getFeature(in DOMString feature, 
+                                      in DOMString version);
+        DOMUserData        setUserData(in DOMString key, 
+                                       in DOMUserData data, 
+                                       in UserDataHandler handler);
+        DOMUserData        getUserData(in DOMString key);
+#endif /* !defined(LANGUAGE_OBJECTIVE_C) */
+#endif /* !defined(LANGUAGE_JAVASCRIPT) */
     };
+
 }
index 64c87ff188454750ff4305b0b424667702021c3d..48788557415a0bfd377f1806ec73821153dc95cf 100644 (file)
@@ -1,3 +1,12 @@
+2006-09-15  Sam Weinig  <sam.weinig@gmail.com>
+
+        Reviewed by Tim H.
+
+        Patch for http://bugzilla.opendarwin.org/show_bug.cgi?id=10870
+        Auto-generate DOMNode for the Objective-C bindings
+
+        * MigrateHeaders.make:
+
 2006-09-15  Timothy Hatcher  <timothy@apple.com>
 
         Reviewed by Justin.
index d0bffa6c05f2a5d5480542c8abe2c12c843bccd1..7cef172d7bc680b37e3dcc7d7968b740cdb326ce 100644 (file)
@@ -157,6 +157,7 @@ all : \
     $(PUBLIC_HEADERS_DIR)/DOMNamedNodeMap.h \
     $(PRIVATE_HEADERS_DIR)/DOMNamedNodeMapPrivate.h \
     $(PUBLIC_HEADERS_DIR)/DOMNode.h \
+    $(PRIVATE_HEADERS_DIR)/DOMNodePrivate.h \
     $(PUBLIC_HEADERS_DIR)/DOMNodeFilter.h \
     $(PUBLIC_HEADERS_DIR)/DOMNodeIterator.h \
     $(PRIVATE_HEADERS_DIR)/DOMNodeIteratorPrivate.h \