[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

kocienda kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:27:51 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 117559f9fdf3a90f0f24f32c7871b95668d8b771
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Mar 1 17:04:26 2004 +0000

    Tests:
    
            Reviewed by Darin
    
    		Changed all Objective-C DOM classes from protocols to classes
    
            * Blot/BlotDocument.m:
            (-[BlotDocument webView:didFinishLoadForFrame:]):
    
    WebCore:
    
            Reviewed by Darin
    
            Changed all Objective-C DOM classes from protocols to classes, using
            a class cluster-like approach.
    
            * WebCore.pbproj/project.pbxproj:
            * khtml/dom/html_object.cpp: Put code in DOM namespace.
            * khtml/html/html_headimpl.cpp: Pull in entire DOM namespace in using directive to
            make up for the removal of it from htmlattrs.
            * khtml/html/htmltokenizer.cpp: Add using directives for the DOM classes used.
            * khtml/misc/htmlattrs.c:
            (getAttrName):
            * khtml/misc/htmlattrs.h:
            * khtml/misc/htmltags.c:
            (getTagName):
            * khtml/misc/makeattrs: Some changes here to avoid pulling in the entire DOM namespace.
            Explicitly use DOM namespace scoping for DOMString.
            * khtml/misc/maketags: Explicitly use DOM namespace scoping for DOMString.
            * khtml/rendering/render_form.cpp: Pull in entire DOM namespace in using directive to
            make up for the removal of it from htmlattrs.
            * kwq/DOM-compat.h:
            * kwq/DOM.h:
            * kwq/DOM.mm: Added.
            * kwq/WebCoreDOM.h: Removed.
            * kwq/WebCoreDOM.mm: Removed.
    
    WebKit:
    
            Reviewed by Darin
    
            Changed all Objective-C DOM classes from protocols to classes.
    
            * DOM.subproj/DOM-compat.h:
            * DOM.subproj/DOM.h:
            * WebCoreSupport.subproj/WebBridge.m:
            (-[WebBridge loadURL:referrer:reload:onLoadEvent:target:triggeringEvent:form:formValues:]):
            (-[WebBridge postWithURL:referrer:target:data:contentType:triggeringEvent:form:formValues:]):
            * WebView.subproj/WebFormDelegate.h:
            * WebView.subproj/WebFormDelegate.m:
            (-[WebFormDelegate frame:sourceFrame:willSubmitForm:withValues:submissionListener:]):
            * WebView.subproj/WebFrame.m:
            (-[WebFrame _loadURL:referrer:loadType:target:triggeringEvent:form:formValues:]):
            (-[WebFrame _postWithURL:referrer:target:data:contentType:triggeringEvent:form:formValues:]):
            (-[WebFormState initWithForm:values:sourceFrame:]):
            (-[WebFormState form]):
            * WebView.subproj/WebFramePrivate.h:
            * WebView.subproj/WebHTMLRepresentation.h:
            * WebView.subproj/WebHTMLRepresentation.m:
            (-[WebHTMLRepresentation DOMDocument]):
            (-[WebHTMLRepresentation setSelectionFrom:startOffset:to:endOffset:]):
            (-[WebHTMLRepresentation attributedStringFrom:startOffset:to:endOffset:]):
            (-[WebHTMLRepresentation elementWithName:inForm:]):
            (-[WebHTMLRepresentation elementForView:]):
            (-[WebHTMLRepresentation elementDoesAutoComplete:]):
            (-[WebHTMLRepresentation elementIsPassword:]):
            (-[WebHTMLRepresentation formForElement:]):
            (-[WebHTMLRepresentation controlsInForm:]):
            (-[WebHTMLRepresentation searchForLabels:beforeElement:]):
            (-[WebHTMLRepresentation matchLabels:againstElement:]):
    
    WebBrowser:
    
            Reviewed by Darin
    
            Changed all Objective-C DOM classes from protocols to classes.
    
            * BrowserWebController.m:
            (-[FormDelegate frame:sourceFrame:willSubmitForm:withValues:submissionListener:]):
            * Debug/SnippetController.m:
            (lastNode):
            (-[SnippetController loadComplete]):
            * FormCompletionController.h:
            * FormCompletionController.m:
            (+[FormCompletionController loginInfoForForm:inFrame:]):
            (+[FormCompletionController _frame:sourceFrame:willSubmitLoginForm:withValues:formInfo:submissionListener:]):
            (+[FormCompletionController _frame:sourceFrame:willSubmitRegularForm:withValues:]):
            (+[FormCompletionController frame:sourceFrame:willSubmitForm:withValues:submissionListener:]):
            (+[FormCompletionController currentFormInFrame:]):
            (+[FormCompletionController currentFrameAndForm:inWebView:]):
            (+[FormCompletionController autoFillInWebView:]):
            (+[FormCompletionController autoFillPasswordInFrame:]):
            (-[FormCompletionController initWithSourceField:frame:]):
            (-[FormCompletionController maxStringLength]):
            (+[AutoFillController autoFillerForFrame:form:create:]):
            (+[AutoFillController abMatchInFrame:form:fieldName:]):
            (+[AutoFillController isContinuationField:inFrame:form:]):
            (+[AutoFillController recordABMatch:inFrame:form:fieldName:]):
            (+[AutoFillController clearAutoFilledView:inFrame:form:]):
            (-[AutoFillController _fieldNameForAutoFillOfView:rep:]):
            (fieldLooksLikeContinuation):
            (-[AutoFillController _reflectMultiFieldMatch:inViews:currIndex:fieldName:]):
            (-[FormToABBinder abPointerForView:rep:useFieldName:foundByPageScan:]):
            * Test/AutoFillTest.m:
            (+[AutoFillTest _dumpFormState:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6135 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 288d84e..342feb4 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,31 @@
+2004-03-01  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by Darin
+
+        Changed all Objective-C DOM classes from protocols to classes, using
+        a class cluster-like approach.
+
+        * WebCore.pbproj/project.pbxproj:
+        * khtml/dom/html_object.cpp: Put code in DOM namespace.
+        * khtml/html/html_headimpl.cpp: Pull in entire DOM namespace in using directive to
+        make up for the removal of it from htmlattrs.
+        * khtml/html/htmltokenizer.cpp: Add using directives for the DOM classes used.
+        * khtml/misc/htmlattrs.c:
+        (getAttrName):
+        * khtml/misc/htmlattrs.h: 
+        * khtml/misc/htmltags.c:
+        (getTagName):
+        * khtml/misc/makeattrs: Some changes here to avoid pulling in the entire DOM namespace.
+        Explicitly use DOM namespace scoping for DOMString.
+        * khtml/misc/maketags: Explicitly use DOM namespace scoping for DOMString.
+        * khtml/rendering/render_form.cpp: Pull in entire DOM namespace in using directive to
+        make up for the removal of it from htmlattrs.
+        * kwq/DOM-compat.h:
+        * kwq/DOM.h:
+        * kwq/DOM.mm: Added.
+        * kwq/WebCoreDOM.h: Removed.
+        * kwq/WebCoreDOM.mm: Removed.
+
 2004-02-26  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by John.
diff --git a/WebCore/WebCore.pbproj/project.pbxproj b/WebCore/WebCore.pbproj/project.pbxproj
index 4f7ea59..86e2aed 100644
--- a/WebCore/WebCore.pbproj/project.pbxproj
+++ b/WebCore/WebCore.pbproj/project.pbxproj
@@ -467,7 +467,6 @@
 				F58785D902DE375901EA4122,
 				F5B2A4FE02E2220F018635CB,
 				F58785DB02DE375901EA4122,
-				F565A2740352509B01A80180,
 				F56234E103026D7301629B47,
 				F58785DE02DE375901EA4122,
 				F5517DC4031AB56301A80180,
@@ -514,10 +513,11 @@
 				BC7E782205C5EB700088A50F,
 				BC3B364905C9D5E200E42902,
 				BC3B364A05C9D5E200E42902,
-				BE16801905EDB91A00B87935,
 				BE16801A05EDB91A00B87935,
 				BE9185E105EE59B80081354D,
 				BE9185E205EE59B80081354D,
+				BE94EB6605EFFE6B0032DCB5,
+				BE94EB6705EFFE6B0032DCB5,
 			);
 			isa = PBXHeadersBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -790,9 +790,9 @@
 				BC7FDE3305C1D9AB0070A902,
 				BC3B364805C9D5E200E42902,
 				BC433AD005D3046F003A5A14,
-				BE16801C05EDBAC000B87935,
 				BE9185E305EE59B80081354D,
 				BE9185E405EE59B80081354D,
+				BE94EB6805EFFE6B0032DCB5,
 			);
 			isa = PBXSourcesBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -2505,14 +2505,6 @@
 //BE2
 //BE3
 //BE4
-		BE16801705EDB91A00B87935 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			path = DOM.h;
-			refType = 4;
-			sourceTree = "<group>";
-		};
 		BE16801805EDB91A00B87935 = {
 			fileEncoding = 30;
 			isa = PBXFileReference;
@@ -2521,32 +2513,12 @@
 			refType = 4;
 			sourceTree = "<group>";
 		};
-		BE16801905EDB91A00B87935 = {
-			fileRef = BE16801705EDB91A00B87935;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
 		BE16801A05EDB91A00B87935 = {
 			fileRef = BE16801805EDB91A00B87935;
 			isa = PBXBuildFile;
 			settings = {
 			};
 		};
-		BE16801B05EDBAC000B87935 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.cpp.objcpp;
-			path = WebCoreDOM.mm;
-			refType = 4;
-			sourceTree = "<group>";
-		};
-		BE16801C05EDBAC000B87935 = {
-			fileRef = BE16801B05EDBAC000B87935;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
 		BE26F15305517DE000BFA0C3 = {
 			fileEncoding = 30;
 			isa = PBXFileReference;
@@ -2638,6 +2610,48 @@
 			settings = {
 			};
 		};
+		BE94EB6305EFFE6B0032DCB5 = {
+			fileEncoding = 30;
+			isa = PBXFileReference;
+			lastKnownFileType = sourcecode.c.h;
+			path = DOM.h;
+			refType = 4;
+			sourceTree = "<group>";
+		};
+		BE94EB6405EFFE6B0032DCB5 = {
+			fileEncoding = 30;
+			isa = PBXFileReference;
+			lastKnownFileType = sourcecode.c.h;
+			path = DOMInternal.h;
+			refType = 4;
+			sourceTree = "<group>";
+		};
+		BE94EB6505EFFE6B0032DCB5 = {
+			fileEncoding = 30;
+			isa = PBXFileReference;
+			lastKnownFileType = sourcecode.cpp.objcpp;
+			path = DOM.mm;
+			refType = 4;
+			sourceTree = "<group>";
+		};
+		BE94EB6605EFFE6B0032DCB5 = {
+			fileRef = BE94EB6305EFFE6B0032DCB5;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
+		BE94EB6705EFFE6B0032DCB5 = {
+			fileRef = BE94EB6405EFFE6B0032DCB5;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
+		BE94EB6805EFFE6B0032DCB5 = {
+			fileRef = BE94EB6505EFFE6B0032DCB5;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
 		BE983D95052A2E0A00892D85 = {
 			fileEncoding = 30;
 			isa = PBXFileReference;
@@ -6207,33 +6221,16 @@
 		};
 		F565A2700352410501A80180 = {
 			children = (
-				BE16801705EDB91A00B87935,
+				BE94EB6305EFFE6B0032DCB5,
+				BE94EB6505EFFE6B0032DCB5,
+				BE94EB6405EFFE6B0032DCB5,
 				BE16801805EDB91A00B87935,
-				F565A2730352509B01A80180,
-				BE16801B05EDBAC000B87935,
 			);
 			isa = PBXGroup;
 			name = DOM;
 			refType = 4;
 			sourceTree = "<group>";
 		};
-		F565A2730352509B01A80180 = {
-			fileEncoding = 4;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			path = WebCoreDOM.h;
-			refType = 4;
-			sourceTree = "<group>";
-		};
-		F565A2740352509B01A80180 = {
-			fileRef = F565A2730352509B01A80180;
-			isa = PBXBuildFile;
-			settings = {
-				ATTRIBUTES = (
-					Private,
-				);
-			};
-		};
 		F565AE8502ECA583018635CA = {
 			fileEncoding = 30;
 			isa = PBXFileReference;
diff --git a/WebCore/khtml/dom/html_object.cpp b/WebCore/khtml/dom/html_object.cpp
index 3db75f1..9e1f939 100644
--- a/WebCore/khtml/dom/html_object.cpp
+++ b/WebCore/khtml/dom/html_object.cpp
@@ -25,6 +25,8 @@
 #include "html/html_objectimpl.h"
 #include "misc/htmlhashes.h"
 
+namespace DOM {
+
 HTMLAppletElement::HTMLAppletElement() : HTMLElement()
 {
 }
@@ -488,3 +490,4 @@ void HTMLParamElement::setValueType( const DOMString &value )
     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_VALUETYPE, value);
 }
 
+} // namespace DOM
diff --git a/WebCore/khtml/html/html_headimpl.cpp b/WebCore/khtml/html/html_headimpl.cpp
index e608bb6..0d1b047 100644
--- a/WebCore/khtml/html/html_headimpl.cpp
+++ b/WebCore/khtml/html/html_headimpl.cpp
@@ -41,6 +41,7 @@
 #include <kurl.h>
 #include <kdebug.h>
 
+using namespace DOM;
 using namespace khtml;
 
 HTMLBaseElementImpl::HTMLBaseElementImpl(DocumentPtr *doc)
diff --git a/WebCore/khtml/html/htmltokenizer.cpp b/WebCore/khtml/html/htmltokenizer.cpp
index 5efada7..3c280f0 100644
--- a/WebCore/khtml/html/htmltokenizer.cpp
+++ b/WebCore/khtml/html/htmltokenizer.cpp
@@ -57,6 +57,16 @@
 #include <kdebug.h>
 #include <stdlib.h>
 
+using DOM::AtomicString;
+using DOM::AttributeImpl;
+using DOM::DOMString;
+using DOM::DOMStringImpl;
+using DOM::DocumentImpl;
+using DOM::FORBIDDEN;
+using DOM::Node;
+using DOM::emptyAtom;
+using DOM::endTag;
+
 // turn off inlining to void warning with newer gcc
 #undef __inline
 #define __inline
diff --git a/WebCore/khtml/misc/htmlattrs.c b/WebCore/khtml/misc/htmlattrs.c
index 2fdee55..485f65d 100644
--- a/WebCore/khtml/misc/htmlattrs.c
+++ b/WebCore/khtml/misc/htmlattrs.c
@@ -568,7 +568,7 @@ static const char * const attrList[] = {
     "Z-INDEX",
     0
 };
-DOMString getAttrName(unsigned short id)
+DOM::DOMString getAttrName(unsigned short id)
 {
     return attrList[id-1];
 };
diff --git a/WebCore/khtml/misc/htmlattrs.h b/WebCore/khtml/misc/htmlattrs.h
index 877aef9..c6abbbf 100644
--- a/WebCore/khtml/misc/htmlattrs.h
+++ b/WebCore/khtml/misc/htmlattrs.h
@@ -6,7 +6,6 @@ htmlattrs.in by makeattrs, do not edit */
 #define HTML_ATTRS_H
 
 #include "dom/dom_string.h"
-using namespace DOM;
 
 #define ATTR_ABBR 1
 #define ATTR_ACCEPT_CHARSET 2
@@ -165,6 +164,6 @@ using namespace DOM;
 #define ATTR_WRAP 155
 #define ATTR_Z_INDEX 156
 #define ATTR_LAST_ATTR 156
-DOMString getAttrName(unsigned short id);
+DOM::DOMString getAttrName(unsigned short id);
 
 #endif
diff --git a/WebCore/khtml/misc/htmltags.c b/WebCore/khtml/misc/htmltags.c
index 850a3e1..86aa4a9 100644
--- a/WebCore/khtml/misc/htmltags.c
+++ b/WebCore/khtml/misc/htmltags.c
@@ -507,8 +507,8 @@ static const char * const tagList[] = {
     "/XMP",
     0
 };
-DOMString getTagName(unsigned short id)
+DOM::DOMString getTagName(unsigned short id)
 {
     if(id > ID_CLOSE_TAG*2) id = ID_CLOSE_TAG+1;
-    return DOMString(tagList[id]);
+    return DOM::DOMString(tagList[id]);
 };
diff --git a/WebCore/khtml/misc/makeattrs b/WebCore/khtml/misc/makeattrs
index d707b48..7732a37 100644
--- a/WebCore/khtml/misc/makeattrs
+++ b/WebCore/khtml/misc/makeattrs
@@ -35,7 +35,7 @@ print out "%{\n/* This file is automatically generated from
 print out "struct attrs {\n    const char *name;\n    int id;\n};\n%%\n";
 
 print header "/* This file is automatically generated from
-htmlattrs.in by makeattrs, do not edit */\n/* Copyright 1999 Lars Knoll */\n\n#ifndef HTML_ATTRS_H\n#define HTML_ATTRS_H\n\n#include \"dom/dom_string.h\"\nusing namespace DOM;\n\n";
+htmlattrs.in by makeattrs, do not edit */\n/* Copyright 1999 Lars Knoll */\n\n#ifndef HTML_ATTRS_H\n#define HTML_ATTRS_H\n\n#include \"dom/dom_string.h\"\n\n";
 
 $num = 0;
 while (<IN>) {
@@ -57,7 +57,7 @@ print header "#define ATTR_LAST_ATTR $num\n";
 print out "%%\n";
 close out;
 
-print header "DOMString getAttrName(unsigned short id);\n";
+print header "DOM::DOMString getAttrName(unsigned short id);\n";
 
 print header "\n#endif\n";
 close header;
@@ -76,7 +76,7 @@ while(defined ($line = shift @a))
     print OUT $line."\n";
 }
 print OUT "    0\n};\n";
-print OUT "DOMString getAttrName(unsigned short id)\n{\n";
+print OUT "DOM::DOMString getAttrName(unsigned short id)\n{\n";
 print OUT "    return attrList[id-1];\n";
 print OUT "};\n";
 
diff --git a/WebCore/khtml/misc/maketags b/WebCore/khtml/misc/maketags
index 6b55bb4..7dccd59 100644
--- a/WebCore/khtml/misc/maketags
+++ b/WebCore/khtml/misc/maketags
@@ -85,7 +85,7 @@ while(defined ($line = shift @b))
     print OUT $line."\n";
 }
 print OUT "    0\n};\n";
-print OUT "DOMString getTagName(unsigned short id)\n{\n";
+print OUT "DOM::DOMString getTagName(unsigned short id)\n{\n";
 print OUT "    if(id > ID_CLOSE_TAG*2) id = ID_CLOSE_TAG+1;\n";
-print OUT "    return DOMString(tagList[id]);\n";
+print OUT "    return DOM::DOMString(tagList[id]);\n";
 print OUT "};\n";
diff --git a/WebCore/khtml/rendering/render_form.cpp b/WebCore/khtml/rendering/render_form.cpp
index 3ee880e..1c561d0 100644
--- a/WebCore/khtml/rendering/render_form.cpp
+++ b/WebCore/khtml/rendering/render_form.cpp
@@ -50,6 +50,7 @@
 #endif
 
 using namespace khtml;
+using namespace DOM;
 
 RenderFormElement::RenderFormElement(HTMLGenericFormElementImpl *element)
     : RenderWidget(element)
diff --git a/WebCore/kwq/DOM-compat.h b/WebCore/kwq/DOM-compat.h
index beb7f71..499408b 100644
--- a/WebCore/kwq/DOM-compat.h
+++ b/WebCore/kwq/DOM-compat.h
@@ -3,78 +3,22 @@
     Copyright 2004, Apple, Inc. All rights reserved.
 */
 
- at protocol DOMNode;
- at protocol DOMNamedNodeMap;
- at protocol DOMNodeList;
- at protocol DOMImplementation;
- at protocol DOMDocumentFragment;
- at protocol DOMDocument;
- at protocol DOMCharacterData;
- at protocol DOMAttr;
- at protocol DOMElement;
- at protocol DOMText;
- at protocol DOMComment;
- at protocol DOMCDATASection;
- at protocol DOMDocumentType;
- at protocol DOMNotation;
- at protocol DOMEntity;
- at protocol DOMEntityReference;
- at protocol DOMProcessingInstruction;
-
- at protocol WebDOMNode <DOMNode>
- at end
-
- at protocol WebDOMNamedNodeMap <DOMNamedNodeMap>
- at end
-
- at protocol WebDOMNodeList <DOMNodeList>
- at end
-
- at protocol WebDOMDocumentType <DOMDocumentType>
- at end
-
- at protocol WebDOMDocumentFragment <DOMDocumentFragment>
- at end
-
- at protocol WebDOMImplementation <DOMImplementation>
- at end
-
- at protocol WebDOMDocument <DOMDocument>
- at end
-
- at protocol WebDOMAttr <DOMAttr>
- at end
-
- at protocol WebDOMCharacterData <DOMCharacterData>
- at end
-
- at protocol WebDOMComment <DOMComment>
- at end
-
- at protocol WebDOMText <DOMText>
- at end
-
- at protocol WebDOMCDATASection <DOMCDATASection>
- at end
-
- at protocol WebDOMProcessingInstruction <DOMProcessingInstruction>
- at end
-
- at protocol WebDOMEntityReference <DOMEntityReference>
+//
+// To preserve source compatibility with Message.framework
+//
+ at protocol WebDOMNode
+- (NSString *)nodeName;
+- (NSString *)nodeValue;
+- (unsigned short)nodeType;
+- (BOOL)hasAttributes;
+- (id)attributes;
+- (id)firstChild;
+- (id)nextSibling;
+- (id)parentNode;
 @end
 
- at protocol WebDOMElement <DOMElement>
+ at protocol WebDOMDocument <WebDOMNode>
 @end
 
-#define WebNodeType DOMNodeType
-#define WebDOMAttr DOMAttr
-#define WebDOMComment DOMComment
-#define WebDOMCDATASection DOMCDATASection
-#define WebDOMDocument DOMDocument
-#define WebDOMElement DOMElement
-#define WebDOMEntityReference DOMEntityReference
-#define WebDOMNamedNodeMap DOMNamedNodeMap
-#define WebDOMNode DOMNode
-#define WebDOMNodeList DOMNodeList
-#define WebDOMProcessingInstruction DOMProcessingInstruction
-#define WebDOMText DOMText
+#define ELEMENT_NODE 1
+#define TEXT_NODE 3
\ No newline at end of file
diff --git a/WebCore/kwq/DOM.h b/WebCore/kwq/DOM.h
index 3d8d75b..1795c1f 100644
--- a/WebCore/kwq/DOM.h
+++ b/WebCore/kwq/DOM.h
@@ -37,36 +37,36 @@
 //=========================================================================
 
 enum DOMNodeType {
-    ELEMENT_NODE                   = 1,
-    ATTRIBUTE_NODE                 = 2,
-    TEXT_NODE                      = 3,
-    CDATA_SECTION_NODE             = 4,
-    ENTITY_REFERENCE_NODE          = 5,
-    ENTITY_NODE                    = 6,
-    PROCESSING_INSTRUCTION_NODE    = 7,
-    COMMENT_NODE                   = 8,
-    DOCUMENT_NODE                  = 9,
-    DOCUMENT_TYPE_NODE             = 10,
-    DOCUMENT_FRAGMENT_NODE         = 11,
-    NOTATION_NODE                  = 12,
+    DOMElementNodeType                   = 1,
+    DOMAttributeNodeType                 = 2,
+    DOMTextNodeType                      = 3,
+    DOMCDATASectionNodeType              = 4,
+    DOMEntityReferenceNodeType           = 5,
+    DOMEntityNodeType                    = 6,
+    DOMProcessingInstructionNodeType     = 7,
+    DOMCommentNodeType                   = 8,
+    DOMDocumentNodeType                  = 9,
+    DOMDocumentTypeNodeType              = 10,
+    DOMDocumentFragmentNodeType          = 11,
+    DOMNotationNodeType                  = 12,
 };
 
-enum DOMExceptionCode {
-    INDEX_SIZE_ERR                 = 1,
-    DOMSTRING_SIZE_ERR             = 2,
-    HIERARCHY_REQUEST_ERR          = 3,
-    WRONG_DOCUMENT_ERR             = 4,
-    INVALID_CHARACTER_ERR          = 5,
-    NO_DATA_ALLOWED_ERR            = 6,
-    NO_MODIFICATION_ALLOWED_ERR    = 7,
-    NOT_FOUND_ERR                  = 8,
-    NOT_SUPPORTED_ERR              = 9,
-    INUSE_ATTRIBUTE_ERR            = 10,
-    INVALID_STATE_ERR              = 11,
-    SYNTAX_ERR                     = 12,
-    INVALID_MODIFICATION_ERR       = 13,
-    NAMESPACE_ERR                  = 14,
-    INVALID_ACCESS_ERR             = 15,
+enum DOMErrorCode {
+    DOMIndexSizeError                 = 1,
+    DOMStringSizeError                = 2,
+    DOMHierarchyRequestError          = 3,
+    DOMWrongDocumentError             = 4,
+    DOMInvalidCharacterError          = 5,
+    DOMNoDataAllowedError             = 6,
+    DOMNoModificationAllowedError     = 7,
+    DOMNotFoundError                  = 8,
+    DOMNotSupportedError              = 9,
+    DOMInUseAttributeError            = 10,
+    DOMInvalidStateError              = 11,
+    DOMSyntaxError                    = 12,
+    DOMInvalidModificationError       = 13,
+    DOMNamespaceError                 = 14,
+    DOMInvalidAccessError             = 15,
 };
 
 extern NSString * const DOMErrorDomain;
@@ -74,45 +74,43 @@ extern NSString * const DOMErrorDomain;
 @class NSError;
 @class NSString;
 
- at protocol NSObject;
- at protocol DOMNode;
- at protocol DOMNamedNodeMap;
- at protocol DOMNodeList;
- at protocol DOMImplementation;
- at protocol DOMDocumentFragment;
- at protocol DOMDocument;
- at protocol DOMCharacterData;
- at protocol DOMAttr;
- at protocol DOMElement;
- at protocol DOMText;
- at protocol DOMComment;
- at protocol DOMCDATASection;
- at protocol DOMDocumentType;
- at protocol DOMNotation;
- at protocol DOMEntity;
- at protocol DOMEntityReference;
- at protocol DOMProcessingInstruction;
- at protocol DOMRange;
-
- at protocol DOMNode <NSObject>
+ at class DOMNode;
+ at class DOMNamedNodeMap;
+ at class DOMNodeList;
+ at class DOMDocumentFragment;
+ at class DOMDocument;
+ at class DOMCharacterData;
+ at class DOMAttr;
+ at class DOMElement;
+ at class DOMText;
+ at class DOMComment;
+ at class DOMCDATASection;
+ at class DOMDocumentType;
+ at class DOMNotation;
+ at class DOMEntity;
+ at class DOMEntityReference;
+ at class DOMProcessingInstruction;
+ at class DOMRange;
+
+ at interface DOMNode : NSObject <NSCopying>
 - (NSString *)nodeName;
 - (NSString *)nodeValue;
 - (void)setNodeValue:(NSString *)string error:(NSError **)error;
 - (unsigned short)nodeType;
-- (id <DOMNode>)parentNode;
-- (id <DOMNodeList>)childNodes;
-- (id <DOMNode>)firstChild;
-- (id <DOMNode>)lastChild;
-- (id <DOMNode>)previousSibling;
-- (id <DOMNode>)nextSibling;
-- (id <DOMNamedNodeMap>)attributes;
-- (id <DOMDocument>)ownerDocument;
-- (id <DOMNode>)insertBefore:(id <DOMNode>)newChild :(id <DOMNode>)refChild error:(NSError **)error;
-- (id <DOMNode>)replaceChild:(id <DOMNode>)newChild :(id <DOMNode>)oldChild error:(NSError **)error;
-- (id <DOMNode>)removeChild:(id <DOMNode>)oldChild error:(NSError **)error;
-- (id <DOMNode>)appendChild:(id <DOMNode>)newChild error:(NSError **)error;
+- (DOMNode *)parentNode;
+- (DOMNodeList *)childNodes;
+- (DOMNode *)firstChild;
+- (DOMNode *)lastChild;
+- (DOMNode *)previousSibling;
+- (DOMNode *)nextSibling;
+- (DOMNamedNodeMap *)attributes;
+- (DOMDocument *)ownerDocument;
+- (DOMNode *)insertBefore:(DOMNode *)newChild :(DOMNode *)refChild error:(NSError **)error;
+- (DOMNode *)replaceChild:(DOMNode *)newChild :(DOMNode *)oldChild error:(NSError **)error;
+- (DOMNode *)removeChild:(DOMNode *)oldChild error:(NSError **)error;
+- (DOMNode *)appendChild:(DOMNode *)newChild error:(NSError **)error;
 - (BOOL)hasChildNodes;
-- (id <DOMNode>)cloneNode:(BOOL)deep;
+- (DOMNode *)cloneNode:(BOOL)deep;
 - (void)normalize;
 - (BOOL)isSupported:(NSString *)feature :(NSString *)version;
 - (NSString *)namespaceURI;
@@ -121,86 +119,59 @@ extern NSString * const DOMErrorDomain;
 - (NSString *)localName;
 - (BOOL)hasAttributes;
 - (NSString *)HTMLString;
-// begin deprecated methods
-- (void)setNodeValue:(NSString *)string;
-- (id<DOMNode>)insert:(id<DOMNode>)newChild before:(id<DOMNode>)refChild;
-- (id<DOMNode>)replace:(id<DOMNode>)newChild child:(id<DOMNode>)oldChild;
-- (id<DOMNode>)removeChild:(id<DOMNode>)oldChild;
-- (id<DOMNode>)appendChild:(id<DOMNode>)newChild;
-- (void)setPrefix:(NSString *)prefix;
-// end deprecated methods
 @end
 
- at protocol DOMNamedNodeMap <NSObject>
-- (id <DOMNode>)getNamedItem:(NSString *)name;
-- (id <DOMNode>)setNamedItem:(id <DOMNode>)arg error:(NSError **)error;
-- (id <DOMNode>)removeNamedItem:(NSString *)name error:(NSError **)error;
-- (id <DOMNode>)item:(unsigned long)index;
+ at interface DOMNamedNodeMap : NSObject <NSCopying>
+- (DOMNode *)getNamedItem:(NSString *)name;
+- (DOMNode *)setNamedItem:(DOMNode *)arg error:(NSError **)error;
+- (DOMNode *)removeNamedItem:(NSString *)name error:(NSError **)error;
+- (DOMNode *)item:(unsigned long)index;
 - (unsigned long)length;
-- (id <DOMNode>)getNamedItemNS:(NSString *)namespaceURI :(NSString *)localName;
-- (id <DOMNode>)setNamedItemNS:(id <DOMNode>)arg error:(NSError **)error;
-- (id <DOMNode>)removeNamedItemNS:(NSString *)namespaceURI :(NSString *)localName error:(NSError **)error;
-// begin deprecated methods
-- (id<DOMNode>)setNamedItem:(id<DOMNode>)arg;
-- (id<DOMNode>)removeNamedItem:(NSString *)name;
-- (id<DOMNode>)setNamedItemNS:(id<DOMNode>)arg;
-- (id<DOMNode>)removeNamedItemNS:(NSString *)namespaceURI :(NSString *)localName;
-// end deprecated methods
+- (DOMNode *)getNamedItemNS:(NSString *)namespaceURI :(NSString *)localName;
+- (DOMNode *)setNamedItemNS:(DOMNode *)arg error:(NSError **)error;
+- (DOMNode *)removeNamedItemNS:(NSString *)namespaceURI :(NSString *)localName error:(NSError **)error;
 @end
 
 
- at protocol DOMNodeList <NSObject>
-- (id <DOMNode>)item:(unsigned long)index;
+ at interface DOMNodeList : NSObject <NSCopying>
+- (DOMNode *)item:(unsigned long)index;
 - (unsigned long)length;
 @end
 
 
- at protocol DOMImplementation <NSObject>
+ at interface DOMImplementation : NSObject <NSCopying>
 - (BOOL)hasFeature:(NSString *)feature :(NSString *)version;
-- (id <DOMDocumentType>)createDocumentType:(NSString *)qualifiedName :(NSString *)publicId :(NSString *)systemId error:(NSError **)error;
-- (id <DOMDocument>)createDocument:(NSString *)namespaceURI :(NSString *)qualifiedName :(id <DOMDocumentType>)doctype error:(NSError **)error;
-// begin deprecated methods
-- (id<DOMDocumentType>)createDocumentType:(NSString *)qualifiedName :(NSString *)publicId :(NSString *)systemId :(int *)exceptionCode;
-- (id<DOMDocument>)createDocument:(NSString *)namespaceURI :(NSString *)qualifiedName :(id<DOMDocumentType>)doctype;
-// end deprecated methods
+- (DOMDocumentType *)createDocumentType:(NSString *)qualifiedName :(NSString *)publicId :(NSString *)systemId error:(NSError **)error;
+- (DOMDocument *)createDocument:(NSString *)namespaceURI :(NSString *)qualifiedName :(DOMDocumentType *)doctype error:(NSError **)error;
 @end
 
 
- at protocol DOMDocumentFragment <DOMNode>
+ at interface DOMDocumentFragment : DOMNode
 @end
 
 
- at protocol DOMDocument <DOMNode>
-- (id <DOMDocumentType>)doctype;
-- (id <DOMImplementation>)implementation;
-- (id <DOMElement>)documentElement;
-- (id <DOMElement>)createElement:(NSString *)tagName error:(NSError **)error;
-- (id <DOMDocumentFragment>)createDocumentFragment;
-- (id <DOMText>)createTextNode:(NSString *)data;
-- (id <DOMComment>)createComment:(NSString *)data;
-- (id <DOMCDATASection>)createCDATASection:(NSString *)data error:(NSError **)error;
-- (id <DOMProcessingInstruction>)createProcessingInstruction:(NSString *)target :(NSString *)data error:(NSError **)error;
-- (id <DOMAttr>)createAttribute:(NSString *)name error:(NSError **)error;
-- (id <DOMEntityReference>)createEntityReference:(NSString *)name error:(NSError **)error;
-- (id <DOMNodeList>)getElementsByTagName:(NSString *)tagname;
-- (id <DOMNode>)importNode:(id <DOMNode>)importedNode :(BOOL)deep error:(NSError **)error;
-- (id <DOMElement>)createElementNS:(NSString *)namespaceURI :(NSString *)qualifiedName error:(NSError **)error;
-- (id <DOMAttr>)createAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName error:(NSError **)error;
-- (id <DOMNodeList>)getElementsByTagNameNS:(NSString *)namespaceURI :(NSString *)localName;
-- (id <DOMElement>)getElementById:(NSString *)elementId;
-// begin deprecated methods
-- (id<DOMElement>)createElement:(NSString *)tagName;
-- (id<DOMElement>)createElementNS:(NSString *)namespaceURI :(NSString *)qualifiedName;
-- (id<DOMCDATASection>)createCDATASection:(NSString *)data;
-- (id<DOMProcessingInstruction>)createProcessingInstruction:(NSString *)target :(NSString *)data;
-- (id<DOMAttr>)createAttribute:(NSString *)name;
-- (id<DOMEntityReference>)createEntityReference:(NSString *)name;
-- (id<DOMNode>)importNode:(id<DOMNode>)importedNode :(BOOL)deep;
-// end deprecated methods
+ at interface DOMDocument : DOMNode
+- (DOMDocumentType *)doctype;
+- (DOMImplementation *)implementation;
+- (DOMElement *)documentElement;
+- (DOMElement *)createElement:(NSString *)tagName error:(NSError **)error;
+- (DOMDocumentFragment *)createDocumentFragment;
+- (DOMText *)createTextNode:(NSString *)data;
+- (DOMComment *)createComment:(NSString *)data;
+- (DOMCDATASection *)createCDATASection:(NSString *)data error:(NSError **)error;
+- (DOMProcessingInstruction *)createProcessingInstruction:(NSString *)target :(NSString *)data error:(NSError **)error;
+- (DOMAttr *)createAttribute:(NSString *)name error:(NSError **)error;
+- (DOMEntityReference *)createEntityReference:(NSString *)name error:(NSError **)error;
+- (DOMNodeList *)getElementsByTagName:(NSString *)tagname;
+- (DOMNode *)importNode:(DOMNode *)importedNode :(BOOL)deep error:(NSError **)error;
+- (DOMElement *)createElementNS:(NSString *)namespaceURI :(NSString *)qualifiedName error:(NSError **)error;
+- (DOMAttr *)createAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName error:(NSError **)error;
+- (DOMNodeList *)getElementsByTagNameNS:(NSString *)namespaceURI :(NSString *)localName;
+- (DOMElement *)getElementById:(NSString *)elementId;
 @end
 
 
- at protocol DOMCharacterData <DOMNode>
+ at interface DOMCharacterData : DOMNode
 - (NSString *)data;
 - (void)setData:(NSString *)data error:(NSError **)error;
 - (unsigned long)length;
@@ -209,142 +180,116 @@ extern NSString * const DOMErrorDomain;
 - (void)insertData:(unsigned long)offset :(NSString *)arg error:(NSError **)error;
 - (void)deleteData:(unsigned long)offset :(unsigned long) count error:(NSError **)error;
 - (void)replaceData:(unsigned long)offset :(unsigned long)count :(NSString *)arg error:(NSError **)error;
-// begin deprecated methods
-- (void)setData: (NSString *)data;
-- (NSString *)substringData: (unsigned long)offset :(unsigned long)count;
-- (void)appendData:(NSString *)arg;
-- (void)insertData:(unsigned long)offset :(NSString *)arg;
-- (void)deleteData:(unsigned long)offset :(unsigned long)count;
-- (void)replaceData:(unsigned long)offset :(unsigned long)count :(NSString *)arg;
-// end deprecated methods
 @end
 
 
- at protocol DOMAttr <DOMNode>
+ at interface DOMAttr : DOMNode
 - (NSString *)name;
 - (BOOL)specified;
 - (NSString *)value;
 - (void)setValue:(NSString *)value error:(NSError **)error;
-- (id <DOMElement>)ownerElement;
-// begin deprecated methods
-- (void)setValue:(NSString *)value;
-// end deprecated methods
+- (DOMElement *)ownerElement;
 @end
 
 
- at protocol DOMElement <DOMNode>
+ at interface DOMElement : DOMNode
 - (NSString *)tagName;
 - (NSString *)getAttribute:(NSString *)name;
 - (void)setAttribute:(NSString *)name :(NSString *)value error:(NSError **)error;
 - (void)removeAttribute:(NSString *)name error:(NSError **)error;
-- (id <DOMAttr>)getAttributeNode:(NSString *)name;
-- (id <DOMAttr>)setAttributeNode:(id <DOMAttr>)newAttr error:(NSError **)error;
-- (id <DOMAttr>)removeAttributeNode:(id <DOMAttr>)oldAttr error:(NSError **)error;
-- (id <DOMNodeList>)getElementsByTagName:(NSString *)name;
+- (DOMAttr *)getAttributeNode:(NSString *)name;
+- (DOMAttr *)setAttributeNode:(DOMAttr *)newAttr error:(NSError **)error;
+- (DOMAttr *)removeAttributeNode:(DOMAttr *)oldAttr error:(NSError **)error;
+- (DOMNodeList *)getElementsByTagName:(NSString *)name;
 - (NSString *)getAttributeNS:(NSString *)namespaceURI :(NSString *)localName;
 - (void)setAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName :(NSString *)value error:(NSError **)error;
 - (void)removeAttributeNS:(NSString *)namespaceURI :(NSString *)localName error:(NSError **)error;
-- (id <DOMAttr>)getAttributeNodeNS:(NSString *)namespaceURI :(NSString *)localName;
-- (id <DOMAttr>)setAttributeNodeNS:(id <DOMAttr>)newAttr error:(NSError **)error;
-- (id <DOMNodeList>)getElementsByTagNameNS:(NSString *)namespaceURI :(NSString *)localName;
+- (DOMAttr *)getAttributeNodeNS:(NSString *)namespaceURI :(NSString *)localName;
+- (DOMAttr *)setAttributeNodeNS:(DOMAttr *)newAttr error:(NSError **)error;
+- (DOMNodeList *)getElementsByTagNameNS:(NSString *)namespaceURI :(NSString *)localName;
 - (BOOL)hasAttribute:(NSString *)name;
 - (BOOL)hasAttributeNS:(NSString *)namespaceURI :(NSString *)localName;
-// begin deprecated methods
-- (void)setAttribute:(NSString *)name :(NSString *)value;
-- (void)removeAttribute:(NSString *)name;
-- (id<DOMAttr>)setAttributeNode:(id<DOMAttr>)newAttr;
-- (id<DOMAttr>)removeAttributeNode:(id<DOMAttr>)oldAttr;
-- (void)setAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName :(NSString *)value;
-- (void)removeAttributeNS:(NSString *)namespaceURI :(NSString *)localName;
-- (id<DOMAttr>)setAttributeNodeNS:(id<DOMAttr>)newAttr;
-// end deprecated methods
 @end
 
 
- at protocol DOMText <DOMCharacterData>
-- (id <DOMText>)splitText:(unsigned long)offset error:(NSError **)error;
-// begin deprecated methods
-- (id<DOMText>)splitText:(unsigned long)offset;
-// end deprecated methods
+ at interface DOMText : DOMCharacterData
+- (DOMText *)splitText:(unsigned long)offset error:(NSError **)error;
 @end
 
 
- at protocol DOMComment <DOMCharacterData>
+ at interface DOMComment : DOMCharacterData
 @end
 
 
- at protocol DOMCDATASection <DOMText>
+ at interface DOMCDATASection : DOMText
 @end
 
 
- at protocol DOMDocumentType <DOMNode>
+ at interface DOMDocumentType : DOMNode
 - (NSString *)name;
-- (id <DOMNamedNodeMap>)entities;
-- (id <DOMNamedNodeMap>)notations;
+- (DOMNamedNodeMap *)entities;
+- (DOMNamedNodeMap *)notations;
 - (NSString *)publicId;
 - (NSString *)systemId;
 - (NSString *)internalSubset;
 @end
 
 
- at protocol DOMNotation <DOMNode>
+ at interface DOMNotation : DOMNode
 - (NSString *)publicId;
 - (NSString *)systemId;
 @end
 
 
- at protocol DOMEntity <DOMNode>
+ at interface DOMEntity : DOMNode
 - (NSString *)publicId;
 - (NSString *)systemId;
 - (NSString *)notationName;
 @end
 
 
- at protocol DOMEntityReference <DOMNode>
+ at interface DOMEntityReference : DOMNode
 @end
 
 
- at protocol DOMProcessingInstruction <DOMNode>
+ at interface DOMProcessingInstruction : DOMNode
 - (NSString *)target;
 - (NSString *)data;
 - (void)setData:(NSString *)data error:(NSError **)error;
-// begin deprecated methods
-- (void)setData:(NSString *)data;
-// end deprecated methods
 @end
 
 
 enum DOMCompareHow
 {
-    START_TO_START = 0,
-    START_TO_END   = 1,
-    END_TO_END     = 2,
-    END_TO_START   = 3,
+    DOMCompareStartToStart = 0,
+    DOMCompareStartToEnd   = 1,
+    DOMCompareEndToEnd     = 2,
+    DOMCompareEndToStart   = 3,
 };
 
- at protocol DOMRange <NSObject>
-- (id <DOMNode>)startContainer:(NSError **)error;
+ at interface DOMRange : NSObject
+- (DOMNode *)startContainer:(NSError **)error;
 - (long)startOffset:(NSError **)error;
-- (id <DOMNode>)endContainer:(NSError **)error;
+- (DOMNode *)endContainer:(NSError **)error;
 - (long)endOffset:(NSError **)error;
 - (BOOL)collapsed:(NSError **)error;
-- (id <DOMNode>)commonAncestorContainer:(NSError **)error;
-- (void)setStart:(id <DOMNode>)refNode :(long)offset error:(NSError **)error;
-- (void)setEnd:(id <DOMNode>)refNode :(long)offset error:(NSError **)error;
-- (void)setStartBefore:(id <DOMNode>)refNode error:(NSError **)error;
-- (void)setStartAfter:(id <DOMNode>)refNode error:(NSError **)error;
-- (void)setEndBefore:(id <DOMNode>)refNode error:(NSError **)error;
-- (void)setEndAfter:(id <DOMNode>)refNode error:(NSError **)error;
+- (DOMNode *)commonAncestorContainer:(NSError **)error;
+- (void)setStart:(DOMNode *)refNode :(long)offset error:(NSError **)error;
+- (void)setEnd:(DOMNode *)refNode :(long)offset error:(NSError **)error;
+- (void)setStartBefore:(DOMNode *)refNode error:(NSError **)error;
+- (void)setStartAfter:(DOMNode *)refNode error:(NSError **)error;
+- (void)setEndBefore:(DOMNode *)refNode error:(NSError **)error;
+- (void)setEndAfter:(DOMNode *)refNode error:(NSError **)error;
 - (void)collapse:(BOOL)toStart error:(NSError **)error;
-- (void)selectNode:(id <DOMNode>)refNode error:(NSError **)error;
-- (void)selectNodeContents:(id <DOMNode>)refNode error:(NSError **)error;
-- (short)compareBoundaryPoints:(unsigned short)how :(id <DOMRange>)sourceRange error:(NSError **)error;
+- (void)selectNode:(DOMNode *)refNode error:(NSError **)error;
+- (void)selectNodeContents:(DOMNode *)refNode error:(NSError **)error;
+- (short)compareBoundaryPoints:(unsigned short)how :(DOMRange *)sourceRange error:(NSError **)error;
 - (void)deleteContents:(NSError **)error;
-- (id <DOMDocumentFragment>)extractContents:(NSError **)error;
-- (id <DOMDocumentFragment>)cloneContents:(NSError **)error;
-- (void)insertNode:(id <DOMNode>)newNode error:(NSError **)error;
-- (void)surroundContents:(id <DOMNode>)newParent error:(NSError **)error;
-- (id <DOMRange>)cloneRange:(NSError **)error;
+- (DOMDocumentFragment *)extractContents:(NSError **)error;
+- (DOMDocumentFragment *)cloneContents:(NSError **)error;
+- (void)insertNode:(DOMNode *)newNode error:(NSError **)error;
+- (void)surroundContents:(DOMNode *)newParent error:(NSError **)error;
+- (DOMRange *)cloneRange:(NSError **)error;
 - (NSString *)toString:(NSError **)error;
 - (void)detach:(NSError **)error;
 @end
diff --git a/WebCore/kwq/DOM.mm b/WebCore/kwq/DOM.mm
index 5f111fd..e19ea64 100644
--- a/WebCore/kwq/DOM.mm
+++ b/WebCore/kwq/DOM.mm
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2004 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -23,10 +23,13 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#import "WebCoreDOM.h"
+#import "DOM.h"
+#import "DOMInternal.h"
 
 #import <Foundation/Foundation.h>
 
+#include <objc/objc-class.h>
+
 #import <dom/dom_doc.h>
 #import <dom/dom_element.h>
 #import <dom/dom_exception.h>
@@ -58,7 +61,6 @@ using DOM::DocumentTypeImpl;
 using DOM::Document;
 using DOM::DocumentImpl;
 using DOM::DOMException;
-using DOM::DOMImplementation;
 using DOM::DOMImplementationImpl;
 using DOM::DOMString;
 using DOM::DOMStringImpl;
@@ -70,17 +72,37 @@ using DOM::NamedNodeMap;
 using DOM::NamedNodeMapImpl;
 using DOM::Node;
 using DOM::NodeImpl;
+using DOM::NodeList;
 using DOM::NodeListImpl;
 using DOM::NotationImpl;
 using DOM::ProcessingInstruction;
 using DOM::ProcessingInstructionImpl;
 using DOM::Range;
 using DOM::RangeImpl;
+using DOM::Text;
 using DOM::TextImpl;
 
+ at class WebCoreDOMAttr;
+ at class WebCoreDOMCDATASection;
+ at class WebCoreDOMCharacterData;
+ at class WebCoreDOMComment;
+ at class WebCoreDOMDocumentFragment;
+ at class WebCoreDOMDocumentType;
+ at class WebCoreDOMDocument;
+ at class WebCoreDOMImplementation;
+ at class WebCoreDOMElement;
+ at class WebCoreDOMEntity;
+ at class WebCoreDOMEntityReference;
+ at class WebCoreDOMNamedNodeMap;
+ at class WebCoreDOMNode;
+ at class WebCoreDOMNodeList;
+ at class WebCoreDOMNotation;
+ at class WebCoreDOMProcessingInstruction;
+ at class WebCoreDOMRange;
+ at class WebCoreDOMText;
+
 //------------------------------------------------------------------------------------------
 // Static functions and data
-#pragma mark Static functions and data 
 
 NSString * const DOMErrorDomain = @"DOMErrorDomain";
 
@@ -110,7 +132,7 @@ static void removeWrapperForImpl(const void *impl)
     CFDictionaryRemoveValue(wrapperCache(), impl);
 }
 
-static NSString *domStringToNSString(const DOMString &aString)
+static NSString *DOMStringToNSString(const DOMString &aString)
 {
     return [NSString stringWithCharacters:(unichar *)aString.unicode() length:aString.length()];
 }
@@ -131,176 +153,99 @@ static void fillInError(NSError **error, int code)
         
     *error = [NSError errorWithDomain:DOMErrorDomain code:code userInfo:nil];
 }
-    
-//------------------------------------------------------------------------------------------
-// Macros
-
-#define WEB_CORE_INTERNAL_METHODS(ObjCClass,CPlusPlusClass) \
-+ (ObjCClass *)objectWithImpl:(CPlusPlusClass *)impl \
-{ \
-    if (!impl) \
-        return nil; \
-    id cachedInstance; \
-    cachedInstance = wrapperForImpl(impl); \
-    if (cachedInstance) \
-        return [[cachedInstance retain] autorelease]; \
-    ObjCClass *instance = [ObjCClass alloc]; \
-    return [[instance initWith##CPlusPlusClass:impl] autorelease]; \
-} \
-- (id)initWith##CPlusPlusClass:(CPlusPlusClass *)impl \
-{ \
-    if (!impl) { \
-        [self release]; \
-        return nil; \
-    } \
-    self = [super initWithDetails:impl]; \
-    if (self) \
-        static_cast<CPlusPlusClass *>(details)->ref(); \
-    return self; \
-} \
-- (CPlusPlusClass *)impl \
-{ \
-    ASSERT(details); \
-    return static_cast<CPlusPlusClass *>(details); \
-}
-    
+
+#define AbstractMethodCalled(absClass) do { \
+	if ([self class] == absClass) \
+		[NSException raise:NSInvalidArgumentException format:@"*** -%s cannot be sent to an abstract object of class %s: You must create a concrete instance.", sel_getName(_cmd), absClass->name]; \
+	else \
+		[NSException raise:NSInvalidArgumentException format:@"*** -%s only defined for abstract class. You must define -[%s %s]", sel_getName(_cmd), object_getClassName(self), sel_getName(_cmd)]; \
+	} while (0)
+
 //------------------------------------------------------------------------------------------
 // Factory methods
 
-DOM::NodeList DOM::NodeListImpl::createInstance(DOM::NodeListImpl *impl)
-{
-    return DOM::NodeList(impl);
-}
-
-DOM::NamedNodeMap DOM::NamedNodeMapImpl::createInstance(DOM::NamedNodeMapImpl *impl)
+NodeList NodeListImpl::createInstance(NodeListImpl *impl)
 {
-    return DOM::NamedNodeMap(impl);
+    return NodeList(impl);
 }
 
-DOM::Attr DOM::AttrImpl::createInstance(DOM::AttrImpl *impl)
+NamedNodeMap NamedNodeMapImpl::createInstance(NamedNodeMapImpl *impl)
 {
-    return DOM::Attr(impl);
+    return NamedNodeMap(impl);
 }
 
-DOM::Element DOM::ElementImpl::createInstance(DOM::ElementImpl *impl)
+Attr AttrImpl::createInstance(AttrImpl *impl)
 {
-    return DOM::Element(impl);
+    return Attr(impl);
 }
 
-DOM::CharacterData DOM::CharacterDataImpl::createInstance(DOM::CharacterDataImpl *impl)
+Element ElementImpl::createInstance(ElementImpl *impl)
 {
-    return DOM::CharacterData(impl);
+    return Element(impl);
 }
 
-DOM::Text DOM::TextImpl::createInstance(DOM::TextImpl *impl)
+CharacterData CharacterDataImpl::createInstance(CharacterDataImpl *impl)
 {
-    return DOM::Text(impl);
+    return CharacterData(impl);
 }
 
-DOM::ProcessingInstruction DOM::ProcessingInstructionImpl::createInstance(ProcessingInstructionImpl *impl)
+Text TextImpl::createInstance(TextImpl *impl)
 {
-    return DOM::ProcessingInstruction(impl);
+    return Text(impl);
 }
 
-DOM::DOMImplementation DOM::DOMImplementationImpl::createInstance(DOM::DOMImplementationImpl *impl)
+ProcessingInstruction ProcessingInstructionImpl::createInstance(ProcessingInstructionImpl *impl)
 {
-    return DOM::DOMImplementation(impl);
+    return ProcessingInstruction(impl);
 }
 
-DOM::DocumentType DOM::DocumentTypeImpl::createInstance(DOM::DocumentTypeImpl *impl)
+DocumentType DocumentTypeImpl::createInstance(DocumentTypeImpl *impl)
 {
-    return DOM::DocumentType(impl);
+    return DocumentType(impl);
 }
 
-DOM::Document DOM::DocumentImpl::createInstance(DOM::DocumentImpl *impl)
+Document DocumentImpl::createInstance(DocumentImpl *impl)
 {
-    return DOM::Document(impl);
+    return Document(impl);
 }
 
-DOM::Range DOM::RangeImpl::createInstance(DOM::RangeImpl *impl)
+Range RangeImpl::createInstance(RangeImpl *impl)
 {
-    return DOM::Range(impl);
+    return Range(impl);
 }
 
 //------------------------------------------------------------------------------------------
-// WebCoreDOMObject
-
- at implementation WebCoreDOMObject
-
-- (id)initWithDetails:(void *)d
-{
-    if (!d) {
-        [self release];
-        return nil;
-    }
-
-    id cachedInstance;
-    cachedInstance = wrapperForImpl(d);
-    if (cachedInstance) {
-        [self release];
-        return [cachedInstance retain];
-    }
+// DOMNode
 
-    [super init];
-    details = d;
-    setWrapperForImpl(self, details);
-    return self;
-}
+ at implementation DOMNode
 
-- (void)dealloc
+- (NodeImpl *)nodeImpl
 {
-    if (details)
-        removeWrapperForImpl(details);
-    [super dealloc];
-}
-
-- (unsigned)hash
-{
-    return (unsigned)details;
+	AbstractMethodCalled([DOMNode class]);
+    return nil;
 }
 
-- (BOOL)isEqual:(id)other
+- (Class)classForDOMDocument
 {
-    if (self == other)
-        return YES;
-        
-    if ([other isKindOfClass:[WebCoreDOMObject class]] && ((WebCoreDOMObject *)other)->details == details)
-        return YES;
-        
-    return NO;
+	AbstractMethodCalled([DOMNode class]);
+    return nil;
 }
 
- at end
-
-//------------------------------------------------------------------------------------------
-// WebCoreDOMNode
-
- at implementation WebCoreDOMNode
-
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMNode, NodeImpl)
-
-// Note: only objects that derive directly from WebDOMObject need their own dealloc method.
-// This is due to the fact that some of the details impl objects derive from
-// khtml::Shared, others from khtml::TreeShared (which do not share a base type), and we 
-// have to cast to the right type in order to call the deref() function.
-- (void)dealloc
+- (id)copyWithZone:(NSZone *)zone
 {
-    NodeImpl *instance = static_cast<NodeImpl *>(details);
-    if (instance)
-        instance->deref();
-    [super dealloc];
+    return [self retain];
 }
 
 - (NSString *)nodeName
 {
-    return domStringToNSString([self impl]->nodeName());
+    return DOMStringToNSString([self nodeImpl]->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 domStringToNSString([self impl]->nodeValue());
+    return DOMStringToNSString([self nodeImpl]->nodeValue());
 }
 
 - (void)setNodeValue:(NSString *)string error:(NSError **)error
@@ -308,122 +253,112 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMNode, NodeImpl)
     ASSERT(string);
     
     int code;
-    [self impl]->setNodeValue(NSStringToDOMString(string), code);
+    [self nodeImpl]->setNodeValue(NSStringToDOMString(string), code);
     fillInError(error, code);
 }
 
 - (unsigned short)nodeType
 {
-    return [self impl]->nodeType();
+    return [self nodeImpl]->nodeType();
 }
 
-- (id <DOMNode>)parentNode
+- (DOMNode *)parentNode
 {
-    return [WebCoreDOMNode objectWithImpl:[self impl]->parentNode()];
+    return [[self class] nodeWithImpl:[self nodeImpl]->parentNode()];
 }
 
-- (id <DOMNodeList>)childNodes
+- (DOMNodeList *)childNodes
 {
-    return [WebCoreDOMNodeList objectWithImpl:[self impl]->childNodes()];
+    return [[self class] nodeListWithImpl:[self nodeImpl]->childNodes()];
 }
 
-- (id <DOMNode>)firstChild
+- (DOMNode *)firstChild
 {
-    return [WebCoreDOMNode objectWithImpl:[self impl]->firstChild()];
+    return [[self class] nodeWithImpl:[self nodeImpl]->firstChild()];
 }
 
-- (id <DOMNode>)lastChild
+- (DOMNode *)lastChild
 {
-    return [WebCoreDOMNode objectWithImpl:[self impl]->lastChild()];
+    return [[self class] nodeWithImpl:[self nodeImpl]->lastChild()];
 }
 
-- (id <DOMNode>)previousSibling
+- (DOMNode *)previousSibling
 {
-    return [WebCoreDOMNode objectWithImpl:[self impl]->previousSibling()];
+    return [[self class] nodeWithImpl:[self nodeImpl]->previousSibling()];
 }
 
-- (id <DOMNode>)nextSibling
+- (DOMNode *)nextSibling
 {
-    return [WebCoreDOMNode objectWithImpl:[self impl]->nextSibling()];
+    return [[self class] nodeWithImpl:[self nodeImpl]->nextSibling()];
 }
 
-- (id <DOMNamedNodeMap>)attributes
+- (DOMNamedNodeMap *)attributes
 {
     // DOM level 2 core specification says: 
     // A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.
     return nil;
 }
 
-- (id <DOMDocument>)ownerDocument
+- (DOMDocument *)ownerDocument
 {
-    return [WebCoreDOMDocument objectWithImpl:[self impl]->getDocument()];
+    return [[self classForDOMDocument] documentWithImpl:[self nodeImpl]->getDocument()];
 }
 
-- (id <DOMNode>)insertBefore:(id <DOMNode>)newChild :(id <DOMNode>)refChild error:(NSError **)error
+- (DOMNode *)insertBefore:(DOMNode *)newChild :(DOMNode *)refChild error:(NSError **)error
 {
-    if (!newChild || !refChild) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
+    ASSERT(newChild);
+    ASSERT(refChild);
 
     int code;
-    WebCoreDOMNode *result = [WebCoreDOMNode objectWithImpl:[self impl]->insertBefore(nodeImpl(newChild), nodeImpl(refChild), code)];
+    DOMNode *result = [[self class] nodeWithImpl:[self nodeImpl]->insertBefore([newChild nodeImpl], [refChild nodeImpl], code)];
     fillInError(error, code);
     return result;
 }
 
-- (id <DOMNode>)replaceChild:(id <DOMNode>)newChild :(id <DOMNode>)oldChild error:(NSError **)error
+- (DOMNode *)replaceChild:(DOMNode *)newChild :(DOMNode *)oldChild error:(NSError **)error
 {
-    if (!newChild || !oldChild) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
+    ASSERT(newChild);
+    ASSERT(oldChild);
 
     int code;
-    WebCoreDOMNode *result = [WebCoreDOMNode objectWithImpl:[self impl]->replaceChild(nodeImpl(newChild), nodeImpl(oldChild), code)];
+    DOMNode *result = [[self class] nodeWithImpl:[self nodeImpl]->replaceChild([newChild nodeImpl], [oldChild nodeImpl], code)];
     fillInError(error, code);
     return result;
 }
 
-- (id <DOMNode>)removeChild:(id <DOMNode>)oldChild error:(NSError **)error
+- (DOMNode *)removeChild:(DOMNode *)oldChild error:(NSError **)error
 {
-    if (!oldChild) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
+    ASSERT(oldChild);
 
     int code;
-    WebCoreDOMNode *result = [WebCoreDOMNode objectWithImpl:[self impl]->removeChild(nodeImpl(oldChild), code)];
+    DOMNode *result = [[self class] nodeWithImpl:[self nodeImpl]->removeChild([oldChild nodeImpl], code)];
     fillInError(error, code);
     return result;
 }
 
-- (id <DOMNode>)appendChild:(id <DOMNode>)newChild error:(NSError **)error
+- (DOMNode *)appendChild:(DOMNode *)newChild error:(NSError **)error
 {
-    if (!newChild) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
+    ASSERT(newChild);
 
     int code;
-    WebCoreDOMNode *result = [WebCoreDOMNode objectWithImpl:[self impl]->appendChild(nodeImpl(newChild), code)];
+    DOMNode *result = [[self class] nodeWithImpl:[self nodeImpl]->appendChild([newChild nodeImpl], code)];
     fillInError(error, code);
     return result;
 }
 
 - (BOOL)hasChildNodes
 {
-    return [self impl]->hasChildNodes();
+    return [self nodeImpl]->hasChildNodes();
 }
 
-- (id <DOMNode>)cloneNode:(BOOL)deep
+- (DOMNode *)cloneNode:(BOOL)deep
 {
-    return [WebCoreDOMNode objectWithImpl:[self impl]->cloneNode(deep)];
+    return [[self class] nodeWithImpl:[self nodeImpl]->cloneNode(deep)];
 }
 
 - (void)normalize
 {
-    [self impl]->normalize();
+    [self nodeImpl]->normalize();
 }
 
 - (BOOL)isSupported:(NSString *)feature :(NSString *)version
@@ -432,20 +367,20 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMNode, NodeImpl)
     ASSERT(version);
 
     // Method not reflected in DOM::NodeImpl interface
-    Node node([self impl]);
+    Node node([self nodeImpl]);
     return node.isSupported(NSStringToDOMString(feature), NSStringToDOMString(version));
 }
 
 - (NSString *)namespaceURI
 {
     // Method not reflected in DOM::NodeImpl interface
-    Node node([self impl]);
-    return domStringToNSString(node.namespaceURI());
+    Node node([self nodeImpl]);
+    return DOMStringToNSString(node.namespaceURI());
 }
 
 - (NSString *)prefix
 {
-    return domStringToNSString([self impl]->prefix());
+    return DOMStringToNSString([self nodeImpl]->prefix());
 }
 
 - (void)setPrefix:(NSString *)prefix error:(NSError **)error
@@ -453,106 +388,137 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMNode, NodeImpl)
     ASSERT(prefix);
 
     int code;
-    [self impl]->setPrefix(NSStringToDOMString(prefix), code);
+    [self nodeImpl]->setPrefix(NSStringToDOMString(prefix), code);
     fillInError(error, code);
 }
 
 - (NSString *)localName
 {
-    return domStringToNSString([self impl]->localName());
+    return DOMStringToNSString([self nodeImpl]->localName());
 }
 
 - (BOOL)hasAttributes
 {
     // Method not reflected in DOM::NodeImpl interface
-    Node node([self impl]);
+    Node node([self nodeImpl]);
     return node.hasAttributes();
 }
 
 - (NSString *)HTMLString
 {
-    return [self impl]->recursive_toHTML(true).getNSString();
+    return [self nodeImpl]->recursive_toHTML(true).getNSString();
 }
 
-//
-// begin deprecated methods
-//
-- (void)setNodeValue:(NSString *)string
+ at end
+
+//------------------------------------------------------------------------------------------
+// WebCoreDOMNode
+
+ at implementation WebCoreDOMNode
+
+- (id)initWithNodeImpl:(NodeImpl *)impl checkCache:(BOOL)checkCache
 {
-    [self setNodeValue:string error:nil];
+    if (!impl) {
+        [self release];
+        return nil;
+    }
+
+	if (checkCache) {
+		id cachedInstance;
+		cachedInstance = wrapperForImpl(impl);
+		if (cachedInstance) {
+			[self release];
+			return [cachedInstance retain];
+		}
+	}
+
+    [super init];
+    m_impl = impl;
+    impl->ref();
+    setWrapperForImpl(self, m_impl);
+    return self;
 }
 
-- (id<DOMNode>)insert:(id<DOMNode>)newChild before:(id<DOMNode>)refChild
++ (DOMNode *)nodeWithImpl:(NodeImpl *)impl
 {
-    return [self insertBefore:newChild :refChild error:nil];
+    if (!impl)
+        return nil;
+    
+    id cachedInstance;
+    cachedInstance = wrapperForImpl(impl);
+    if (cachedInstance)
+        return [[cachedInstance retain] autorelease];
+    
+    return [[[self alloc] initWithNodeImpl:impl checkCache:NO] autorelease];
 }
 
-- (id<DOMNode>)replace:(id<DOMNode>)newChild child:(id<DOMNode>)oldChild
+- (id)initWithNodeImpl:(NodeImpl *)impl
 {
-    return [self replaceChild:newChild :oldChild error:nil];
+    return [self initWithNodeImpl:impl checkCache:YES];
 }
 
-- (id<DOMNode>)removeChild:(id<DOMNode>)oldChild
+- (NodeImpl *)nodeImpl
 {
-    return [self removeChild:oldChild error:nil];
+	return m_impl;
 }
 
-- (id<DOMNode>)appendChild:(id<DOMNode>)newChild
+- (Class)classForDOMDocument
 {
-    return [self appendChild:newChild error:nil];
+	return [WebCoreDOMDocument class];
 }
 
-- (void)setPrefix:(NSString *)prefix
+- (void)dealloc
 {
-    [self setPrefix:prefix error:nil];
+    if (m_impl) {
+        removeWrapperForImpl(m_impl);
+    	m_impl->deref();
+    }
+    [super dealloc];
 }
-//
-// end deprecated methods
-//
 
 @end
 
 //------------------------------------------------------------------------------------------
-// WebCoreDOMNamedNodeMap
+// DOMNamedNodeMap
 
- at implementation WebCoreDOMNamedNodeMap
+ at implementation DOMNamedNodeMap
+
+- (NamedNodeMapImpl *)namedNodeMapImpl
+{
+	AbstractMethodCalled([DOMNamedNodeMap class]);
+    return nil;
+}
 
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMNamedNodeMap, NamedNodeMapImpl)
+- (Class)classForDOMNode
+{
+	AbstractMethodCalled([DOMNamedNodeMap class]);
+    return nil;
+}
 
-// Note: only objects that derive directly from WebDOMObject need their own dealloc method.
-// This is due to the fact that some of the details impl objects derive from
-// khtml::Shared, others from khtml::TreeShared (which do not share a base type), and we 
-// have to cast to the right type in order to call the deref() function.
-- (void)dealloc
+- (id)copyWithZone:(NSZone *)zone
 {
-    NamedNodeMapImpl *instance = static_cast<NamedNodeMapImpl *>(details);
-    if (instance)
-        instance->deref();
-    [super dealloc];
+    return [self retain];
 }
 
-- (id <DOMNode>)getNamedItem:(NSString *)name
+- (DOMNode *)getNamedItem:(NSString *)name
 {
     ASSERT(name);
 
     // Method not reflected in DOM::NamedNodeMapImpl interface
-    NamedNodeMap map = NamedNodeMapImpl::createInstance([self impl]);
+    NamedNodeMap map = NamedNodeMapImpl::createInstance([self namedNodeMapImpl]);
     Node result(map.getNamedItem(NSStringToDOMString(name)));
-    return [WebCoreDOMNode objectWithImpl:result.handle()];
+    return [[self classForDOMNode] nodeWithImpl:result.handle()];
 }
 
-- (id <DOMNode>)setNamedItem:(id <DOMNode>)arg error:(NSError **)error
+- (DOMNode *)setNamedItem:(DOMNode *)arg error:(NSError **)error
 {
-    if (!arg) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
+    ASSERT(arg);
 
     // Method not reflected in DOM::NamedNodeMapImpl interface
     try {
-        NamedNodeMap map = NamedNodeMapImpl::createInstance([self impl]);
-        Node result(map.setNamedItem(nodeImpl(arg)));
-        return [WebCoreDOMNode objectWithImpl:result.handle()];
+        NamedNodeMap map = NamedNodeMapImpl::createInstance([self namedNodeMapImpl]);
+        Node result(map.setNamedItem([arg nodeImpl]));
+        return [[self classForDOMNode] nodeWithImpl:result.handle()];
     } 
     catch (const DOMException &e) {
         fillInError(error, e.code);
@@ -560,18 +526,15 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMNamedNodeMap, NamedNodeMapImpl)
     }
 }
 
-- (id <DOMNode>)removeNamedItem:(NSString *)name error:(NSError **)error
+- (DOMNode *)removeNamedItem:(NSString *)name error:(NSError **)error
 {
-    if (!name) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
+    ASSERT(name);
 
     // Method not reflected in DOM::NamedNodeMapImpl interface
     try {
-        NamedNodeMap map = NamedNodeMapImpl::createInstance([self impl]);
+        NamedNodeMap map = NamedNodeMapImpl::createInstance([self namedNodeMapImpl]);
         Node result(map.removeNamedItem(NSStringToDOMString(name)));
-        return [WebCoreDOMNode objectWithImpl:result.handle()];
+        return [[self classForDOMNode] nodeWithImpl:result.handle()];
     } 
     catch (const DOMException &e) {
         fillInError(error, e.code);
@@ -579,40 +542,37 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMNamedNodeMap, NamedNodeMapImpl)
     }
 }
 
-- (id <DOMNode>)item:(unsigned long)index
+- (DOMNode *)item:(unsigned long)index
 {
-    return [WebCoreDOMNode objectWithImpl:[self impl]->item(index)];
+    return [[self classForDOMNode] nodeWithImpl:[self namedNodeMapImpl]->item(index)];
 }
 
 - (unsigned long)length
 {
-    return [self impl]->length();
+    return [self namedNodeMapImpl]->length();
 }
 
-- (id <DOMNode>)getNamedItemNS:(NSString *)namespaceURI :(NSString *)localName
+- (DOMNode *)getNamedItemNS:(NSString *)namespaceURI :(NSString *)localName
 {
     if (!namespaceURI || !localName) {
         return nil;
     }
 
     // Method not reflected in DOM::NamedNodeMapImpl interface
-    NamedNodeMap map = NamedNodeMapImpl::createInstance([self impl]);
+    NamedNodeMap map = NamedNodeMapImpl::createInstance([self namedNodeMapImpl]);
     Node result(map.getNamedItemNS(NSStringToDOMString(namespaceURI), NSStringToDOMString(localName)));
-    return [WebCoreDOMNode objectWithImpl:result.handle()];
+    return [[self classForDOMNode] nodeWithImpl:result.handle()];
 }
 
-- (id <DOMNode>)setNamedItemNS:(id <DOMNode>)arg error:(NSError **)error
+- (DOMNode *)setNamedItemNS:(DOMNode *)arg error:(NSError **)error
 {
-    if (!arg) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
+    ASSERT(arg);
 
     // Method not reflected in DOM::NamedNodeMapImpl interface
     try {
-        NamedNodeMap map = NamedNodeMapImpl::createInstance([self impl]);
-        Node result(map.setNamedItemNS(nodeImpl(arg)));
-        return [WebCoreDOMNode objectWithImpl:result.handle()];
+        NamedNodeMap map = NamedNodeMapImpl::createInstance([self namedNodeMapImpl]);
+        Node result(map.setNamedItemNS([arg nodeImpl]));
+        return [[self classForDOMNode] nodeWithImpl:result.handle()];
     } 
     catch (const DOMException &e) {
         fillInError(error, e.code);
@@ -620,18 +580,16 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMNamedNodeMap, NamedNodeMapImpl)
     }
 }
 
-- (id <DOMNode>)removeNamedItemNS:(NSString *)namespaceURI :(NSString *)localName error:(NSError **)error
+- (DOMNode *)removeNamedItemNS:(NSString *)namespaceURI :(NSString *)localName error:(NSError **)error
 {
-    if (!namespaceURI || !localName) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
+    ASSERT(namespaceURI);
+    ASSERT(localName);
 
     // Method not reflected in DOM::NamedNodeMapImpl interface
     try {
-        NamedNodeMap map = NamedNodeMapImpl::createInstance([self impl]);
+        NamedNodeMap map = NamedNodeMapImpl::createInstance([self namedNodeMapImpl]);
         Node result(map.removeNamedItemNS(NSStringToDOMString(namespaceURI), NSStringToDOMString(localName)));
-        return [WebCoreDOMNode objectWithImpl:result.handle()];
+        return [[self classForDOMNode] nodeWithImpl:result.handle()];
     } 
     catch (const DOMException &e) {
         fillInError(error, e.code);
@@ -639,138 +597,332 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMNamedNodeMap, NamedNodeMapImpl)
     }
 }
 
-//
-// begin deprecated methods
-//
-- (id<DOMNode>)setNamedItem:(id<DOMNode>)arg
+ at end
+
+//------------------------------------------------------------------------------------------
+// WebCoreDOMNamedNodeMap
+
+ at implementation WebCoreDOMNamedNodeMap
+
+- (id)initWithNamedNodeMapImpl:(NamedNodeMapImpl *)impl checkCache:(BOOL)checkCache
 {
-    return [self setNamedItem:arg error:nil];
+    if (!impl) {
+        [self release];
+        return nil;
+    }
+
+	if (checkCache) {
+		id cachedInstance;
+		cachedInstance = wrapperForImpl(impl);
+		if (cachedInstance) {
+			[self release];
+			return [cachedInstance retain];
+		}
+	}
+
+    [super init];
+    m_impl = impl;
+    impl->ref();
+    setWrapperForImpl(self, m_impl);
+    return self;
+}
+
++ (DOMNamedNodeMap *)namedNodeMapWithImpl:(NamedNodeMapImpl *)impl
+{
+    if (!impl)
+        return nil;
+    
+    id cachedInstance;
+    cachedInstance = wrapperForImpl(impl);
+    if (cachedInstance)
+        return [[cachedInstance retain] autorelease];
+    
+    return [[[self alloc] initWithNamedNodeMapImpl:impl checkCache:NO] autorelease];
 }
 
-- (id<DOMNode>)removeNamedItem:(NSString *)name
+- (id)initWithNamedNodeMapImpl:(NamedNodeMapImpl *)impl
 {
-    return [self removeNamedItem:name error:nil];
+    return [self initWithNamedNodeMapImpl:impl checkCache:YES];
 }
 
-- (id<DOMNode>)setNamedItemNS:(id<DOMNode>)arg
+- (NamedNodeMapImpl *)namedNodeMapImpl
 {
-    return [self setNamedItemNS:arg error:nil];
+	return m_impl;
 }
 
-- (id<DOMNode>)removeNamedItemNS:(NSString *)namespaceURI :(NSString *)localName
+- (Class)classForDOMNode
 {
-    return [self removeNamedItemNS:namespaceURI :localName error:nil];
+	return [WebCoreDOMNode class];
+}
+
+- (void)dealloc
+{
+    if (m_impl) {
+        removeWrapperForImpl(m_impl);
+    	m_impl->deref();
+    }
+    [super dealloc];
 }
-//
-// end deprecated methods
-//
 
 @end
 
 //------------------------------------------------------------------------------------------
-// WebCoreDOMNodeList
+// DOMNodeList
 
- at implementation WebCoreDOMNodeList
+ at implementation DOMNodeList
 
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMNodeList, NodeListImpl)
+- (NodeListImpl *)nodeListImpl
+{
+	AbstractMethodCalled([DOMNodeList class]);
+    return nil;
+}
 
-// Note: only objects that derive directly from WebDOMObject need their own dealloc method.
-// This is due to the fact that some of the details impl objects derive from
-// khtml::Shared, others from khtml::TreeShared (which do not share a base type), and we 
-// have to cast to the right type in order to call the deref() function.
-- (void)dealloc
+- (Class)classForDOMNode
 {
-    NodeListImpl *instance = static_cast<NodeListImpl *>(details);
-    if (instance)
-        instance->deref();
-    [super dealloc];
+	AbstractMethodCalled([DOMNodeList class]);
+    return nil;
+}
+
+- (id)copyWithZone:(NSZone *)zone
+{
+    return [self retain];
 }
 
-- (id <DOMNode>)item:(unsigned long)index
+- (DOMNode *)item:(unsigned long)index
 {
-    return [WebCoreDOMNode objectWithImpl:[self impl]->item(index)];
+    return [[self classForDOMNode] nodeWithImpl:[self nodeListImpl]->item(index)];
 }
 
 - (unsigned long)length
 {
-    return [self impl]->length();
+    return [self nodeListImpl]->length();
 }
 
 @end
 
 //------------------------------------------------------------------------------------------
-// WebCoreDOMImplementation
+// WebCoreDOMNodeList
 
- at implementation WebCoreDOMImplementation
+ at implementation WebCoreDOMNodeList
+
+- (id)initWithNodeListImpl:(NodeListImpl *)impl checkCache:(BOOL)checkCache
+{
+    if (!impl) {
+        [self release];
+        return nil;
+    }
+
+	if (checkCache) {
+		id cachedInstance;
+		cachedInstance = wrapperForImpl(impl);
+		if (cachedInstance) {
+			[self release];
+			return [cachedInstance retain];
+		}
+	}
 
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMImplementation, DOMImplementationImpl)
+    [super init];
+    m_impl = impl;
+    impl->ref();
+    setWrapperForImpl(self, m_impl);
+    return self;
+}
+
++ (DOMNodeList *)nodeListWithImpl:(NodeListImpl *)impl
+{
+    if (!impl)
+        return nil;
+    
+    id cachedInstance;
+    cachedInstance = wrapperForImpl(impl);
+    if (cachedInstance)
+        return [[cachedInstance retain] autorelease];
+    
+    return [[[self alloc] initWithNodeListImpl:impl checkCache:NO] autorelease];
+}
+
+- (id)initWithNodeListImpl:(NodeListImpl *)impl
+{
+    return [self initWithNodeListImpl:impl checkCache:YES];
+}
+
+- (NodeListImpl *)nodeListImpl
+{
+	return m_impl;
+}
+
+- (Class)classForDOMNode
+{
+	return [WebCoreDOMNode class];
+}
+
+- (id)copyWithZone:(NSZone *)zone
+{
+    return [self retain];
+}
 
-// Note: only objects that derive directly from WebDOMObject need their own dealloc method.
-// This is due to the fact that some of the details impl objects derive from
-// khtml::Shared, others from khtml::TreeShared (which do not share a base type), and we 
-// have to cast to the right type in order to call the deref() function.
 - (void)dealloc
 {
-    DOMImplementationImpl *instance = static_cast<DOMImplementationImpl *>(details);
-    if (instance)
-        instance->deref();
+    if (m_impl) {
+        removeWrapperForImpl(m_impl);
+    	m_impl->deref();
+    }
     [super dealloc];
 }
 
+ at end
+
+//------------------------------------------------------------------------------------------
+// DOMImplementation
+
+ at implementation DOMImplementation
+
+- (DOMImplementationImpl *)DOMImplementationImpl
+{
+	AbstractMethodCalled([DOMImplementation class]);
+    return nil;
+}
+
+- (Class)classForDOMDocumentType
+{
+	AbstractMethodCalled([DOMImplementation class]);
+    return nil;
+}
+
+- (Class)classForDOMDocument
+{
+	AbstractMethodCalled([DOMImplementation class]);
+    return nil;
+}
+
+- (id)copyWithZone:(NSZone *)zone
+{
+    return [self retain];
+}
+
 - (BOOL)hasFeature:(NSString *)feature :(NSString *)version
 {
     ASSERT(feature);
     ASSERT(version);
 
-    return [self impl]->hasFeature(NSStringToDOMString(feature), NSStringToDOMString(version));
+    return [self DOMImplementationImpl]->hasFeature(NSStringToDOMString(feature), NSStringToDOMString(version));
 }
 
-- (id <DOMDocumentType>)createDocumentType:(NSString *)qualifiedName :(NSString *)publicId :(NSString *)systemId error:(NSError **)error
+- (DOMDocumentType *)createDocumentType:(NSString *)qualifiedName :(NSString *)publicId :(NSString *)systemId error:(NSError **)error
 {
     ASSERT(qualifiedName);
     ASSERT(publicId);
     ASSERT(systemId);
 
     int code;
-    DocumentTypeImpl *impl = [self impl]->createDocumentType(NSStringToDOMString(qualifiedName), NSStringToDOMString(publicId), NSStringToDOMString(systemId), code);
-    id <DOMDocumentType> result = [WebCoreDOMDocumentType objectWithImpl:impl];
+    DocumentTypeImpl *impl = [self DOMImplementationImpl]->createDocumentType(NSStringToDOMString(qualifiedName), NSStringToDOMString(publicId), NSStringToDOMString(systemId), code);
+    DOMDocumentType * result = [[self classForDOMDocumentType] documentTypeWithImpl:impl];
     fillInError(error, code);
     return result;
 }
 
-- (id <DOMDocument>)createDocument:(NSString *)namespaceURI :(NSString *)qualifiedName :(id <DOMDocumentType>)doctype error:(NSError **)error
+- (DOMDocument *)createDocument:(NSString *)namespaceURI :(NSString *)qualifiedName :(DOMDocumentType *)doctype error:(NSError **)error
 {
     ASSERT(namespaceURI);
     ASSERT(qualifiedName);
 
     int code;
-    DocumentType dt = DocumentTypeImpl::createInstance(documentTypeImpl(doctype));
-    DocumentImpl *impl = [self impl]->createDocument(NSStringToDOMString(namespaceURI), NSStringToDOMString(qualifiedName), dt, code);
-    id <DOMDocument> result = [WebCoreDOMDocument objectWithImpl:impl];
+    DocumentType dt = DocumentTypeImpl::createInstance([doctype documentTypeImpl]);
+    DocumentImpl *impl = [self DOMImplementationImpl]->createDocument(NSStringToDOMString(namespaceURI), NSStringToDOMString(qualifiedName), dt, code);
+    DOMDocument * result = [[self classForDOMDocument] documentWithImpl:impl];
     fillInError(error, code);
     return result;
 }
 
-//
-// begin deprecated methods
-//
-- (id<DOMDocumentType>)createDocumentType:(NSString *)qualifiedName :(NSString *)publicId :(NSString *)systemId :(int *)exceptionCode
+ at end
+ 
+//------------------------------------------------------------------------------------------
+// WebCoreDOMImplementation
+
+ at implementation WebCoreDOMImplementation
+
+- (id)initWithDOMImplementationImpl:(DOMImplementationImpl *)impl checkCache:(BOOL)checkCache
+{
+    if (!impl) {
+        [self release];
+        return nil;
+    }
+
+	if (checkCache) {
+		id cachedInstance;
+		cachedInstance = wrapperForImpl(impl);
+		if (cachedInstance) {
+			[self release];
+			return [cachedInstance retain];
+		}
+	}
+
+    [super init];
+    m_impl = impl;
+    impl->ref();
+    setWrapperForImpl(self, m_impl);
+    return self;
+}
+
++ (DOMImplementation *)DOMImplementationWithImpl:(DOMImplementationImpl *)impl
 {
-    ASSERT(qualifiedName);
-    ASSERT(publicId);
-    ASSERT(systemId);
+    if (!impl)
+        return nil;
+    
+    id cachedInstance;
+    cachedInstance = wrapperForImpl(impl);
+    if (cachedInstance)
+        return [[cachedInstance retain] autorelease];
+    
+    return [[[self alloc] initWithDOMImplementationImpl:impl checkCache:NO] autorelease];
+}
 
-    DocumentTypeImpl *impl = [self impl]->createDocumentType(NSStringToDOMString(qualifiedName), NSStringToDOMString(publicId), NSStringToDOMString(systemId), *exceptionCode);
-    return [WebCoreDOMDocumentType objectWithImpl:impl];
+- (id)initWithDOMImplementationImpl:(DOMImplementationImpl *)impl
+{
+    return [self initWithDOMImplementationImpl:impl checkCache:YES];
+}
+
+- (DOMImplementationImpl *)DOMImplementationImpl
+{
+	return m_impl;
+}
+
+- (Class)classForDOMDocumentType
+{
+	return [WebCoreDOMDocumentType class];
 }
 
-- (id<DOMDocument>)createDocument:(NSString *)namespaceURI :(NSString *)qualifiedName :(id<DOMDocumentType>)doctype
+- (Class)classForDOMDocument
 {
-    return [self createDocument:namespaceURI :qualifiedName :doctype error:nil];
+	return [WebCoreDOMDocument class];
+}
+
+- (void)dealloc
+{
+    if (m_impl) {
+        removeWrapperForImpl(m_impl);
+    	m_impl->deref();
+    }
+    [super dealloc];
+}
+
+ at end
+
+//------------------------------------------------------------------------------------------
+// DOMDocumentFragment
+
+ at implementation DOMDocumentFragment
+
+- (DocumentFragmentImpl *)documentFragmentImpl
+{
+	AbstractMethodCalled([DOMDocumentFragment class]);
+    return nil;
+}
+
+- (id)copyWithZone:(NSZone *)zone
+{
+    return [self retain];
 }
-//
-// end deprecated methods
-//
 
 @end
 
@@ -779,96 +931,224 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMImplementation, DOMImplementationImpl)
 
 @implementation WebCoreDOMDocumentFragment
 
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMDocumentFragment, DocumentFragmentImpl)
+- (id)initWithDocumentFragmentImpl:(DocumentFragmentImpl *)impl checkCache:(BOOL)checkCache
+{
+    if (!impl) {
+        [self release];
+        return nil;
+    }
+
+	if (checkCache) {
+		id cachedInstance;
+		cachedInstance = wrapperForImpl(impl);
+		if (cachedInstance) {
+			[self release];
+			return [cachedInstance retain];
+		}
+	}
 
-// Note: This object does not need its own dealloc method, since it derives from
-// WebCoreDOMNode. See the dealloc method comment on that method for more information. 
+    [super init];
+    m_impl = impl;
+    impl->ref();
+    setWrapperForImpl(self, m_impl);
+    return self;
+}
+
++ (DOMDocumentFragment *)documentFragmentWithImpl:(DocumentFragmentImpl *)impl
+{
+    if (!impl)
+        return nil;
+    
+    id cachedInstance;
+    cachedInstance = wrapperForImpl(impl);
+    if (cachedInstance)
+        return [[cachedInstance retain] autorelease];
+    
+    return [[[self alloc] initWithDocumentFragmentImpl:impl checkCache:NO] autorelease];
+}
+
+- (id)initWithDocumentFragmentImpl:(DocumentFragmentImpl *)impl
+{
+    return [self initWithDocumentFragmentImpl:impl checkCache:YES];
+}
+
+- (DocumentFragmentImpl *)documentFragmentImpl
+{
+	return m_impl;
+}
+
+- (void)dealloc
+{
+    if (m_impl) {
+        removeWrapperForImpl(m_impl);
+    	m_impl->deref();
+    }
+    [super dealloc];
+}
 
 @end
 
 //------------------------------------------------------------------------------------------
-// WebCoreDOMDocument
+// DOMDocument
 
- at implementation WebCoreDOMDocument
+ at implementation DOMDocument
 
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMDocument, DocumentImpl)
+- (DocumentImpl *)documentImpl
+{
+	AbstractMethodCalled([DOMDocument class]);
+    return nil;
+}
 
-// Note: This object does not need its own dealloc method, since it derives from
-// WebCoreDOMNode. See the dealloc method comment on that method for more information. 
+- (Class)classForDOMAttr
+{
+	AbstractMethodCalled([DOMDocument class]);
+    return nil;
+}
 
-- (id <DOMDocumentType>)doctype
+- (Class)classForDOMCDATASection
 {
-    return [WebCoreDOMDocumentType objectWithImpl:[self impl]->doctype()];
+	AbstractMethodCalled([DOMDocument class]);
+    return nil;
 }
 
-- (id <DOMImplementation>)implementation
+- (Class)classForDOMComment
 {
-    return [WebCoreDOMImplementation objectWithImpl:[self impl]->implementation()];
+	AbstractMethodCalled([DOMDocument class]);
+    return nil;
 }
 
-- (id <DOMElement>)documentElement
+- (Class)classForDOMDocumentFragment
 {
-    return [WebCoreDOMElement objectWithImpl:[self impl]->documentElement()];
+	AbstractMethodCalled([DOMDocument class]);
+    return nil;
 }
 
-- (id <DOMElement>)createElement:(NSString *)tagName error:(NSError **)error
+- (Class)classForDOMDocumentType
+{
+	AbstractMethodCalled([DOMDocument class]);
+    return nil;
+}
+
+- (Class)classForDOMElement
+{
+	AbstractMethodCalled([DOMDocument class]);
+    return nil;
+}
+
+- (Class)classForDOMEntityReference
+{
+	AbstractMethodCalled([DOMDocument class]);
+    return nil;
+}
+
+- (Class)classForDOMImplementation
+{
+	AbstractMethodCalled([DOMDocument class]);
+    return nil;
+}
+
+- (Class)classForDOMNode
+{
+	AbstractMethodCalled([DOMDocument class]);
+    return nil;
+}
+
+- (Class)classForDOMNodeList
+{
+	AbstractMethodCalled([DOMDocument class]);
+    return nil;
+}
+
+- (Class)classForDOMProcessingInstruction
+{
+	AbstractMethodCalled([DOMDocument class]);
+    return nil;
+}
+
+- (Class)classForDOMText
+{
+	AbstractMethodCalled([DOMDocument class]);
+    return nil;
+}
+
+- (id)copyWithZone:(NSZone *)zone
+{
+    return [self retain];
+}
+
+- (DOMDocumentType *)doctype
+{
+    return [[self classForDOMDocumentType] documentTypeWithImpl:[self documentImpl]->doctype()];
+}
+
+- (DOMImplementation *)implementation
+{
+    return [[self classForDOMImplementation] DOMImplementationWithImpl:[self documentImpl]->implementation()];
+}
+
+- (DOMElement *)documentElement
+{
+    return [[self classForDOMElement] elementWithImpl:[self documentImpl]->documentElement()];
+}
+
+- (DOMElement *)createElement:(NSString *)tagName error:(NSError **)error
 {
     ASSERT(tagName);
 
     int code;
-    id <DOMElement> result = [WebCoreDOMElement objectWithImpl:[self impl]->createElement(NSStringToDOMString(tagName), code)];
+    DOMElement *result = [[self classForDOMElement] elementWithImpl:[self documentImpl]->createElement(NSStringToDOMString(tagName), code)];
     fillInError(error, code);
     return result;
 }
 
-- (id <DOMDocumentFragment>)createDocumentFragment
+- (DOMDocumentFragment *)createDocumentFragment
 {
-    return [WebCoreDOMDocumentFragment objectWithImpl:[self impl]->createDocumentFragment()];
+    return [[self classForDOMDocumentFragment] documentFragmentWithImpl:[self documentImpl]->createDocumentFragment()];
 }
 
-- (id <DOMText>)createTextNode:(NSString *)data
+- (DOMText *)createTextNode:(NSString *)data
 {
     ASSERT(data);
 
-    return [WebCoreDOMText objectWithImpl:[self impl]->createTextNode(NSStringToDOMString(data))];
+    return [[self classForDOMText] textWithImpl:[self documentImpl]->createTextNode(NSStringToDOMString(data))];
 }
 
-- (id <DOMComment>)createComment:(NSString *)data
+- (DOMComment *)createComment:(NSString *)data
 {
     ASSERT(data);
 
-    return [WebCoreDOMComment objectWithImpl:[self impl]->createComment(NSStringToDOMString(data))];
+    return [[self classForDOMComment] commentWithImpl:[self documentImpl]->createComment(NSStringToDOMString(data))];
 }
 
-- (id <DOMCDATASection>)createCDATASection:(NSString *)data error:(NSError **)error
+- (DOMCDATASection *)createCDATASection:(NSString *)data error:(NSError **)error
 {
     ASSERT(data);
 
     // Documentation says we can raise a NOT_SUPPORTED_ERR.
     // However, the lower layer does not report that error up to us.
-    return [WebCoreDOMCDATASection objectWithImpl:[self impl]->createCDATASection(NSStringToDOMString(data))];
+    return [[self classForDOMCDATASection] CDATASectionWithImpl:[self documentImpl]->createCDATASection(NSStringToDOMString(data))];
 }
 
-- (id <DOMProcessingInstruction>)createProcessingInstruction:(NSString *)target :(NSString *)data error:(NSError **)error
+- (DOMProcessingInstruction *)createProcessingInstruction:(NSString *)target :(NSString *)data error:(NSError **)error
 {
     ASSERT(target);
     ASSERT(data);
 
     // Documentation says we can raise a INVALID_CHARACTER_ERR or a NOT_SUPPORTED_ERR.
     // However, the lower layer does not report these errors up to us.
-    return [WebCoreDOMProcessingInstruction objectWithImpl:[self impl]->createProcessingInstruction(NSStringToDOMString(target), NSStringToDOMString(data))];
+    return [[self classForDOMProcessingInstruction] processingInstructionWithImpl:[self documentImpl]->createProcessingInstruction(NSStringToDOMString(target), NSStringToDOMString(data))];
 }
 
-- (id <DOMAttr>)createAttribute:(NSString *)name error:(NSError **)error
+- (DOMAttr *)createAttribute:(NSString *)name error:(NSError **)error
 {
     ASSERT(name);
 
     // Method not reflected in DOM::DocumentImpl interface
     try {
-        Document doc(DocumentImpl::createInstance([self impl]));
+        Document doc(DocumentImpl::createInstance([self documentImpl]));
         Attr result(doc.createAttribute(NSStringToDOMString(name)));
         AttrImpl *impl = static_cast<AttrImpl *>(result.handle());
-        return [WebCoreDOMAttr objectWithImpl:impl];
+        return [[self classForDOMAttr] attrWithImpl:impl];
     } 
     catch (const DOMException &e) {
         fillInError(error, e.code);
@@ -876,52 +1156,52 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMDocument, DocumentImpl)
     }
 }
 
-- (id <DOMEntityReference>)createEntityReference:(NSString *)name error:(NSError **)error
+- (DOMEntityReference *)createEntityReference:(NSString *)name error:(NSError **)error
 {
     ASSERT(name);
 
     // Documentation says we can raise a INVALID_CHARACTER_ERR or a NOT_SUPPORTED_ERR.
     // However, the lower layer does not report these errors up to us.
-    return [WebCoreDOMEntityReference objectWithImpl:[self impl]->createEntityReference(NSStringToDOMString(name))];
+    return [WebCoreDOMEntityReference entityReferenceWithImpl:[self documentImpl]->createEntityReference(NSStringToDOMString(name))];
 }
 
-- (id <DOMNodeList>)getElementsByTagName:(NSString *)tagname
+- (DOMNodeList *)getElementsByTagName:(NSString *)tagname
 {
     ASSERT(tagname);
 
-    return [WebCoreDOMNodeList objectWithImpl:[self impl]->getElementsByTagNameNS(0, NSStringToDOMString(tagname).implementation())];
+    return [[self classForDOMNodeList] nodeListWithImpl:[self documentImpl]->getElementsByTagNameNS(0, NSStringToDOMString(tagname).implementation())];
 }
 
-- (id <DOMNode>)importNode:(id <DOMNode>)importedNode :(BOOL)deep error:(NSError **)error
+- (DOMNode *)importNode:(DOMNode *)importedNode :(BOOL)deep error:(NSError **)error
 {
     int code;
-    WebCoreDOMNode *result = [WebCoreDOMNode objectWithImpl:[self impl]->importNode(nodeImpl(importedNode), deep, code)];
+    DOMNode *result = [WebCoreDOMNode nodeWithImpl:[self documentImpl]->importNode([importedNode nodeImpl], deep, code)];
     fillInError(error, code);
     return result;
 }
 
-- (id <DOMElement>)createElementNS:(NSString *)namespaceURI :(NSString *)qualifiedName error:(NSError **)error
+- (DOMElement *)createElementNS:(NSString *)namespaceURI :(NSString *)qualifiedName error:(NSError **)error
 {
     ASSERT(namespaceURI);
     ASSERT(qualifiedName);
 
     int code;
-    id <DOMElement> result = [WebCoreDOMElement objectWithImpl:[self impl]->createElementNS(NSStringToDOMString(namespaceURI), NSStringToDOMString(qualifiedName), code)];
+    DOMElement *result = [[self classForDOMElement] elementWithImpl:[self documentImpl]->createElementNS(NSStringToDOMString(namespaceURI), NSStringToDOMString(qualifiedName), code)];
     fillInError(error, code);
     return result;
 }
 
-- (id <DOMAttr>)createAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName error:(NSError **)error
+- (DOMAttr *)createAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName error:(NSError **)error
 {
     ASSERT(namespaceURI);
     ASSERT(qualifiedName);
 
     // Method not reflected in DOM::DocumentImpl interface
     try {
-        Document doc(DocumentImpl::createInstance([self impl]));
+        Document doc(DocumentImpl::createInstance([self documentImpl]));
         Attr result(doc.createAttributeNS(NSStringToDOMString(namespaceURI), NSStringToDOMString(qualifiedName)));
         AttrImpl *impl = static_cast<AttrImpl *>(result.handle());
-        return [WebCoreDOMAttr objectWithImpl:impl];
+        return [[self classForDOMAttr] attrWithImpl:impl];
     } 
     catch (const DOMException &e) {
         fillInError(error, e.code);
@@ -929,79 +1209,166 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMDocument, DocumentImpl)
     }
 }
 
-- (id <DOMNodeList>)getElementsByTagNameNS:(NSString *)namespaceURI :(NSString *)localName
+- (DOMNodeList *)getElementsByTagNameNS:(NSString *)namespaceURI :(NSString *)localName
 {
     ASSERT(namespaceURI);
     ASSERT(localName);
 
-    return [WebCoreDOMNodeList objectWithImpl:[self impl]->getElementsByTagNameNS(NSStringToDOMString(namespaceURI).implementation(), NSStringToDOMString(localName).implementation())];
+    return [[self classForDOMNodeList] nodeListWithImpl:[self documentImpl]->getElementsByTagNameNS(NSStringToDOMString(namespaceURI).implementation(), NSStringToDOMString(localName).implementation())];
 }
 
-- (id <DOMElement>)getElementById:(NSString *)elementId
+- (DOMElement *)getElementById:(NSString *)elementId
 {
     ASSERT(elementId);
 
-    return [WebCoreDOMElement objectWithImpl:[self impl]->getElementById(NSStringToDOMString(elementId))];
+    return [[self classForDOMElement] elementWithImpl:[self documentImpl]->getElementById(NSStringToDOMString(elementId))];
+}
+
+ at end
+
+//------------------------------------------------------------------------------------------
+// WebCoreDOMDocumentFragment
+
+ at implementation WebCoreDOMDocument
+
+- (id)initWithDocumentImpl:(DocumentImpl *)impl checkCache:(BOOL)checkCache
+{
+    if (!impl) {
+        [self release];
+        return nil;
+    }
+
+	if (checkCache) {
+		id cachedInstance;
+		cachedInstance = wrapperForImpl(impl);
+		if (cachedInstance) {
+			[self release];
+			return [cachedInstance retain];
+		}
+	}
+
+    [super init];
+    m_impl = impl;
+    impl->ref();
+    setWrapperForImpl(self, m_impl);
+    return self;
+}
+
++ (DOMDocument *)documentWithImpl:(DocumentImpl *)impl
+{
+    if (!impl)
+        return nil;
+    
+    id cachedInstance;
+    cachedInstance = wrapperForImpl(impl);
+    if (cachedInstance)
+        return [[cachedInstance retain] autorelease];
+    
+    return [[[self alloc] initWithDocumentImpl:impl checkCache:NO] autorelease];
+}
+
+- (id)initWithDocumentImpl:(DocumentImpl *)impl
+{
+    return [self initWithDocumentImpl:impl checkCache:YES];
+}
+
+- (DocumentImpl *)documentImpl
+{
+	return m_impl;
+}
+
+- (Class)classForDOMAttr
+{
+	return [WebCoreDOMAttr class];
 }
 
-//
-// begin deprecated methods
-//
-- (id<DOMElement>)createElement:(NSString *)tagName
+- (Class)classForDOMCDATASection
 {
-    return [self createElement:tagName error:nil];
+	return [WebCoreDOMCDATASection class];
 }
 
-- (id<DOMElement>)createElementNS:(NSString *)namespaceURI :(NSString *)qualifiedName
+- (Class)classForDOMComment
 {
-    return [self createElementNS:namespaceURI :qualifiedName error:nil];
+	return [WebCoreDOMComment class];
 }
 
-- (id<DOMCDATASection>)createCDATASection:(NSString *)data
+- (Class)classForDOMDocumentFragment
 {
-    return [self createCDATASection:data error:nil];
+	return [WebCoreDOMDocumentFragment class];
 }
 
-- (id<DOMProcessingInstruction>)createProcessingInstruction:(NSString *)target :(NSString *)data
+- (Class)classForDOMDocumentType
 {
-    return [self createProcessingInstruction:target :data error:nil];
+	return [WebCoreDOMDocumentType class];
 }
 
-- (id<DOMAttr>)createAttribute:(NSString *)name;
+- (Class)classForDOMElement
 {
-    return [self createAttribute:name error:nil];
+	return [WebCoreDOMElement class];
 }
 
-- (id<DOMEntityReference>)createEntityReference:(NSString *)name
+- (Class)classForDOMEntityReference
 {
-    return [self createEntityReference:name error:nil];
+	return [WebCoreDOMEntityReference class];
 }
 
-- (id<DOMNode>)importNode:(id<DOMNode>)importedNode :(BOOL)deep
+- (Class)classForDOMImplementation
 {
-    return [self importNode:importedNode :deep error:nil];
+	return [WebCoreDOMImplementation class];
+}
+
+- (Class)classForDOMNode
+{
+	return [WebCoreDOMNode class];
+}
+
+- (Class)classForDOMNodeList
+{
+	return [WebCoreDOMNodeList class];
+}
+
+- (Class)classForDOMProcessingInstruction
+{
+	return [WebCoreDOMProcessingInstruction class];
+}
+
+- (Class)classForDOMText
+{
+	return [WebCoreDOMText class];
+}
+
+- (void)dealloc
+{
+    if (m_impl) {
+        removeWrapperForImpl(m_impl);
+    	m_impl->deref();
+    }
+    [super dealloc];
 }
-//
-// end deprecated methods
-//
 
 @end
 
 //------------------------------------------------------------------------------------------
-// WebCoreDOMCharacterData
+// DOMCharacterData
 
- at implementation WebCoreDOMCharacterData
+ at implementation DOMCharacterData
 
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMCharacterData, CharacterDataImpl)
+- (CharacterDataImpl *)characterDataImpl
+{
+	AbstractMethodCalled([DOMCharacterData class]);
+    return nil;
+}
 
-// Note: This object does not need its own dealloc method, since it derives from
-// WebCoreDOMNode. See the dealloc method comment on that method for more information. 
+- (id)copyWithZone:(NSZone *)zone
+{
+    return [self retain];
+}
 
 - (NSString *)data
 {
     // Documentation says we can raise a DOMSTRING_SIZE_ERR.
     // However, the lower layer does not report that error up to us.
-    return domStringToNSString([self impl]->data());
+    return DOMStringToNSString([self characterDataImpl]->data());
 }
 
 - (void)setData:(NSString *)data error:(NSError **)error
@@ -1009,19 +1376,19 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMCharacterData, CharacterDataImpl)
     ASSERT(data);
     
     int code;
-    [self impl]->setData(NSStringToDOMString(data), code);
+    [self characterDataImpl]->setData(NSStringToDOMString(data), code);
     fillInError(error, code);
 }
 
 - (unsigned long)length
 {
-    return [self impl]->length();
+    return [self characterDataImpl]->length();
 }
 
 - (NSString *)substringData:(unsigned long)offset :(unsigned long)count error:(NSError **)error
 {
     int code;
-    NSString *result = domStringToNSString([self impl]->substringData(offset, count, code));
+    NSString *result = DOMStringToNSString([self characterDataImpl]->substringData(offset, count, code));
     fillInError(error, code);
     return result;
 }
@@ -1031,7 +1398,7 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMCharacterData, CharacterDataImpl)
     ASSERT(arg);
     
     int code;
-    [self impl]->appendData(NSStringToDOMString(arg), code);
+    [self characterDataImpl]->appendData(NSStringToDOMString(arg), code);
     fillInError(error, code);
 }
 
@@ -1040,14 +1407,14 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMCharacterData, CharacterDataImpl)
     ASSERT(arg);
     
     int code;
-    [self impl]->insertData(offset, NSStringToDOMString(arg), code);
+    [self characterDataImpl]->insertData(offset, NSStringToDOMString(arg), code);
     fillInError(error, code);
 }
 
 - (void)deleteData:(unsigned long)offset :(unsigned long) count error:(NSError **)error;
 {
     int code;
-    [self impl]->deleteData(offset, count, code);
+    [self characterDataImpl]->deleteData(offset, count, code);
     fillInError(error, code);
 }
 
@@ -1056,72 +1423,109 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMCharacterData, CharacterDataImpl)
     ASSERT(arg);
 
     int code;
-    [self impl]->replaceData(offset, count, NSStringToDOMString(arg), code);
+    [self characterDataImpl]->replaceData(offset, count, NSStringToDOMString(arg), code);
     fillInError(error, code);
 }
 
-//
-// begin deprecated methods
-//
-- (void)setData: (NSString *)data
-{
-    [self setData:data error:nil];
-}
+ at end
+
+//------------------------------------------------------------------------------------------
+// WebCoreDOMCharacterData
 
-- (NSString *)substringData: (unsigned long)offset :(unsigned long)count
+ at implementation WebCoreDOMCharacterData
+
+- (id)initWithCharacterDataImpl:(CharacterDataImpl *)impl checkCache:(BOOL)checkCache
 {
-    return [self substringData:offset :count error:nil];
+    if (!impl) {
+        [self release];
+        return nil;
+    }
+
+	if (checkCache) {
+		id cachedInstance;
+		cachedInstance = wrapperForImpl(impl);
+		if (cachedInstance) {
+			[self release];
+			return [cachedInstance retain];
+		}
+	}
+
+    [super init];
+    m_impl = impl;
+    impl->ref();
+    setWrapperForImpl(self, m_impl);
+    return self;
 }
 
-- (void)appendData:(NSString *)arg
++ (DOMCharacterData *)characterDataWithImpl:(CharacterDataImpl *)impl
 {
-    [self appendData:arg error:nil];
+    if (!impl)
+        return nil;
+    
+    id cachedInstance;
+    cachedInstance = wrapperForImpl(impl);
+    if (cachedInstance)
+        return [[cachedInstance retain] autorelease];
+    
+    return [[[self alloc] initWithCharacterDataImpl:impl checkCache:NO] autorelease];
 }
 
-- (void)insertData:(unsigned long)offset :(NSString *)arg
+- (id)initWithCharacterDataImpl:(CharacterDataImpl *)impl
 {
-    [self insertData:offset :arg error:nil];
+    return [self initWithCharacterDataImpl:impl checkCache:YES];
 }
 
-- (void)deleteData:(unsigned long)offset :(unsigned long)count
+- (CharacterDataImpl *)characterDataImpl
 {
-    [self deleteData:offset :count error:nil];
+	return m_impl;
 }
 
-- (void)replaceData:(unsigned long)offset :(unsigned long)count :(NSString *)arg
+- (void)dealloc
 {
-    [self replaceData:offset :count :arg error:nil];
+    if (m_impl) {
+        removeWrapperForImpl(m_impl);
+    	m_impl->deref();
+    }
+    [super dealloc];
 }
-//
-// end deprecated methods
-//
 
 @end
 
-
 //------------------------------------------------------------------------------------------
-// WebCoreDOMAttr
+// DOMAttr
 
- at implementation WebCoreDOMAttr
+ at implementation DOMAttr
 
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMAttr, AttrImpl)
+- (AttrImpl *)attrImpl
+{
+	AbstractMethodCalled([DOMAttr class]);
+    return nil;
+}
 
-// Note: This object does not need its own dealloc method, since it derives from
-// WebCoreDOMNode. See the dealloc method comment on that method for more information. 
+- (Class)classForDOMElement
+{
+	AbstractMethodCalled([DOMAttr class]);
+    return nil;
+}
+
+- (id)copyWithZone:(NSZone *)zone
+{
+    return [self retain];
+}
 
 - (NSString *)name
 {
-    return domStringToNSString([self impl]->nodeName());
+    return DOMStringToNSString([self attrImpl]->nodeName());
 }
 
 - (BOOL)specified
 {
-    return [self impl]->specified();
+    return [self attrImpl]->specified();
 }
 
 - (NSString *)value
 {
-    return domStringToNSString([self impl]->nodeValue());
+    return DOMStringToNSString([self attrImpl]->nodeValue());
 }
 
 - (void)setValue:(NSString *)value error:(NSError **)error
@@ -1129,48 +1533,122 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMAttr, AttrImpl)
     ASSERT(value);
 
     int code;
-    [self impl]->setValue(NSStringToDOMString(value), code);
+    [self attrImpl]->setValue(NSStringToDOMString(value), code);
     fillInError(error, code);
 }
 
-- (id <DOMElement>)ownerElement
+- (DOMElement *)ownerElement
+{
+    return [[self classForDOMElement] elementWithImpl:[self attrImpl]->ownerElement()];
+}
+
+ at end
+
+//------------------------------------------------------------------------------------------
+// WebCoreDOMAttr
+
+ at implementation WebCoreDOMAttr
+
+- (id)initWithAttrImpl:(AttrImpl *)impl checkCache:(BOOL)checkCache
+{
+    if (!impl) {
+        [self release];
+        return nil;
+    }
+
+	if (checkCache) {
+		id cachedInstance;
+		cachedInstance = wrapperForImpl(impl);
+		if (cachedInstance) {
+			[self release];
+			return [cachedInstance retain];
+		}
+	}
+
+    [super init];
+    m_impl = impl;
+    impl->ref();
+    setWrapperForImpl(self, m_impl);
+    return self;
+}
+
++ (DOMAttr *)attrWithImpl:(AttrImpl *)impl
+{
+    if (!impl)
+        return nil;
+    
+    id cachedInstance;
+    cachedInstance = wrapperForImpl(impl);
+    if (cachedInstance)
+        return [[cachedInstance retain] autorelease];
+    
+    return [[[self alloc] initWithAttrImpl:impl checkCache:NO] autorelease];
+}
+
+- (id)initWithAttrImpl:(AttrImpl *)impl
 {
-    return [WebCoreDOMElement objectWithImpl:[self impl]->ownerElement()];
+    return [self initWithAttrImpl:impl checkCache:YES];
 }
 
-//
-// begin deprecated methods
-//
-- (void)setValue:(NSString *)value
+- (AttrImpl *)attrImpl
 {
-    [self setValue:value error:nil];
+	return m_impl;
+}
+
+- (Class)classForDOMElement
+{
+	return [WebCoreDOMElement class];
+}
+
+- (void)dealloc
+{
+    if (m_impl) {
+        removeWrapperForImpl(m_impl);
+    	m_impl->deref();
+    }
+    [super dealloc];
 }
-//
-// end deprecated methods
-//
 
 @end
 
 //------------------------------------------------------------------------------------------
-// WebCoreDOMElement
+// DOMElement
 
- at implementation WebCoreDOMElement
+ at implementation DOMElement
+
+- (ElementImpl *)elementImpl
+{
+	AbstractMethodCalled([DOMElement class]);
+    return nil;
+}
 
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMElement, ElementImpl)
+- (Class)classForDOMAttr
+{
+	AbstractMethodCalled([DOMElement class]);
+    return nil;
+}
+
+- (Class)classForDOMNodeList
+{
+	AbstractMethodCalled([DOMElement class]);
+    return nil;
+}
 
-// Note: This object does not need its own dealloc method, since it derives from
-// WebCoreDOMNode. See the dealloc method comment on that method for more information. 
+- (id)copyWithZone:(NSZone *)zone
+{
+    return [self retain];
+}
 
 - (NSString *)tagName
 {
-    return domStringToNSString([self impl]->tagName());
+    return DOMStringToNSString([self elementImpl]->tagName());
 }
 
 - (NSString *)getAttribute:(NSString *)name
 {
     ASSERT(name);
 
-    return domStringToNSString([self impl]->getAttribute(NSStringToDOMString(name)));
+    return DOMStringToNSString([self elementImpl]->getAttribute(NSStringToDOMString(name)));
 }
 
 - (void)setAttribute:(NSString *)name :(NSString *)value error:(NSError **)error
@@ -1180,7 +1658,7 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMElement, ElementImpl)
 
     // Method not reflected in DOM::ElementImpl interface
     try {
-        Element element(ElementImpl::createInstance([self impl]));
+        Element element(ElementImpl::createInstance([self elementImpl]));
         element.setAttribute(NSStringToDOMString(name), NSStringToDOMString(value));
     } 
     catch (const DOMException &e) {
@@ -1194,7 +1672,7 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMElement, ElementImpl)
 
     // Method not reflected in DOM::ElementImpl interface
     try {
-        Element element(ElementImpl::createInstance([self impl]));
+        Element element(ElementImpl::createInstance([self elementImpl]));
         element.removeAttribute(NSStringToDOMString(name));
     } 
     catch (const DOMException &e) {
@@ -1202,29 +1680,26 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMElement, ElementImpl)
     }
 }
 
-- (id <DOMAttr>)getAttributeNode:(NSString *)name
+- (DOMAttr *)getAttributeNode:(NSString *)name
 {
     ASSERT(name);
 
     // Method not reflected in DOM::ElementImpl interface
-    Element element(ElementImpl::createInstance([self impl]));
+    Element element(ElementImpl::createInstance([self elementImpl]));
     Attr result(element.getAttributeNode(NSStringToDOMString(name)));
-    return [WebCoreDOMAttr objectWithImpl:static_cast<AttrImpl *>(result.handle())];
+    return [[self classForDOMAttr] attrWithImpl:static_cast<AttrImpl *>(result.handle())];
 }
 
-- (id <DOMAttr>)setAttributeNode:(id <DOMAttr>)newAttr error:(NSError **)error
+- (DOMAttr *)setAttributeNode:(DOMAttr *)newAttr error:(NSError **)error
 {
-    if (!newAttr) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
+    ASSERT(newAttr);
 
     // Method not reflected in DOM::ElementImpl interface
     try {
-        Element element(ElementImpl::createInstance([self impl]));
-        Attr attr(AttrImpl::createInstance(attrImpl(newAttr)));
+        Element element(ElementImpl::createInstance([self elementImpl]));
+        Attr attr(AttrImpl::createInstance([newAttr attrImpl]));
         Attr result(element.setAttributeNode(attr));
-        return [WebCoreDOMAttr objectWithImpl:static_cast<AttrImpl *>(result.handle())];
+        return [[self classForDOMAttr] attrWithImpl:static_cast<AttrImpl *>(result.handle())];
     } 
     catch (const DOMException &e) {
         fillInError(error, e.code);
@@ -1232,19 +1707,16 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMElement, ElementImpl)
     }
 }
 
-- (id <DOMAttr>)removeAttributeNode:(id <DOMAttr>)oldAttr error:(NSError **)error
+- (DOMAttr *)removeAttributeNode:(DOMAttr *)oldAttr error:(NSError **)error
 {
-    if (!oldAttr) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
+    ASSERT(oldAttr);
 
     // Method not reflected in DOM::ElementImpl interface
     try {
-        Element element(ElementImpl::createInstance([self impl]));
-        Attr attr(AttrImpl::createInstance(attrImpl(oldAttr)));
+        Element element(ElementImpl::createInstance([self elementImpl]));
+        Attr attr(AttrImpl::createInstance([oldAttr attrImpl]));
         Attr result(element.removeAttributeNode(attr));
-        return [WebCoreDOMAttr objectWithImpl:static_cast<AttrImpl *>(result.handle())];
+        return [[self classForDOMAttr] attrWithImpl:static_cast<AttrImpl *>(result.handle())];
     } 
     catch (const DOMException &e) {
         fillInError(error, e.code);
@@ -1252,11 +1724,11 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMElement, ElementImpl)
     }
 }
 
-- (id <DOMNodeList>)getElementsByTagName:(NSString *)name
+- (DOMNodeList *)getElementsByTagName:(NSString *)name
 {
     ASSERT(name);
 
-    return [WebCoreDOMNodeList objectWithImpl:[self impl]->getElementsByTagNameNS(0, NSStringToDOMString(name).implementation())];
+    return [[self classForDOMNodeList] nodeListWithImpl:[self elementImpl]->getElementsByTagNameNS(0, NSStringToDOMString(name).implementation())];
 }
 
 - (NSString *)getAttributeNS:(NSString *)namespaceURI :(NSString *)localName
@@ -1264,8 +1736,8 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMElement, ElementImpl)
     ASSERT(namespaceURI);
     ASSERT(localName);
 
-    Element element(ElementImpl::createInstance([self impl]));
-    return domStringToNSString(element.getAttributeNS(NSStringToDOMString(namespaceURI), NSStringToDOMString(localName)));
+    Element element(ElementImpl::createInstance([self elementImpl]));
+    return DOMStringToNSString(element.getAttributeNS(NSStringToDOMString(namespaceURI), NSStringToDOMString(localName)));
 }
 
 - (void)setAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName :(NSString *)value error:(NSError **)error
@@ -1276,7 +1748,7 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMElement, ElementImpl)
 
     // Method not reflected in DOM::ElementImpl interface
     try {
-        Element element(ElementImpl::createInstance([self impl]));
+        Element element(ElementImpl::createInstance([self elementImpl]));
         element.setAttributeNS(NSStringToDOMString(namespaceURI), NSStringToDOMString(qualifiedName), NSStringToDOMString(value));
     } 
     catch (const DOMException &e) {
@@ -1291,7 +1763,7 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMElement, ElementImpl)
 
     // Method not reflected in DOM::ElementImpl interface
     try {
-        Element element(ElementImpl::createInstance([self impl]));
+        Element element(ElementImpl::createInstance([self elementImpl]));
         element.removeAttributeNS(NSStringToDOMString(namespaceURI), NSStringToDOMString(localName));
     } 
     catch (const DOMException &e) {
@@ -1299,30 +1771,27 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMElement, ElementImpl)
     }
 }
 
-- (id <DOMAttr>)getAttributeNodeNS:(NSString *)namespaceURI :(NSString *)localName
+- (DOMAttr *)getAttributeNodeNS:(NSString *)namespaceURI :(NSString *)localName
 {
     ASSERT(namespaceURI);
     ASSERT(localName);
 
     // Method not reflected in DOM::ElementImpl interface
-    Element element(ElementImpl::createInstance([self impl]));
+    Element element(ElementImpl::createInstance([self elementImpl]));
     Attr result(element.getAttributeNodeNS(NSStringToDOMString(namespaceURI), NSStringToDOMString(localName)));
-    return [WebCoreDOMAttr objectWithImpl:static_cast<AttrImpl *>(result.handle())];
+    return [[self classForDOMAttr] attrWithImpl:static_cast<AttrImpl *>(result.handle())];
 }
 
-- (id <DOMAttr>)setAttributeNodeNS:(id <DOMAttr>)newAttr error:(NSError **)error
+- (DOMAttr *)setAttributeNodeNS:(DOMAttr *)newAttr error:(NSError **)error
 {
-    if (!newAttr) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
+    ASSERT(newAttr);
 
     // Method not reflected in DOM::ElementImpl interface
     try {
-        Element element(ElementImpl::createInstance([self impl]));
-        Attr attr(AttrImpl::createInstance(attrImpl(newAttr)));
+        Element element(ElementImpl::createInstance([self elementImpl]));
+        Attr attr(AttrImpl::createInstance([newAttr attrImpl]));
         Attr result(element.setAttributeNodeNS(attr));
-        return [WebCoreDOMAttr objectWithImpl:static_cast<AttrImpl *>(result.handle())];
+        return [[self classForDOMAttr] attrWithImpl:static_cast<AttrImpl *>(result.handle())];
     } 
     catch (const DOMException &e) {
         fillInError(error, e.code);
@@ -1330,12 +1799,12 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMElement, ElementImpl)
     }
 }
 
-- (id <DOMNodeList>)getElementsByTagNameNS:(NSString *)namespaceURI :(NSString *)localName
+- (DOMNodeList *)getElementsByTagNameNS:(NSString *)namespaceURI :(NSString *)localName
 {
     ASSERT(namespaceURI);
     ASSERT(localName);
 
-    return [WebCoreDOMNodeList objectWithImpl:[self impl]->getElementsByTagNameNS(NSStringToDOMString(namespaceURI).implementation(), NSStringToDOMString(localName).implementation())];
+    return [[self classForDOMNodeList] nodeListWithImpl:[self elementImpl]->getElementsByTagNameNS(NSStringToDOMString(namespaceURI).implementation(), NSStringToDOMString(localName).implementation())];
 }
 
 - (BOOL)hasAttribute:(NSString *)name
@@ -1343,7 +1812,7 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMElement, ElementImpl)
     ASSERT(name);
 
     // Method not reflected in DOM::ElementImpl interface
-    Element element(ElementImpl::createInstance([self impl]));
+    Element element(ElementImpl::createInstance([self elementImpl]));
     return element.hasAttribute(NSStringToDOMString(name));
 }
 
@@ -1353,81 +1822,187 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMElement, ElementImpl)
     ASSERT(localName);
 
     // Method not reflected in DOM::ElementImpl interface
-    Element element(ElementImpl::createInstance([self impl]));
+    Element element(ElementImpl::createInstance([self elementImpl]));
     return element.hasAttributeNS(NSStringToDOMString(namespaceURI), NSStringToDOMString(localName));
 }
 
-//
-// begin deprecated methods
-//
-- (void)setAttribute:(NSString *)name :(NSString *)value
+ at end
+
+//------------------------------------------------------------------------------------------
+// WebCoreDOMElement
+
+ at implementation WebCoreDOMElement
+
+- (id)initWithElementImpl:(ElementImpl *)impl checkCache:(BOOL)checkCache
 {
-    [self setAttribute:name :value error:nil];
+    if (!impl) {
+        [self release];
+        return nil;
+    }
+
+	if (checkCache) {
+		id cachedInstance;
+		cachedInstance = wrapperForImpl(impl);
+		if (cachedInstance) {
+			[self release];
+			return [cachedInstance retain];
+		}
+	}
+
+    [super init];
+    m_impl = impl;
+    impl->ref();
+    setWrapperForImpl(self, m_impl);
+    return self;
 }
 
-- (void)removeAttribute:(NSString *)name
++ (DOMElement *)elementWithImpl:(ElementImpl *)impl
 {
-    [self removeAttribute:name error:nil];
+    if (!impl)
+        return nil;
+    
+    id cachedInstance;
+    cachedInstance = wrapperForImpl(impl);
+    if (cachedInstance)
+        return [[cachedInstance retain] autorelease];
+    
+    return [[[self alloc] initWithElementImpl:impl checkCache:NO] autorelease];
 }
 
-- (id<DOMAttr>)setAttributeNode:(id<DOMAttr>)newAttr
+- (id)initWithElementImpl:(ElementImpl *)impl
 {
-    return [self setAttributeNode:newAttr error:nil];
+    return [self initWithElementImpl:impl checkCache:YES];
 }
 
-- (id<DOMAttr>)removeAttributeNode:(id<DOMAttr>)oldAttr
+- (ElementImpl *)elementImpl
 {
-    return [self removeAttributeNode:oldAttr error:nil];
+	return m_impl;
 }
 
-- (void)setAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName :(NSString *)value
+- (Class)classForDOMAttr
 {
-    [self setAttributeNS:namespaceURI :qualifiedName :value error:nil];
+	return [WebCoreDOMAttr class];
 }
 
-- (void)removeAttributeNS:(NSString *)namespaceURI :(NSString *)localName
+- (Class)classForDOMNodeList
 {
-    [self removeAttributeNS:namespaceURI :localName error:nil];
+	return [WebCoreDOMNodeList class];
 }
 
-- (id<DOMAttr>)setAttributeNodeNS:(id<DOMAttr>)newAttr
+- (void)dealloc
 {
-    return [self setAttributeNodeNS:newAttr error:nil];
+    if (m_impl) {
+        removeWrapperForImpl(m_impl);
+    	m_impl->deref();
+    }
+    [super dealloc];
 }
-//
-// end deprecated methods
-//
 
 @end
 
 //------------------------------------------------------------------------------------------
-// WebCoreDOMText
+// DOMText
 
- at implementation WebCoreDOMText
+ at implementation DOMText
 
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMText, TextImpl)
+- (TextImpl *)textImpl
+{
+	AbstractMethodCalled([DOMText class]);
+    return nil;
+}
 
-// Note: This object does not need its own dealloc method, since it derives from
-// WebCoreDOMNode. See the dealloc method comment on that method for more information. 
+- (id)copyWithZone:(NSZone *)zone
+{
+    return [self retain];
+}
 
-- (id <DOMText>)splitText:(unsigned long)offset error:(NSError **)error
+- (DOMText *)splitText:(unsigned long)offset error:(NSError **)error
 {
     int code;
-    id <DOMText> result = [WebCoreDOMText objectWithImpl:[self impl]->splitText(offset, code)];
+    DOMText *result = [[self class] textWithImpl:[self textImpl]->splitText(offset, code)];
     fillInError(error, code);
     return result;
 }
 
-//
-// begin deprecated methods
-//
-- (id<DOMText>)splitText:(unsigned long)offset
+ at end
+
+//------------------------------------------------------------------------------------------
+// WebCoreDOMText
+
+ at implementation WebCoreDOMText
+
+- (id)initWithTextImpl:(TextImpl *)impl checkCache:(BOOL)checkCache
+{
+    if (!impl) {
+        [self release];
+        return nil;
+    }
+
+	if (checkCache) {
+		id cachedInstance;
+		cachedInstance = wrapperForImpl(impl);
+		if (cachedInstance) {
+			[self release];
+			return [cachedInstance retain];
+		}
+	}
+
+    [super init];
+    m_impl = impl;
+    impl->ref();
+    setWrapperForImpl(self, m_impl);
+    return self;
+}
+
++ (DOMText *)textWithImpl:(TextImpl *)impl
+{
+    if (!impl)
+        return nil;
+    
+    id cachedInstance;
+    cachedInstance = wrapperForImpl(impl);
+    if (cachedInstance)
+        return [[cachedInstance retain] autorelease];
+    
+    return [[[self alloc] initWithTextImpl:impl checkCache:NO] autorelease];
+}
+
+- (id)initWithTextImpl:(TextImpl *)impl
 {
-    return [self splitText:offset error:nil];
+    return [self initWithTextImpl:impl checkCache:YES];
+}
+
+- (TextImpl *)textImpl
+{
+	return m_impl;
+}
+
+- (void)dealloc
+{
+    if (m_impl) {
+        removeWrapperForImpl(m_impl);
+    	m_impl->deref();
+    }
+    [super dealloc];
+}
+
+ at end
+
+//------------------------------------------------------------------------------------------
+// DOMComment
+
+ at implementation DOMComment
+
+- (CommentImpl *)commentImpl
+{
+	AbstractMethodCalled([DOMComment class]);
+    return nil;
+}
+
+- (id)copyWithZone:(NSZone *)zone
+{
+    return [self retain];
 }
-//
-// end deprecated methods
-//
 
 @end
 
@@ -1436,7 +2011,78 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMText, TextImpl)
 
 @implementation WebCoreDOMComment
 
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMComment, CommentImpl)
+- (id)initWithCommentImpl:(CommentImpl *)impl checkCache:(BOOL)checkCache
+{
+    if (!impl) {
+        [self release];
+        return nil;
+    }
+
+	if (checkCache) {
+		id cachedInstance;
+		cachedInstance = wrapperForImpl(impl);
+		if (cachedInstance) {
+			[self release];
+			return [cachedInstance retain];
+		}
+	}
+
+    [super init];
+    m_impl = impl;
+    impl->ref();
+    setWrapperForImpl(self, m_impl);
+    return self;
+}
+
++ (DOMComment *)commentWithImpl:(CommentImpl *)impl
+{
+    if (!impl)
+        return nil;
+    
+    id cachedInstance;
+    cachedInstance = wrapperForImpl(impl);
+    if (cachedInstance)
+        return [[cachedInstance retain] autorelease];
+    
+    return [[[self alloc] initWithCommentImpl:impl checkCache:NO] autorelease];
+}
+
+- (id)initWithCommentImpl:(CommentImpl *)impl
+{
+    return [self initWithCommentImpl:impl checkCache:YES];
+}
+
+- (CommentImpl *)commentImpl
+{
+	return m_impl;
+}
+
+- (void)dealloc
+{
+    if (m_impl) {
+        removeWrapperForImpl(m_impl);
+    	m_impl->deref();
+    }
+    [super dealloc];
+}
+
+ at end
+
+//------------------------------------------------------------------------------------------
+// DOMCDATASection
+
+ at implementation DOMCDATASection
+
+- (CDATASectionImpl *)CDATASectionImpl
+{
+	AbstractMethodCalled([DOMCDATASection class]);
+    return nil;
+}
+
+- (id)copyWithZone:(NSZone *)zone
+{
+    return [self retain];
+}
 
 @end
 
@@ -1445,48 +2091,208 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMComment, CommentImpl)
 
 @implementation WebCoreDOMCDATASection
 
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMCDATASection, CDATASectionImpl)
+- (id)initWithCDATASectionImpl:(CDATASectionImpl *)impl checkCache:(BOOL)checkCache
+{
+    if (!impl) {
+        [self release];
+        return nil;
+    }
+
+	if (checkCache) {
+		id cachedInstance;
+		cachedInstance = wrapperForImpl(impl);
+		if (cachedInstance) {
+			[self release];
+			return [cachedInstance retain];
+		}
+	}
+
+    [super init];
+    m_impl = impl;
+    impl->ref();
+    setWrapperForImpl(self, m_impl);
+    return self;
+}
+
++ (DOMCDATASection *)CDATASectionWithImpl:(CDATASectionImpl *)impl
+{
+    if (!impl)
+        return nil;
+    
+    id cachedInstance;
+    cachedInstance = wrapperForImpl(impl);
+    if (cachedInstance)
+        return [[cachedInstance retain] autorelease];
+    
+    return [[[self alloc] initWithCDATASectionImpl:impl checkCache:NO] autorelease];
+}
+
+- (id)initWithCDATASectionImpl:(CDATASectionImpl *)impl
+{
+    return [self initWithCDATASectionImpl:impl checkCache:YES];
+}
+
+- (CDATASectionImpl *)CDATASectionImpl
+{
+	return m_impl;
+}
+
+- (void)dealloc
+{
+    if (m_impl) {
+        removeWrapperForImpl(m_impl);
+    	m_impl->deref();
+    }
+    [super dealloc];
+}
 
 @end
 
 //------------------------------------------------------------------------------------------
-// WebCoreDOMDocumentType
+// DOMDocumentType
 
- at implementation WebCoreDOMDocumentType
+ at implementation DOMDocumentType
 
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMDocumentType, DocumentTypeImpl)
+- (DocumentTypeImpl *)documentTypeImpl
+{
+	AbstractMethodCalled([DOMDocumentType class]);
+    return nil;
+}
 
-// Note: This object does not need its own dealloc method, since it derives from
-// WebCoreDOMNode. See the dealloc method comment on that method for more information. 
+- (Class)classForDOMNamedNodeMap
+{
+	AbstractMethodCalled([DOMDocumentType class]);
+    return nil;
+}
+
+- (id)copyWithZone:(NSZone *)zone
+{
+    return [self retain];
+}
 
 - (NSString *)name
 {
-    return domStringToNSString([self impl]->publicId());
+    return DOMStringToNSString([self documentTypeImpl]->publicId());
 }
 
-- (id <DOMNamedNodeMap>)entities
+- (DOMNamedNodeMap *)entities
 {
-    return [WebCoreDOMNamedNodeMap objectWithImpl:[self impl]->entities()];
+    return [[self classForDOMNamedNodeMap] namedNodeMapWithImpl:[self documentTypeImpl]->entities()];
 }
 
-- (id <DOMNamedNodeMap>)notations
+- (DOMNamedNodeMap *)notations
 {
-    return [WebCoreDOMNamedNodeMap objectWithImpl:[self impl]->notations()];
+    return [[self classForDOMNamedNodeMap] namedNodeMapWithImpl:[self documentTypeImpl]->notations()];
 }
 
 - (NSString *)publicId
 {
-    return domStringToNSString([self impl]->publicId());
+    return DOMStringToNSString([self documentTypeImpl]->publicId());
 }
 
 - (NSString *)systemId
 {
-    return domStringToNSString([self impl]->systemId());
+    return DOMStringToNSString([self documentTypeImpl]->systemId());
 }
 
 - (NSString *)internalSubset
 {
-    return domStringToNSString([self impl]->internalSubset());
+    return DOMStringToNSString([self documentTypeImpl]->internalSubset());
+}
+
+ at end
+
+//------------------------------------------------------------------------------------------
+// WebCoreDOMDocumentType
+
+ at implementation WebCoreDOMDocumentType
+
+- (id)initWithDocumentTypeImpl:(DocumentTypeImpl *)impl checkCache:(BOOL)checkCache
+{
+    if (!impl) {
+        [self release];
+        return nil;
+    }
+
+	if (checkCache) {
+		id cachedInstance;
+		cachedInstance = wrapperForImpl(impl);
+		if (cachedInstance) {
+			[self release];
+			return [cachedInstance retain];
+		}
+	}
+
+    [super init];
+    m_impl = impl;
+    impl->ref();
+    setWrapperForImpl(self, m_impl);
+    return self;
+}
+
++ (DOMDocumentType *)documentTypeWithImpl:(DocumentTypeImpl *)impl
+{
+    if (!impl)
+        return nil;
+    
+    id cachedInstance;
+    cachedInstance = wrapperForImpl(impl);
+    if (cachedInstance)
+        return [[cachedInstance retain] autorelease];
+    
+    return [[[self alloc] initWithDocumentTypeImpl:impl checkCache:NO] autorelease];
+}
+
+- (id)initWithDocumentTypeImpl:(DocumentTypeImpl *)impl
+{
+    return [self initWithDocumentTypeImpl:impl checkCache:YES];
+}
+
+- (DocumentTypeImpl *)documentTypeImpl
+{
+	return m_impl;
+}
+
+- (Class)classForDOMNamedNodeMap
+{
+	return [WebCoreDOMNamedNodeMap class];
+}
+
+- (void)dealloc
+{
+    if (m_impl) {
+        removeWrapperForImpl(m_impl);
+    	m_impl->deref();
+    }
+    [super dealloc];
+}
+
+ at end
+
+//------------------------------------------------------------------------------------------
+// DOMNotation
+
+ at implementation DOMNotation
+
+- (NotationImpl *)notationImpl
+{
+	AbstractMethodCalled([DOMNotation class]);
+    return nil;
+}
+
+- (id)copyWithZone:(NSZone *)zone
+{
+    return [self retain];
+}
+
+- (NSString *)publicId
+{
+    return DOMStringToNSString([self notationImpl]->publicId());
+}
+
+- (NSString *)systemId
+{
+    return DOMStringToNSString([self notationImpl]->systemId());
 }
 
 @end
@@ -1496,19 +2302,92 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMDocumentType, DocumentTypeImpl)
 
 @implementation WebCoreDOMNotation
 
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMNotation, NotationImpl)
+- (id)initWithNotationImpl:(NotationImpl *)impl checkCache:(BOOL)checkCache
+{
+    if (!impl) {
+        [self release];
+        return nil;
+    }
 
-// Note: This object does not need its own dealloc method, since it derives from
-// WebCoreDOMNode. See the dealloc method comment on that method for more information. 
+	if (checkCache) {
+		id cachedInstance;
+		cachedInstance = wrapperForImpl(impl);
+		if (cachedInstance) {
+			[self release];
+			return [cachedInstance retain];
+		}
+	}
+
+    [super init];
+    m_impl = impl;
+    impl->ref();
+    setWrapperForImpl(self, m_impl);
+    return self;
+}
+
++ (DOMNotation *)notationWithImpl:(NotationImpl *)impl
+{
+    if (!impl)
+        return nil;
+    
+    id cachedInstance;
+    cachedInstance = wrapperForImpl(impl);
+    if (cachedInstance)
+        return [[cachedInstance retain] autorelease];
+    
+    return [[[self alloc] initWithNotationImpl:impl checkCache:NO] autorelease];
+}
+
+- (id)initWithNotationImpl:(NotationImpl *)impl
+{
+	return [self initWithNotationImpl:impl checkCache:YES];
+}
+
+- (NotationImpl *)notationImpl
+{
+	return m_impl;
+}
+
+- (void)dealloc
+{
+    if (m_impl) {
+        removeWrapperForImpl(m_impl);
+    	m_impl->deref();
+    }
+    [super dealloc];
+}
+
+ at end
+
+//------------------------------------------------------------------------------------------
+// DOMEntity
+
+ at implementation DOMEntity
+
+- (EntityImpl *)entityImpl
+{
+	AbstractMethodCalled([DOMEntity class]);
+    return nil;
+}
+
+- (id)copyWithZone:(NSZone *)zone
+{
+    return [self retain];
+}
 
 - (NSString *)publicId
 {
-    return domStringToNSString([self impl]->publicId());
+    return DOMStringToNSString([self entityImpl]->publicId());
 }
 
 - (NSString *)systemId
 {
-    return domStringToNSString([self impl]->systemId());
+    return DOMStringToNSString([self entityImpl]->systemId());
+}
+
+- (NSString *)notationName
+{
+    return DOMStringToNSString([self entityImpl]->notationName());
 }
 
 @end
@@ -1518,21 +2397,77 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMNotation, NotationImpl)
 
 @implementation WebCoreDOMEntity
 
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMEntity, EntityImpl)
+- (id)initWithEntityImpl:(EntityImpl *)impl checkCache:(BOOL)checkCache
+{
+    if (!impl) {
+        [self release];
+        return nil;
+    }
 
-- (NSString *)publicId
+	if (checkCache) {
+		id cachedInstance;
+		cachedInstance = wrapperForImpl(impl);
+		if (cachedInstance) {
+			[self release];
+			return [cachedInstance retain];
+		}
+	}
+
+    [super init];
+    m_impl = impl;
+    impl->ref();
+    setWrapperForImpl(self, m_impl);
+    return self;
+}
+
++ (DOMEntity *)entityWithImpl:(EntityImpl *)impl
 {
-    return domStringToNSString([self impl]->publicId());
+    if (!impl)
+        return nil;
+    
+    id cachedInstance;
+    cachedInstance = wrapperForImpl(impl);
+    if (cachedInstance)
+        return [[cachedInstance retain] autorelease];
+    
+    return [[[self alloc] initWithEntityImpl:impl checkCache:NO] autorelease];
 }
 
-- (NSString *)systemId
+- (id)initWithEntityImpl:(EntityImpl *)impl
 {
-    return domStringToNSString([self impl]->systemId());
+	return [self initWithEntityImpl:impl checkCache:YES];
 }
 
-- (NSString *)notationName
+- (EntityImpl *)entityImpl
+{
+	return m_impl;
+}
+
+- (void)dealloc
 {
-    return domStringToNSString([self impl]->notationName());
+    if (m_impl) {
+        removeWrapperForImpl(m_impl);
+    	m_impl->deref();
+    }
+    [super dealloc];
+}
+
+ at end
+
+//------------------------------------------------------------------------------------------
+// DOMEntityReference
+
+ at implementation DOMEntityReference
+
+- (EntityReferenceImpl *)entityReferenceImpl
+{
+	AbstractMethodCalled([DOMEntityReference class]);
+    return nil;
+}
+
+- (id)copyWithZone:(NSZone *)zone
+{
+    return [self retain];
 }
 
 @end
@@ -1542,31 +2477,88 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMEntity, EntityImpl)
 
 @implementation WebCoreDOMEntityReference
 
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMEntityReference, EntityReferenceImpl)
+- (id)initWithEntityReferenceImpl:(EntityReferenceImpl *)impl checkCache:(BOOL)checkCache
+{
+    if (!impl) {
+        [self release];
+        return nil;
+    }
+
+	if (checkCache) {
+		id cachedInstance;
+		cachedInstance = wrapperForImpl(impl);
+		if (cachedInstance) {
+			[self release];
+			return [cachedInstance retain];
+		}
+	}
+
+    [super init];
+    m_impl = impl;
+    impl->ref();
+    setWrapperForImpl(self, m_impl);
+    return self;
+}
+
++ (DOMEntityReference *)entityReferenceWithImpl:(EntityReferenceImpl *)impl
+{
+    if (!impl)
+        return nil;
+    
+    id cachedInstance;
+    cachedInstance = wrapperForImpl(impl);
+    if (cachedInstance)
+        return [[cachedInstance retain] autorelease];
+    
+    return [[[self alloc] initWithEntityReferenceImpl:impl checkCache:NO] autorelease];
+}
+
+- (id)initWithEntityReferenceImpl:(EntityReferenceImpl *)impl
+{
+    return [self initWithEntityReferenceImpl:impl checkCache:YES];
+}
 
-// Note: This object does not need its own dealloc method, since it derives from
-// WebCoreDOMNode. See the dealloc method comment on that method for more information. 
+- (EntityReferenceImpl *)entityReferenceImpl
+{
+	return m_impl;
+}
+
+- (void)dealloc
+{
+    if (m_impl) {
+        removeWrapperForImpl(m_impl);
+    	m_impl->deref();
+    }
+    [super dealloc];
+}
 
 @end
 
+
 //------------------------------------------------------------------------------------------
-// WebCoreDOMProcessingInstruction
+// DOMProcessingInstruction
 
- at implementation WebCoreDOMProcessingInstruction
+ at implementation DOMProcessingInstruction
 
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMProcessingInstruction, ProcessingInstructionImpl)
+- (ProcessingInstructionImpl *)processingInstructionImpl
+{
+	AbstractMethodCalled([DOMProcessingInstruction class]);
+    return nil;
+}
 
-// Note: This object does not need its own dealloc method, since it derives from
-// WebCoreDOMNode. See the dealloc method comment on that method for more information. 
+- (id)copyWithZone:(NSZone *)zone
+{
+    return [self retain];
+}
 
 - (NSString *)target
 {
-    return domStringToNSString([self impl]->target());
+    return DOMStringToNSString([self processingInstructionImpl]->target());
 }
 
 - (NSString *)data
 {
-    return domStringToNSString([self impl]->data());
+    return DOMStringToNSString([self processingInstructionImpl]->data());
 }
 
 - (void)setData:(NSString *)data error:(NSError **)error
@@ -1574,46 +2566,106 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMProcessingInstruction, ProcessingInstruction
     ASSERT(data);
 
     int code;
-    [self impl]->setData(NSStringToDOMString(data), code);
+    [self processingInstructionImpl]->setData(NSStringToDOMString(data), code);
     fillInError(error, code);
 }
 
-//
-// begin deprecated methods
-//
-- (void)setData:(NSString *)data
+ at end
+
+//------------------------------------------------------------------------------------------
+// WebCoreDOMProcessingInstruction
+
+ at implementation WebCoreDOMProcessingInstruction
+
+- (id)initWithProcessingInstructionImpl:(ProcessingInstructionImpl *)impl checkCache:(BOOL)checkCache
 {
-    [self setData:data error:nil];
+    if (!impl) {
+        [self release];
+        return nil;
+    }
+
+	if (checkCache) {
+		id cachedInstance;
+		cachedInstance = wrapperForImpl(impl);
+		if (cachedInstance) {
+			[self release];
+			return [cachedInstance retain];
+		}
+	}
+
+    [super init];
+    m_impl = impl;
+    impl->ref();
+    setWrapperForImpl(self, m_impl);
+    return self;
+}
+
++ (DOMProcessingInstruction *)processingInstructionWithImpl:(ProcessingInstructionImpl *)impl
+{
+    if (!impl)
+        return nil;
+    
+    id cachedInstance;
+    cachedInstance = wrapperForImpl(impl);
+    if (cachedInstance)
+        return [[cachedInstance retain] autorelease];
+    
+    return [[[self alloc] initWithProcessingInstructionImpl:impl checkCache:NO] autorelease];
+}
+
+- (id)initWithProcessingInstructionImpl:(ProcessingInstructionImpl *)impl
+{
+	return [self initWithProcessingInstructionImpl:impl checkCache:YES];
+}
+
+- (ProcessingInstructionImpl *)processingInstructionImpl
+{
+	return m_impl;
+}
+
+- (void)dealloc
+{
+    if (m_impl) {
+        removeWrapperForImpl(m_impl);
+    	m_impl->deref();
+    }
+    [super dealloc];
 }
-//
-// end deprecated methods
-//
 
 @end
 
 //------------------------------------------------------------------------------------------
-// WebCoreDOMRange
+// DOMRange
 
- at implementation WebCoreDOMRange
+ at implementation DOMRange
 
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMRange, RangeImpl)
+- (RangeImpl *)rangeImpl
+{
+	AbstractMethodCalled([DOMRange class]);
+    return nil;
+}
 
-// Note: only objects that derive directly from WebDOMObject need their own dealloc method.
-// This is due to the fact that some of the details impl objects derive from
-// khtml::Shared, others from khtml::TreeShared (which do not share a base type), and we 
-// have to cast to the right type in order to call the deref() function.
-- (void)dealloc
+- (Class)classForDOMDocumentFragment
 {
-    RangeImpl *instance = static_cast<RangeImpl *>(details);
-    if (instance)
-        instance->deref();
-    [super dealloc];
+	AbstractMethodCalled([DOMRange class]);
+    return nil;
 }
 
-- (id <DOMNode>)startContainer:(NSError **)error
+- (Class)classForDOMNode
+{
+	AbstractMethodCalled([DOMRange class]);
+    return nil;
+}
+
+- (id)copyWithZone:(NSZone *)zone
+{
+    return [self retain];
+}
+
+- (DOMNode *)startContainer:(NSError **)error
 {
     int code;
-    id <DOMNode> result = [WebCoreDOMNode objectWithImpl:[self impl]->startContainer(code)];
+    DOMNode *result = [[self classForDOMNode] nodeWithImpl:[self rangeImpl]->startContainer(code)];
     fillInError(error, code);
     return result;
 }
@@ -1621,15 +2673,15 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMRange, RangeImpl)
 - (long)startOffset:(NSError **)error
 {
     int code;
-    long result = [self impl]->startOffset(code);
+    long result = [self rangeImpl]->startOffset(code);
     fillInError(error, code);
     return result;
 }
 
-- (id <DOMNode>)endContainer:(NSError **)error
+- (DOMNode *)endContainer:(NSError **)error
 {
     int code;
-    id <DOMNode> result = [WebCoreDOMNode objectWithImpl:[self impl]->endContainer(code)];
+    DOMNode *result = [[self classForDOMNode] nodeWithImpl:[self rangeImpl]->endContainer(code)];
     fillInError(error, code);
     return result;
 }
@@ -1637,7 +2689,7 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMRange, RangeImpl)
 - (long)endOffset:(NSError **)error
 {
     int code;
-    long result = [self impl]->endOffset(code);
+    long result = [self rangeImpl]->endOffset(code);
     fillInError(error, code);
     return result;
 }
@@ -1645,86 +2697,86 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMRange, RangeImpl)
 - (BOOL)collapsed:(NSError **)error
 {
     int code;
-    BOOL result = [self impl]->collapsed(code);
+    BOOL result = [self rangeImpl]->collapsed(code);
     fillInError(error, code);
     return result;
 }
 
-- (id <DOMNode>)commonAncestorContainer:(NSError **)error
+- (DOMNode *)commonAncestorContainer:(NSError **)error
 {
     int code;
-    id <DOMNode> result = [WebCoreDOMNode objectWithImpl:[self impl]->commonAncestorContainer(code)];
+    DOMNode *result = [[self classForDOMNode] nodeWithImpl:[self rangeImpl]->commonAncestorContainer(code)];
     fillInError(error, code);
     return result;
 }
 
-- (void)setStart:(id <DOMNode>)refNode :(long)offset error:(NSError **)error
+- (void)setStart:(DOMNode *)refNode :(long)offset error:(NSError **)error
 {
     int code;
-    [self impl]->setStart(nodeImpl(refNode), offset, code);
+    [self rangeImpl]->setStart([refNode nodeImpl], offset, code);
     fillInError(error, code);
 }
 
-- (void)setEnd:(id <DOMNode>)refNode :(long)offset error:(NSError **)error
+- (void)setEnd:(DOMNode *)refNode :(long)offset error:(NSError **)error
 {
     int code;
-    [self impl]->setEnd(nodeImpl(refNode), offset, code);
+    [self rangeImpl]->setEnd([refNode nodeImpl], offset, code);
     fillInError(error, code);
 }
 
-- (void)setStartBefore:(id <DOMNode>)refNode error:(NSError **)error
+- (void)setStartBefore:(DOMNode *)refNode error:(NSError **)error
 {
     int code;
-    [self impl]->setStartBefore(nodeImpl(refNode), code);
+    [self rangeImpl]->setStartBefore([refNode nodeImpl], code);
     fillInError(error, code);
 }
 
-- (void)setStartAfter:(id <DOMNode>)refNode error:(NSError **)error
+- (void)setStartAfter:(DOMNode *)refNode error:(NSError **)error
 {
     int code;
-    [self impl]->setStartAfter(nodeImpl(refNode), code);
+    [self rangeImpl]->setStartAfter([refNode nodeImpl], code);
     fillInError(error, code);
 }
 
-- (void)setEndBefore:(id <DOMNode>)refNode error:(NSError **)error
+- (void)setEndBefore:(DOMNode *)refNode error:(NSError **)error
 {
     int code;
-    [self impl]->setEndBefore(nodeImpl(refNode), code);
+    [self rangeImpl]->setEndBefore([refNode nodeImpl], code);
     fillInError(error, code);
 }
 
-- (void)setEndAfter:(id <DOMNode>)refNode error:(NSError **)error
+- (void)setEndAfter:(DOMNode *)refNode error:(NSError **)error
 {
     int code;
-    [self impl]->setEndAfter(nodeImpl(refNode), code);
+    [self rangeImpl]->setEndAfter([refNode nodeImpl], code);
     fillInError(error, code);
 }
 
 - (void)collapse:(BOOL)toStart error:(NSError **)error
 {
     int code;
-    [self impl]->collapse(toStart, code);
+    [self rangeImpl]->collapse(toStart, code);
     fillInError(error, code);
 }
 
-- (void)selectNode:(id <DOMNode>)refNode error:(NSError **)error
+- (void)selectNode:(DOMNode *)refNode error:(NSError **)error
 {
     int code;
-    [self impl]->selectNode(nodeImpl(refNode), code);
+    [self rangeImpl]->selectNode([refNode nodeImpl], code);
     fillInError(error, code);
 }
 
-- (void)selectNodeContents:(id <DOMNode>)refNode error:(NSError **)error
+- (void)selectNodeContents:(DOMNode *)refNode error:(NSError **)error
 {
     int code;
-    [self impl]->selectNodeContents(nodeImpl(refNode), code);
+    [self rangeImpl]->selectNodeContents([refNode nodeImpl], code);
     fillInError(error, code);
 }
 
-- (short)compareBoundaryPoints:(unsigned short)how :(id <DOMRange>)sourceRange error:(NSError **)error
+- (short)compareBoundaryPoints:(unsigned short)how :(DOMRange *)sourceRange error:(NSError **)error
 {
     int code;
-    short result = [self impl]->compareBoundaryPoints(static_cast<Range::CompareHow>(how), rangeImpl(sourceRange), code);
+    short result = [self rangeImpl]->compareBoundaryPoints(static_cast<Range::CompareHow>(how), [sourceRange rangeImpl], code);
     fillInError(error, code);
     return result;
 }
@@ -1732,44 +2784,44 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMRange, RangeImpl)
 - (void)deleteContents:(NSError **)error
 {
     int code;
-    [self impl]->deleteContents(code);
+    [self rangeImpl]->deleteContents(code);
     fillInError(error, code);
 }
 
-- (id <DOMDocumentFragment>)extractContents:(NSError **)error
+- (DOMDocumentFragment *)extractContents:(NSError **)error
 {
     int code;
-    id <DOMDocumentFragment> result = [WebCoreDOMDocumentFragment objectWithImpl:[self impl]->extractContents(code)];
+    DOMDocumentFragment *result = [[self classForDOMDocumentFragment] documentFragmentWithImpl:[self rangeImpl]->extractContents(code)];
     fillInError(error, code);
     return result;
 }
 
-- (id <DOMDocumentFragment>)cloneContents:(NSError **)error
+- (DOMDocumentFragment *)cloneContents:(NSError **)error
 {
     int code;
-    id <DOMDocumentFragment> result = [WebCoreDOMDocumentFragment objectWithImpl:[self impl]->cloneContents(code)];
+    DOMDocumentFragment *result = [[self classForDOMDocumentFragment] documentFragmentWithImpl:[self rangeImpl]->cloneContents(code)];
     fillInError(error, code);
     return result;
 }
 
-- (void)insertNode:(id <DOMNode>)newNode error:(NSError **)error
+- (void)insertNode:(DOMNode *)newNode error:(NSError **)error
 {
     int code;
-    [self impl]->insertNode(nodeImpl(newNode), code);
+    [self rangeImpl]->insertNode([newNode nodeImpl], code);
     fillInError(error, code);
 }
 
-- (void)surroundContents:(id <DOMNode>)newParent error:(NSError **)error
+- (void)surroundContents:(DOMNode *)newParent error:(NSError **)error
 {
     int code;
-    [self impl]->surroundContents(nodeImpl(newParent), code);
+    [self rangeImpl]->surroundContents([newParent nodeImpl], code);
     fillInError(error, code);
 }
 
-- (id <DOMRange>)cloneRange:(NSError **)error
+- (DOMRange *)cloneRange:(NSError **)error
 {
     int code;
-    id <DOMRange> result = [WebCoreDOMRange objectWithImpl:[self impl]->cloneRange(code)];
+    DOMRange *result = [WebCoreDOMRange rangeWithImpl:[self rangeImpl]->cloneRange(code)];
     fillInError(error, code);
     return result;
 }
@@ -1777,7 +2829,7 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMRange, RangeImpl)
 - (NSString *)toString:(NSError **)error
 {
     int code;
-    NSString *result = domStringToNSString([self impl]->toString(code));
+    NSString *result = DOMStringToNSString([self rangeImpl]->toString(code));
     fillInError(error, code);
     return result;
 }
@@ -1785,10 +2837,72 @@ WEB_CORE_INTERNAL_METHODS(WebCoreDOMRange, RangeImpl)
 - (void)detach:(NSError **)error
 {
     int code;
-    [self impl]->detach(code);
+    [self rangeImpl]->detach(code);
     fillInError(error, code);
 }
 
 @end
 
 //------------------------------------------------------------------------------------------
+// WebCoreDOMRange
+
+ at implementation WebCoreDOMRange
+
+- (id)initWithRangeImpl:(RangeImpl *)impl checkCache:(BOOL)checkCache
+{
+    if (!impl) {
+        [self release];
+        return nil;
+    }
+
+	if (checkCache) {
+		id cachedInstance;
+		cachedInstance = wrapperForImpl(impl);
+		if (cachedInstance) {
+			[self release];
+			return [cachedInstance retain];
+		}
+	}
+
+    [super init];
+    m_impl = impl;
+    impl->ref();
+    setWrapperForImpl(self, m_impl);
+    return self;
+}
+
++ (DOMRange *)rangeWithImpl:(RangeImpl *)impl
+{
+    if (!impl)
+        return nil;
+    
+    id cachedInstance;
+    cachedInstance = wrapperForImpl(impl);
+    if (cachedInstance)
+        return [[cachedInstance retain] autorelease];
+    
+    return [[[self alloc] initWithRangeImpl:impl checkCache:NO] autorelease];
+}
+
+- (id)initWithRangeImpl:(RangeImpl *)impl
+{
+    return [self initWithRangeImpl:impl checkCache:YES];
+}
+
+- (RangeImpl *)rangeImpl
+{
+	return m_impl;
+}
+
+- (void)dealloc
+{
+    if (m_impl) {
+        removeWrapperForImpl(m_impl);
+    	m_impl->deref();
+    }
+    [super dealloc];
+}
+
+ at end
+
+//------------------------------------------------------------------------------------------
diff --git a/WebCore/kwq/DOMInternal.h b/WebCore/kwq/DOMInternal.h
new file mode 100644
index 0000000..dc1897a
--- /dev/null
+++ b/WebCore/kwq/DOMInternal.h
@@ -0,0 +1,285 @@
+/*
+ * Copyright (C) 2004 Apple Computer, 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.
+ *
+ * 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 "DOM.h"
+
+namespace DOM {
+    class AttrImpl;
+    class CDATASectionImpl;
+    class CharacterDataImpl;
+    class CommentImpl;
+    class DocumentFragmentImpl;
+    class DocumentTypeImpl;
+    class DocumentImpl;
+    class DOMImplementationImpl;
+    class ElementImpl;
+    class EntityImpl;
+    class EntityReferenceImpl;
+    class NamedNodeMapImpl;
+    class NodeImpl;
+    class NodeListImpl;
+    class NotationImpl;
+    class ProcessingInstructionImpl;
+    class RangeImpl;
+    class TextImpl;
+}
+
+ at interface DOMNode (SubclassResponsibility)
+- (DOM::NodeImpl *)nodeImpl;
+- (Class)classForDOMDocument;
+ at end
+
+ at interface WebCoreDOMNode : DOMNode
+{
+	DOM::NodeImpl *m_impl;
+}
++ (DOMNode *)nodeWithImpl:(DOM::NodeImpl *)impl;
+- (id)initWithNodeImpl:(DOM::NodeImpl *)impl;
+ at end
+
+ at interface DOMNamedNodeMap (SubclassResponsibility)
+- (DOM::NamedNodeMapImpl *)namedNodeMapImpl;
+- (Class)classForDOMNode;
+ at end
+
+ at interface WebCoreDOMNamedNodeMap : DOMNamedNodeMap
+{
+	DOM::NamedNodeMapImpl *m_impl;
+}
++ (DOMNamedNodeMap *)namedNodeMapWithImpl:(DOM::NamedNodeMapImpl *)impl;
+- (id)initWithNamedNodeMapImpl:(DOM::NamedNodeMapImpl *)impl;
+ at end
+
+ at interface DOMNodeList (SubclassResponsibility)
+- (DOM::NodeListImpl *)nodeListImpl;
+ at end
+
+ at interface WebCoreDOMNodeList : DOMNodeList
+{
+	DOM::NodeListImpl *m_impl;
+}
++ (DOMNodeList *)nodeListWithImpl:(DOM::NodeListImpl *)impl;
+- (id)initWithNodeListImpl:(DOM::NodeListImpl *)impl;
+ at end
+
+ at interface DOMImplementation (SubclassResponsibility)
+- (DOM::DOMImplementationImpl *)DOMImplementationImpl;
+- (Class)classForDOMDocumentType;
+- (Class)classForDOMDocument;
+ at end
+
+ at interface WebCoreDOMImplementation : DOMImplementation
+{
+	DOM::DOMImplementationImpl *m_impl;
+}
++ (DOMImplementation *)DOMImplementationWithImpl:(DOM::DOMImplementationImpl *)impl;
+- (id)initWithDOMImplementationImpl:(DOM::DOMImplementationImpl *)impl;
+ at end
+
+ at interface DOMDocumentFragment (SubclassResponsibility)
+- (DOM::DocumentFragmentImpl *)documentFragmentImpl;
+ at end
+
+ at interface WebCoreDOMDocumentFragment : DOMDocumentFragment
+{
+	DOM::DocumentFragmentImpl *m_impl;
+}
++ (DOMDocumentFragment *)documentFragmentWithImpl:(DOM::DocumentFragmentImpl *)impl;
+- (id)initWithDocumentFragmentImpl:(DOM::DocumentFragmentImpl *)impl;
+ at end
+
+ at interface DOMDocument (SubclassResponsibility)
+- (DOM::DocumentImpl *)documentImpl;
+- (Class)classForDOMAttr;
+- (Class)classForDOMCDATASection;
+- (Class)classForDOMComment;
+- (Class)classForDOMDocumentFragment;
+- (Class)classForDOMDocumentType;
+- (Class)classForDOMElement;
+- (Class)classForDOMEntityReference;
+- (Class)classForDOMImplementation;
+- (Class)classForDOMNode;
+- (Class)classForDOMNodeList;
+- (Class)classForDOMProcessingInstruction;
+- (Class)classForDOMText;
+ at end
+
+ at interface WebCoreDOMDocument : DOMDocument
+{
+	DOM::DocumentImpl *m_impl;
+}
++ (DOMDocument *)documentWithImpl:(DOM::DocumentImpl *)impl;
+- (id)initWithDocumentImpl:(DOM::DocumentImpl *)impl;
+ at end
+
+ at interface DOMCharacterData (SubclassResponsibility)
+- (DOM::CharacterDataImpl *)characterDataImpl;
+ at end
+
+ at interface WebCoreDOMCharacterData : DOMCharacterData
+{
+	DOM::CharacterDataImpl *m_impl;
+}
++ (DOMCharacterData *)characterDataWithImpl:(DOM::CharacterDataImpl *)impl;
+- (id)initWithCharacterDataImpl:(DOM::CharacterDataImpl *)impl;
+ at end
+
+ at interface DOMAttr (SubclassResponsibility)
+- (DOM::AttrImpl *)attrImpl;
+- (Class)classForDOMElement;
+ at end
+
+ at interface WebCoreDOMAttr : DOMAttr
+{
+	DOM::AttrImpl *m_impl;
+}
++ (DOMAttr *)attrWithImpl:(DOM::AttrImpl *)impl;
+- (id)initWithAttrImpl:(DOM::AttrImpl *)impl;
+ at end
+
+ at interface DOMElement (SubclassResponsibility)
+- (DOM::ElementImpl *)elementImpl;
+- (Class)classForDOMAttr;
+- (Class)classForDOMNodeList;
+ at end
+
+ at interface WebCoreDOMElement : DOMElement
+{
+	DOM::ElementImpl *m_impl;
+}
++ (DOMElement *)elementWithImpl:(DOM::ElementImpl *)impl;
+- (id)initWithElementImpl:(DOM::ElementImpl *)impl;
+ at end
+
+ at interface DOMText (SubclassResponsibility)
+- (DOM::TextImpl *)textImpl;
+ at end
+
+ at interface WebCoreDOMText : DOMText
+{
+	DOM::TextImpl *m_impl;
+}
++ (DOMText *)textWithImpl:(DOM::TextImpl *)impl;
+- (id)initWithTextImpl:(DOM::TextImpl *)impl;
+ at end
+
+ at interface DOMComment (SubclassResponsibility)
+- (DOM::CommentImpl *)commentImpl;
+ at end
+
+ at interface WebCoreDOMComment : DOMComment
+{
+	DOM::CommentImpl *m_impl;
+}
++ (DOMComment *)commentWithImpl:(DOM::CommentImpl *)impl;
+- (id)initWithCommentImpl:(DOM::CommentImpl *)impl;
+ at end
+
+ at interface DOMCDATASection (SubclassResponsibility)
+- (DOM::CDATASectionImpl *)CDATASectionImpl;
+ at end
+
+ at interface WebCoreDOMCDATASection : DOMCDATASection
+{
+	DOM::CDATASectionImpl *m_impl;
+}
++ (DOMCDATASection *)CDATASectionWithImpl:(DOM::CDATASectionImpl *)impl;
+- (id)initWithCDATASectionImpl:(DOM::CDATASectionImpl *)impl;
+ at end
+
+ at interface DOMDocumentType (SubclassResponsibility)
+- (DOM::DocumentTypeImpl *)documentTypeImpl;
+- (Class)classForDOMNamedNodeMap;
+ at end
+
+ at interface WebCoreDOMDocumentType : DOMDocumentType
+{
+	DOM::DocumentTypeImpl *m_impl;
+}
++ (DOMDocumentType *)documentTypeWithImpl:(DOM::DocumentTypeImpl *)impl;
+- (id)initWithDocumentTypeImpl:(DOM::DocumentTypeImpl *)impl;
+ at end
+
+ at interface DOMNotation (SubclassResponsibility)
+- (DOM::NotationImpl *)notationImpl;
+ at end
+
+ at interface WebCoreDOMNotation : DOMNotation
+{
+	DOM::NotationImpl *m_impl;
+}
++ (DOMNotation *)notationWithImpl:(DOM::NotationImpl *)impl;
+- (id)initWithNotationImpl:(DOM::NotationImpl *)impl;
+ at end
+
+ at interface DOMEntity (SubclassResponsibility)
+- (DOM::EntityImpl *)entityImpl;
+ at end
+
+ at interface WebCoreDOMEntity : DOMEntity
+{
+	DOM::EntityImpl *m_impl;
+}
++ (DOMEntity *)entityWithImpl:(DOM::EntityImpl *)impl;
+- (id)initWithEntityImpl:(DOM::EntityImpl *)impl;
+ at end
+
+ at interface DOMEntityReference (SubclassResponsibility)
+- (DOM::EntityReferenceImpl *)entityReferenceImpl;
+ at end
+
+ at interface WebCoreDOMEntityReference : DOMEntityReference
+{
+	DOM::EntityReferenceImpl *m_impl;
+}
++ (DOMEntityReference *)entityReferenceWithImpl:(DOM::EntityReferenceImpl *)impl;
+- (id)initWithEntityReferenceImpl:(DOM::EntityReferenceImpl *)impl;
+ at end
+
+ at interface DOMProcessingInstruction (SubclassResponsibility)
+- (DOM::ProcessingInstructionImpl *)processingInstructionImpl;
+ at end
+
+ at interface WebCoreDOMProcessingInstruction : DOMProcessingInstruction
+{
+	DOM::ProcessingInstructionImpl *m_impl;
+}
++ (DOMProcessingInstruction *)processingInstructionWithImpl:(DOM::ProcessingInstructionImpl *)impl;
+- (id)initWithProcessingInstructionImpl:(DOM::ProcessingInstructionImpl *)impl;
+ at end
+
+ at interface DOMRange (SubclassResponsibility)
+- (DOM::RangeImpl *)rangeImpl;
+- (Class)classForDOMDocumentFragment;
+- (Class)classForDOMNode;
+ at end
+
+ at interface WebCoreDOMRange : DOMRange
+{
+	DOM::RangeImpl *m_impl;
+}
++ (DOMRange *)rangeWithImpl:(DOM::RangeImpl *)impl;
+- (id)initWithRangeImpl:(DOM::RangeImpl *)impl;
+ at end
diff --git a/WebCore/kwq/KWQAccObject.mm b/WebCore/kwq/KWQAccObject.mm
index 595232f..926c628 100644
--- a/WebCore/kwq/KWQAccObject.mm
+++ b/WebCore/kwq/KWQAccObject.mm
@@ -43,8 +43,13 @@
 #import "render_style.h"
 #import "render_text.h"
 
+using DOM::DocumentImpl;
 using DOM::ElementImpl;
 using DOM::HTMLAnchorElementImpl;
+using DOM::Node;
+using DOM::NodeImpl;
+using DOM::Range;
+
 using khtml::RenderObject;
 using khtml::RenderWidget;
 using khtml::RenderCanvas;
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index 4a8d0c7..24368bf 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -56,31 +56,40 @@ namespace KJS {
 }
 
 #ifdef __OBJC__
+
+// Avoid clashes with KJS::DOMElement in KHTML code.
+ at class DOMElement;
+typedef DOMElement ObjCDOMElement;
+
+ at class KWQPageState;
+ at class NSArray;
 @class NSAttributedString;
+ at class NSColor;
 @class NSEvent;
 @class NSFileWrapper;
+ at class NSMutableDictionary;
 @class NSResponder;
+ at class NSString;
 @class NSView;
 @class WebCoreBridge;
- at class KWQPageState;
- at class NSString;
- at class NSArray;
- at class NSMutableDictionary;
- at class WebCoreDOMElement;
- at class NSColor;
+
 #else
+
+// Avoid clashes with KJS::DOMElement in KHTML code.
+class ObjCDOMElement;
+
+class KWQPageState;
+class NSArray;
 class NSAttributedString;
+class NSColor;
 class NSEvent;
 class NSFileWrapper;
+class NSMutableDictionary;
 class NSResponder;
+class NSString;
 class NSView;
 class WebCoreBridge;
-class KWQPageState;
-class NSString;
-class NSArray;
-class NSMutableDictionary;
-class WebCoreDOMElement;
-class NSColor;
+
 #endif
 
 enum KWQSelectionDirection {
@@ -301,7 +310,7 @@ private:
     KURL _submittedFormURL;
 
     NSMutableDictionary *_formValuesAboutToBeSubmitted;
-    WebCoreDOMElement *_formAboutToBeSubmitted;
+    ObjCDOMElement *_formAboutToBeSubmitted;
 
     static QPtrList<KWQKHTMLPart> &mutableInstances();
 
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 855b0dd..d506045 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -34,9 +34,9 @@
 #import "KWQPrinter.h"
 #import "KWQWindowWidget.h"
 #import "WebCoreBridge.h"
-#import "WebCoreDOM.h"
 #import "WebCoreViewFactory.h"
 #import "DOM.h"
+#import "DOMInternal.h"
 #import "csshelper.h"
 #import "html_documentimpl.h"
 #import "html_misc.h"
@@ -60,11 +60,19 @@
 
 #undef _KWQ_TIMING
 
+using DOM::AtomicString;
 using DOM::DocumentImpl;
 using DOM::DOMString;
 using DOM::ElementImpl;
 using DOM::EventImpl;
+using DOM::HTMLDocumentImpl;
+using DOM::HTMLElementImpl;
+using DOM::HTMLFormElementImpl;
+using DOM::HTMLFrameElementImpl;
+using DOM::HTMLGenericFormElementImpl;
+using DOM::HTMLTableCellElementImpl;
 using DOM::Node;
+using DOM::NodeImpl;
 
 using khtml::Cache;
 using khtml::ChildFrame;
@@ -574,11 +582,9 @@ void KWQKHTMLPart::recordFormValue(const QString &name, const QString &value, HT
     if (!_formValuesAboutToBeSubmitted) {
         _formValuesAboutToBeSubmitted = [[NSMutableDictionary alloc] init];
         ASSERT(!_formAboutToBeSubmitted);
-        _formAboutToBeSubmitted = [[WebCoreDOMElement objectWithImpl:element] retain];
+        _formAboutToBeSubmitted = [[WebCoreDOMElement elementWithImpl:element] retain];
     } else {
-        if ([_formAboutToBeSubmitted isKindOfClass:[WebCoreDOMElement class]]) {
-            ASSERT([(WebCoreDOMElement *)_formAboutToBeSubmitted impl] == element);
-        }
+        ASSERT([_formAboutToBeSubmitted elementImpl] == element);
     }
     [_formValuesAboutToBeSubmitted setObject:value.getNSString() forKey:name.getNSString()];
 }
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index f601a4c..300ddf8 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -51,6 +51,9 @@ typedef khtml::RenderPart KHTMLRenderPart;
 
 #endif
 
+ at class DOMDocument;
+ at class DOMNode;
+ at class DOMElement;
 @class WebCoreSettings;
 
 @protocol WebCoreDOMTreeCopier;
@@ -59,9 +62,6 @@ typedef khtml::RenderPart KHTMLRenderPart;
 @protocol WebCoreResourceLoader;
 @protocol WebCoreFileButton;
 @protocol WebCoreFileButtonDelegate;
- at protocol DOMDocument;
- at protocol DOMNode;
- at protocol DOMElement;
 
 extern NSString *WebCoreElementDOMNodeKey;
 extern NSString *WebCoreElementFrameKey;
@@ -179,15 +179,15 @@ typedef enum {
 - (NSString *)renderTreeAsExternalRepresentation;
 
 - (NSDictionary *)elementAtPoint:(NSPoint)point;
-- (id <DOMElement>)elementWithName:(NSString *)name inForm:(id <DOMElement>)form;
-- (id <DOMElement>)elementForView:(NSView *)view;
-- (BOOL)elementDoesAutoComplete:(id <DOMElement>)element;
-- (BOOL)elementIsPassword:(id <DOMElement>)element;
-- (id <DOMElement>)formForElement:(id <DOMElement>)element;
-- (id <DOMElement>)currentForm;
-- (NSArray *)controlsInForm:(id <DOMElement>)form;
-- (NSString *)searchForLabels:(NSArray *)labels beforeElement:(id <DOMElement>)element;
-- (NSString *)matchLabels:(NSArray *)labels againstElement:(id <DOMElement>)element;
+- (DOMElement *)elementWithName:(NSString *)name inForm:(DOMElement *)form;
+- (DOMElement *)elementForView:(NSView *)view;
+- (BOOL)elementDoesAutoComplete:(DOMElement *)element;
+- (BOOL)elementIsPassword:(DOMElement *)element;
+- (DOMElement *)formForElement:(DOMElement *)element;
+- (DOMElement *)currentForm;
+- (NSArray *)controlsInForm:(DOMElement *)form;
+- (NSString *)searchForLabels:(NSArray *)labels beforeElement:(DOMElement *)element;
+- (NSString *)matchLabels:(NSArray *)labels againstElement:(DOMElement *)element;
 
 - (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag;
 - (void)jumpToSelection;
@@ -198,9 +198,9 @@ typedef enum {
 
 - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)string;
 
-- (id <DOMDocument>)DOMDocument;
+- (DOMDocument *)DOMDocument;
 
-- (void)setSelectionFrom:(id <DOMNode>)start startOffset:(int)startOffset to:(id <DOMNode>)end endOffset:(int) endOffset;
+- (void)setSelectionFrom:(DOMNode *)start startOffset:(int)startOffset to:(DOMNode *)end endOffset:(int) endOffset;
 
 - (BOOL)isSelectionEditable;
 - (BOOL)moveCaretToPoint:(NSPoint)point;
@@ -225,12 +225,12 @@ typedef enum {
 - (NSRect)visibleSelectionRect;
 - (NSImage *)selectionImage;
 
-- (id <DOMNode>)selectionStart;
+- (DOMNode *)selectionStart;
 - (int)selectionStartOffset;
-- (id <DOMNode>)selectionEnd;
+- (DOMNode *)selectionEnd;
 - (int)selectionEndOffset;
 
-- (NSAttributedString *)attributedStringFrom:(id <DOMNode>)startNode startOffset:(int)startOffset to:(id <DOMNode>)endNode endOffset:(int)endOffset;
+- (NSAttributedString *)attributedStringFrom:(DOMNode *)startNode startOffset:(int)startOffset to:(DOMNode *)endNode endOffset:(int)endOffset;
 
 + (NSString *)stringWithData:(NSData *)data textEncoding:(CFStringEncoding)textEncoding;
 + (NSString *)stringWithData:(NSData *)data textEncodingName:(NSString *)textEncodingName;
@@ -267,8 +267,8 @@ typedef enum {
 - (void)frameDetached;
 - (NSView *)documentView;
 
-- (void)loadURL:(NSURL *)URL referrer:(NSString *)referrer reload:(BOOL)reload onLoadEvent:(BOOL)onLoad target:(NSString *)target triggeringEvent:(NSEvent *)event form:(NSObject <DOMElement> *)form formValues:(NSDictionary *)values;
-- (void)postWithURL:(NSURL *)URL referrer:(NSString *)referrer target:(NSString *)target data:(NSData *)data contentType:(NSString *)contentType triggeringEvent:(NSEvent *)event form:(NSObject <DOMElement> *)form formValues:(NSDictionary *)values;
+- (void)loadURL:(NSURL *)URL referrer:(NSString *)referrer reload:(BOOL)reload onLoadEvent:(BOOL)onLoad target:(NSString *)target triggeringEvent:(NSEvent *)event form:(DOMElement *)form formValues:(NSDictionary *)values;
+- (void)postWithURL:(NSURL *)URL referrer:(NSString *)referrer target:(NSString *)target data:(NSData *)data contentType:(NSString *)contentType triggeringEvent:(NSEvent *)event form:(DOMElement *)form formValues:(NSDictionary *)values;
 
 - (WebCoreBridge *)createWindowWithURL:(NSURL *)URL frameName:(NSString *)name;
 - (void)showWindow;
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index b855340..08de72a 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -66,7 +66,7 @@
 #import "KWQAccObjectCache.h"
 
 #import "DOM.h"
-#import "WebCoreDOM.h"
+#import "DOMInternal.h"
 #import "WebCoreImageRenderer.h"
 #import "WebCoreTextRendererFactory.h"
 #import "WebCoreViewFactory.h"
@@ -74,9 +74,19 @@
 
 #import <AppKit/NSView.h>
 
+using DOM::AtomicString;
 using DOM::DocumentImpl;
+using DOM::DocumentTypeImpl;
+using DOM::DOMString;
+using DOM::Element;
+using DOM::ElementImpl;
+using DOM::HTMLFormElementImpl;
+using DOM::HTMLGenericFormElementImpl;
+using DOM::HTMLImageElementImpl;
+using DOM::HTMLInputElementImpl;
 using DOM::Node;
 using DOM::NodeImpl;
+using DOM::Range;
 
 using khtml::Decoder;
 using khtml::parseURL;
@@ -729,7 +739,7 @@ static BOOL nowPrinting(WebCoreBridge *self)
     return _part->sendContextMenuEvent(event);
 }
 
-- (id <DOMElement>)elementForView:(NSView *)view
+- (DOMElement *)elementForView:(NSView *)view
 {
     // FIXME: implemented currently for only a subset of the KWQ widgets
     if ([view conformsToProtocol:@protocol(KWQWidgetHolder)]) {
@@ -737,7 +747,7 @@ static BOOL nowPrinting(WebCoreBridge *self)
         QWidget *widget = [widgetHolder widget];
         if (widget != nil) {
             NodeImpl *node = static_cast<const RenderWidget *>(widget->eventFilterObject())->element();
-            return [WebCoreDOMElement objectWithImpl:static_cast<ElementImpl *>(node)];
+            return [WebCoreDOMElement elementWithImpl:static_cast<ElementImpl *>(node)];
         }
     }
     return nil;
@@ -756,27 +766,25 @@ static NSView *viewForElement(DOM::ElementImpl *elementImpl)
     return nil;
 }
 
-static HTMLInputElementImpl *inputElementFromDOMElement(id <DOMElement> element)
+static HTMLInputElementImpl *inputElementFromDOMElement(DOMElement * element)
 {
-    ASSERT([(NSObject *)element isKindOfClass:[WebCoreDOMElement class]]);
-    DOM::ElementImpl *domElement = [(WebCoreDOMElement *)element impl];
+    DOM::ElementImpl *domElement = [element elementImpl];
     if (domElement && idFromNode(domElement) == ID_INPUT) {
         return static_cast<HTMLInputElementImpl *>(domElement);
     }
     return nil;
 }
 
-static HTMLFormElementImpl *formElementFromDOMElement(id <DOMElement> element)
+static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
 {
-    ASSERT([(NSObject *)element isKindOfClass:[WebCoreDOMElement class]]);
-    DOM::ElementImpl *domElement = [(WebCoreDOMElement *)element impl];
+    DOM::ElementImpl *domElement = [element elementImpl];
     if (domElement && idFromNode(domElement) == ID_FORM) {
         return static_cast<HTMLFormElementImpl *>(domElement);
     }
     return nil;
 }
 
-- (id <DOMElement>)elementWithName:(NSString *)name inForm:(id <DOMElement>)form
+- (DOMElement *)elementWithName:(NSString *)name inForm:(DOMElement *)form
 {
     HTMLFormElementImpl *formElement = formElementFromDOMElement(form);
     if (formElement) {
@@ -786,14 +794,14 @@ static HTMLFormElementImpl *formElementFromDOMElement(id <DOMElement> element)
             HTMLGenericFormElementImpl *elt = elements.at(i);
             // Skip option elements, other duds
             if (elt->name() == targetName) {
-                return [WebCoreDOMElement objectWithImpl:elt];
+                return [WebCoreDOMElement elementWithImpl:elt];
             }
         }
     }
     return nil;
 }
 
-- (BOOL)elementDoesAutoComplete:(id <DOMElement>)element
+- (BOOL)elementDoesAutoComplete:(DOMElement *)element
 {
     HTMLInputElementImpl *inputElement = inputElementFromDOMElement(element);
     return inputElement != nil
@@ -801,32 +809,32 @@ static HTMLFormElementImpl *formElementFromDOMElement(id <DOMElement> element)
         && inputElement->autoComplete();
 }
 
-- (BOOL)elementIsPassword:(id <DOMElement>)element
+- (BOOL)elementIsPassword:(DOMElement *)element
 {
     HTMLInputElementImpl *inputElement = inputElementFromDOMElement(element);
     return inputElement != nil
         && inputElement->inputType() == HTMLInputElementImpl::PASSWORD;
 }
 
-- (id <DOMElement>)formForElement:(id <DOMElement>)element;
+- (DOMElement *)formForElement:(DOMElement *)element;
 {
     HTMLInputElementImpl *inputElement = inputElementFromDOMElement(element);
     if (inputElement) {
         HTMLFormElementImpl *formElement = inputElement->form();
         if (formElement) {
-            return [WebCoreDOMElement objectWithImpl:formElement];
+            return [WebCoreDOMElement elementWithImpl:formElement];
         }
     }
     return nil;
 }
 
-- (id <DOMElement>)currentForm
+- (DOMElement *)currentForm
 {
     HTMLFormElementImpl *formElement = _part->currentForm();
-    return formElement ? [WebCoreDOMElement objectWithImpl:formElement] : nil;
+    return formElement ? [WebCoreDOMElement elementWithImpl:formElement] : nil;
 }
 
-- (NSArray *)controlsInForm:(id <DOMElement>)form
+- (NSArray *)controlsInForm:(DOMElement *)form
 {
     NSMutableArray *results = nil;
     HTMLFormElementImpl *formElement = formElementFromDOMElement(form);
@@ -848,16 +856,14 @@ static HTMLFormElementImpl *formElementFromDOMElement(id <DOMElement> element)
     return results;
 }
 
-- (NSString *)searchForLabels:(NSArray *)labels beforeElement:(id <DOMElement>)element
+- (NSString *)searchForLabels:(NSArray *)labels beforeElement:(DOMElement *)element
 {
-    ASSERT([(NSObject *)element isKindOfClass:[WebCoreDOMElement class]]);
-    return _part->searchForLabelsBeforeElement(labels, [(WebCoreDOMElement *)element impl]);
+    return _part->searchForLabelsBeforeElement(labels, [element elementImpl]);
 }
 
-- (NSString *)matchLabels:(NSArray *)labels againstElement:(id <DOMElement>)element
+- (NSString *)matchLabels:(NSArray *)labels againstElement:(DOMElement *)element
 {
-    ASSERT([(NSObject *)element isKindOfClass:[WebCoreDOMElement class]]);
-    return _part->matchLabelsAgainstElement(labels, [(WebCoreDOMElement *)element impl]);
+    return _part->matchLabelsAgainstElement(labels, [element elementImpl]);
 }
 
 - (NSDictionary *)elementAtPoint:(NSPoint)point
@@ -928,7 +934,7 @@ static HTMLFormElementImpl *formElementFromDOMElement(id <DOMElement> element)
         [element setObject:[NSNumber numberWithBool:node->isContentEditable()]
                     forKey:WebCoreElementIsEditableKey];
         
-        [element setObject:[WebCoreDOMNode objectWithImpl:node] forKey:WebCoreElementDOMNodeKey];
+        [element setObject:[WebCoreDOMNode nodeWithImpl:node] forKey:WebCoreElementDOMNodeKey];
     
         if (node->renderer() && node->renderer()->isImage()) {
             RenderImage *r = static_cast<RenderImage *>(node->renderer());
@@ -1033,16 +1039,16 @@ static HTMLFormElementImpl *formElementFromDOMElement(id <DOMElement> element)
     return _part->executeScript(QString::fromNSString(string), true).asString().getNSString();
 }
 
-- (id<DOMDocument>)DOMDocument
+- (DOMDocument *)DOMDocument
 {
-    return [WebCoreDOMDocument objectWithImpl:_part->xmlDocImpl()];
+    return [WebCoreDOMDocument documentWithImpl:_part->xmlDocImpl()];
 }
 
-- (void)setSelectionFrom:(id<DOMNode>)start startOffset:(int)startOffset to:(id<DOMNode>)end endOffset:(int) endOffset
+- (void)setSelectionFrom:(DOMNode *)start startOffset:(int)startOffset to:(DOMNode *)end endOffset:(int) endOffset
 {
-    WebCoreDOMNode *startNode = start;
-    WebCoreDOMNode *endNode = end;
-    KHTMLSelection selection([startNode impl], startOffset, [endNode impl], endOffset);
+    DOMNode *startNode = start;
+    DOMNode *endNode = end;
+    KHTMLSelection selection([startNode nodeImpl], startOffset, [endNode nodeImpl], endOffset);
     _part->setSelection(selection);
 }
 
@@ -1051,16 +1057,16 @@ static HTMLFormElementImpl *formElementFromDOMElement(id <DOMElement> element)
     return _part->attributedString(_part->selectionStart(), _part->selectionStartOffset(), _part->selectionEnd(), _part->selectionEndOffset());
 }
 
-- (NSAttributedString *)attributedStringFrom:(id<DOMNode>)start startOffset:(int)startOffset to:(id<DOMNode>)end endOffset:(int)endOffset
+- (NSAttributedString *)attributedStringFrom:(DOMNode *)start startOffset:(int)startOffset to:(DOMNode *)end endOffset:(int)endOffset
 {
-    WebCoreDOMNode *startNode = start;
-    WebCoreDOMNode *endNode = end;
-    return _part->attributedString([startNode impl], startOffset, [endNode impl], endOffset);
+    DOMNode *startNode = start;
+    DOMNode *endNode = end;
+    return _part->attributedString([startNode nodeImpl], startOffset, [endNode nodeImpl], endOffset);
 }
 
-- (id<DOMNode>)selectionStart
+- (DOMNode *)selectionStart
 {
-    return [WebCoreDOMNode objectWithImpl:_part->selectionStart()];
+    return [WebCoreDOMNode nodeWithImpl:_part->selectionStart()];
 }
 
 - (int)selectionStartOffset
@@ -1068,9 +1074,9 @@ static HTMLFormElementImpl *formElementFromDOMElement(id <DOMElement> element)
     return _part->selectionStartOffset();
 }
 
-- (id<DOMNode>)selectionEnd
+- (DOMNode *)selectionEnd
 {
-    return [WebCoreDOMNode objectWithImpl:_part->selectionEnd()];
+    return [WebCoreDOMNode nodeWithImpl:_part->selectionEnd()];
 }
 
 - (int)selectionEndOffset
diff --git a/WebCore/kwq/WebCoreDOM.h b/WebCore/kwq/WebCoreDOM.h
deleted file mode 100644
index 8702d5d..0000000
--- a/WebCore/kwq/WebCoreDOM.h
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * Copyright (C) 2003 Apple Computer, 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.
- *
- * 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 "DOM.h"
-
-namespace DOM {
-    class AttrImpl;
-    class CDATASectionImpl;
-    class CharacterDataImpl;
-    class CommentImpl;
-    class DocumentFragmentImpl;
-    class DocumentTypeImpl;
-    class DocumentImpl;
-    class DOMImplementationImpl;
-    class ElementImpl;
-    class EntityImpl;
-    class EntityReferenceImpl;
-    class NamedNodeMapImpl;
-    class NodeImpl;
-    class NodeListImpl;
-    class NotationImpl;
-    class ProcessingInstructionImpl;
-    class RangeImpl;
-    class TextImpl;
-}
-
- at class NSObject;
-
- at interface WebCoreDOMObject : NSObject
-{
-    void *details;
-}
-- (id)initWithDetails:(void *)d;
- at end
-
- at protocol WebCoreNodeImplWrapper
-- (DOM::NodeImpl *)impl;
- at end
-
- at protocol WebCoreNamedNodeMapImplWrapper
-- (DOM::NamedNodeMapImpl *)impl;
- at end
-
- at protocol WebCoreNodeListImplWrapper
-- (DOM::NodeListImpl *)impl;
- at end
-
- at protocol WebCoreDOMImplementationImplWrapper
-- (DOM::DOMImplementationImpl *)impl;
- at end
-
- at protocol WebCoreDocumentFragmentImplWrapper
-- (DOM::DocumentFragmentImpl *)impl;
- at end
-
- at protocol WebCoreDocumentImplWrapper
-- (DOM::DocumentImpl *)impl;
- at end
-
- at protocol WebCoreCharacterDataImplWrapper
-- (DOM::CharacterDataImpl *)impl;
- at end
-
- at protocol WebCoreAttrImplWrapper
-- (DOM::AttrImpl *)impl;
- at end
-
- at protocol WebCoreElementImplWrapper
-- (DOM::ElementImpl *)impl;
- at end
-
- at protocol WebCoreTextImplWrapper
-- (DOM::TextImpl *)impl;
- at end
-
- at protocol WebCoreCommentImplWrapper
-- (DOM::CommentImpl *)impl;
- at end
-
- at protocol WebCoreCDATASectionImplWrapper
-- (DOM::CDATASectionImpl *)impl;
- at end
-
- at protocol WebCoreDocumentTypeImplWrapper
-- (DOM::DocumentTypeImpl *)impl;
- at end
-
- at protocol WebCoreNotationImplWrapper
-- (DOM::NotationImpl *)impl;
- at end
-
- at protocol WebCoreEntityImplWrapper
-- (DOM::EntityImpl *)impl;
- at end
-
- at protocol WebCoreEntityReferenceImplWrapper
-- (DOM::EntityReferenceImpl *)impl;
- at end
-
- at protocol WebCoreProcessingInstructionImplWrapper
-- (DOM::ProcessingInstructionImpl *)impl;
- at end
-
- at protocol WebCoreRangeImplWrapper
-- (DOM::RangeImpl *)impl;
- at end
-
- at interface WebCoreDOMNode : WebCoreDOMObject <DOMNode, WebCoreNodeImplWrapper>
-+ (WebCoreDOMNode *)objectWithImpl:(DOM::NodeImpl *)impl;
-- (id)initWithNodeImpl:(DOM::NodeImpl *)impl;
- at end
-
- at interface WebCoreDOMNamedNodeMap : WebCoreDOMObject <DOMNamedNodeMap, WebCoreNamedNodeMapImplWrapper>
-+ (WebCoreDOMNamedNodeMap *)objectWithImpl:(DOM::NamedNodeMapImpl *)impl;
-- (id)initWithNamedNodeMapImpl:(DOM::NamedNodeMapImpl *)impl;
- at end
-
- at interface WebCoreDOMNodeList : WebCoreDOMObject <DOMNodeList, WebCoreNodeListImplWrapper>
-+ (WebCoreDOMNodeList *)objectWithImpl:(DOM::NodeListImpl *)impl;
-- (id)initWithNodeListImpl:(DOM::NodeListImpl *)impl;
- at end
-
- at interface WebCoreDOMImplementation : WebCoreDOMObject <DOMImplementation, WebCoreDOMImplementationImplWrapper>
-+ (WebCoreDOMImplementation *)objectWithImpl:(DOM::DOMImplementationImpl *)impl;
-- (id)initWithDOMImplementationImpl:(DOM::DOMImplementationImpl *)impl;
- at end
-
- at interface WebCoreDOMDocumentFragment : WebCoreDOMNode <DOMDocumentFragment, WebCoreDocumentFragmentImplWrapper>
-+ (WebCoreDOMDocumentFragment *)objectWithImpl:(DOM::DocumentFragmentImpl *)impl;
-- (id)initWithDocumentFragmentImpl:(DOM::DocumentFragmentImpl *)impl;
- at end
-
- at interface WebCoreDOMDocument : WebCoreDOMNode <DOMDocument, WebCoreDocumentImplWrapper>
-+ (WebCoreDOMDocument *)objectWithImpl:(DOM::DocumentImpl *)impl;
-- (id)initWithDocumentImpl:(DOM::DocumentImpl *)impl;
- at end
-
- at interface WebCoreDOMCharacterData : WebCoreDOMNode <DOMCharacterData, WebCoreCharacterDataImplWrapper>
-+ (WebCoreDOMCharacterData *)objectWithImpl:(DOM::CharacterDataImpl *)impl;
-- (id)initWithCharacterDataImpl:(DOM::CharacterDataImpl *)impl;
- at end
-
- at interface WebCoreDOMAttr : WebCoreDOMNode <DOMAttr, WebCoreAttrImplWrapper>
-+ (WebCoreDOMAttr *)objectWithImpl:(DOM::AttrImpl *)impl;
-- (id)initWithAttrImpl:(DOM::AttrImpl *)impl;
- at end
-
- at interface WebCoreDOMElement : WebCoreDOMNode <DOMElement, WebCoreElementImplWrapper>
-+ (WebCoreDOMElement *)objectWithImpl:(DOM::ElementImpl *)impl;
-- (id)initWithElementImpl:(DOM::ElementImpl *)impl;
- at end
-
- at interface WebCoreDOMText : WebCoreDOMCharacterData <DOMText, WebCoreTextImplWrapper>
-+ (WebCoreDOMText *)objectWithImpl:(DOM::TextImpl *)impl;
-- (id)initWithTextImpl:(DOM::TextImpl *)impl;
- at end
-
- at interface WebCoreDOMComment : WebCoreDOMCharacterData <WebCoreCommentImplWrapper>
-+ (WebCoreDOMComment *)objectWithImpl:(DOM::CommentImpl *)impl;
-- (id)initWithCommentImpl:(DOM::CommentImpl *)impl;
- at end
-
- at interface WebCoreDOMCDATASection : WebCoreDOMText <DOMCDATASection, WebCoreCDATASectionImplWrapper>
-+ (WebCoreDOMCDATASection *)objectWithImpl:(DOM::CDATASectionImpl *)impl;
-- (id)initWithCDATASectionImpl:(DOM::CDATASectionImpl *)impl;
- at end
-
- at interface WebCoreDOMDocumentType : WebCoreDOMNode <DOMDocumentType, WebCoreDocumentTypeImplWrapper>
-+ (WebCoreDOMDocumentType *)objectWithImpl:(DOM::DocumentTypeImpl *)impl;
-- (id)initWithDocumentTypeImpl:(DOM::DocumentTypeImpl *)impl;
- at end
-
- at interface WebCoreDOMNotation : WebCoreDOMNode <DOMNotation, WebCoreNotationImplWrapper>
-+ (WebCoreDOMNotation *)objectWithImpl:(DOM::NotationImpl *)impl;
-- (id)initWithNotationImpl:(DOM::NotationImpl *)impl;
- at end
-
- at interface WebCoreDOMEntity : WebCoreDOMNode <DOMEntity, WebCoreEntityImplWrapper>
-+ (WebCoreDOMEntity *)objectWithImpl:(DOM::EntityImpl *)impl;
-- (id)initWithEntityImpl:(DOM::EntityImpl *)impl;
- at end
-
- at interface WebCoreDOMEntityReference : WebCoreDOMNode <DOMEntityReference, WebCoreEntityReferenceImplWrapper>
-+ (WebCoreDOMEntityReference *)objectWithImpl:(DOM::EntityReferenceImpl *)impl;
-- (id)initWithEntityReferenceImpl:(DOM::EntityReferenceImpl *)impl;
- at end
-
- at interface WebCoreDOMProcessingInstruction : WebCoreDOMNode <DOMProcessingInstruction, WebCoreProcessingInstructionImplWrapper>
-+ (WebCoreDOMProcessingInstruction *)objectWithImpl:(DOM::ProcessingInstructionImpl *)impl;
-- (id)initWithProcessingInstructionImpl:(DOM::ProcessingInstructionImpl *)impl;
- at end
-
- at interface WebCoreDOMRange : WebCoreDOMObject <DOMRange, WebCoreRangeImplWrapper>
-+ (WebCoreDOMRange *)objectWithImpl:(DOM::RangeImpl *)impl;
-- (id)initWithRangeImpl:(DOM::RangeImpl *)impl;
- at end
-
-
-//------------------------------------------------------------------------------------------
-// Impl accessor conveniences
-
-inline DOM::NodeImpl *nodeImpl(id <DOMNode> instance)
-{
-    return [(id <WebCoreNodeImplWrapper>)instance impl];
-}
-
-inline DOM::NamedNodeMapImpl *namedNodeMapImpl(id <DOMNamedNodeMap> instance)
-{
-    return [(id <WebCoreNamedNodeMapImplWrapper>)instance impl];
-}
-
-inline DOM::NodeListImpl *nodeListImpl(id <DOMNodeList> instance)
-{
-    return [(id <WebCoreNodeListImplWrapper>)instance impl];
-}
-
-inline DOM::DOMImplementationImpl *domImplementationImpl(id <DOMImplementation> instance)
-{
-    return [(id <WebCoreDOMImplementationImplWrapper>)instance impl];
-}
-
-inline DOM::DocumentFragmentImpl *documentFragmentImpl(id <DOMDocumentFragment> instance)
-{
-    return [(id <WebCoreDocumentFragmentImplWrapper>)instance impl];
-}
-
-inline DOM::DocumentImpl *documentImpl(id <DOMDocument> instance)
-{
-    return [(id <WebCoreDocumentImplWrapper>)instance impl];
-}
-
-inline DOM::CharacterDataImpl *characterDataImpl(id <DOMCharacterData> instance)
-{
-    return [(id <WebCoreCharacterDataImplWrapper>)instance impl];
-}
-
-inline DOM::AttrImpl *attrImpl(id <DOMAttr> instance)
-{
-    return [(id <WebCoreAttrImplWrapper>)instance impl];
-}
-
-inline DOM::ElementImpl *elementImpl(id <DOMElement> instance)
-{
-    return [(id <WebCoreElementImplWrapper>)instance impl];
-}
-
-inline DOM::TextImpl *textImpl(id <DOMText> instance)
-{
-    return [(id <WebCoreTextImplWrapper>)instance impl];
-}
-
-inline DOM::CommentImpl *commentImpl(id <DOMComment> instance)
-{
-    return [(id <WebCoreCommentImplWrapper>)instance impl];
-}
-
-inline DOM::CDATASectionImpl *cdataSectionImpl(id <DOMCDATASection> instance)
-{
-    return [(id <WebCoreCDATASectionImplWrapper>)instance impl];
-}
-
-inline DOM::DocumentTypeImpl *documentTypeImpl(id <DOMDocumentType> instance)
-{
-    return [(id <WebCoreDocumentTypeImplWrapper>)instance impl];
-}
-
-inline DOM::NotationImpl *notationImpl(id <DOMNotation> instance)
-{
-    return [(id <WebCoreNotationImplWrapper>)instance impl];
-}
-
-inline DOM::EntityImpl *entityImpl(id <DOMEntity> instance)
-{
-    return [(id <WebCoreEntityImplWrapper>)instance impl];
-}
-
-inline DOM::EntityReferenceImpl *entityReferenceImpl(id <DOMEntityReference> instance)
-{
-    return [(id <WebCoreEntityReferenceImplWrapper>)instance impl];
-}
-
-inline DOM::ProcessingInstructionImpl *processingInstructionImpl(id <DOMProcessingInstruction> instance)
-{
-    return [(id <WebCoreProcessingInstructionImplWrapper>)instance impl];
-}
-
-inline DOM::RangeImpl *rangeImpl(id <DOMRange> instance)
-{
-    return [(id <WebCoreRangeImplWrapper>)instance impl];
-}
diff --git a/WebCore/kwq/WebCoreDOM.mm b/WebCore/kwq/WebCoreDOM.mm
deleted file mode 100644
index 5f111fd..0000000
--- a/WebCore/kwq/WebCoreDOM.mm
+++ /dev/null
@@ -1,1794 +0,0 @@
-/*
- * Copyright (C) 2003 Apple Computer, 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.
- *
- * 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 "WebCoreDOM.h"
-
-#import <Foundation/Foundation.h>
-
-#import <dom/dom_doc.h>
-#import <dom/dom_element.h>
-#import <dom/dom_exception.h>
-#import <dom/dom_node.h>
-#import <dom/dom_string.h>
-#import <dom/dom_text.h>
-#import <dom/dom_xml.h>
-#import <dom/dom2_range.h>
-#import <xml/dom_docimpl.h>
-#import <xml/dom_elementimpl.h>
-#import <xml/dom_nodeimpl.h>
-#import <xml/dom_stringimpl.h>
-#import <xml/dom_textimpl.h>
-#import <xml/dom_xmlimpl.h>
-#import <xml/dom2_rangeimpl.h>
-
-#import "KWQAssertions.h"
-#import "KWQLogging.h"
-
-using DOM::Attr;
-using DOM::AttrImpl;
-using DOM::CDATASectionImpl;
-using DOM::CharacterData;
-using DOM::CharacterDataImpl;
-using DOM::CommentImpl;
-using DOM::DocumentFragmentImpl;
-using DOM::DocumentType;
-using DOM::DocumentTypeImpl;
-using DOM::Document;
-using DOM::DocumentImpl;
-using DOM::DOMException;
-using DOM::DOMImplementation;
-using DOM::DOMImplementationImpl;
-using DOM::DOMString;
-using DOM::DOMStringImpl;
-using DOM::Element;
-using DOM::ElementImpl;
-using DOM::EntityImpl;
-using DOM::EntityReferenceImpl;
-using DOM::NamedNodeMap;
-using DOM::NamedNodeMapImpl;
-using DOM::Node;
-using DOM::NodeImpl;
-using DOM::NodeListImpl;
-using DOM::NotationImpl;
-using DOM::ProcessingInstruction;
-using DOM::ProcessingInstructionImpl;
-using DOM::Range;
-using DOM::RangeImpl;
-using DOM::TextImpl;
-
-//------------------------------------------------------------------------------------------
-// Static functions and data
-#pragma mark Static functions and data 
-
-NSString * const DOMErrorDomain = @"DOMErrorDomain";
-
-static CFMutableDictionaryRef wrapperCache(void)
-{
-    static CFMutableDictionaryRef wrapperCache = NULL;
-    if (!wrapperCache) {
-        // No need to retain/free either impl key, or id value.  Items will be removed
-        // from the cache in WebCoreDOMNode's dealloc method.
-        wrapperCache = CFDictionaryCreateMutable(NULL, 0, NULL, NULL);
-    }
-    return wrapperCache;
-}
-
-static id wrapperForImpl(const void *impl)
-{
-    return (id)CFDictionaryGetValue(wrapperCache(), impl);
-}
-
-static void setWrapperForImpl(id wrapper, const void *impl)
-{
-    CFDictionarySetValue(wrapperCache(), impl, wrapper);
-}
-
-static void removeWrapperForImpl(const void *impl)
-{
-    CFDictionaryRemoveValue(wrapperCache(), impl);
-}
-
-static NSString *domStringToNSString(const DOMString &aString)
-{
-    return [NSString stringWithCharacters:(unichar *)aString.unicode() length:aString.length()];
-}
-
-static DOMString NSStringToDOMString(NSString *aString)
-{
-    QChar *chars = (QChar *)malloc([aString length] * sizeof(QChar));
-    [aString getCharacters:(unichar *)chars];
-    DOMString ret(chars, [aString length]);
-    free(chars);
-    return ret;
-}
-
-static void fillInError(NSError **error, int code)
-{
-    if (!error || !code)
-        return;
-        
-    *error = [NSError errorWithDomain:DOMErrorDomain code:code userInfo:nil];
-}
-    
-//------------------------------------------------------------------------------------------
-// Macros
-
-#define WEB_CORE_INTERNAL_METHODS(ObjCClass,CPlusPlusClass) \
-+ (ObjCClass *)objectWithImpl:(CPlusPlusClass *)impl \
-{ \
-    if (!impl) \
-        return nil; \
-    id cachedInstance; \
-    cachedInstance = wrapperForImpl(impl); \
-    if (cachedInstance) \
-        return [[cachedInstance retain] autorelease]; \
-    ObjCClass *instance = [ObjCClass alloc]; \
-    return [[instance initWith##CPlusPlusClass:impl] autorelease]; \
-} \
-- (id)initWith##CPlusPlusClass:(CPlusPlusClass *)impl \
-{ \
-    if (!impl) { \
-        [self release]; \
-        return nil; \
-    } \
-    self = [super initWithDetails:impl]; \
-    if (self) \
-        static_cast<CPlusPlusClass *>(details)->ref(); \
-    return self; \
-} \
-- (CPlusPlusClass *)impl \
-{ \
-    ASSERT(details); \
-    return static_cast<CPlusPlusClass *>(details); \
-}
-    
-//------------------------------------------------------------------------------------------
-// Factory methods
-
-DOM::NodeList DOM::NodeListImpl::createInstance(DOM::NodeListImpl *impl)
-{
-    return DOM::NodeList(impl);
-}
-
-DOM::NamedNodeMap DOM::NamedNodeMapImpl::createInstance(DOM::NamedNodeMapImpl *impl)
-{
-    return DOM::NamedNodeMap(impl);
-}
-
-DOM::Attr DOM::AttrImpl::createInstance(DOM::AttrImpl *impl)
-{
-    return DOM::Attr(impl);
-}
-
-DOM::Element DOM::ElementImpl::createInstance(DOM::ElementImpl *impl)
-{
-    return DOM::Element(impl);
-}
-
-DOM::CharacterData DOM::CharacterDataImpl::createInstance(DOM::CharacterDataImpl *impl)
-{
-    return DOM::CharacterData(impl);
-}
-
-DOM::Text DOM::TextImpl::createInstance(DOM::TextImpl *impl)
-{
-    return DOM::Text(impl);
-}
-
-DOM::ProcessingInstruction DOM::ProcessingInstructionImpl::createInstance(ProcessingInstructionImpl *impl)
-{
-    return DOM::ProcessingInstruction(impl);
-}
-
-DOM::DOMImplementation DOM::DOMImplementationImpl::createInstance(DOM::DOMImplementationImpl *impl)
-{
-    return DOM::DOMImplementation(impl);
-}
-
-DOM::DocumentType DOM::DocumentTypeImpl::createInstance(DOM::DocumentTypeImpl *impl)
-{
-    return DOM::DocumentType(impl);
-}
-
-DOM::Document DOM::DocumentImpl::createInstance(DOM::DocumentImpl *impl)
-{
-    return DOM::Document(impl);
-}
-
-DOM::Range DOM::RangeImpl::createInstance(DOM::RangeImpl *impl)
-{
-    return DOM::Range(impl);
-}
-
-//------------------------------------------------------------------------------------------
-// WebCoreDOMObject
-
- at implementation WebCoreDOMObject
-
-- (id)initWithDetails:(void *)d
-{
-    if (!d) {
-        [self release];
-        return nil;
-    }
-
-    id cachedInstance;
-    cachedInstance = wrapperForImpl(d);
-    if (cachedInstance) {
-        [self release];
-        return [cachedInstance retain];
-    }
-
-    [super init];
-    details = d;
-    setWrapperForImpl(self, details);
-    return self;
-}
-
-- (void)dealloc
-{
-    if (details)
-        removeWrapperForImpl(details);
-    [super dealloc];
-}
-
-- (unsigned)hash
-{
-    return (unsigned)details;
-}
-
-- (BOOL)isEqual:(id)other
-{
-    if (self == other)
-        return YES;
-        
-    if ([other isKindOfClass:[WebCoreDOMObject class]] && ((WebCoreDOMObject *)other)->details == details)
-        return YES;
-        
-    return NO;
-}
-
- at end
-
-//------------------------------------------------------------------------------------------
-// WebCoreDOMNode
-
- at implementation WebCoreDOMNode
-
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMNode, NodeImpl)
-
-// Note: only objects that derive directly from WebDOMObject need their own dealloc method.
-// This is due to the fact that some of the details impl objects derive from
-// khtml::Shared, others from khtml::TreeShared (which do not share a base type), and we 
-// have to cast to the right type in order to call the deref() function.
-- (void)dealloc
-{
-    NodeImpl *instance = static_cast<NodeImpl *>(details);
-    if (instance)
-        instance->deref();
-    [super dealloc];
-}
-
-- (NSString *)nodeName
-{
-    return domStringToNSString([self 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 domStringToNSString([self impl]->nodeValue());
-}
-
-- (void)setNodeValue:(NSString *)string error:(NSError **)error
-{
-    ASSERT(string);
-    
-    int code;
-    [self impl]->setNodeValue(NSStringToDOMString(string), code);
-    fillInError(error, code);
-}
-
-- (unsigned short)nodeType
-{
-    return [self impl]->nodeType();
-}
-
-- (id <DOMNode>)parentNode
-{
-    return [WebCoreDOMNode objectWithImpl:[self impl]->parentNode()];
-}
-
-- (id <DOMNodeList>)childNodes
-{
-    return [WebCoreDOMNodeList objectWithImpl:[self impl]->childNodes()];
-}
-
-- (id <DOMNode>)firstChild
-{
-    return [WebCoreDOMNode objectWithImpl:[self impl]->firstChild()];
-}
-
-- (id <DOMNode>)lastChild
-{
-    return [WebCoreDOMNode objectWithImpl:[self impl]->lastChild()];
-}
-
-- (id <DOMNode>)previousSibling
-{
-    return [WebCoreDOMNode objectWithImpl:[self impl]->previousSibling()];
-}
-
-- (id <DOMNode>)nextSibling
-{
-    return [WebCoreDOMNode objectWithImpl:[self impl]->nextSibling()];
-}
-
-- (id <DOMNamedNodeMap>)attributes
-{
-    // DOM level 2 core specification says: 
-    // A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.
-    return nil;
-}
-
-- (id <DOMDocument>)ownerDocument
-{
-    return [WebCoreDOMDocument objectWithImpl:[self impl]->getDocument()];
-}
-
-- (id <DOMNode>)insertBefore:(id <DOMNode>)newChild :(id <DOMNode>)refChild error:(NSError **)error
-{
-    if (!newChild || !refChild) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
-
-    int code;
-    WebCoreDOMNode *result = [WebCoreDOMNode objectWithImpl:[self impl]->insertBefore(nodeImpl(newChild), nodeImpl(refChild), code)];
-    fillInError(error, code);
-    return result;
-}
-
-- (id <DOMNode>)replaceChild:(id <DOMNode>)newChild :(id <DOMNode>)oldChild error:(NSError **)error
-{
-    if (!newChild || !oldChild) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
-
-    int code;
-    WebCoreDOMNode *result = [WebCoreDOMNode objectWithImpl:[self impl]->replaceChild(nodeImpl(newChild), nodeImpl(oldChild), code)];
-    fillInError(error, code);
-    return result;
-}
-
-- (id <DOMNode>)removeChild:(id <DOMNode>)oldChild error:(NSError **)error
-{
-    if (!oldChild) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
-
-    int code;
-    WebCoreDOMNode *result = [WebCoreDOMNode objectWithImpl:[self impl]->removeChild(nodeImpl(oldChild), code)];
-    fillInError(error, code);
-    return result;
-}
-
-- (id <DOMNode>)appendChild:(id <DOMNode>)newChild error:(NSError **)error
-{
-    if (!newChild) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
-
-    int code;
-    WebCoreDOMNode *result = [WebCoreDOMNode objectWithImpl:[self impl]->appendChild(nodeImpl(newChild), code)];
-    fillInError(error, code);
-    return result;
-}
-
-- (BOOL)hasChildNodes
-{
-    return [self impl]->hasChildNodes();
-}
-
-- (id <DOMNode>)cloneNode:(BOOL)deep
-{
-    return [WebCoreDOMNode objectWithImpl:[self impl]->cloneNode(deep)];
-}
-
-- (void)normalize
-{
-    [self impl]->normalize();
-}
-
-- (BOOL)isSupported:(NSString *)feature :(NSString *)version
-{
-    ASSERT(feature);
-    ASSERT(version);
-
-    // Method not reflected in DOM::NodeImpl interface
-    Node node([self impl]);
-    return node.isSupported(NSStringToDOMString(feature), NSStringToDOMString(version));
-}
-
-- (NSString *)namespaceURI
-{
-    // Method not reflected in DOM::NodeImpl interface
-    Node node([self impl]);
-    return domStringToNSString(node.namespaceURI());
-}
-
-- (NSString *)prefix
-{
-    return domStringToNSString([self impl]->prefix());
-}
-
-- (void)setPrefix:(NSString *)prefix error:(NSError **)error
-{
-    ASSERT(prefix);
-
-    int code;
-    [self impl]->setPrefix(NSStringToDOMString(prefix), code);
-    fillInError(error, code);
-}
-
-- (NSString *)localName
-{
-    return domStringToNSString([self impl]->localName());
-}
-
-- (BOOL)hasAttributes
-{
-    // Method not reflected in DOM::NodeImpl interface
-    Node node([self impl]);
-    return node.hasAttributes();
-}
-
-- (NSString *)HTMLString
-{
-    return [self impl]->recursive_toHTML(true).getNSString();
-}
-
-//
-// begin deprecated methods
-//
-- (void)setNodeValue:(NSString *)string
-{
-    [self setNodeValue:string error:nil];
-}
-
-- (id<DOMNode>)insert:(id<DOMNode>)newChild before:(id<DOMNode>)refChild
-{
-    return [self insertBefore:newChild :refChild error:nil];
-}
-
-- (id<DOMNode>)replace:(id<DOMNode>)newChild child:(id<DOMNode>)oldChild
-{
-    return [self replaceChild:newChild :oldChild error:nil];
-}
-
-- (id<DOMNode>)removeChild:(id<DOMNode>)oldChild
-{
-    return [self removeChild:oldChild error:nil];
-}
-
-- (id<DOMNode>)appendChild:(id<DOMNode>)newChild
-{
-    return [self appendChild:newChild error:nil];
-}
-
-- (void)setPrefix:(NSString *)prefix
-{
-    [self setPrefix:prefix error:nil];
-}
-//
-// end deprecated methods
-//
-
- at end
-
-//------------------------------------------------------------------------------------------
-// WebCoreDOMNamedNodeMap
-
- at implementation WebCoreDOMNamedNodeMap
-
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMNamedNodeMap, NamedNodeMapImpl)
-
-// Note: only objects that derive directly from WebDOMObject need their own dealloc method.
-// This is due to the fact that some of the details impl objects derive from
-// khtml::Shared, others from khtml::TreeShared (which do not share a base type), and we 
-// have to cast to the right type in order to call the deref() function.
-- (void)dealloc
-{
-    NamedNodeMapImpl *instance = static_cast<NamedNodeMapImpl *>(details);
-    if (instance)
-        instance->deref();
-    [super dealloc];
-}
-
-- (id <DOMNode>)getNamedItem:(NSString *)name
-{
-    ASSERT(name);
-
-    // Method not reflected in DOM::NamedNodeMapImpl interface
-    NamedNodeMap map = NamedNodeMapImpl::createInstance([self impl]);
-    Node result(map.getNamedItem(NSStringToDOMString(name)));
-    return [WebCoreDOMNode objectWithImpl:result.handle()];
-}
-
-- (id <DOMNode>)setNamedItem:(id <DOMNode>)arg error:(NSError **)error
-{
-    if (!arg) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
-
-    // Method not reflected in DOM::NamedNodeMapImpl interface
-    try {
-        NamedNodeMap map = NamedNodeMapImpl::createInstance([self impl]);
-        Node result(map.setNamedItem(nodeImpl(arg)));
-        return [WebCoreDOMNode objectWithImpl:result.handle()];
-    } 
-    catch (const DOMException &e) {
-        fillInError(error, e.code);
-        return nil;
-    }
-}
-
-- (id <DOMNode>)removeNamedItem:(NSString *)name error:(NSError **)error
-{
-    if (!name) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
-
-    // Method not reflected in DOM::NamedNodeMapImpl interface
-    try {
-        NamedNodeMap map = NamedNodeMapImpl::createInstance([self impl]);
-        Node result(map.removeNamedItem(NSStringToDOMString(name)));
-        return [WebCoreDOMNode objectWithImpl:result.handle()];
-    } 
-    catch (const DOMException &e) {
-        fillInError(error, e.code);
-        return nil;
-    }
-}
-
-- (id <DOMNode>)item:(unsigned long)index
-{
-    return [WebCoreDOMNode objectWithImpl:[self impl]->item(index)];
-}
-
-- (unsigned long)length
-{
-    return [self impl]->length();
-}
-
-- (id <DOMNode>)getNamedItemNS:(NSString *)namespaceURI :(NSString *)localName
-{
-    if (!namespaceURI || !localName) {
-        return nil;
-    }
-
-    // Method not reflected in DOM::NamedNodeMapImpl interface
-    NamedNodeMap map = NamedNodeMapImpl::createInstance([self impl]);
-    Node result(map.getNamedItemNS(NSStringToDOMString(namespaceURI), NSStringToDOMString(localName)));
-    return [WebCoreDOMNode objectWithImpl:result.handle()];
-}
-
-- (id <DOMNode>)setNamedItemNS:(id <DOMNode>)arg error:(NSError **)error
-{
-    if (!arg) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
-
-    // Method not reflected in DOM::NamedNodeMapImpl interface
-    try {
-        NamedNodeMap map = NamedNodeMapImpl::createInstance([self impl]);
-        Node result(map.setNamedItemNS(nodeImpl(arg)));
-        return [WebCoreDOMNode objectWithImpl:result.handle()];
-    } 
-    catch (const DOMException &e) {
-        fillInError(error, e.code);
-        return nil;
-    }
-}
-
-- (id <DOMNode>)removeNamedItemNS:(NSString *)namespaceURI :(NSString *)localName error:(NSError **)error
-{
-    if (!namespaceURI || !localName) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
-
-    // Method not reflected in DOM::NamedNodeMapImpl interface
-    try {
-        NamedNodeMap map = NamedNodeMapImpl::createInstance([self impl]);
-        Node result(map.removeNamedItemNS(NSStringToDOMString(namespaceURI), NSStringToDOMString(localName)));
-        return [WebCoreDOMNode objectWithImpl:result.handle()];
-    } 
-    catch (const DOMException &e) {
-        fillInError(error, e.code);
-        return nil;
-    }
-}
-
-//
-// begin deprecated methods
-//
-- (id<DOMNode>)setNamedItem:(id<DOMNode>)arg
-{
-    return [self setNamedItem:arg error:nil];
-}
-
-- (id<DOMNode>)removeNamedItem:(NSString *)name
-{
-    return [self removeNamedItem:name error:nil];
-}
-
-- (id<DOMNode>)setNamedItemNS:(id<DOMNode>)arg
-{
-    return [self setNamedItemNS:arg error:nil];
-}
-
-- (id<DOMNode>)removeNamedItemNS:(NSString *)namespaceURI :(NSString *)localName
-{
-    return [self removeNamedItemNS:namespaceURI :localName error:nil];
-}
-//
-// end deprecated methods
-//
-
- at end
-
-//------------------------------------------------------------------------------------------
-// WebCoreDOMNodeList
-
- at implementation WebCoreDOMNodeList
-
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMNodeList, NodeListImpl)
-
-// Note: only objects that derive directly from WebDOMObject need their own dealloc method.
-// This is due to the fact that some of the details impl objects derive from
-// khtml::Shared, others from khtml::TreeShared (which do not share a base type), and we 
-// have to cast to the right type in order to call the deref() function.
-- (void)dealloc
-{
-    NodeListImpl *instance = static_cast<NodeListImpl *>(details);
-    if (instance)
-        instance->deref();
-    [super dealloc];
-}
-
-- (id <DOMNode>)item:(unsigned long)index
-{
-    return [WebCoreDOMNode objectWithImpl:[self impl]->item(index)];
-}
-
-- (unsigned long)length
-{
-    return [self impl]->length();
-}
-
- at end
-
-//------------------------------------------------------------------------------------------
-// WebCoreDOMImplementation
-
- at implementation WebCoreDOMImplementation
-
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMImplementation, DOMImplementationImpl)
-
-// Note: only objects that derive directly from WebDOMObject need their own dealloc method.
-// This is due to the fact that some of the details impl objects derive from
-// khtml::Shared, others from khtml::TreeShared (which do not share a base type), and we 
-// have to cast to the right type in order to call the deref() function.
-- (void)dealloc
-{
-    DOMImplementationImpl *instance = static_cast<DOMImplementationImpl *>(details);
-    if (instance)
-        instance->deref();
-    [super dealloc];
-}
-
-- (BOOL)hasFeature:(NSString *)feature :(NSString *)version
-{
-    ASSERT(feature);
-    ASSERT(version);
-
-    return [self impl]->hasFeature(NSStringToDOMString(feature), NSStringToDOMString(version));
-}
-
-- (id <DOMDocumentType>)createDocumentType:(NSString *)qualifiedName :(NSString *)publicId :(NSString *)systemId error:(NSError **)error
-{
-    ASSERT(qualifiedName);
-    ASSERT(publicId);
-    ASSERT(systemId);
-
-    int code;
-    DocumentTypeImpl *impl = [self impl]->createDocumentType(NSStringToDOMString(qualifiedName), NSStringToDOMString(publicId), NSStringToDOMString(systemId), code);
-    id <DOMDocumentType> result = [WebCoreDOMDocumentType objectWithImpl:impl];
-    fillInError(error, code);
-    return result;
-}
-
-- (id <DOMDocument>)createDocument:(NSString *)namespaceURI :(NSString *)qualifiedName :(id <DOMDocumentType>)doctype error:(NSError **)error
-{
-    ASSERT(namespaceURI);
-    ASSERT(qualifiedName);
-
-    int code;
-    DocumentType dt = DocumentTypeImpl::createInstance(documentTypeImpl(doctype));
-    DocumentImpl *impl = [self impl]->createDocument(NSStringToDOMString(namespaceURI), NSStringToDOMString(qualifiedName), dt, code);
-    id <DOMDocument> result = [WebCoreDOMDocument objectWithImpl:impl];
-    fillInError(error, code);
-    return result;
-}
-
-//
-// begin deprecated methods
-//
-- (id<DOMDocumentType>)createDocumentType:(NSString *)qualifiedName :(NSString *)publicId :(NSString *)systemId :(int *)exceptionCode
-{
-    ASSERT(qualifiedName);
-    ASSERT(publicId);
-    ASSERT(systemId);
-
-    DocumentTypeImpl *impl = [self impl]->createDocumentType(NSStringToDOMString(qualifiedName), NSStringToDOMString(publicId), NSStringToDOMString(systemId), *exceptionCode);
-    return [WebCoreDOMDocumentType objectWithImpl:impl];
-}
-
-- (id<DOMDocument>)createDocument:(NSString *)namespaceURI :(NSString *)qualifiedName :(id<DOMDocumentType>)doctype
-{
-    return [self createDocument:namespaceURI :qualifiedName :doctype error:nil];
-}
-//
-// end deprecated methods
-//
-
- at end
-
-//------------------------------------------------------------------------------------------
-// WebCoreDOMDocumentFragment
-
- at implementation WebCoreDOMDocumentFragment
-
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMDocumentFragment, DocumentFragmentImpl)
-
-// Note: This object does not need its own dealloc method, since it derives from
-// WebCoreDOMNode. See the dealloc method comment on that method for more information. 
-
- at end
-
-//------------------------------------------------------------------------------------------
-// WebCoreDOMDocument
-
- at implementation WebCoreDOMDocument
-
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMDocument, DocumentImpl)
-
-// Note: This object does not need its own dealloc method, since it derives from
-// WebCoreDOMNode. See the dealloc method comment on that method for more information. 
-
-- (id <DOMDocumentType>)doctype
-{
-    return [WebCoreDOMDocumentType objectWithImpl:[self impl]->doctype()];
-}
-
-- (id <DOMImplementation>)implementation
-{
-    return [WebCoreDOMImplementation objectWithImpl:[self impl]->implementation()];
-}
-
-- (id <DOMElement>)documentElement
-{
-    return [WebCoreDOMElement objectWithImpl:[self impl]->documentElement()];
-}
-
-- (id <DOMElement>)createElement:(NSString *)tagName error:(NSError **)error
-{
-    ASSERT(tagName);
-
-    int code;
-    id <DOMElement> result = [WebCoreDOMElement objectWithImpl:[self impl]->createElement(NSStringToDOMString(tagName), code)];
-    fillInError(error, code);
-    return result;
-}
-
-- (id <DOMDocumentFragment>)createDocumentFragment
-{
-    return [WebCoreDOMDocumentFragment objectWithImpl:[self impl]->createDocumentFragment()];
-}
-
-- (id <DOMText>)createTextNode:(NSString *)data
-{
-    ASSERT(data);
-
-    return [WebCoreDOMText objectWithImpl:[self impl]->createTextNode(NSStringToDOMString(data))];
-}
-
-- (id <DOMComment>)createComment:(NSString *)data
-{
-    ASSERT(data);
-
-    return [WebCoreDOMComment objectWithImpl:[self impl]->createComment(NSStringToDOMString(data))];
-}
-
-- (id <DOMCDATASection>)createCDATASection:(NSString *)data error:(NSError **)error
-{
-    ASSERT(data);
-
-    // Documentation says we can raise a NOT_SUPPORTED_ERR.
-    // However, the lower layer does not report that error up to us.
-    return [WebCoreDOMCDATASection objectWithImpl:[self impl]->createCDATASection(NSStringToDOMString(data))];
-}
-
-- (id <DOMProcessingInstruction>)createProcessingInstruction:(NSString *)target :(NSString *)data error:(NSError **)error
-{
-    ASSERT(target);
-    ASSERT(data);
-
-    // Documentation says we can raise a INVALID_CHARACTER_ERR or a NOT_SUPPORTED_ERR.
-    // However, the lower layer does not report these errors up to us.
-    return [WebCoreDOMProcessingInstruction objectWithImpl:[self impl]->createProcessingInstruction(NSStringToDOMString(target), NSStringToDOMString(data))];
-}
-
-- (id <DOMAttr>)createAttribute:(NSString *)name error:(NSError **)error
-{
-    ASSERT(name);
-
-    // Method not reflected in DOM::DocumentImpl interface
-    try {
-        Document doc(DocumentImpl::createInstance([self impl]));
-        Attr result(doc.createAttribute(NSStringToDOMString(name)));
-        AttrImpl *impl = static_cast<AttrImpl *>(result.handle());
-        return [WebCoreDOMAttr objectWithImpl:impl];
-    } 
-    catch (const DOMException &e) {
-        fillInError(error, e.code);
-        return nil;
-    }
-}
-
-- (id <DOMEntityReference>)createEntityReference:(NSString *)name error:(NSError **)error
-{
-    ASSERT(name);
-
-    // Documentation says we can raise a INVALID_CHARACTER_ERR or a NOT_SUPPORTED_ERR.
-    // However, the lower layer does not report these errors up to us.
-    return [WebCoreDOMEntityReference objectWithImpl:[self impl]->createEntityReference(NSStringToDOMString(name))];
-}
-
-- (id <DOMNodeList>)getElementsByTagName:(NSString *)tagname
-{
-    ASSERT(tagname);
-
-    return [WebCoreDOMNodeList objectWithImpl:[self impl]->getElementsByTagNameNS(0, NSStringToDOMString(tagname).implementation())];
-}
-
-- (id <DOMNode>)importNode:(id <DOMNode>)importedNode :(BOOL)deep error:(NSError **)error
-{
-    int code;
-    WebCoreDOMNode *result = [WebCoreDOMNode objectWithImpl:[self impl]->importNode(nodeImpl(importedNode), deep, code)];
-    fillInError(error, code);
-    return result;
-}
-
-- (id <DOMElement>)createElementNS:(NSString *)namespaceURI :(NSString *)qualifiedName error:(NSError **)error
-{
-    ASSERT(namespaceURI);
-    ASSERT(qualifiedName);
-
-    int code;
-    id <DOMElement> result = [WebCoreDOMElement objectWithImpl:[self impl]->createElementNS(NSStringToDOMString(namespaceURI), NSStringToDOMString(qualifiedName), code)];
-    fillInError(error, code);
-    return result;
-}
-
-- (id <DOMAttr>)createAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName error:(NSError **)error
-{
-    ASSERT(namespaceURI);
-    ASSERT(qualifiedName);
-
-    // Method not reflected in DOM::DocumentImpl interface
-    try {
-        Document doc(DocumentImpl::createInstance([self impl]));
-        Attr result(doc.createAttributeNS(NSStringToDOMString(namespaceURI), NSStringToDOMString(qualifiedName)));
-        AttrImpl *impl = static_cast<AttrImpl *>(result.handle());
-        return [WebCoreDOMAttr objectWithImpl:impl];
-    } 
-    catch (const DOMException &e) {
-        fillInError(error, e.code);
-        return nil;
-    }
-}
-
-- (id <DOMNodeList>)getElementsByTagNameNS:(NSString *)namespaceURI :(NSString *)localName
-{
-    ASSERT(namespaceURI);
-    ASSERT(localName);
-
-    return [WebCoreDOMNodeList objectWithImpl:[self impl]->getElementsByTagNameNS(NSStringToDOMString(namespaceURI).implementation(), NSStringToDOMString(localName).implementation())];
-}
-
-- (id <DOMElement>)getElementById:(NSString *)elementId
-{
-    ASSERT(elementId);
-
-    return [WebCoreDOMElement objectWithImpl:[self impl]->getElementById(NSStringToDOMString(elementId))];
-}
-
-//
-// begin deprecated methods
-//
-- (id<DOMElement>)createElement:(NSString *)tagName
-{
-    return [self createElement:tagName error:nil];
-}
-
-- (id<DOMElement>)createElementNS:(NSString *)namespaceURI :(NSString *)qualifiedName
-{
-    return [self createElementNS:namespaceURI :qualifiedName error:nil];
-}
-
-- (id<DOMCDATASection>)createCDATASection:(NSString *)data
-{
-    return [self createCDATASection:data error:nil];
-}
-
-- (id<DOMProcessingInstruction>)createProcessingInstruction:(NSString *)target :(NSString *)data
-{
-    return [self createProcessingInstruction:target :data error:nil];
-}
-
-- (id<DOMAttr>)createAttribute:(NSString *)name;
-{
-    return [self createAttribute:name error:nil];
-}
-
-- (id<DOMEntityReference>)createEntityReference:(NSString *)name
-{
-    return [self createEntityReference:name error:nil];
-}
-
-- (id<DOMNode>)importNode:(id<DOMNode>)importedNode :(BOOL)deep
-{
-    return [self importNode:importedNode :deep error:nil];
-}
-//
-// end deprecated methods
-//
-
- at end
-
-//------------------------------------------------------------------------------------------
-// WebCoreDOMCharacterData
-
- at implementation WebCoreDOMCharacterData
-
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMCharacterData, CharacterDataImpl)
-
-// Note: This object does not need its own dealloc method, since it derives from
-// WebCoreDOMNode. See the dealloc method comment on that method for more information. 
-
-- (NSString *)data
-{
-    // Documentation says we can raise a DOMSTRING_SIZE_ERR.
-    // However, the lower layer does not report that error up to us.
-    return domStringToNSString([self impl]->data());
-}
-
-- (void)setData:(NSString *)data error:(NSError **)error
-{
-    ASSERT(data);
-    
-    int code;
-    [self impl]->setData(NSStringToDOMString(data), code);
-    fillInError(error, code);
-}
-
-- (unsigned long)length
-{
-    return [self impl]->length();
-}
-
-- (NSString *)substringData:(unsigned long)offset :(unsigned long)count error:(NSError **)error
-{
-    int code;
-    NSString *result = domStringToNSString([self impl]->substringData(offset, count, code));
-    fillInError(error, code);
-    return result;
-}
-
-- (void)appendData:(NSString *)arg error:(NSError **)error
-{
-    ASSERT(arg);
-    
-    int code;
-    [self impl]->appendData(NSStringToDOMString(arg), code);
-    fillInError(error, code);
-}
-
-- (void)insertData:(unsigned long)offset :(NSString *)arg error:(NSError **)error
-{
-    ASSERT(arg);
-    
-    int code;
-    [self impl]->insertData(offset, NSStringToDOMString(arg), code);
-    fillInError(error, code);
-}
-
-- (void)deleteData:(unsigned long)offset :(unsigned long) count error:(NSError **)error;
-{
-    int code;
-    [self impl]->deleteData(offset, count, code);
-    fillInError(error, code);
-}
-
-- (void)replaceData:(unsigned long)offset :(unsigned long)count :(NSString *)arg error:(NSError **)error
-{
-    ASSERT(arg);
-
-    int code;
-    [self impl]->replaceData(offset, count, NSStringToDOMString(arg), code);
-    fillInError(error, code);
-}
-
-//
-// begin deprecated methods
-//
-- (void)setData: (NSString *)data
-{
-    [self setData:data error:nil];
-}
-
-- (NSString *)substringData: (unsigned long)offset :(unsigned long)count
-{
-    return [self substringData:offset :count error:nil];
-}
-
-- (void)appendData:(NSString *)arg
-{
-    [self appendData:arg error:nil];
-}
-
-- (void)insertData:(unsigned long)offset :(NSString *)arg
-{
-    [self insertData:offset :arg error:nil];
-}
-
-- (void)deleteData:(unsigned long)offset :(unsigned long)count
-{
-    [self deleteData:offset :count error:nil];
-}
-
-- (void)replaceData:(unsigned long)offset :(unsigned long)count :(NSString *)arg
-{
-    [self replaceData:offset :count :arg error:nil];
-}
-//
-// end deprecated methods
-//
-
- at end
-
-
-//------------------------------------------------------------------------------------------
-// WebCoreDOMAttr
-
- at implementation WebCoreDOMAttr
-
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMAttr, AttrImpl)
-
-// Note: This object does not need its own dealloc method, since it derives from
-// WebCoreDOMNode. See the dealloc method comment on that method for more information. 
-
-- (NSString *)name
-{
-    return domStringToNSString([self impl]->nodeName());
-}
-
-- (BOOL)specified
-{
-    return [self impl]->specified();
-}
-
-- (NSString *)value
-{
-    return domStringToNSString([self impl]->nodeValue());
-}
-
-- (void)setValue:(NSString *)value error:(NSError **)error
-{
-    ASSERT(value);
-
-    int code;
-    [self impl]->setValue(NSStringToDOMString(value), code);
-    fillInError(error, code);
-}
-
-- (id <DOMElement>)ownerElement
-{
-    return [WebCoreDOMElement objectWithImpl:[self impl]->ownerElement()];
-}
-
-//
-// begin deprecated methods
-//
-- (void)setValue:(NSString *)value
-{
-    [self setValue:value error:nil];
-}
-//
-// end deprecated methods
-//
-
- at end
-
-//------------------------------------------------------------------------------------------
-// WebCoreDOMElement
-
- at implementation WebCoreDOMElement
-
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMElement, ElementImpl)
-
-// Note: This object does not need its own dealloc method, since it derives from
-// WebCoreDOMNode. See the dealloc method comment on that method for more information. 
-
-- (NSString *)tagName
-{
-    return domStringToNSString([self impl]->tagName());
-}
-
-- (NSString *)getAttribute:(NSString *)name
-{
-    ASSERT(name);
-
-    return domStringToNSString([self impl]->getAttribute(NSStringToDOMString(name)));
-}
-
-- (void)setAttribute:(NSString *)name :(NSString *)value error:(NSError **)error
-{
-    ASSERT(name);
-    ASSERT(value);
-
-    // Method not reflected in DOM::ElementImpl interface
-    try {
-        Element element(ElementImpl::createInstance([self impl]));
-        element.setAttribute(NSStringToDOMString(name), NSStringToDOMString(value));
-    } 
-    catch (const DOMException &e) {
-        fillInError(error, e.code);
-    }
-}
-
-- (void)removeAttribute:(NSString *)name error:(NSError **)error
-{
-    ASSERT(name);
-
-    // Method not reflected in DOM::ElementImpl interface
-    try {
-        Element element(ElementImpl::createInstance([self impl]));
-        element.removeAttribute(NSStringToDOMString(name));
-    } 
-    catch (const DOMException &e) {
-        fillInError(error, e.code);
-    }
-}
-
-- (id <DOMAttr>)getAttributeNode:(NSString *)name
-{
-    ASSERT(name);
-
-    // Method not reflected in DOM::ElementImpl interface
-    Element element(ElementImpl::createInstance([self impl]));
-    Attr result(element.getAttributeNode(NSStringToDOMString(name)));
-    return [WebCoreDOMAttr objectWithImpl:static_cast<AttrImpl *>(result.handle())];
-}
-
-- (id <DOMAttr>)setAttributeNode:(id <DOMAttr>)newAttr error:(NSError **)error
-{
-    if (!newAttr) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
-
-    // Method not reflected in DOM::ElementImpl interface
-    try {
-        Element element(ElementImpl::createInstance([self impl]));
-        Attr attr(AttrImpl::createInstance(attrImpl(newAttr)));
-        Attr result(element.setAttributeNode(attr));
-        return [WebCoreDOMAttr objectWithImpl:static_cast<AttrImpl *>(result.handle())];
-    } 
-    catch (const DOMException &e) {
-        fillInError(error, e.code);
-        return nil;
-    }
-}
-
-- (id <DOMAttr>)removeAttributeNode:(id <DOMAttr>)oldAttr error:(NSError **)error
-{
-    if (!oldAttr) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
-
-    // Method not reflected in DOM::ElementImpl interface
-    try {
-        Element element(ElementImpl::createInstance([self impl]));
-        Attr attr(AttrImpl::createInstance(attrImpl(oldAttr)));
-        Attr result(element.removeAttributeNode(attr));
-        return [WebCoreDOMAttr objectWithImpl:static_cast<AttrImpl *>(result.handle())];
-    } 
-    catch (const DOMException &e) {
-        fillInError(error, e.code);
-        return nil;
-    }
-}
-
-- (id <DOMNodeList>)getElementsByTagName:(NSString *)name
-{
-    ASSERT(name);
-
-    return [WebCoreDOMNodeList objectWithImpl:[self impl]->getElementsByTagNameNS(0, NSStringToDOMString(name).implementation())];
-}
-
-- (NSString *)getAttributeNS:(NSString *)namespaceURI :(NSString *)localName
-{
-    ASSERT(namespaceURI);
-    ASSERT(localName);
-
-    Element element(ElementImpl::createInstance([self impl]));
-    return domStringToNSString(element.getAttributeNS(NSStringToDOMString(namespaceURI), NSStringToDOMString(localName)));
-}
-
-- (void)setAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName :(NSString *)value error:(NSError **)error
-{
-    ASSERT(namespaceURI);
-    ASSERT(qualifiedName);
-    ASSERT(value);
-
-    // Method not reflected in DOM::ElementImpl interface
-    try {
-        Element element(ElementImpl::createInstance([self impl]));
-        element.setAttributeNS(NSStringToDOMString(namespaceURI), NSStringToDOMString(qualifiedName), NSStringToDOMString(value));
-    } 
-    catch (const DOMException &e) {
-        fillInError(error, e.code);
-    }
-}
-
-- (void)removeAttributeNS:(NSString *)namespaceURI :(NSString *)localName error:(NSError **)error
-{
-    ASSERT(namespaceURI);
-    ASSERT(localName);
-
-    // Method not reflected in DOM::ElementImpl interface
-    try {
-        Element element(ElementImpl::createInstance([self impl]));
-        element.removeAttributeNS(NSStringToDOMString(namespaceURI), NSStringToDOMString(localName));
-    } 
-    catch (const DOMException &e) {
-        fillInError(error, e.code);
-    }
-}
-
-- (id <DOMAttr>)getAttributeNodeNS:(NSString *)namespaceURI :(NSString *)localName
-{
-    ASSERT(namespaceURI);
-    ASSERT(localName);
-
-    // Method not reflected in DOM::ElementImpl interface
-    Element element(ElementImpl::createInstance([self impl]));
-    Attr result(element.getAttributeNodeNS(NSStringToDOMString(namespaceURI), NSStringToDOMString(localName)));
-    return [WebCoreDOMAttr objectWithImpl:static_cast<AttrImpl *>(result.handle())];
-}
-
-- (id <DOMAttr>)setAttributeNodeNS:(id <DOMAttr>)newAttr error:(NSError **)error
-{
-    if (!newAttr) {
-        fillInError(error, NOT_FOUND_ERR);
-        return nil;
-    }
-
-    // Method not reflected in DOM::ElementImpl interface
-    try {
-        Element element(ElementImpl::createInstance([self impl]));
-        Attr attr(AttrImpl::createInstance(attrImpl(newAttr)));
-        Attr result(element.setAttributeNodeNS(attr));
-        return [WebCoreDOMAttr objectWithImpl:static_cast<AttrImpl *>(result.handle())];
-    } 
-    catch (const DOMException &e) {
-        fillInError(error, e.code);
-        return nil;
-    }
-}
-
-- (id <DOMNodeList>)getElementsByTagNameNS:(NSString *)namespaceURI :(NSString *)localName
-{
-    ASSERT(namespaceURI);
-    ASSERT(localName);
-
-    return [WebCoreDOMNodeList objectWithImpl:[self impl]->getElementsByTagNameNS(NSStringToDOMString(namespaceURI).implementation(), NSStringToDOMString(localName).implementation())];
-}
-
-- (BOOL)hasAttribute:(NSString *)name
-{
-    ASSERT(name);
-
-    // Method not reflected in DOM::ElementImpl interface
-    Element element(ElementImpl::createInstance([self impl]));
-    return element.hasAttribute(NSStringToDOMString(name));
-}
-
-- (BOOL)hasAttributeNS:(NSString *)namespaceURI :(NSString *)localName
-{
-    ASSERT(namespaceURI);
-    ASSERT(localName);
-
-    // Method not reflected in DOM::ElementImpl interface
-    Element element(ElementImpl::createInstance([self impl]));
-    return element.hasAttributeNS(NSStringToDOMString(namespaceURI), NSStringToDOMString(localName));
-}
-
-//
-// begin deprecated methods
-//
-- (void)setAttribute:(NSString *)name :(NSString *)value
-{
-    [self setAttribute:name :value error:nil];
-}
-
-- (void)removeAttribute:(NSString *)name
-{
-    [self removeAttribute:name error:nil];
-}
-
-- (id<DOMAttr>)setAttributeNode:(id<DOMAttr>)newAttr
-{
-    return [self setAttributeNode:newAttr error:nil];
-}
-
-- (id<DOMAttr>)removeAttributeNode:(id<DOMAttr>)oldAttr
-{
-    return [self removeAttributeNode:oldAttr error:nil];
-}
-
-- (void)setAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName :(NSString *)value
-{
-    [self setAttributeNS:namespaceURI :qualifiedName :value error:nil];
-}
-
-- (void)removeAttributeNS:(NSString *)namespaceURI :(NSString *)localName
-{
-    [self removeAttributeNS:namespaceURI :localName error:nil];
-}
-
-- (id<DOMAttr>)setAttributeNodeNS:(id<DOMAttr>)newAttr
-{
-    return [self setAttributeNodeNS:newAttr error:nil];
-}
-//
-// end deprecated methods
-//
-
- at end
-
-//------------------------------------------------------------------------------------------
-// WebCoreDOMText
-
- at implementation WebCoreDOMText
-
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMText, TextImpl)
-
-// Note: This object does not need its own dealloc method, since it derives from
-// WebCoreDOMNode. See the dealloc method comment on that method for more information. 
-
-- (id <DOMText>)splitText:(unsigned long)offset error:(NSError **)error
-{
-    int code;
-    id <DOMText> result = [WebCoreDOMText objectWithImpl:[self impl]->splitText(offset, code)];
-    fillInError(error, code);
-    return result;
-}
-
-//
-// begin deprecated methods
-//
-- (id<DOMText>)splitText:(unsigned long)offset
-{
-    return [self splitText:offset error:nil];
-}
-//
-// end deprecated methods
-//
-
- at end
-
-//------------------------------------------------------------------------------------------
-// WebCoreDOMComment
-
- at implementation WebCoreDOMComment
-
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMComment, CommentImpl)
-
- at end
-
-//------------------------------------------------------------------------------------------
-// WebCoreDOMCDATASection
-
- at implementation WebCoreDOMCDATASection
-
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMCDATASection, CDATASectionImpl)
-
- at end
-
-//------------------------------------------------------------------------------------------
-// WebCoreDOMDocumentType
-
- at implementation WebCoreDOMDocumentType
-
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMDocumentType, DocumentTypeImpl)
-
-// Note: This object does not need its own dealloc method, since it derives from
-// WebCoreDOMNode. See the dealloc method comment on that method for more information. 
-
-- (NSString *)name
-{
-    return domStringToNSString([self impl]->publicId());
-}
-
-- (id <DOMNamedNodeMap>)entities
-{
-    return [WebCoreDOMNamedNodeMap objectWithImpl:[self impl]->entities()];
-}
-
-- (id <DOMNamedNodeMap>)notations
-{
-    return [WebCoreDOMNamedNodeMap objectWithImpl:[self impl]->notations()];
-}
-
-- (NSString *)publicId
-{
-    return domStringToNSString([self impl]->publicId());
-}
-
-- (NSString *)systemId
-{
-    return domStringToNSString([self impl]->systemId());
-}
-
-- (NSString *)internalSubset
-{
-    return domStringToNSString([self impl]->internalSubset());
-}
-
- at end
-
-//------------------------------------------------------------------------------------------
-// WebCoreDOMNotation
-
- at implementation WebCoreDOMNotation
-
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMNotation, NotationImpl)
-
-// Note: This object does not need its own dealloc method, since it derives from
-// WebCoreDOMNode. See the dealloc method comment on that method for more information. 
-
-- (NSString *)publicId
-{
-    return domStringToNSString([self impl]->publicId());
-}
-
-- (NSString *)systemId
-{
-    return domStringToNSString([self impl]->systemId());
-}
-
- at end
-
-//------------------------------------------------------------------------------------------
-// WebCoreDOMEntity
-
- at implementation WebCoreDOMEntity
-
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMEntity, EntityImpl)
-
-- (NSString *)publicId
-{
-    return domStringToNSString([self impl]->publicId());
-}
-
-- (NSString *)systemId
-{
-    return domStringToNSString([self impl]->systemId());
-}
-
-- (NSString *)notationName
-{
-    return domStringToNSString([self impl]->notationName());
-}
-
- at end
-
-//------------------------------------------------------------------------------------------
-// WebCoreDOMEntityReference
-
- at implementation WebCoreDOMEntityReference
-
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMEntityReference, EntityReferenceImpl)
-
-// Note: This object does not need its own dealloc method, since it derives from
-// WebCoreDOMNode. See the dealloc method comment on that method for more information. 
-
- at end
-
-//------------------------------------------------------------------------------------------
-// WebCoreDOMProcessingInstruction
-
- at implementation WebCoreDOMProcessingInstruction
-
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMProcessingInstruction, ProcessingInstructionImpl)
-
-// Note: This object does not need its own dealloc method, since it derives from
-// WebCoreDOMNode. See the dealloc method comment on that method for more information. 
-
-- (NSString *)target
-{
-    return domStringToNSString([self impl]->target());
-}
-
-- (NSString *)data
-{
-    return domStringToNSString([self impl]->data());
-}
-
-- (void)setData:(NSString *)data error:(NSError **)error
-{
-    ASSERT(data);
-
-    int code;
-    [self impl]->setData(NSStringToDOMString(data), code);
-    fillInError(error, code);
-}
-
-//
-// begin deprecated methods
-//
-- (void)setData:(NSString *)data
-{
-    [self setData:data error:nil];
-}
-//
-// end deprecated methods
-//
-
- at end
-
-//------------------------------------------------------------------------------------------
-// WebCoreDOMRange
-
- at implementation WebCoreDOMRange
-
-WEB_CORE_INTERNAL_METHODS(WebCoreDOMRange, RangeImpl)
-
-// Note: only objects that derive directly from WebDOMObject need their own dealloc method.
-// This is due to the fact that some of the details impl objects derive from
-// khtml::Shared, others from khtml::TreeShared (which do not share a base type), and we 
-// have to cast to the right type in order to call the deref() function.
-- (void)dealloc
-{
-    RangeImpl *instance = static_cast<RangeImpl *>(details);
-    if (instance)
-        instance->deref();
-    [super dealloc];
-}
-
-- (id <DOMNode>)startContainer:(NSError **)error
-{
-    int code;
-    id <DOMNode> result = [WebCoreDOMNode objectWithImpl:[self impl]->startContainer(code)];
-    fillInError(error, code);
-    return result;
-}
-
-- (long)startOffset:(NSError **)error
-{
-    int code;
-    long result = [self impl]->startOffset(code);
-    fillInError(error, code);
-    return result;
-}
-
-- (id <DOMNode>)endContainer:(NSError **)error
-{
-    int code;
-    id <DOMNode> result = [WebCoreDOMNode objectWithImpl:[self impl]->endContainer(code)];
-    fillInError(error, code);
-    return result;
-}
-
-- (long)endOffset:(NSError **)error
-{
-    int code;
-    long result = [self impl]->endOffset(code);
-    fillInError(error, code);
-    return result;
-}
-
-- (BOOL)collapsed:(NSError **)error
-{
-    int code;
-    BOOL result = [self impl]->collapsed(code);
-    fillInError(error, code);
-    return result;
-}
-
-- (id <DOMNode>)commonAncestorContainer:(NSError **)error
-{
-    int code;
-    id <DOMNode> result = [WebCoreDOMNode objectWithImpl:[self impl]->commonAncestorContainer(code)];
-    fillInError(error, code);
-    return result;
-}
-
-- (void)setStart:(id <DOMNode>)refNode :(long)offset error:(NSError **)error
-{
-    int code;
-    [self impl]->setStart(nodeImpl(refNode), offset, code);
-    fillInError(error, code);
-}
-
-- (void)setEnd:(id <DOMNode>)refNode :(long)offset error:(NSError **)error
-{
-    int code;
-    [self impl]->setEnd(nodeImpl(refNode), offset, code);
-    fillInError(error, code);
-}
-
-- (void)setStartBefore:(id <DOMNode>)refNode error:(NSError **)error
-{
-    int code;
-    [self impl]->setStartBefore(nodeImpl(refNode), code);
-    fillInError(error, code);
-}
-
-- (void)setStartAfter:(id <DOMNode>)refNode error:(NSError **)error
-{
-    int code;
-    [self impl]->setStartAfter(nodeImpl(refNode), code);
-    fillInError(error, code);
-}
-
-- (void)setEndBefore:(id <DOMNode>)refNode error:(NSError **)error
-{
-    int code;
-    [self impl]->setEndBefore(nodeImpl(refNode), code);
-    fillInError(error, code);
-}
-
-- (void)setEndAfter:(id <DOMNode>)refNode error:(NSError **)error
-{
-    int code;
-    [self impl]->setEndAfter(nodeImpl(refNode), code);
-    fillInError(error, code);
-}
-
-- (void)collapse:(BOOL)toStart error:(NSError **)error
-{
-    int code;
-    [self impl]->collapse(toStart, code);
-    fillInError(error, code);
-}
-
-- (void)selectNode:(id <DOMNode>)refNode error:(NSError **)error
-{
-    int code;
-    [self impl]->selectNode(nodeImpl(refNode), code);
-    fillInError(error, code);
-}
-
-- (void)selectNodeContents:(id <DOMNode>)refNode error:(NSError **)error
-{
-    int code;
-    [self impl]->selectNodeContents(nodeImpl(refNode), code);
-    fillInError(error, code);
-}
-
-- (short)compareBoundaryPoints:(unsigned short)how :(id <DOMRange>)sourceRange error:(NSError **)error
-{
-    int code;
-    short result = [self impl]->compareBoundaryPoints(static_cast<Range::CompareHow>(how), rangeImpl(sourceRange), code);
-    fillInError(error, code);
-    return result;
-}
-
-- (void)deleteContents:(NSError **)error
-{
-    int code;
-    [self impl]->deleteContents(code);
-    fillInError(error, code);
-}
-
-- (id <DOMDocumentFragment>)extractContents:(NSError **)error
-{
-    int code;
-    id <DOMDocumentFragment> result = [WebCoreDOMDocumentFragment objectWithImpl:[self impl]->extractContents(code)];
-    fillInError(error, code);
-    return result;
-}
-
-- (id <DOMDocumentFragment>)cloneContents:(NSError **)error
-{
-    int code;
-    id <DOMDocumentFragment> result = [WebCoreDOMDocumentFragment objectWithImpl:[self impl]->cloneContents(code)];
-    fillInError(error, code);
-    return result;
-}
-
-- (void)insertNode:(id <DOMNode>)newNode error:(NSError **)error
-{
-    int code;
-    [self impl]->insertNode(nodeImpl(newNode), code);
-    fillInError(error, code);
-}
-
-- (void)surroundContents:(id <DOMNode>)newParent error:(NSError **)error
-{
-    int code;
-    [self impl]->surroundContents(nodeImpl(newParent), code);
-    fillInError(error, code);
-}
-
-- (id <DOMRange>)cloneRange:(NSError **)error
-{
-    int code;
-    id <DOMRange> result = [WebCoreDOMRange objectWithImpl:[self impl]->cloneRange(code)];
-    fillInError(error, code);
-    return result;
-}
-
-- (NSString *)toString:(NSError **)error
-{
-    int code;
-    NSString *result = domStringToNSString([self impl]->toString(code));
-    fillInError(error, code);
-    return result;
-}
-
-- (void)detach:(NSError **)error
-{
-    int code;
-    [self impl]->detach(code);
-    fillInError(error, code);
-}
-
- at end
-
-//------------------------------------------------------------------------------------------
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 8a71688..2f7c76f 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,37 @@
+2004-03-01  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by Darin
+        
+        Changed all Objective-C DOM classes from protocols to classes. 
+
+        * DOM.subproj/DOM-compat.h:
+        * DOM.subproj/DOM.h:
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge loadURL:referrer:reload:onLoadEvent:target:triggeringEvent:form:formValues:]):
+        (-[WebBridge postWithURL:referrer:target:data:contentType:triggeringEvent:form:formValues:]):
+        * WebView.subproj/WebFormDelegate.h:
+        * WebView.subproj/WebFormDelegate.m:
+        (-[WebFormDelegate frame:sourceFrame:willSubmitForm:withValues:submissionListener:]):
+        * WebView.subproj/WebFrame.m:
+        (-[WebFrame _loadURL:referrer:loadType:target:triggeringEvent:form:formValues:]):
+        (-[WebFrame _postWithURL:referrer:target:data:contentType:triggeringEvent:form:formValues:]):
+        (-[WebFormState initWithForm:values:sourceFrame:]):
+        (-[WebFormState form]):
+        * WebView.subproj/WebFramePrivate.h:
+        * WebView.subproj/WebHTMLRepresentation.h:
+        * WebView.subproj/WebHTMLRepresentation.m:
+        (-[WebHTMLRepresentation DOMDocument]):
+        (-[WebHTMLRepresentation setSelectionFrom:startOffset:to:endOffset:]):
+        (-[WebHTMLRepresentation attributedStringFrom:startOffset:to:endOffset:]):
+        (-[WebHTMLRepresentation elementWithName:inForm:]):
+        (-[WebHTMLRepresentation elementForView:]):
+        (-[WebHTMLRepresentation elementDoesAutoComplete:]):
+        (-[WebHTMLRepresentation elementIsPassword:]):
+        (-[WebHTMLRepresentation formForElement:]):
+        (-[WebHTMLRepresentation controlsInForm:]):
+        (-[WebHTMLRepresentation searchForLabels:beforeElement:]):
+        (-[WebHTMLRepresentation matchLabels:againstElement:]):
+
 2004-02-27  John Sullivan  <sullivan at apple.com>
 
         - WebKit changes to allow performance improvements to bookmarks 
diff --git a/WebKit/DOM.subproj/DOM-compat.h b/WebKit/DOM.subproj/DOM-compat.h
index beb7f71..499408b 100644
--- a/WebKit/DOM.subproj/DOM-compat.h
+++ b/WebKit/DOM.subproj/DOM-compat.h
@@ -3,78 +3,22 @@
     Copyright 2004, Apple, Inc. All rights reserved.
 */
 
- at protocol DOMNode;
- at protocol DOMNamedNodeMap;
- at protocol DOMNodeList;
- at protocol DOMImplementation;
- at protocol DOMDocumentFragment;
- at protocol DOMDocument;
- at protocol DOMCharacterData;
- at protocol DOMAttr;
- at protocol DOMElement;
- at protocol DOMText;
- at protocol DOMComment;
- at protocol DOMCDATASection;
- at protocol DOMDocumentType;
- at protocol DOMNotation;
- at protocol DOMEntity;
- at protocol DOMEntityReference;
- at protocol DOMProcessingInstruction;
-
- at protocol WebDOMNode <DOMNode>
- at end
-
- at protocol WebDOMNamedNodeMap <DOMNamedNodeMap>
- at end
-
- at protocol WebDOMNodeList <DOMNodeList>
- at end
-
- at protocol WebDOMDocumentType <DOMDocumentType>
- at end
-
- at protocol WebDOMDocumentFragment <DOMDocumentFragment>
- at end
-
- at protocol WebDOMImplementation <DOMImplementation>
- at end
-
- at protocol WebDOMDocument <DOMDocument>
- at end
-
- at protocol WebDOMAttr <DOMAttr>
- at end
-
- at protocol WebDOMCharacterData <DOMCharacterData>
- at end
-
- at protocol WebDOMComment <DOMComment>
- at end
-
- at protocol WebDOMText <DOMText>
- at end
-
- at protocol WebDOMCDATASection <DOMCDATASection>
- at end
-
- at protocol WebDOMProcessingInstruction <DOMProcessingInstruction>
- at end
-
- at protocol WebDOMEntityReference <DOMEntityReference>
+//
+// To preserve source compatibility with Message.framework
+//
+ at protocol WebDOMNode
+- (NSString *)nodeName;
+- (NSString *)nodeValue;
+- (unsigned short)nodeType;
+- (BOOL)hasAttributes;
+- (id)attributes;
+- (id)firstChild;
+- (id)nextSibling;
+- (id)parentNode;
 @end
 
- at protocol WebDOMElement <DOMElement>
+ at protocol WebDOMDocument <WebDOMNode>
 @end
 
-#define WebNodeType DOMNodeType
-#define WebDOMAttr DOMAttr
-#define WebDOMComment DOMComment
-#define WebDOMCDATASection DOMCDATASection
-#define WebDOMDocument DOMDocument
-#define WebDOMElement DOMElement
-#define WebDOMEntityReference DOMEntityReference
-#define WebDOMNamedNodeMap DOMNamedNodeMap
-#define WebDOMNode DOMNode
-#define WebDOMNodeList DOMNodeList
-#define WebDOMProcessingInstruction DOMProcessingInstruction
-#define WebDOMText DOMText
+#define ELEMENT_NODE 1
+#define TEXT_NODE 3
\ No newline at end of file
diff --git a/WebKit/DOM.subproj/DOM.h b/WebKit/DOM.subproj/DOM.h
index 3d8d75b..1795c1f 100644
--- a/WebKit/DOM.subproj/DOM.h
+++ b/WebKit/DOM.subproj/DOM.h
@@ -37,36 +37,36 @@
 //=========================================================================
 
 enum DOMNodeType {
-    ELEMENT_NODE                   = 1,
-    ATTRIBUTE_NODE                 = 2,
-    TEXT_NODE                      = 3,
-    CDATA_SECTION_NODE             = 4,
-    ENTITY_REFERENCE_NODE          = 5,
-    ENTITY_NODE                    = 6,
-    PROCESSING_INSTRUCTION_NODE    = 7,
-    COMMENT_NODE                   = 8,
-    DOCUMENT_NODE                  = 9,
-    DOCUMENT_TYPE_NODE             = 10,
-    DOCUMENT_FRAGMENT_NODE         = 11,
-    NOTATION_NODE                  = 12,
+    DOMElementNodeType                   = 1,
+    DOMAttributeNodeType                 = 2,
+    DOMTextNodeType                      = 3,
+    DOMCDATASectionNodeType              = 4,
+    DOMEntityReferenceNodeType           = 5,
+    DOMEntityNodeType                    = 6,
+    DOMProcessingInstructionNodeType     = 7,
+    DOMCommentNodeType                   = 8,
+    DOMDocumentNodeType                  = 9,
+    DOMDocumentTypeNodeType              = 10,
+    DOMDocumentFragmentNodeType          = 11,
+    DOMNotationNodeType                  = 12,
 };
 
-enum DOMExceptionCode {
-    INDEX_SIZE_ERR                 = 1,
-    DOMSTRING_SIZE_ERR             = 2,
-    HIERARCHY_REQUEST_ERR          = 3,
-    WRONG_DOCUMENT_ERR             = 4,
-    INVALID_CHARACTER_ERR          = 5,
-    NO_DATA_ALLOWED_ERR            = 6,
-    NO_MODIFICATION_ALLOWED_ERR    = 7,
-    NOT_FOUND_ERR                  = 8,
-    NOT_SUPPORTED_ERR              = 9,
-    INUSE_ATTRIBUTE_ERR            = 10,
-    INVALID_STATE_ERR              = 11,
-    SYNTAX_ERR                     = 12,
-    INVALID_MODIFICATION_ERR       = 13,
-    NAMESPACE_ERR                  = 14,
-    INVALID_ACCESS_ERR             = 15,
+enum DOMErrorCode {
+    DOMIndexSizeError                 = 1,
+    DOMStringSizeError                = 2,
+    DOMHierarchyRequestError          = 3,
+    DOMWrongDocumentError             = 4,
+    DOMInvalidCharacterError          = 5,
+    DOMNoDataAllowedError             = 6,
+    DOMNoModificationAllowedError     = 7,
+    DOMNotFoundError                  = 8,
+    DOMNotSupportedError              = 9,
+    DOMInUseAttributeError            = 10,
+    DOMInvalidStateError              = 11,
+    DOMSyntaxError                    = 12,
+    DOMInvalidModificationError       = 13,
+    DOMNamespaceError                 = 14,
+    DOMInvalidAccessError             = 15,
 };
 
 extern NSString * const DOMErrorDomain;
@@ -74,45 +74,43 @@ extern NSString * const DOMErrorDomain;
 @class NSError;
 @class NSString;
 
- at protocol NSObject;
- at protocol DOMNode;
- at protocol DOMNamedNodeMap;
- at protocol DOMNodeList;
- at protocol DOMImplementation;
- at protocol DOMDocumentFragment;
- at protocol DOMDocument;
- at protocol DOMCharacterData;
- at protocol DOMAttr;
- at protocol DOMElement;
- at protocol DOMText;
- at protocol DOMComment;
- at protocol DOMCDATASection;
- at protocol DOMDocumentType;
- at protocol DOMNotation;
- at protocol DOMEntity;
- at protocol DOMEntityReference;
- at protocol DOMProcessingInstruction;
- at protocol DOMRange;
-
- at protocol DOMNode <NSObject>
+ at class DOMNode;
+ at class DOMNamedNodeMap;
+ at class DOMNodeList;
+ at class DOMDocumentFragment;
+ at class DOMDocument;
+ at class DOMCharacterData;
+ at class DOMAttr;
+ at class DOMElement;
+ at class DOMText;
+ at class DOMComment;
+ at class DOMCDATASection;
+ at class DOMDocumentType;
+ at class DOMNotation;
+ at class DOMEntity;
+ at class DOMEntityReference;
+ at class DOMProcessingInstruction;
+ at class DOMRange;
+
+ at interface DOMNode : NSObject <NSCopying>
 - (NSString *)nodeName;
 - (NSString *)nodeValue;
 - (void)setNodeValue:(NSString *)string error:(NSError **)error;
 - (unsigned short)nodeType;
-- (id <DOMNode>)parentNode;
-- (id <DOMNodeList>)childNodes;
-- (id <DOMNode>)firstChild;
-- (id <DOMNode>)lastChild;
-- (id <DOMNode>)previousSibling;
-- (id <DOMNode>)nextSibling;
-- (id <DOMNamedNodeMap>)attributes;
-- (id <DOMDocument>)ownerDocument;
-- (id <DOMNode>)insertBefore:(id <DOMNode>)newChild :(id <DOMNode>)refChild error:(NSError **)error;
-- (id <DOMNode>)replaceChild:(id <DOMNode>)newChild :(id <DOMNode>)oldChild error:(NSError **)error;
-- (id <DOMNode>)removeChild:(id <DOMNode>)oldChild error:(NSError **)error;
-- (id <DOMNode>)appendChild:(id <DOMNode>)newChild error:(NSError **)error;
+- (DOMNode *)parentNode;
+- (DOMNodeList *)childNodes;
+- (DOMNode *)firstChild;
+- (DOMNode *)lastChild;
+- (DOMNode *)previousSibling;
+- (DOMNode *)nextSibling;
+- (DOMNamedNodeMap *)attributes;
+- (DOMDocument *)ownerDocument;
+- (DOMNode *)insertBefore:(DOMNode *)newChild :(DOMNode *)refChild error:(NSError **)error;
+- (DOMNode *)replaceChild:(DOMNode *)newChild :(DOMNode *)oldChild error:(NSError **)error;
+- (DOMNode *)removeChild:(DOMNode *)oldChild error:(NSError **)error;
+- (DOMNode *)appendChild:(DOMNode *)newChild error:(NSError **)error;
 - (BOOL)hasChildNodes;
-- (id <DOMNode>)cloneNode:(BOOL)deep;
+- (DOMNode *)cloneNode:(BOOL)deep;
 - (void)normalize;
 - (BOOL)isSupported:(NSString *)feature :(NSString *)version;
 - (NSString *)namespaceURI;
@@ -121,86 +119,59 @@ extern NSString * const DOMErrorDomain;
 - (NSString *)localName;
 - (BOOL)hasAttributes;
 - (NSString *)HTMLString;
-// begin deprecated methods
-- (void)setNodeValue:(NSString *)string;
-- (id<DOMNode>)insert:(id<DOMNode>)newChild before:(id<DOMNode>)refChild;
-- (id<DOMNode>)replace:(id<DOMNode>)newChild child:(id<DOMNode>)oldChild;
-- (id<DOMNode>)removeChild:(id<DOMNode>)oldChild;
-- (id<DOMNode>)appendChild:(id<DOMNode>)newChild;
-- (void)setPrefix:(NSString *)prefix;
-// end deprecated methods
 @end
 
- at protocol DOMNamedNodeMap <NSObject>
-- (id <DOMNode>)getNamedItem:(NSString *)name;
-- (id <DOMNode>)setNamedItem:(id <DOMNode>)arg error:(NSError **)error;
-- (id <DOMNode>)removeNamedItem:(NSString *)name error:(NSError **)error;
-- (id <DOMNode>)item:(unsigned long)index;
+ at interface DOMNamedNodeMap : NSObject <NSCopying>
+- (DOMNode *)getNamedItem:(NSString *)name;
+- (DOMNode *)setNamedItem:(DOMNode *)arg error:(NSError **)error;
+- (DOMNode *)removeNamedItem:(NSString *)name error:(NSError **)error;
+- (DOMNode *)item:(unsigned long)index;
 - (unsigned long)length;
-- (id <DOMNode>)getNamedItemNS:(NSString *)namespaceURI :(NSString *)localName;
-- (id <DOMNode>)setNamedItemNS:(id <DOMNode>)arg error:(NSError **)error;
-- (id <DOMNode>)removeNamedItemNS:(NSString *)namespaceURI :(NSString *)localName error:(NSError **)error;
-// begin deprecated methods
-- (id<DOMNode>)setNamedItem:(id<DOMNode>)arg;
-- (id<DOMNode>)removeNamedItem:(NSString *)name;
-- (id<DOMNode>)setNamedItemNS:(id<DOMNode>)arg;
-- (id<DOMNode>)removeNamedItemNS:(NSString *)namespaceURI :(NSString *)localName;
-// end deprecated methods
+- (DOMNode *)getNamedItemNS:(NSString *)namespaceURI :(NSString *)localName;
+- (DOMNode *)setNamedItemNS:(DOMNode *)arg error:(NSError **)error;
+- (DOMNode *)removeNamedItemNS:(NSString *)namespaceURI :(NSString *)localName error:(NSError **)error;
 @end
 
 
- at protocol DOMNodeList <NSObject>
-- (id <DOMNode>)item:(unsigned long)index;
+ at interface DOMNodeList : NSObject <NSCopying>
+- (DOMNode *)item:(unsigned long)index;
 - (unsigned long)length;
 @end
 
 
- at protocol DOMImplementation <NSObject>
+ at interface DOMImplementation : NSObject <NSCopying>
 - (BOOL)hasFeature:(NSString *)feature :(NSString *)version;
-- (id <DOMDocumentType>)createDocumentType:(NSString *)qualifiedName :(NSString *)publicId :(NSString *)systemId error:(NSError **)error;
-- (id <DOMDocument>)createDocument:(NSString *)namespaceURI :(NSString *)qualifiedName :(id <DOMDocumentType>)doctype error:(NSError **)error;
-// begin deprecated methods
-- (id<DOMDocumentType>)createDocumentType:(NSString *)qualifiedName :(NSString *)publicId :(NSString *)systemId :(int *)exceptionCode;
-- (id<DOMDocument>)createDocument:(NSString *)namespaceURI :(NSString *)qualifiedName :(id<DOMDocumentType>)doctype;
-// end deprecated methods
+- (DOMDocumentType *)createDocumentType:(NSString *)qualifiedName :(NSString *)publicId :(NSString *)systemId error:(NSError **)error;
+- (DOMDocument *)createDocument:(NSString *)namespaceURI :(NSString *)qualifiedName :(DOMDocumentType *)doctype error:(NSError **)error;
 @end
 
 
- at protocol DOMDocumentFragment <DOMNode>
+ at interface DOMDocumentFragment : DOMNode
 @end
 
 
- at protocol DOMDocument <DOMNode>
-- (id <DOMDocumentType>)doctype;
-- (id <DOMImplementation>)implementation;
-- (id <DOMElement>)documentElement;
-- (id <DOMElement>)createElement:(NSString *)tagName error:(NSError **)error;
-- (id <DOMDocumentFragment>)createDocumentFragment;
-- (id <DOMText>)createTextNode:(NSString *)data;
-- (id <DOMComment>)createComment:(NSString *)data;
-- (id <DOMCDATASection>)createCDATASection:(NSString *)data error:(NSError **)error;
-- (id <DOMProcessingInstruction>)createProcessingInstruction:(NSString *)target :(NSString *)data error:(NSError **)error;
-- (id <DOMAttr>)createAttribute:(NSString *)name error:(NSError **)error;
-- (id <DOMEntityReference>)createEntityReference:(NSString *)name error:(NSError **)error;
-- (id <DOMNodeList>)getElementsByTagName:(NSString *)tagname;
-- (id <DOMNode>)importNode:(id <DOMNode>)importedNode :(BOOL)deep error:(NSError **)error;
-- (id <DOMElement>)createElementNS:(NSString *)namespaceURI :(NSString *)qualifiedName error:(NSError **)error;
-- (id <DOMAttr>)createAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName error:(NSError **)error;
-- (id <DOMNodeList>)getElementsByTagNameNS:(NSString *)namespaceURI :(NSString *)localName;
-- (id <DOMElement>)getElementById:(NSString *)elementId;
-// begin deprecated methods
-- (id<DOMElement>)createElement:(NSString *)tagName;
-- (id<DOMElement>)createElementNS:(NSString *)namespaceURI :(NSString *)qualifiedName;
-- (id<DOMCDATASection>)createCDATASection:(NSString *)data;
-- (id<DOMProcessingInstruction>)createProcessingInstruction:(NSString *)target :(NSString *)data;
-- (id<DOMAttr>)createAttribute:(NSString *)name;
-- (id<DOMEntityReference>)createEntityReference:(NSString *)name;
-- (id<DOMNode>)importNode:(id<DOMNode>)importedNode :(BOOL)deep;
-// end deprecated methods
+ at interface DOMDocument : DOMNode
+- (DOMDocumentType *)doctype;
+- (DOMImplementation *)implementation;
+- (DOMElement *)documentElement;
+- (DOMElement *)createElement:(NSString *)tagName error:(NSError **)error;
+- (DOMDocumentFragment *)createDocumentFragment;
+- (DOMText *)createTextNode:(NSString *)data;
+- (DOMComment *)createComment:(NSString *)data;
+- (DOMCDATASection *)createCDATASection:(NSString *)data error:(NSError **)error;
+- (DOMProcessingInstruction *)createProcessingInstruction:(NSString *)target :(NSString *)data error:(NSError **)error;
+- (DOMAttr *)createAttribute:(NSString *)name error:(NSError **)error;
+- (DOMEntityReference *)createEntityReference:(NSString *)name error:(NSError **)error;
+- (DOMNodeList *)getElementsByTagName:(NSString *)tagname;
+- (DOMNode *)importNode:(DOMNode *)importedNode :(BOOL)deep error:(NSError **)error;
+- (DOMElement *)createElementNS:(NSString *)namespaceURI :(NSString *)qualifiedName error:(NSError **)error;
+- (DOMAttr *)createAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName error:(NSError **)error;
+- (DOMNodeList *)getElementsByTagNameNS:(NSString *)namespaceURI :(NSString *)localName;
+- (DOMElement *)getElementById:(NSString *)elementId;
 @end
 
 
- at protocol DOMCharacterData <DOMNode>
+ at interface DOMCharacterData : DOMNode
 - (NSString *)data;
 - (void)setData:(NSString *)data error:(NSError **)error;
 - (unsigned long)length;
@@ -209,142 +180,116 @@ extern NSString * const DOMErrorDomain;
 - (void)insertData:(unsigned long)offset :(NSString *)arg error:(NSError **)error;
 - (void)deleteData:(unsigned long)offset :(unsigned long) count error:(NSError **)error;
 - (void)replaceData:(unsigned long)offset :(unsigned long)count :(NSString *)arg error:(NSError **)error;
-// begin deprecated methods
-- (void)setData: (NSString *)data;
-- (NSString *)substringData: (unsigned long)offset :(unsigned long)count;
-- (void)appendData:(NSString *)arg;
-- (void)insertData:(unsigned long)offset :(NSString *)arg;
-- (void)deleteData:(unsigned long)offset :(unsigned long)count;
-- (void)replaceData:(unsigned long)offset :(unsigned long)count :(NSString *)arg;
-// end deprecated methods
 @end
 
 
- at protocol DOMAttr <DOMNode>
+ at interface DOMAttr : DOMNode
 - (NSString *)name;
 - (BOOL)specified;
 - (NSString *)value;
 - (void)setValue:(NSString *)value error:(NSError **)error;
-- (id <DOMElement>)ownerElement;
-// begin deprecated methods
-- (void)setValue:(NSString *)value;
-// end deprecated methods
+- (DOMElement *)ownerElement;
 @end
 
 
- at protocol DOMElement <DOMNode>
+ at interface DOMElement : DOMNode
 - (NSString *)tagName;
 - (NSString *)getAttribute:(NSString *)name;
 - (void)setAttribute:(NSString *)name :(NSString *)value error:(NSError **)error;
 - (void)removeAttribute:(NSString *)name error:(NSError **)error;
-- (id <DOMAttr>)getAttributeNode:(NSString *)name;
-- (id <DOMAttr>)setAttributeNode:(id <DOMAttr>)newAttr error:(NSError **)error;
-- (id <DOMAttr>)removeAttributeNode:(id <DOMAttr>)oldAttr error:(NSError **)error;
-- (id <DOMNodeList>)getElementsByTagName:(NSString *)name;
+- (DOMAttr *)getAttributeNode:(NSString *)name;
+- (DOMAttr *)setAttributeNode:(DOMAttr *)newAttr error:(NSError **)error;
+- (DOMAttr *)removeAttributeNode:(DOMAttr *)oldAttr error:(NSError **)error;
+- (DOMNodeList *)getElementsByTagName:(NSString *)name;
 - (NSString *)getAttributeNS:(NSString *)namespaceURI :(NSString *)localName;
 - (void)setAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName :(NSString *)value error:(NSError **)error;
 - (void)removeAttributeNS:(NSString *)namespaceURI :(NSString *)localName error:(NSError **)error;
-- (id <DOMAttr>)getAttributeNodeNS:(NSString *)namespaceURI :(NSString *)localName;
-- (id <DOMAttr>)setAttributeNodeNS:(id <DOMAttr>)newAttr error:(NSError **)error;
-- (id <DOMNodeList>)getElementsByTagNameNS:(NSString *)namespaceURI :(NSString *)localName;
+- (DOMAttr *)getAttributeNodeNS:(NSString *)namespaceURI :(NSString *)localName;
+- (DOMAttr *)setAttributeNodeNS:(DOMAttr *)newAttr error:(NSError **)error;
+- (DOMNodeList *)getElementsByTagNameNS:(NSString *)namespaceURI :(NSString *)localName;
 - (BOOL)hasAttribute:(NSString *)name;
 - (BOOL)hasAttributeNS:(NSString *)namespaceURI :(NSString *)localName;
-// begin deprecated methods
-- (void)setAttribute:(NSString *)name :(NSString *)value;
-- (void)removeAttribute:(NSString *)name;
-- (id<DOMAttr>)setAttributeNode:(id<DOMAttr>)newAttr;
-- (id<DOMAttr>)removeAttributeNode:(id<DOMAttr>)oldAttr;
-- (void)setAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName :(NSString *)value;
-- (void)removeAttributeNS:(NSString *)namespaceURI :(NSString *)localName;
-- (id<DOMAttr>)setAttributeNodeNS:(id<DOMAttr>)newAttr;
-// end deprecated methods
 @end
 
 
- at protocol DOMText <DOMCharacterData>
-- (id <DOMText>)splitText:(unsigned long)offset error:(NSError **)error;
-// begin deprecated methods
-- (id<DOMText>)splitText:(unsigned long)offset;
-// end deprecated methods
+ at interface DOMText : DOMCharacterData
+- (DOMText *)splitText:(unsigned long)offset error:(NSError **)error;
 @end
 
 
- at protocol DOMComment <DOMCharacterData>
+ at interface DOMComment : DOMCharacterData
 @end
 
 
- at protocol DOMCDATASection <DOMText>
+ at interface DOMCDATASection : DOMText
 @end
 
 
- at protocol DOMDocumentType <DOMNode>
+ at interface DOMDocumentType : DOMNode
 - (NSString *)name;
-- (id <DOMNamedNodeMap>)entities;
-- (id <DOMNamedNodeMap>)notations;
+- (DOMNamedNodeMap *)entities;
+- (DOMNamedNodeMap *)notations;
 - (NSString *)publicId;
 - (NSString *)systemId;
 - (NSString *)internalSubset;
 @end
 
 
- at protocol DOMNotation <DOMNode>
+ at interface DOMNotation : DOMNode
 - (NSString *)publicId;
 - (NSString *)systemId;
 @end
 
 
- at protocol DOMEntity <DOMNode>
+ at interface DOMEntity : DOMNode
 - (NSString *)publicId;
 - (NSString *)systemId;
 - (NSString *)notationName;
 @end
 
 
- at protocol DOMEntityReference <DOMNode>
+ at interface DOMEntityReference : DOMNode
 @end
 
 
- at protocol DOMProcessingInstruction <DOMNode>
+ at interface DOMProcessingInstruction : DOMNode
 - (NSString *)target;
 - (NSString *)data;
 - (void)setData:(NSString *)data error:(NSError **)error;
-// begin deprecated methods
-- (void)setData:(NSString *)data;
-// end deprecated methods
 @end
 
 
 enum DOMCompareHow
 {
-    START_TO_START = 0,
-    START_TO_END   = 1,
-    END_TO_END     = 2,
-    END_TO_START   = 3,
+    DOMCompareStartToStart = 0,
+    DOMCompareStartToEnd   = 1,
+    DOMCompareEndToEnd     = 2,
+    DOMCompareEndToStart   = 3,
 };
 
- at protocol DOMRange <NSObject>
-- (id <DOMNode>)startContainer:(NSError **)error;
+ at interface DOMRange : NSObject
+- (DOMNode *)startContainer:(NSError **)error;
 - (long)startOffset:(NSError **)error;
-- (id <DOMNode>)endContainer:(NSError **)error;
+- (DOMNode *)endContainer:(NSError **)error;
 - (long)endOffset:(NSError **)error;
 - (BOOL)collapsed:(NSError **)error;
-- (id <DOMNode>)commonAncestorContainer:(NSError **)error;
-- (void)setStart:(id <DOMNode>)refNode :(long)offset error:(NSError **)error;
-- (void)setEnd:(id <DOMNode>)refNode :(long)offset error:(NSError **)error;
-- (void)setStartBefore:(id <DOMNode>)refNode error:(NSError **)error;
-- (void)setStartAfter:(id <DOMNode>)refNode error:(NSError **)error;
-- (void)setEndBefore:(id <DOMNode>)refNode error:(NSError **)error;
-- (void)setEndAfter:(id <DOMNode>)refNode error:(NSError **)error;
+- (DOMNode *)commonAncestorContainer:(NSError **)error;
+- (void)setStart:(DOMNode *)refNode :(long)offset error:(NSError **)error;
+- (void)setEnd:(DOMNode *)refNode :(long)offset error:(NSError **)error;
+- (void)setStartBefore:(DOMNode *)refNode error:(NSError **)error;
+- (void)setStartAfter:(DOMNode *)refNode error:(NSError **)error;
+- (void)setEndBefore:(DOMNode *)refNode error:(NSError **)error;
+- (void)setEndAfter:(DOMNode *)refNode error:(NSError **)error;
 - (void)collapse:(BOOL)toStart error:(NSError **)error;
-- (void)selectNode:(id <DOMNode>)refNode error:(NSError **)error;
-- (void)selectNodeContents:(id <DOMNode>)refNode error:(NSError **)error;
-- (short)compareBoundaryPoints:(unsigned short)how :(id <DOMRange>)sourceRange error:(NSError **)error;
+- (void)selectNode:(DOMNode *)refNode error:(NSError **)error;
+- (void)selectNodeContents:(DOMNode *)refNode error:(NSError **)error;
+- (short)compareBoundaryPoints:(unsigned short)how :(DOMRange *)sourceRange error:(NSError **)error;
 - (void)deleteContents:(NSError **)error;
-- (id <DOMDocumentFragment>)extractContents:(NSError **)error;
-- (id <DOMDocumentFragment>)cloneContents:(NSError **)error;
-- (void)insertNode:(id <DOMNode>)newNode error:(NSError **)error;
-- (void)surroundContents:(id <DOMNode>)newParent error:(NSError **)error;
-- (id <DOMRange>)cloneRange:(NSError **)error;
+- (DOMDocumentFragment *)extractContents:(NSError **)error;
+- (DOMDocumentFragment *)cloneContents:(NSError **)error;
+- (void)insertNode:(DOMNode *)newNode error:(NSError **)error;
+- (void)surroundContents:(DOMNode *)newParent error:(NSError **)error;
+- (DOMRange *)cloneRange:(NSError **)error;
 - (NSString *)toString:(NSError **)error;
 - (void)detach:(NSError **)error;
 @end
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index fe1cd21..2ec1207 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -551,7 +551,7 @@
     [[self dataSource] _setIconURL:URL withType:type];
 }
 
-- (void)loadURL:(NSURL *)URL referrer:(NSString *)referrer reload:(BOOL)reload onLoadEvent:(BOOL)onLoad target:(NSString *)target triggeringEvent:(NSEvent *)event form:(NSObject <DOMElement> *)form formValues:(NSDictionary *)values
+- (void)loadURL:(NSURL *)URL referrer:(NSString *)referrer reload:(BOOL)reload onLoadEvent:(BOOL)onLoad target:(NSString *)target triggeringEvent:(NSEvent *)event form:(DOMElement *)form formValues:(NSDictionary *)values
 {
     if ([target length] == 0) {
 	target = nil;
@@ -573,7 +573,7 @@
     }
 }
 
-- (void)postWithURL:(NSURL *)URL referrer:(NSString *)referrer target:(NSString *)target data:(NSData *)data contentType:(NSString *)contentType triggeringEvent:(NSEvent *)event form:(NSObject <DOMElement> *)form formValues:(NSDictionary *)values
+- (void)postWithURL:(NSURL *)URL referrer:(NSString *)referrer target:(NSString *)target data:(NSData *)data contentType:(NSString *)contentType triggeringEvent:(NSEvent *)event form:(DOMElement *)form formValues:(NSDictionary *)values
 {
     if ([target length] == 0) {
 	target = nil;
diff --git a/WebKit/WebView.subproj/WebFormDelegate.h b/WebKit/WebView.subproj/WebFormDelegate.h
index 2d052ea..3b56ae6 100644
--- a/WebKit/WebView.subproj/WebFormDelegate.h
+++ b/WebKit/WebView.subproj/WebFormDelegate.h
@@ -7,9 +7,8 @@
 
 #import <AppKit/AppKit.h>
 
+ at class DOMElement;
 @class WebFrame;
- at protocol DOMElement;
-
 
 /*!
     @protocol  WebFormSubmissionListener
@@ -43,7 +42,7 @@
 
 // Sent when a form is just about to be submitted (before the load is started)
 // listener must be sent continue when the delegate is done.
-- (void)frame:(WebFrame *)frame sourceFrame:(WebFrame *)sourceFrame willSubmitForm:(id <DOMElement>)form withValues:(NSDictionary *)values submissionListener:(id <WebFormSubmissionListener>)listener;
+- (void)frame:(WebFrame *)frame sourceFrame:(WebFrame *)sourceFrame willSubmitForm:(DOMElement *)form withValues:(NSDictionary *)values submissionListener:(id <WebFormSubmissionListener>)listener;
 @end
 
 /*!
diff --git a/WebKit/WebView.subproj/WebFormDelegate.m b/WebKit/WebView.subproj/WebFormDelegate.m
index 6690e45..8486580 100644
--- a/WebKit/WebView.subproj/WebFormDelegate.m
+++ b/WebKit/WebView.subproj/WebFormDelegate.m
@@ -57,7 +57,7 @@ static WebFormDelegate *sharedDelegate = nil;
     return NO;
 }
 
-- (void)frame:(WebFrame *)frame sourceFrame:(WebFrame *)sourceFrame willSubmitForm:(id <DOMElement>)form withValues:(NSDictionary *)values submissionListener:(id <WebFormSubmissionListener>)listener
+- (void)frame:(WebFrame *)frame sourceFrame:(WebFrame *)sourceFrame willSubmitForm:(DOMElement *)form withValues:(NSDictionary *)values submissionListener:(id <WebFormSubmissionListener>)listener
 {
     [listener continue];
 }
diff --git a/WebKit/WebView.subproj/WebFrame.m b/WebKit/WebView.subproj/WebFrame.m
index 3516cda..98e5d7b 100644
--- a/WebKit/WebView.subproj/WebFrame.m
+++ b/WebKit/WebView.subproj/WebFrame.m
@@ -7,6 +7,7 @@
 
 #import <Cocoa/Cocoa.h>
 
+#import <WebKit/DOM.h>
 #import <WebKit/WebBackForwardList.h>
 #import <WebKit/WebBridge.h>
 #import <WebKit/WebDataProtocol.h>
@@ -111,12 +112,12 @@ NSString *WebPageCacheDocumentViewKey = @"WebPageCacheDocumentViewKey";
 // layers while doing a load.
 @interface WebFormState : NSObject
 {
-    NSObject <DOMElement> *_form;
+    DOMElement *_form;
     NSDictionary *_values;
     WebFrame *_sourceFrame;
 }
-- (id)initWithForm:(NSObject <DOMElement> *)form values:(NSDictionary *)values sourceFrame:(WebFrame *)sourceFrame;
-- (id <DOMElement>)form;
+- (id)initWithForm:(DOMElement *)form values:(NSDictionary *)values sourceFrame:(WebFrame *)sourceFrame;
+- (DOMElement *)form;
 - (NSDictionary *)values;
 - (WebFrame *)sourceFrame;
 @end
@@ -1734,7 +1735,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
 
 
 // main funnel for navigating via callback from WebCore (e.g., clicking a link, redirect)
-- (void)_loadURL:(NSURL *)URL referrer:(NSString *)referrer loadType:(WebFrameLoadType)loadType target:(NSString *)target triggeringEvent:(NSEvent *)event form:(NSObject <DOMElement> *)form formValues:(NSDictionary *)values
+- (void)_loadURL:(NSURL *)URL referrer:(NSString *)referrer loadType:(WebFrameLoadType)loadType target:(NSString *)target triggeringEvent:(NSEvent *)event form:(DOMElement *)form formValues:(NSDictionary *)values
 {
     BOOL isFormSubmission = (values != nil);
 
@@ -1871,7 +1872,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     [childFrame _loadURL:URL referrer:[[self _bridge] referrer] loadType:childLoadType target:nil triggeringEvent:nil form:nil formValues:nil];
 }
 
-- (void)_postWithURL:(NSURL *)URL referrer:(NSString *)referrer target:(NSString *)target data:(NSData *)data contentType:(NSString *)contentType triggeringEvent:(NSEvent *)event form:(NSObject <DOMElement> *)form formValues:(NSDictionary *)values
+- (void)_postWithURL:(NSURL *)URL referrer:(NSString *)referrer target:(NSString *)target data:(NSData *)data contentType:(NSString *)contentType triggeringEvent:(NSEvent *)event form:(DOMElement *)form formValues:(NSDictionary *)values
 {
     // When posting, use the NSURLRequestReloadIgnoringCacheData load flag.
     // This prevents a potential bug which may cause a page with a form that uses itself
@@ -2401,7 +2402,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
 
 @implementation WebFormState : NSObject
 
-- (id)initWithForm:(NSObject <DOMElement> *)form values:(NSDictionary *)values sourceFrame:(WebFrame *)sourceFrame
+- (id)initWithForm:(DOMElement *)form values:(NSDictionary *)values sourceFrame:(WebFrame *)sourceFrame
 {
     [super init];
     _form = [form retain];
@@ -2418,7 +2419,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     [super dealloc];
 }
 
-- (id <DOMElement>)form
+- (DOMElement *)form
 {
     return _form;
 }
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index d8e64b4..7b6c685 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -9,18 +9,17 @@
 #import <WebKit/WebFrame.h>
 #import <WebKit/WebPolicyDelegatePrivate.h>
 
+ at class DOMElement;
+ at class NSMutableURLRequest;
+ at class NSURLRequest;
 @class WebBridge;
 @class WebFormState;
 @class WebFrameBridge;
 @class WebFrameView;
 @class WebHistoryItem;
- at class NSURLRequest;
- at class NSMutableURLRequest;
 @class WebPolicyDecisionListener;
 @class WebView;
 
- at protocol DOMElement;
-
 typedef enum {
     WebFrameStateProvisional,
     
@@ -149,9 +148,9 @@ extern NSString *WebPageCacheDocumentViewKey;
 - (void)_invalidatePendingPolicyDecisionCallingDefaultAction:(BOOL)call;
 
 - (void)_goToItem:(WebHistoryItem *)item withLoadType:(WebFrameLoadType)type;
-- (void)_loadURL:(NSURL *)URL referrer:(NSString *)referrer loadType:(WebFrameLoadType)loadType target:(NSString *)target triggeringEvent:(NSEvent *)event form:(NSObject <DOMElement> *)form formValues:(NSDictionary *)values;
+- (void)_loadURL:(NSURL *)URL referrer:(NSString *)referrer loadType:(WebFrameLoadType)loadType target:(NSString *)target triggeringEvent:(NSEvent *)event form:(DOMElement *)form formValues:(NSDictionary *)values;
 - (void)_loadURL:(NSURL *)URL intoChild:(WebFrame *)childFrame;
-- (void)_postWithURL:(NSURL *)URL referrer:(NSString *)referrer target:(NSString *)target data:(NSData *)data contentType:(NSString *)contentType triggeringEvent:(NSEvent *)event form:(NSObject <DOMElement> *)form formValues:(NSDictionary *)values;
+- (void)_postWithURL:(NSURL *)URL referrer:(NSString *)referrer target:(NSString *)target data:(NSData *)data contentType:(NSString *)contentType triggeringEvent:(NSEvent *)event form:(DOMElement *)form formValues:(NSDictionary *)values;
 
 - (void)_loadRequest:(NSURLRequest *)request inFrameNamed:(NSString *)frameName;
 
diff --git a/WebKit/WebView.subproj/WebHTMLRepresentation.h b/WebKit/WebView.subproj/WebHTMLRepresentation.h
index a98a330..28b33fe 100644
--- a/WebKit/WebView.subproj/WebHTMLRepresentation.h
+++ b/WebKit/WebView.subproj/WebHTMLRepresentation.h
@@ -8,11 +8,12 @@
 @class WebHTMLRepresentationPrivate;
 @class NSView;
 
+ at class DOMDocument;
+ at class DOMNode;
+ at class DOMElement;
+
 @protocol WebDocumentRepresentation;
 @protocol WebDocumentSourceRepresentation;
- at protocol DOMDocument;
- at protocol DOMNode;
- at protocol DOMElement;
 
 /*!
     @class WebHTMLRepresentation
@@ -26,7 +27,7 @@
     @method DOMDocument
     @abstract return the DOM document for this data source.
 */
-- (id<DOMDocument>)DOMDocument;
+- (DOMDocument *)DOMDocument;
 
 /*!
     @method setSelectionFrom:startOffset:to:endOffset
@@ -36,7 +37,7 @@
     @param end The node that includes the ending selection point.
     @param endOffset The character offset into the text of the ending node.
 */
-- (void)setSelectionFrom:(id<DOMNode>)start startOffset:(int)startOffset to:(id<DOMNode>)end endOffset:(int)endOffset;
+- (void)setSelectionFrom:(DOMNode *)start startOffset:(int)startOffset to:(DOMNode *)end endOffset:(int)endOffset;
 
 //- (NSAttributedString *)selectedAttributedString;
 
@@ -47,17 +48,17 @@
 - (NSString *)reconstructedDocumentSource;
 
 
-- (NSAttributedString *)attributedStringFrom:(id<DOMNode>)startNode startOffset:(int)startOffset to:(id<DOMNode>)endNode endOffset:(int)endOffset;
+- (NSAttributedString *)attributedStringFrom:(DOMNode *)startNode startOffset:(int)startOffset to:(DOMNode *)endNode endOffset:(int)endOffset;
 
-- (id <DOMElement>)elementWithName:(NSString *)name inForm:(id <DOMElement>)form;
-- (id <DOMElement>)elementForView:(NSView *)view;
-- (BOOL)elementDoesAutoComplete:(id <DOMElement>)element;
-- (BOOL)elementIsPassword:(id <DOMElement>)element;
-- (id <DOMElement>)formForElement:(id <DOMElement>)element;
-- (id <DOMElement>)currentForm;
-- (NSArray *)controlsInForm:(id <DOMElement>)form;
-- (NSString *)searchForLabels:(NSArray *)labels beforeElement:(id <DOMElement>)element;
-- (NSString *)matchLabels:(NSArray *)labels againstElement:(id <DOMElement>)element;
+- (DOMElement *)elementWithName:(NSString *)name inForm:(DOMElement *)form;
+- (DOMElement *)elementForView:(NSView *)view;
+- (BOOL)elementDoesAutoComplete:(DOMElement *)element;
+- (BOOL)elementIsPassword:(DOMElement *)element;
+- (DOMElement *)formForElement:(DOMElement *)element;
+- (DOMElement *)currentForm;
+- (NSArray *)controlsInForm:(DOMElement *)form;
+- (NSString *)searchForLabels:(NSArray *)labels beforeElement:(DOMElement *)element;
+- (NSString *)matchLabels:(NSArray *)labels againstElement:(DOMElement *)element;
 
 - (NSString *)HTMLString;
 
diff --git a/WebKit/WebView.subproj/WebHTMLRepresentation.m b/WebKit/WebView.subproj/WebHTMLRepresentation.m
index e3a6bf5..d64e9b6 100644
--- a/WebKit/WebView.subproj/WebHTMLRepresentation.m
+++ b/WebKit/WebView.subproj/WebHTMLRepresentation.m
@@ -91,12 +91,12 @@
     return [_private->dataSource _title];
 }
 
-- (id<DOMDocument>)DOMDocument
+- (DOMDocument *)DOMDocument
 {
     return [_private->bridge DOMDocument];
 }
 
-- (void)setSelectionFrom:(id<DOMNode>)start startOffset:(int)startOffset to:(id<DOMNode>)end endOffset:(int) endOffset
+- (void)setSelectionFrom:(DOMNode *)start startOffset:(int)startOffset to:(DOMNode *)end endOffset:(int) endOffset
 {
 }
 
@@ -112,52 +112,52 @@
     return nil;
 }
 
-- (NSAttributedString *)attributedStringFrom: (id<DOMNode>)startNode startOffset: (int)startOffset to: (id<DOMNode>)endNode endOffset: (int)endOffset
+- (NSAttributedString *)attributedStringFrom: (DOMNode *)startNode startOffset: (int)startOffset to: (DOMNode *)endNode endOffset: (int)endOffset
 {
     return [_private->bridge attributedStringFrom: startNode startOffset: startOffset to: endNode endOffset: endOffset];
 }
 
-- (id <DOMElement>)elementWithName:(NSString *)name inForm:(id <DOMElement>)form
+- (DOMElement *)elementWithName:(NSString *)name inForm:(DOMElement *)form
 {
     return [_private->bridge elementWithName:name inForm:form];
 }
 
-- (id <DOMElement>)elementForView:(NSView *)view
+- (DOMElement *)elementForView:(NSView *)view
 {
     return [_private->bridge elementForView:view];
 }
 
-- (BOOL)elementDoesAutoComplete:(id <DOMElement>)element
+- (BOOL)elementDoesAutoComplete:(DOMElement *)element
 {
     return [_private->bridge elementDoesAutoComplete:element];
 }
 
-- (BOOL)elementIsPassword:(id <DOMElement>)element
+- (BOOL)elementIsPassword:(DOMElement *)element
 {
     return [_private->bridge elementIsPassword:element];
 }
 
-- (id <DOMElement>)formForElement:(id <DOMElement>)element
+- (DOMElement *)formForElement:(DOMElement *)element
 {
     return [_private->bridge formForElement:element];
 }
 
-- (id <DOMElement>)currentForm;
+- (DOMElement *)currentForm;
 {
     return [_private->bridge currentForm];
 }
 
-- (NSArray *)controlsInForm:(id <DOMElement>)form
+- (NSArray *)controlsInForm:(DOMElement *)form
 {
     return [_private->bridge controlsInForm:form];
 }
 
-- (NSString *)searchForLabels:(NSArray *)labels beforeElement:(id <DOMElement>)element
+- (NSString *)searchForLabels:(NSArray *)labels beforeElement:(DOMElement *)element
 {
     return [_private->bridge searchForLabels:labels beforeElement:element];
 }
 
-- (NSString *)matchLabels:(NSArray *)labels againstElement:(id <DOMElement>)element
+- (NSString *)matchLabels:(NSArray *)labels againstElement:(DOMElement *)element
 {
     return [_private->bridge matchLabels:labels againstElement:element];
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list