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

cblu cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:34:36 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 6cf4a1ff606658f6dbaaafa61e73894cff702368
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Apr 16 19:51:34 2004 +0000

    WebCore:
    
    	Added DOMHTMLEmbedElement as a DOM extension since EMBED is represented in our DOM even though its not part of the spec.
    	Added all DOMCore and DOMHTML symbols to WebCore's symbols file.
    	Removed isSubresourceURLAttribute from dom node. This was only used for the WebArchive feature and all that work is now done in WebKit.
    
            Reviewed by kocienda.
    
            * WebCore-combined.exp:
            * WebCore.exp:
            * khtml/html/html_baseimpl.cpp:
            (HTMLBodyElementImpl::isURLAttribute): renamed from isSubresourceURLAttribute. As a convenience to subclasses, dom_elementimpl would call isSubresourceURLAttribute in isURLAttribute, but this is no longer done
            (HTMLFrameElementImpl::isURLAttribute): ditto
            (HTMLIFrameElementImpl::isURLAttribute): ditto
            * khtml/html/html_baseimpl.h:
            * khtml/html/html_formimpl.cpp:
            (HTMLInputElementImpl::isURLAttribute): ditto
            * khtml/html/html_formimpl.h:
            * khtml/html/html_headimpl.cpp:
            (HTMLScriptElementImpl::isURLAttribute): ditto
            * khtml/html/html_headimpl.h:
            * khtml/html/html_imageimpl.cpp:
            (HTMLImageElementImpl::isURLAttribute): ditto
            * khtml/html/html_imageimpl.h:
            * khtml/html/html_objectimpl.cpp:
            (HTMLEmbedElementImpl::isURLAttribute): ditto
            (HTMLObjectElementImpl::isURLAttribute): ditto
            (HTMLParamElementImpl::isURLAttribute): ditto
            * khtml/html/html_objectimpl.h:
            * khtml/html/html_tableimpl.cpp:
            (HTMLTableElementImpl::isURLAttribute): ditto
            (HTMLTableCellElementImpl::isURLAttribute): ditto
            * khtml/html/html_tableimpl.h:
            * khtml/xml/dom2_rangeimpl.cpp:
            (RangeImpl::toHTMLWithOptions): take a node list (see below)
            * khtml/xml/dom2_rangeimpl.h:
            * khtml/xml/dom_elementimpl.cpp:
            (ElementImpl::isURLAttribute):
            * khtml/xml/dom_elementimpl.h:
            * khtml/xml/dom_nodeimpl.cpp:
            (NodeImpl::recursive_toHTMLWithOptions): append copied nodes to a list of nodes so that WebKit can operate on them
            * khtml/xml/dom_nodeimpl.h:
            * kwq/DOM.mm:
            (+[DOMNode _nodeWithImpl:]): added support for HTML types
            * kwq/DOMExtensions.h:
            * kwq/DOMHTML.mm:
            (-[DOMHTMLPreElement setWidth:]):
            (-[DOMHTMLEmbedElement _embedElementImpl]):
            (-[DOMHTMLEmbedElement align]):
            (-[DOMHTMLEmbedElement setAlign:]):
            (-[DOMHTMLEmbedElement height]):
            (-[DOMHTMLEmbedElement setHeight:]):
            (-[DOMHTMLEmbedElement name]):
            (-[DOMHTMLEmbedElement setName:]):
            (-[DOMHTMLEmbedElement src]):
            (-[DOMHTMLEmbedElement setSrc:]):
            (-[DOMHTMLEmbedElement type]):
            (-[DOMHTMLEmbedElement setType:]):
            (-[DOMHTMLEmbedElement width]):
            (-[DOMHTMLEmbedElement setWidth:]):
            (-[DOMHTMLTableElement background]):
            (-[DOMHTMLTableElement setBackground:]):
            (-[DOMHTMLTableCellElement background]): new extension
            (-[DOMHTMLTableCellElement setBackground:]): ditto
            * kwq/WebCoreBridge.h:
            * kwq/WebCoreBridge.mm:
            (-[WebCoreBridge nodesFromList:]): new
            (-[WebCoreBridge markupStringFromNode:nodes:]): return a list of nodes instead of subresource URLs so WebKit can operate on the nodes
            (-[WebCoreBridge markupStringFromRange:nodes:]): ditto
    
    WebKit:
    
    	Fixed: <rdar://problem/3587599>: Mail Page, Web Archives don't preserve subframes
    	Moved code that assembled subresource URLs from DOM nodes from WebCore to WebKit.
    
            Reviewed by rjw.
    
            * DOM.subproj/DOMExtensions.h: copied from WebCore
            * DOM.subproj/WebDOMOperations.h:
            * DOM.subproj/WebDOMOperations.m:
            (-[DOMNode webArchive]): call renamed methods
            (-[DOMNode markupString]): ditto
            (-[DOMNode _URLsFromSelectors:]): new, returns array of URLs given selectors
            (-[DOMNode _subresourceURLs]): new, base class does nothing, subclasses call _URLsFromSelectors with URL selectors
            (-[DOMDocument webFrame]): new
            (-[DOMRange webArchive]): call renamed methods
            (-[DOMRange markupString]): ditto
            (-[DOMHTMLBodyElement _subresourceURLs]): new
            (-[DOMHTMLInputElement _subresourceURLs]): new
            (-[DOMHTMLLinkElement _subresourceURLs]): new
            (-[DOMHTMLScriptElement _subresourceURLs]): new
            (-[DOMHTMLImageElement _subresourceURLs]): new
            (-[DOMHTMLEmbedElement _subresourceURLs]): new
            (-[DOMHTMLObjectElement _subresourceURLs]): new
            (-[DOMHTMLParamElement _subresourceURLs]): new
            (-[DOMHTMLTableElement _subresourceURLs]): new
            (-[DOMHTMLTableCellElement _subresourceURLs]): new
            * WebKit.pbproj/project.pbxproj:
            * WebView.subproj/WebArchive.h:
            * WebView.subproj/WebArchive.m:
            (-[WebArchivePrivate dealloc]): release new subframeArchives ivar
            (-[WebArchive initWithMainResource:subresources:subframeArchives:]): take subframeArchives
            (-[WebArchive _initWithPropertyList:]): new, recursively creates WebArchives
            (-[WebArchive initWithData:]): call _initWithPropertyList
            (-[WebArchive subframeArchives]): new
            (-[WebArchive _propertyListRepresentation]): new, recursively creates property lists of WebArchives
            (-[WebArchive data]): call _propertyListRepresentation
            * WebView.subproj/WebBaseResourceHandleDelegate.m:
            (-[WebBaseResourceHandleDelegate saveResource]): call renamed methods
            * WebView.subproj/WebDataSource.m:
            (-[WebDataSourcePrivate dealloc]): release new pendingSubframeArchives ivar
            (-[WebDataSource _archiveWithMarkupString:nodes:]): renamed and reimplemented, handles subframes
            (-[WebDataSource _archive]): new
            (-[WebDataSource _setPendingSubframeArchives:]): new
            (-[WebDataSource _archiveForFrameName:]): new
            * WebView.subproj/WebDataSourcePrivate.h:
            * WebView.subproj/WebFrame.m:
            (-[WebFrame loadArchive:]): handle subframes
            (-[WebFrame _loadRequest:subresources:subframeArchives:]): ditto
            (-[WebFrame _loadURL:intoChild:]): use the subframe archive if we have it
            (-[WebFrame loadRequest:]): call renamed methods
            * WebView.subproj/WebFramePrivate.h:
            * WebView.subproj/WebHTMLRepresentation.m:
            (-[WebHTMLRepresentation loadWebArchive]): call renamed methods and handle subframes
            * WebView.subproj/WebHTMLView.m:
            (-[WebHTMLView _selectedArchive:]): call renamed methods
            (-[WebHTMLView _pasteFromPasteboard:]): call renamed methods
            * WebView.subproj/WebHTMLViewPrivate.h:
            * WebView.subproj/WebImageRepresentation.h:
            * WebView.subproj/WebImageRepresentation.m: instead of storing some items from the data source, just store the data source
            (-[WebImageRepresentation dealloc]): removed use of deleted ivars
            (-[WebImageRepresentation URL]): use dataSource instead of ivar
            (-[WebImageRepresentation doneLoading]): use new boolean ivar
            (-[WebImageRepresentation setDataSource:]): store the data source
            (-[WebImageRepresentation receivedData:withDataSource:]): use dataSource instead of ivar
            (-[WebImageRepresentation receivedError:withDataSource:]): ditto
            (-[WebImageRepresentation finishedLoadingWithDataSource:]): ditto
            (-[WebImageRepresentation title]): ditto
            (-[WebImageRepresentation data]): ditto
            (-[WebImageRepresentation filename]): ditto
            (-[WebImageRepresentation archive]): ditto
            * WebView.subproj/WebResource.h:
            * WebView.subproj/WebResource.m:
            (-[WebResourcePrivate dealloc]): release new frame name ivar
            (-[WebResource initWithData:URL:MIMEType:textEncodingName:frameName:]): take a frame name
            (-[WebResource frameName]): new
            (-[WebResource _initWithPropertyList:]): handle frame name
            (-[WebResource _initWithCachedResponse:originalURL:]): call renamed methods
            (-[WebResource _propertyListRepresentation]):
            * WebView.subproj/WebResourcePrivate.h: handle frame name
    
    WebBrowser:
    
            Reviewed by rjw.
    
            * BrowserDocument.m:
            (-[BrowserDocument mailPageAddress:]): call renamed methods
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6400 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index efdc34f..35fff6d 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,73 @@
+2004-04-16  Chris Blumenberg  <cblu at apple.com>
+
+	Added DOMHTMLEmbedElement as a DOM extension since EMBED is represented in our DOM even though its not part of the spec.
+	Added all DOMCore and DOMHTML symbols to WebCore's symbols file.
+	Removed isSubresourceURLAttribute from dom node. This was only used for the WebArchive feature and all that work is now done in WebKit.
+
+        Reviewed by kocienda.
+
+        * WebCore-combined.exp:
+        * WebCore.exp:
+        * khtml/html/html_baseimpl.cpp:
+        (HTMLBodyElementImpl::isURLAttribute): renamed from isSubresourceURLAttribute. As a convenience to subclasses, dom_elementimpl would call isSubresourceURLAttribute in isURLAttribute, but this is no longer done
+        (HTMLFrameElementImpl::isURLAttribute): ditto
+        (HTMLIFrameElementImpl::isURLAttribute): ditto
+        * khtml/html/html_baseimpl.h:
+        * khtml/html/html_formimpl.cpp:
+        (HTMLInputElementImpl::isURLAttribute): ditto
+        * khtml/html/html_formimpl.h:
+        * khtml/html/html_headimpl.cpp:
+        (HTMLScriptElementImpl::isURLAttribute): ditto
+        * khtml/html/html_headimpl.h:
+        * khtml/html/html_imageimpl.cpp: 
+        (HTMLImageElementImpl::isURLAttribute): ditto
+        * khtml/html/html_imageimpl.h:
+        * khtml/html/html_objectimpl.cpp:
+        (HTMLEmbedElementImpl::isURLAttribute): ditto
+        (HTMLObjectElementImpl::isURLAttribute): ditto
+        (HTMLParamElementImpl::isURLAttribute): ditto
+        * khtml/html/html_objectimpl.h:
+        * khtml/html/html_tableimpl.cpp:
+        (HTMLTableElementImpl::isURLAttribute): ditto
+        (HTMLTableCellElementImpl::isURLAttribute): ditto
+        * khtml/html/html_tableimpl.h:
+        * khtml/xml/dom2_rangeimpl.cpp:
+        (RangeImpl::toHTMLWithOptions): take a node list (see below)
+        * khtml/xml/dom2_rangeimpl.h:
+        * khtml/xml/dom_elementimpl.cpp:
+        (ElementImpl::isURLAttribute):
+        * khtml/xml/dom_elementimpl.h:
+        * khtml/xml/dom_nodeimpl.cpp:
+        (NodeImpl::recursive_toHTMLWithOptions): append copied nodes to a list of nodes so that WebKit can operate on them
+        * khtml/xml/dom_nodeimpl.h:
+        * kwq/DOM.mm:
+        (+[DOMNode _nodeWithImpl:]): added support for HTML types
+        * kwq/DOMExtensions.h:
+        * kwq/DOMHTML.mm:
+        (-[DOMHTMLPreElement setWidth:]):
+        (-[DOMHTMLEmbedElement _embedElementImpl]):
+        (-[DOMHTMLEmbedElement align]):
+        (-[DOMHTMLEmbedElement setAlign:]):
+        (-[DOMHTMLEmbedElement height]):
+        (-[DOMHTMLEmbedElement setHeight:]):
+        (-[DOMHTMLEmbedElement name]):
+        (-[DOMHTMLEmbedElement setName:]):
+        (-[DOMHTMLEmbedElement src]):
+        (-[DOMHTMLEmbedElement setSrc:]):
+        (-[DOMHTMLEmbedElement type]):
+        (-[DOMHTMLEmbedElement setType:]):
+        (-[DOMHTMLEmbedElement width]):
+        (-[DOMHTMLEmbedElement setWidth:]):
+        (-[DOMHTMLTableElement background]):
+        (-[DOMHTMLTableElement setBackground:]):
+        (-[DOMHTMLTableCellElement background]): new extension 
+        (-[DOMHTMLTableCellElement setBackground:]): ditto
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge nodesFromList:]): new
+        (-[WebCoreBridge markupStringFromNode:nodes:]): return a list of nodes instead of subresource URLs so WebKit can operate on the nodes
+        (-[WebCoreBridge markupStringFromRange:nodes:]): ditto
+
 2004-04-15  David Hyatt  <hyatt at apple.com>
 
 	Fix for 3624335, bugs with overflow and positioned objects.  The scrollbar didn't properly update
diff --git a/WebCore/WebCore-combined.exp b/WebCore/WebCore-combined.exp
index 63aa7af..918eaf2 100644
--- a/WebCore/WebCore-combined.exp
+++ b/WebCore/WebCore-combined.exp
@@ -1,9 +1,78 @@
+.objc_class_name_DOMImplementation
+.objc_class_name_DOMNode
+.objc_class_name_DOMNodeList
+.objc_class_name_DOMNamedNodeMap
+.objc_class_name_DOMCharacterData
+.objc_class_name_DOMAttr
+.objc_class_name_DOMElement
+.objc_class_name_DOMText
+.objc_class_name_DOMComment
+.objc_class_name_DOMCDATASection
+.objc_class_name_DOMDocumentType
+.objc_class_name_DOMNotation
+.objc_class_name_DOMEntity
+.objc_class_name_DOMEntityReference
+.objc_class_name_DOMProcessingInstruction
+.objc_class_name_DOMDocumentFragment
 .objc_class_name_DOMDocument
+.objc_class_name_DOMRange
+.objc_class_name_DOMHTMLCollection
+.objc_class_name_DOMHTMLDocument
+.objc_class_name_DOMHTMLElement
+.objc_class_name_DOMHTMLHtmlElement
+.objc_class_name_DOMHTMLHeadElement
+.objc_class_name_DOMHTMLTitleElement
+.objc_class_name_DOMHTMLMetaElement
+.objc_class_name_DOMHTMLBaseElement
+.objc_class_name_DOMHTMLIsIndexElement
+.objc_class_name_DOMHTMLStyleElement
+.objc_class_name_DOMHTMLFormElement
+.objc_class_name_DOMHTMLSelectElement
+.objc_class_name_DOMHTMLOptGroupElement
+.objc_class_name_DOMHTMLOptionElement
+.objc_class_name_DOMHTMLTextAreaElement
+.objc_class_name_DOMHTMLButtonElement
+.objc_class_name_DOMHTMLLabelElement
+.objc_class_name_DOMHTMLFieldSetElement
+.objc_class_name_DOMHTMLLegendElement
+.objc_class_name_DOMHTMLUListElement
+.objc_class_name_DOMHTMLOListElement
+.objc_class_name_DOMHTMLDListElement
+.objc_class_name_DOMHTMLDirectoryElement
+.objc_class_name_DOMHTMLMenuElement
+.objc_class_name_DOMHTMLLIElement
+.objc_class_name_DOMHTMLDivElement
+.objc_class_name_DOMHTMLParagraphElement
+.objc_class_name_DOMHTMLHeadingElement
+.objc_class_name_DOMHTMLQuoteElement
+.objc_class_name_DOMHTMLPreElement
+.objc_class_name_DOMHTMLBRElement
+.objc_class_name_DOMHTMLBaseFontElement
+.objc_class_name_DOMHTMLFontElement
+.objc_class_name_DOMHTMLHRElement
+.objc_class_name_DOMHTMLModElement
+.objc_class_name_DOMHTMLAnchorElement
+.objc_class_name_DOMHTMLAppletElement
+.objc_class_name_DOMHTMLMapElement
+.objc_class_name_DOMHTMLTableCaptionElement
+.objc_class_name_DOMHTMLTableColElement
+.objc_class_name_DOMHTMLTableSectionElement
+.objc_class_name_DOMHTMLTableRowElement
+.objc_class_name_DOMHTMLFrameSetElement
+.objc_class_name_DOMHTMLFrameElement
+.objc_class_name_DOMHTMLIFrameElement
+.objc_class_name_DOMHTMLBodyElement
+.objc_class_name_DOMHTMLEmbedElement
+.objc_class_name_DOMHTMLInputElement
+.objc_class_name_DOMHTMLLinkElement
+.objc_class_name_DOMHTMLObjectElement
+.objc_class_name_DOMHTMLParamElement
+.objc_class_name_DOMHTMLScriptElement
+.objc_class_name_DOMHTMLTableCellElement
+.objc_class_name_DOMHTMLTableElement
 .objc_class_name_DOMHTMLAnchorElement
 .objc_class_name_DOMHTMLAreaElement
 .objc_class_name_DOMHTMLImageElement
-.objc_class_name_DOMNode
-.objc_class_name_DOMRange
 .objc_class_name_WebCoreBridge
 .objc_class_name_WebCoreCache
 .objc_class_name_WebCoreCookieAdapter
diff --git a/WebCore/WebCore.exp b/WebCore/WebCore.exp
index b7bf47b..5bdd1d8 100644
--- a/WebCore/WebCore.exp
+++ b/WebCore/WebCore.exp
@@ -1,9 +1,78 @@
+.objc_class_name_DOMImplementation
+.objc_class_name_DOMNode
+.objc_class_name_DOMNodeList
+.objc_class_name_DOMNamedNodeMap
+.objc_class_name_DOMCharacterData
+.objc_class_name_DOMAttr
+.objc_class_name_DOMElement
+.objc_class_name_DOMText
+.objc_class_name_DOMComment
+.objc_class_name_DOMCDATASection
+.objc_class_name_DOMDocumentType
+.objc_class_name_DOMNotation
+.objc_class_name_DOMEntity
+.objc_class_name_DOMEntityReference
+.objc_class_name_DOMProcessingInstruction
+.objc_class_name_DOMDocumentFragment
 .objc_class_name_DOMDocument
+.objc_class_name_DOMRange
+.objc_class_name_DOMHTMLCollection
+.objc_class_name_DOMHTMLDocument
+.objc_class_name_DOMHTMLElement
+.objc_class_name_DOMHTMLHtmlElement
+.objc_class_name_DOMHTMLHeadElement
+.objc_class_name_DOMHTMLTitleElement
+.objc_class_name_DOMHTMLMetaElement
+.objc_class_name_DOMHTMLBaseElement
+.objc_class_name_DOMHTMLIsIndexElement
+.objc_class_name_DOMHTMLStyleElement
+.objc_class_name_DOMHTMLFormElement
+.objc_class_name_DOMHTMLSelectElement
+.objc_class_name_DOMHTMLOptGroupElement
+.objc_class_name_DOMHTMLOptionElement
+.objc_class_name_DOMHTMLTextAreaElement
+.objc_class_name_DOMHTMLButtonElement
+.objc_class_name_DOMHTMLLabelElement
+.objc_class_name_DOMHTMLFieldSetElement
+.objc_class_name_DOMHTMLLegendElement
+.objc_class_name_DOMHTMLUListElement
+.objc_class_name_DOMHTMLOListElement
+.objc_class_name_DOMHTMLDListElement
+.objc_class_name_DOMHTMLDirectoryElement
+.objc_class_name_DOMHTMLMenuElement
+.objc_class_name_DOMHTMLLIElement
+.objc_class_name_DOMHTMLDivElement
+.objc_class_name_DOMHTMLParagraphElement
+.objc_class_name_DOMHTMLHeadingElement
+.objc_class_name_DOMHTMLQuoteElement
+.objc_class_name_DOMHTMLPreElement
+.objc_class_name_DOMHTMLBRElement
+.objc_class_name_DOMHTMLBaseFontElement
+.objc_class_name_DOMHTMLFontElement
+.objc_class_name_DOMHTMLHRElement
+.objc_class_name_DOMHTMLModElement
+.objc_class_name_DOMHTMLAnchorElement
+.objc_class_name_DOMHTMLAppletElement
+.objc_class_name_DOMHTMLMapElement
+.objc_class_name_DOMHTMLTableCaptionElement
+.objc_class_name_DOMHTMLTableColElement
+.objc_class_name_DOMHTMLTableSectionElement
+.objc_class_name_DOMHTMLTableRowElement
+.objc_class_name_DOMHTMLFrameSetElement
+.objc_class_name_DOMHTMLFrameElement
+.objc_class_name_DOMHTMLIFrameElement
+.objc_class_name_DOMHTMLBodyElement
+.objc_class_name_DOMHTMLEmbedElement
+.objc_class_name_DOMHTMLInputElement
+.objc_class_name_DOMHTMLLinkElement
+.objc_class_name_DOMHTMLObjectElement
+.objc_class_name_DOMHTMLParamElement
+.objc_class_name_DOMHTMLScriptElement
+.objc_class_name_DOMHTMLTableCellElement
+.objc_class_name_DOMHTMLTableElement
 .objc_class_name_DOMHTMLAnchorElement
 .objc_class_name_DOMHTMLAreaElement
 .objc_class_name_DOMHTMLImageElement
-.objc_class_name_DOMNode
-.objc_class_name_DOMRange
 .objc_class_name_WebCoreBridge
 .objc_class_name_WebCoreCache
 .objc_class_name_WebCoreCookieAdapter
diff --git a/WebCore/khtml/html/html_baseimpl.cpp b/WebCore/khtml/html/html_baseimpl.cpp
index 295c314..8431083 100644
--- a/WebCore/khtml/html/html_baseimpl.cpp
+++ b/WebCore/khtml/html/html_baseimpl.cpp
@@ -211,7 +211,7 @@ void HTMLBodyElementImpl::insertedIntoDocument()
     }
 }
 
-bool HTMLBodyElementImpl::isSubresourceURLAttribute(AttributeImpl *attr) const
+bool HTMLBodyElementImpl::isURLAttribute(AttributeImpl *attr) const
 {
     return attr->id() == ATTR_BACKGROUND;
 }
@@ -498,7 +498,7 @@ DocumentImpl* HTMLFrameElementImpl::contentDocument() const
     return 0;
 }
 
-bool HTMLFrameElementImpl::isSubresourceURLAttribute(AttributeImpl *attr) const
+bool HTMLFrameElementImpl::isURLAttribute(AttributeImpl *attr) const
 {
     return attr->id() == ATTR_SRC;
 }
@@ -767,7 +767,7 @@ void HTMLIFrameElementImpl::openURL()
     setChanged();
 }
 
-bool HTMLIFrameElementImpl::isSubresourceURLAttribute(AttributeImpl *attr) const
+bool HTMLIFrameElementImpl::isURLAttribute(AttributeImpl *attr) const
 {
     return attr->id() == ATTR_SRC;
 }
diff --git a/WebCore/khtml/html/html_baseimpl.h b/WebCore/khtml/html/html_baseimpl.h
index 6a75738..2cc5d37 100644
--- a/WebCore/khtml/html/html_baseimpl.h
+++ b/WebCore/khtml/html/html_baseimpl.h
@@ -63,7 +63,7 @@ public:
 
     void createLinkDecl();
     
-    virtual bool isSubresourceURLAttribute(AttributeImpl *attr) const;
+    virtual bool isURLAttribute(AttributeImpl *attr) const;
 
 protected:
     CSSStyleDeclarationImpl* m_linkDecl;
@@ -97,7 +97,7 @@ public:
 
     DocumentImpl* contentDocument() const;
     
-    virtual bool isSubresourceURLAttribute(AttributeImpl *attr) const;
+    virtual bool isURLAttribute(AttributeImpl *attr) const;
 
 #if APPLE_CHANGES
     QScrollView::ScrollBarMode scrollingMode() const { return scrolling; }
@@ -210,7 +210,7 @@ public:
     virtual khtml::RenderObject *createRenderer(RenderArena *, khtml::RenderStyle *);
     virtual void recalcStyle( StyleChange ch );
     
-    virtual bool isSubresourceURLAttribute(AttributeImpl *attr) const;
+    virtual bool isURLAttribute(AttributeImpl *attr) const;
 
 protected:
     virtual void openURL();
diff --git a/WebCore/khtml/html/html_formimpl.cpp b/WebCore/khtml/html/html_formimpl.cpp
index 326dfca..992be1c 100644
--- a/WebCore/khtml/html/html_formimpl.cpp
+++ b/WebCore/khtml/html/html_formimpl.cpp
@@ -1934,7 +1934,7 @@ bool HTMLInputElementImpl::isEditable()
             (m_type == SEARCH) || (m_type == ISINDEX) || (m_type == FILE));
 }
 
-bool HTMLInputElementImpl::isSubresourceURLAttribute(AttributeImpl *attr) const
+bool HTMLInputElementImpl::isURLAttribute(AttributeImpl *attr) const
 {
     return (attr->id() == ATTR_SRC);
 }
diff --git a/WebCore/khtml/html/html_formimpl.h b/WebCore/khtml/html/html_formimpl.h
index c1af88a..87f2d17 100644
--- a/WebCore/khtml/html/html_formimpl.h
+++ b/WebCore/khtml/html/html_formimpl.h
@@ -342,7 +342,7 @@ public:
 
     DOMString altText() const;
     
-    virtual bool isSubresourceURLAttribute(AttributeImpl *attr) const;
+    virtual bool isURLAttribute(AttributeImpl *attr) const;
 
 #if APPLE_CHANGES
     long maxResults() const { return m_maxResults; }
diff --git a/WebCore/khtml/html/html_headimpl.cpp b/WebCore/khtml/html/html_headimpl.cpp
index 0d1b047..d9ea334 100644
--- a/WebCore/khtml/html/html_headimpl.cpp
+++ b/WebCore/khtml/html/html_headimpl.cpp
@@ -304,20 +304,6 @@ bool HTMLLinkElementImpl::isURLAttribute(AttributeImpl *attr) const
     return attr->id() == ATTR_HREF;
 }
 
-bool HTMLLinkElementImpl::isSubresourceURLAttribute(AttributeImpl *attr) const
-{
-    if (attr->id() == ATTR_HREF) {
-        AttributeImpl *attr = attributes()->getAttributeItem(ATTR_REL);
-        if (attr) {
-            QString value = attr->value().string().lower();
-            if (value.contains("stylesheet") || value.contains("icon")) {
-                return true;
-            }
-        }
-    }
-    return false;
-}
-
 // -------------------------------------------------------------------------
 
 HTMLMetaElementImpl::HTMLMetaElementImpl(DocumentPtr *doc) : HTMLElementImpl(doc)
@@ -381,7 +367,7 @@ NodeImpl::Id HTMLScriptElementImpl::id() const
     return ID_SCRIPT;
 }
 
-bool HTMLScriptElementImpl::isSubresourceURLAttribute(AttributeImpl *attr) const
+bool HTMLScriptElementImpl::isURLAttribute(AttributeImpl *attr) const
 {
     return attr->id() == ATTR_SRC;
 }
diff --git a/WebCore/khtml/html/html_headimpl.h b/WebCore/khtml/html/html_headimpl.h
index a682e5f..b0499e3 100644
--- a/WebCore/khtml/html/html_headimpl.h
+++ b/WebCore/khtml/html/html_headimpl.h
@@ -98,7 +98,6 @@ public:
     void setDisabledState(bool _disabled);
 
     virtual bool isURLAttribute(AttributeImpl *attr) const;
-    virtual bool isSubresourceURLAttribute(AttributeImpl *attr) const;
     
 protected:
     khtml::CachedCSSStyleSheet *m_cachedSheet;
@@ -144,7 +143,7 @@ public:
 
     virtual Id id() const;
     
-    virtual bool isSubresourceURLAttribute(AttributeImpl *attr) const;
+    virtual bool isURLAttribute(AttributeImpl *attr) const;
     
 };
 
diff --git a/WebCore/khtml/html/html_imageimpl.cpp b/WebCore/khtml/html/html_imageimpl.cpp
index 13e7945..aff53ee 100644
--- a/WebCore/khtml/html/html_imageimpl.cpp
+++ b/WebCore/khtml/html/html_imageimpl.cpp
@@ -294,7 +294,7 @@ QImage HTMLImageElementImpl::currentImage() const
     return QImage();
 }
 
-bool HTMLImageElementImpl::isSubresourceURLAttribute(AttributeImpl *attr) const
+bool HTMLImageElementImpl::isURLAttribute(AttributeImpl *attr) const
 {
     return (attr->id() == ATTR_SRC || (attr->id() == ATTR_USEMAP && attr->value().domString()[0] != '#'));
 }
diff --git a/WebCore/khtml/html/html_imageimpl.h b/WebCore/khtml/html/html_imageimpl.h
index fc1b359..69c0b5e 100644
--- a/WebCore/khtml/html/html_imageimpl.h
+++ b/WebCore/khtml/html/html_imageimpl.h
@@ -60,7 +60,7 @@ public:
 
     DOMString imageMap() const { return usemap; }
     
-    virtual bool isSubresourceURLAttribute(AttributeImpl *attr) const;
+    virtual bool isURLAttribute(AttributeImpl *attr) const;
     
 protected:
     DOMString usemap;
diff --git a/WebCore/khtml/html/html_objectimpl.cpp b/WebCore/khtml/html/html_objectimpl.cpp
index 6130213..5734de6 100644
--- a/WebCore/khtml/html/html_objectimpl.cpp
+++ b/WebCore/khtml/html/html_objectimpl.cpp
@@ -332,7 +332,7 @@ void HTMLEmbedElementImpl::attach()
     }
 }
 
-bool HTMLEmbedElementImpl::isSubresourceURLAttribute(AttributeImpl *attr) const
+bool HTMLEmbedElementImpl::isURLAttribute(AttributeImpl *attr) const
 {
     return attr->id() == ATTR_SRC;
 }
@@ -490,7 +490,7 @@ void HTMLObjectElementImpl::recalcStyle( StyleChange ch )
     HTMLElementImpl::recalcStyle( ch );
 }
 
-bool HTMLObjectElementImpl::isSubresourceURLAttribute(AttributeImpl *attr) const
+bool HTMLObjectElementImpl::isURLAttribute(AttributeImpl *attr) const
 {
     return (attr->id() == ATTR_DATA || (attr->id() == ATTR_USEMAP && attr->value().domString()[0] != '#'));
 }
@@ -527,7 +527,7 @@ void HTMLParamElementImpl::parseHTMLAttribute(HTMLAttributeImpl *attr)
     }
 }
 
-bool HTMLParamElementImpl::isSubresourceURLAttribute(AttributeImpl *attr) const
+bool HTMLParamElementImpl::isURLAttribute(AttributeImpl *attr) const
 {
     if (attr->id() == ATTR_VALUE) {
         AttributeImpl *attr = attributes()->getAttributeItem(ATTR_NAME);
diff --git a/WebCore/khtml/html/html_objectimpl.h b/WebCore/khtml/html/html_objectimpl.h
index 97103f0..6463e93 100644
--- a/WebCore/khtml/html/html_objectimpl.h
+++ b/WebCore/khtml/html/html_objectimpl.h
@@ -90,7 +90,7 @@ public:
     virtual bool rendererIsNeeded(khtml::RenderStyle *);
     virtual khtml::RenderObject *createRenderer(RenderArena *, khtml::RenderStyle *);
     
-    virtual bool isSubresourceURLAttribute(AttributeImpl *attr) const;
+    virtual bool isURLAttribute(AttributeImpl *attr) const;
 
     QString url;
     QString pluginPage;
@@ -122,7 +122,7 @@ public:
 
     DocumentImpl* contentDocument() const;
     
-    virtual bool isSubresourceURLAttribute(AttributeImpl *attr) const;
+    virtual bool isURLAttribute(AttributeImpl *attr) const;
 
     QString serviceType;
     QString url;
@@ -147,7 +147,7 @@ public:
     QString name() const { return m_name.string(); }
     QString value() const { return m_value.string(); }
     
-    virtual bool isSubresourceURLAttribute(AttributeImpl *attr) const;
+    virtual bool isURLAttribute(AttributeImpl *attr) const;
 
  protected:
     AtomicString m_name;
diff --git a/WebCore/khtml/html/html_tableimpl.cpp b/WebCore/khtml/html/html_tableimpl.cpp
index 88c8ef2..971381b 100644
--- a/WebCore/khtml/html/html_tableimpl.cpp
+++ b/WebCore/khtml/html/html_tableimpl.cpp
@@ -590,7 +590,7 @@ void HTMLTableElementImpl::attach()
 	static_cast<RenderTable *>(m_render)->setCellPadding( padding );
 }
 
-bool HTMLTableElementImpl::isSubresourceURLAttribute(AttributeImpl *attr) const
+bool HTMLTableElementImpl::isURLAttribute(AttributeImpl *attr) const
 {
     return attr->id() == ATTR_BACKGROUND;
 }
@@ -973,7 +973,7 @@ void HTMLTableCellElementImpl::attach()
     HTMLTablePartElementImpl::attach();
 }
 
-bool HTMLTableCellElementImpl::isSubresourceURLAttribute(AttributeImpl *attr) const
+bool HTMLTableCellElementImpl::isURLAttribute(AttributeImpl *attr) const
 {
     return attr->id() == ATTR_BACKGROUND;
 }
diff --git a/WebCore/khtml/html/html_tableimpl.h b/WebCore/khtml/html/html_tableimpl.h
index ef23e56..7533b4a 100644
--- a/WebCore/khtml/html/html_tableimpl.h
+++ b/WebCore/khtml/html/html_tableimpl.h
@@ -107,7 +107,7 @@ public:
 
     virtual void attach();
     
-    virtual bool isSubresourceURLAttribute(AttributeImpl *attr) const;
+    virtual bool isURLAttribute(AttributeImpl *attr) const;
 
 protected:
     HTMLTableSectionElementImpl *head;
@@ -214,7 +214,7 @@ public:
     // used by table cells to share style decls created by the enclosing table.
     virtual CSSStyleDeclarationImpl* additionalAttributeStyleDecl();
     
-    virtual bool isSubresourceURLAttribute(AttributeImpl *attr) const;
+    virtual bool isURLAttribute(AttributeImpl *attr) const;
 
 protected:
     int _row;
diff --git a/WebCore/khtml/xml/dom2_rangeimpl.cpp b/WebCore/khtml/xml/dom2_rangeimpl.cpp
index f39efef..91e9538 100644
--- a/WebCore/khtml/xml/dom2_rangeimpl.cpp
+++ b/WebCore/khtml/xml/dom2_rangeimpl.cpp
@@ -843,7 +843,7 @@ DOMString RangeImpl::toString( int &exceptioncode )
     return text;
 }
 
-DOMString RangeImpl::toHTMLWithOptions(QStringList *subresourceURLs)
+DOMString RangeImpl::toHTMLWithOptions(QPtrList<NodeImpl> *nodes)
 {
     // Find the common containing block node of the start and end nodes.
     RenderBlock *startBlock = m_startContainer->renderer()->containingBlock();
@@ -867,7 +867,7 @@ DOMString RangeImpl::toHTMLWithOptions(QStringList *subresourceURLs)
         startBlock = startBlock->containingBlock();
     }
     
-    return commonBlockNode->recursive_toHTMLWithOptions(true, this, subresourceURLs);
+    return commonBlockNode->recursive_toHTMLWithOptions(true, this, nodes);
 }
 
 DOMString RangeImpl::toHTML(  )
diff --git a/WebCore/khtml/xml/dom2_rangeimpl.h b/WebCore/khtml/xml/dom2_rangeimpl.h
index 07587c0..1038ce7 100644
--- a/WebCore/khtml/xml/dom2_rangeimpl.h
+++ b/WebCore/khtml/xml/dom2_rangeimpl.h
@@ -63,7 +63,7 @@ public:
     void insertNode( NodeImpl *newNode, int &exceptioncode );
     DOMString toString ( int &exceptioncode );
     DOMString toHTML (  );
-    DOMString toHTMLWithOptions(QStringList *subresourceURLs=NULL);
+    DOMString toHTMLWithOptions(QPtrList<NodeImpl> *nodes=NULL);
 
     DocumentFragmentImpl *createContextualFragment ( DOMString &html, int &exceptioncode );
     
diff --git a/WebCore/khtml/xml/dom_elementimpl.cpp b/WebCore/khtml/xml/dom_elementimpl.cpp
index d80708c..bf34784 100644
--- a/WebCore/khtml/xml/dom_elementimpl.cpp
+++ b/WebCore/khtml/xml/dom_elementimpl.cpp
@@ -364,12 +364,8 @@ void ElementImpl::createAttributeMap() const
 
 bool ElementImpl::isURLAttribute(AttributeImpl *attr) const
 {
-    return isSubresourceURLAttribute(attr);
-    
-}
-bool ElementImpl::isSubresourceURLAttribute(AttributeImpl *attr) const
-{
     return false;
+    
 }
 
 void ElementImpl::defaultEventHandler(EventImpl *evt)
diff --git a/WebCore/khtml/xml/dom_elementimpl.h b/WebCore/khtml/xml/dom_elementimpl.h
index 5447cf2..66090af 100644
--- a/WebCore/khtml/xml/dom_elementimpl.h
+++ b/WebCore/khtml/xml/dom_elementimpl.h
@@ -217,7 +217,6 @@ public:
     virtual void defaultEventHandler(EventImpl *evt);
     
     virtual bool isURLAttribute(AttributeImpl *attr) const;
-    virtual bool isSubresourceURLAttribute(AttributeImpl *attr) const;
     
 #ifndef NDEBUG
     virtual void dump(QTextStream *stream, QString ind = "") const;
diff --git a/WebCore/khtml/xml/dom_nodeimpl.cpp b/WebCore/khtml/xml/dom_nodeimpl.cpp
index 7cdbdfa..bc0c9c5 100644
--- a/WebCore/khtml/xml/dom_nodeimpl.cpp
+++ b/WebCore/khtml/xml/dom_nodeimpl.cpp
@@ -284,7 +284,7 @@ static QString escapeHTML( const QString& in )
     return s;
 }
 
-QString NodeImpl::recursive_toHTMLWithOptions(bool start, const DOM::RangeImpl *range, QStringList *subresourceURLs) const
+QString NodeImpl::recursive_toHTMLWithOptions(bool start, const DOM::RangeImpl *range, QPtrList<NodeImpl> *nodes) const
 {	
     QString me = "";
     
@@ -326,6 +326,9 @@ QString NodeImpl::recursive_toHTMLWithOptions(bool start, const DOM::RangeImpl *
     }
     
     if (isNodeIncluded) {
+        if (nodes) {
+            nodes->append(this);
+        }
         // Copy who I am into the me string
         if (nodeType() == Node::TEXT_NODE) {
             DOMString str = nodeValue().copy();
@@ -344,19 +347,12 @@ QString NodeImpl::recursive_toHTMLWithOptions(bool start, const DOM::RangeImpl *
             me += QChar('<') + nodeName().string();
             if (nodeType() == Node::ELEMENT_NODE) {
                 const ElementImpl *el = static_cast<const ElementImpl *>(this);
-                
                 NamedAttrMapImpl *attrs = el->attributes();
                 unsigned long length = attrs->length();
                 for (unsigned int i=0; i<length; i++) {
                     AttributeImpl *attr = attrs->attributeItem(i);
                     DOMString value = attr->value();
                     me += " " + getDocument()->attrName(attr->id()).string() + "=\"" + value.string() + "\"";
-                    if (subresourceURLs && el->isSubresourceURLAttribute(attr)) {
-                        QString URL = getDocument()->completeURL(khtml::parseURL(value).string());
-                        if (!subresourceURLs->contains(URL)) {
-                            subresourceURLs->append(URL);
-                        }
-                    }
                 }
             }
             me += isHTMLElement() ? ">" : "/>";
@@ -366,7 +362,7 @@ QString NodeImpl::recursive_toHTMLWithOptions(bool start, const DOM::RangeImpl *
     if (!isHTMLElement() || endTag[ident] != FORBIDDEN) {
         // print firstChild
         if ((n = firstChild())) {
-            me += n->recursive_toHTMLWithOptions(false, range, subresourceURLs);
+            me += n->recursive_toHTMLWithOptions(false, range, nodes);
         }
         // Print my ending tag
         if (isNodeIncluded && nodeType() != Node::TEXT_NODE) {
@@ -375,7 +371,7 @@ QString NodeImpl::recursive_toHTMLWithOptions(bool start, const DOM::RangeImpl *
     }
     // print next sibling
     if ((n = nextSibling())) {
-        me += n->recursive_toHTMLWithOptions(false, range, subresourceURLs);
+        me += n->recursive_toHTMLWithOptions(false, range, nodes);
     }
     
     return me;
@@ -1422,6 +1418,13 @@ bool NodeImpl::inSameContainingEditableBlock(NodeImpl *n)
     return n ? containingEditableBlock() == n->containingEditableBlock() : false;
 }
 
+#if APPLE_CHANGES
+NodeImpl::Id NodeImpl::identifier() const
+{
+    return id();
+}
+#endif
+
 DOMPosition NodeImpl::positionForCoordinates(int x, int y)
 {
     if (renderer())
diff --git a/WebCore/khtml/xml/dom_nodeimpl.h b/WebCore/khtml/xml/dom_nodeimpl.h
index 9099c6c..635c2bb 100644
--- a/WebCore/khtml/xml/dom_nodeimpl.h
+++ b/WebCore/khtml/xml/dom_nodeimpl.h
@@ -190,7 +190,9 @@ public:
     //                 the lower 16 bit identify the local part of the
     //                 qualified element name.
     virtual Id id() const { return 0; };
-
+#if APPLE_CHANGES
+    Id identifier() const;
+#endif
     enum MouseEventType {
         MousePress,
         MouseRelease,
@@ -254,7 +256,7 @@ public:
     virtual bool isInline() const;
     virtual QString toHTML() const;
     QString recursive_toHTML(bool start = false) const;
-    QString recursive_toHTMLWithOptions(bool start=false, const DOM::RangeImpl *range=NULL, QStringList *subresourceURLs=NULL) const;
+    QString recursive_toHTMLWithOptions(bool start=false, const DOM::RangeImpl *range=NULL, QPtrList<NodeImpl> *nodes=NULL) const;
     void recursive_completeURLs(QString baseURL);
     
     virtual bool isContentEditable() const;
diff --git a/WebCore/kwq/DOM.mm b/WebCore/kwq/DOM.mm
index dc070de..9881196 100644
--- a/WebCore/kwq/DOM.mm
+++ b/WebCore/kwq/DOM.mm
@@ -36,6 +36,7 @@
 #import <dom/dom_xml.h>
 #import <dom/dom2_range.h>
 #import <html/html_elementimpl.h>
+#import <misc/htmltags.h>
 #import <xml/dom_docimpl.h>
 #import <xml/dom_elementimpl.h>
 #import <xml/dom_nodeimpl.h>
@@ -45,6 +46,7 @@
 #import <xml/dom2_rangeimpl.h>
 #import <xml/dom2_viewsimpl.h>
 
+#import "DOMHTML.h"
 #import "DOMInternal.h"
 #import "KWQAssertions.h"
 
@@ -363,42 +365,197 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
     
     Class wrapperClass = nil;
     switch (impl->nodeType()) {
-    case Node::ELEMENT_NODE:
-        wrapperClass = [DOMElement class];
-        break;
-    case Node::ATTRIBUTE_NODE:
-        wrapperClass = [DOMAttr class];
-        break;
-    case Node::TEXT_NODE:
-        wrapperClass = [DOMText class];
-        break;
-    case Node::CDATA_SECTION_NODE:
-        wrapperClass = [DOMCDATASection class];
-        break;
-    case Node::ENTITY_REFERENCE_NODE:
-        wrapperClass = [DOMEntityReference class];
-        break;
-    case Node::ENTITY_NODE:
-        wrapperClass = [DOMEntity class];
-        break;
-    case Node::PROCESSING_INSTRUCTION_NODE:
-        wrapperClass = [DOMProcessingInstruction class];
-        break;
-    case Node::COMMENT_NODE:
-        wrapperClass = [DOMComment class];
-        break;
-    case Node::DOCUMENT_NODE:
-        wrapperClass = [DOMDocument class];
-        break;
-    case Node::DOCUMENT_TYPE_NODE:
-        wrapperClass = [DOMDocumentType class];
-        break;
-    case Node::DOCUMENT_FRAGMENT_NODE:
-        wrapperClass = [DOMDocumentFragment class];
-        break;
-    case Node::NOTATION_NODE:
-        wrapperClass = [DOMNotation class];
-        break;
+        case Node::ELEMENT_NODE:
+            if (impl->isHTMLElement()) {
+                // FIXME: There are no identifiers for HTMLHeadingElement, HTMLModElement, 
+                // HTMLTableCaptionElement, HTMLTableColElement, HTMLTableSectionElement.
+                // Find other ways to identify them.
+                switch (impl->identifier()) {
+                    case ID_HTML:
+                        wrapperClass = [DOMHTMLHtmlElement class];
+                        break;
+                    case ID_HEAD:
+                        wrapperClass = [DOMHTMLHeadElement class];
+                        break;
+                    case ID_LINK:
+                        wrapperClass = [DOMHTMLLinkElement class];
+                        break;
+                    case ID_TITLE:
+                        wrapperClass = [DOMHTMLTitleElement class];
+                        break;
+                    case ID_META:
+                        wrapperClass = [DOMHTMLMetaElement class];
+                        break;
+                    case ID_BASE:
+                        wrapperClass = [DOMHTMLBaseElement class];
+                        break;
+                    case ID_ISINDEX:
+                        wrapperClass = [DOMHTMLIsIndexElement class];
+                        break;
+                    case ID_STYLE:
+                        wrapperClass = [DOMHTMLStyleElement class];
+                        break;
+                    case ID_BODY:
+                        wrapperClass = [DOMHTMLBodyElement class];
+                        break;
+                    case ID_FORM:
+                        wrapperClass = [DOMHTMLFormElement class];
+                        break;
+                    case ID_SELECT:
+                        wrapperClass = [DOMHTMLSelectElement class];
+                        break;
+                    case ID_OPTGROUP:
+                        wrapperClass = [DOMHTMLOptGroupElement class];
+                        break;
+                    case ID_OPTION:
+                        wrapperClass = [DOMHTMLOptionElement class];
+                        break;
+                    case ID_INPUT:
+                        wrapperClass = [DOMHTMLInputElement class];
+                        break;
+                    case ID_TEXTAREA:
+                        wrapperClass = [DOMHTMLTextAreaElement class];
+                        break;
+                    case ID_BUTTON:
+                        wrapperClass = [DOMHTMLButtonElement class];
+                        break;
+                    case ID_LABEL:
+                        wrapperClass = [DOMHTMLLabelElement class];
+                        break;  
+                    case ID_FIELDSET:
+                        wrapperClass = [DOMHTMLFieldSetElement class];
+                        break;      
+                    case ID_LEGEND:
+                        wrapperClass = [DOMHTMLLegendElement class];
+                        break;
+                    case ID_UL:
+                        wrapperClass = [DOMHTMLUListElement class];
+                        break;
+                    case ID_OL:
+                        wrapperClass = [DOMHTMLOListElement class];
+                        break;
+                    case ID_DL:
+                        wrapperClass = [DOMHTMLDListElement class];
+                        break;
+                    case ID_DIR:
+                        wrapperClass = [DOMHTMLDirectoryElement class];
+                        break;
+                    case ID_MENU:
+                        wrapperClass = [DOMHTMLMenuElement class];
+                        break;
+                    case ID_LI:
+                        wrapperClass = [DOMHTMLLIElement class];
+                        break;
+                    case ID_DIV:
+                        wrapperClass = [DOMHTMLDivElement class];
+                        break;
+                    case ID_P:
+                        wrapperClass = [DOMHTMLParagraphElement class];
+                        break;
+                    case ID_Q:
+                        wrapperClass = [DOMHTMLQuoteElement class];
+                        break;
+                    case ID_PRE:
+                        wrapperClass = [DOMHTMLPreElement class];
+                        break;
+                    case ID_BR:
+                        wrapperClass = [DOMHTMLBRElement class];
+                        break;
+                    case ID_BASEFONT:
+                        wrapperClass = [DOMHTMLFontElement class];
+                        break;
+                    case ID_FONT:
+                        wrapperClass = [DOMHTMLFontElement class];
+                        break;
+                    case ID_HR:
+                        wrapperClass = [DOMHTMLHRElement class];
+                        break;
+                    case ID_A:
+                        wrapperClass = [DOMHTMLAnchorElement class];
+                        break;
+                    case ID_IMG:
+                        wrapperClass = [DOMHTMLImageElement class];
+                        break;
+                    case ID_OBJECT:
+                        wrapperClass = [DOMHTMLObjectElement class];
+                        break;
+                    case ID_PARAM:
+                        wrapperClass = [DOMHTMLParamElement class];
+                        break;
+                    case ID_APPLET:
+                        wrapperClass = [DOMHTMLAppletElement class];
+                        break;
+                    case ID_MAP:
+                        wrapperClass = [DOMHTMLMapElement class];
+                        break;
+                    case ID_AREA:
+                        wrapperClass = [DOMHTMLAreaElement class];
+                        break;
+                    case ID_SCRIPT:
+                        wrapperClass = [DOMHTMLScriptElement class];
+                        break;
+                    case ID_TABLE:
+                        wrapperClass = [DOMHTMLTableElement class];
+                        break;
+                    case ID_TD:
+                        wrapperClass = [DOMHTMLTableCellElement class];
+                        break;
+                    case ID_TR:
+                        wrapperClass = [DOMHTMLTableRowElement class];
+                        break;
+                    case ID_FRAMESET:
+                        wrapperClass = [DOMHTMLFrameSetElement class];
+                        break;
+                    case ID_FRAME:
+                        wrapperClass = [DOMHTMLFrameElement class];
+                        break;
+                    case ID_IFRAME:
+                        wrapperClass = [DOMHTMLIFrameElement class];
+                        break;
+                    default:
+                        wrapperClass = [DOMHTMLElement class];
+                }
+            } else {
+                wrapperClass = [DOMElement class];
+            }
+            break;
+        case Node::ATTRIBUTE_NODE:
+            wrapperClass = [DOMAttr class];
+            break;
+        case Node::TEXT_NODE:
+            wrapperClass = [DOMText class];
+            break;
+        case Node::CDATA_SECTION_NODE:
+            wrapperClass = [DOMCDATASection class];
+            break;
+        case Node::ENTITY_REFERENCE_NODE:
+            wrapperClass = [DOMEntityReference class];
+            break;
+        case Node::ENTITY_NODE:
+            wrapperClass = [DOMEntity class];
+            break;
+        case Node::PROCESSING_INSTRUCTION_NODE:
+            wrapperClass = [DOMProcessingInstruction class];
+            break;
+        case Node::COMMENT_NODE:
+            wrapperClass = [DOMComment class];
+            break;
+        case Node::DOCUMENT_NODE:
+            if (static_cast<DocumentImpl *>(impl)->isHTMLDocument()) {
+                wrapperClass = [DOMHTMLDocument class];
+            } else {
+                wrapperClass = [DOMDocument class];
+            }
+            break;
+        case Node::DOCUMENT_TYPE_NODE:
+            wrapperClass = [DOMDocumentType class];
+            break;
+        case Node::DOCUMENT_FRAGMENT_NODE:
+            wrapperClass = [DOMDocumentFragment class];
+            break;
+        case Node::NOTATION_NODE:
+            wrapperClass = [DOMNotation class];
+            break;
     }
     return [[[wrapperClass alloc] _initWithNodeImpl:impl] autorelease];
 }
diff --git a/WebCore/kwq/DOMExtensions.h b/WebCore/kwq/DOMExtensions.h
index 5bba3a3..c33861a 100644
--- a/WebCore/kwq/DOMExtensions.h
+++ b/WebCore/kwq/DOMExtensions.h
@@ -25,7 +25,22 @@
 
 #import "DOMHTML.h"
 
- at interface DOMElement (DOMHTMLExtensions)
+ at interface DOMHTMLEmbedElement : DOMHTMLElement
+- (NSString *)align;
+- (void)setAlign:(NSString *)align;
+- (long)height;
+- (void)setHeight:(long)height;
+- (NSString *)name;
+- (void)setName:(NSString *)name;
+- (NSString *)src;
+- (void)setSrc:(NSString *)src;
+- (NSString *)type;
+- (void)setType:(NSString *)type;
+- (long)width;
+- (void)setWidth:(long)width;
+ at end
+
+ at interface DOMHTMLElement (DOMHTMLElementExtensions)
 - (NSString *)innerHTML;
 - (void)setInnerHTML:(NSString *)innerHTML;
 - (NSString *)innerText;
@@ -35,3 +50,13 @@
 - (void)setContentEditable:(NSString *)contentEditable;
 - (BOOL)isContentEditable;
 @end
+
+ at interface DOMHTMLTableElement (DOMHTMLTableElementExtensions)
+- (NSString *)background;
+- (void)setBackground:(NSString *)background;
+ at end
+
+ at interface DOMHTMLTableCellElement (DOMHTMLTableCellElementExtensions)
+- (NSString *)background;
+- (void)setBackground:(NSString *)background;
+ at end
diff --git a/WebCore/kwq/DOMHTML.mm b/WebCore/kwq/DOMHTML.mm
index 7184e2b..a6f8205 100644
--- a/WebCore/kwq/DOMHTML.mm
+++ b/WebCore/kwq/DOMHTML.mm
@@ -45,6 +45,7 @@
 #import <xml/dom_elementimpl.h>
 #import <xml/dom_nodeimpl.h>
 
+#import "DOMExtensions.h"
 #import "DOMInternal.h"
 #import "KWQAssertions.h"
 
@@ -65,6 +66,7 @@ using DOM::HTMLDivElementImpl;
 using DOM::HTMLDListElementImpl;
 using DOM::HTMLDocumentImpl;
 using DOM::HTMLElementImpl;
+using DOM::HTMLEmbedElementImpl;
 using DOM::HTMLFieldSetElementImpl;
 using DOM::HTMLFontElementImpl;
 using DOM::HTMLFormCollectionImpl;
@@ -140,6 +142,7 @@ using DOM::NodeImpl;
 
 @interface DOMHTMLTableCellElement (WebCoreInternal)
 + (DOMHTMLTableCellElement *)_tableCellElementWithImpl:(HTMLTableCellElementImpl *)impl;
+- (HTMLTableCellElementImpl *)_tableCellElementImpl;
 @end
 
 //------------------------------------------------------------------------------------------
@@ -1909,7 +1912,7 @@ using DOM::NodeImpl;
 
 - (void)setWidth:(long)width
 {
-	DOMString string(QString::number(width));
+    DOMString string(QString::number(width));
     [self _preElementImpl]->setAttribute(ATTR_WIDTH, string);
 }
 
@@ -3876,3 +3879,102 @@ using DOM::NodeImpl;
 }
 
 @end
+
+#pragma mark DOM EXTENSIONS
+
+ at implementation DOMHTMLEmbedElement
+
+- (HTMLEmbedElementImpl *)_embedElementImpl
+{
+    return reinterpret_cast<HTMLEmbedElementImpl *>(_internal);
+}
+
+- (NSString *)align
+{
+    return [self _embedElementImpl]->getAttribute(ATTR_ALIGN);
+}
+
+- (void)setAlign:(NSString *)align
+{
+    [self _embedElementImpl]->setAttribute(ATTR_ALIGN, align);
+}
+
+- (long)height
+{
+    return [self _embedElementImpl]->getAttribute(ATTR_HEIGHT).toInt();
+}
+
+- (void)setHeight:(long)height
+{
+    DOMString string(QString::number(height));
+    [self _embedElementImpl]->setAttribute(ATTR_HEIGHT, string);
+}
+
+- (NSString *)name
+{
+    return [self _embedElementImpl]->getAttribute(ATTR_NAME);
+}
+
+- (void)setName:(NSString *)name
+{
+    [self _embedElementImpl]->setAttribute(ATTR_NAME, name);
+}
+
+- (NSString *)src
+{
+    return [self _embedElementImpl]->getAttribute(ATTR_SRC);
+}
+
+- (void)setSrc:(NSString *)src
+{
+    [self _embedElementImpl]->setAttribute(ATTR_SRC, src);
+}
+
+- (NSString *)type
+{
+    return [self _embedElementImpl]->getAttribute(ATTR_TYPE);
+}
+
+- (void)setType:(NSString *)type
+{
+    [self _embedElementImpl]->setAttribute(ATTR_TYPE, type);
+}
+
+- (long)width
+{
+    return [self _embedElementImpl]->getAttribute(ATTR_WIDTH).toInt();
+}
+
+- (void)setWidth:(long)width
+{
+    DOMString string(QString::number(width));
+    [self _embedElementImpl]->setAttribute(ATTR_WIDTH, string);
+}
+
+ at end
+
+ at implementation DOMHTMLTableElement (DOMHTMLTableElementExtensions)
+
+- (NSString *)background
+{
+    return [self _tableElementImpl]->getAttribute(ATTR_BACKGROUND);
+}
+
+- (void)setBackground:(NSString *)background
+{
+    [self _tableElementImpl]->setAttribute(ATTR_BACKGROUND, background);
+}
+ at end
+
+ at implementation DOMHTMLTableCellElement (DOMHTMLTableCellElementExtensions)
+
+- (NSString *)background
+{
+    return [self _tableCellElementImpl]->getAttribute(ATTR_BACKGROUND);
+}
+
+- (void)setBackground:(NSString *)background
+{
+    [self _tableCellElementImpl]->setAttribute(ATTR_BACKGROUND, background);
+}
+ at end
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index a08367a..058a56f 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -236,8 +236,8 @@ typedef enum {
 - (NSAttributedString *)selectedAttributedString;
 - (NSString *)selectedString;
 
-- (NSString *)markupStringFromNode:(DOMNode *)node subresourceURLStrings:(NSArray **)subresourceURLStrings;
-- (NSString *)markupStringFromRange:(DOMRange *)range subresourceURLStrings:(NSArray **)subresourceURLStrings;
+- (NSString *)markupStringFromNode:(DOMNode *)node nodes:(NSArray **)nodes;
+- (NSString *)markupStringFromRange:(DOMRange *)range nodes:(NSArray **)nodes;
 
 - (void)selectAll;
 - (void)deselectAll;
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 000b1b8..6a5bd5f 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -449,28 +449,40 @@ static bool initializedKJS = FALSE;
     }
 }
 
-- (NSString *)markupStringFromNode:(DOMNode *)node subresourceURLStrings:(NSArray **)subresourceURLStrings
+- (NSArray *)nodesFromList:(QPtrList<NodeImpl> *)nodeList
 {
-    QStringList *subresourceURLs = NULL;
-    if (subresourceURLStrings) {
-        subresourceURLs = new QStringList();
+    NSMutableArray *nodes = [NSMutableArray array];
+    unsigned int count = nodeList->count();
+    for (unsigned int i = 0; i < count; i++) {
+        [nodes addObject:[DOMNode _nodeWithImpl:nodeList->at(i)]];
+    }    
+    return nodes;
+}
+
+- (NSString *)markupStringFromNode:(DOMNode *)node nodes:(NSArray **)nodes
+{
+    QPtrList<NodeImpl> *nodeList = NULL;
+    if (nodes) {
+        nodeList = new QPtrList<NodeImpl>;
     }
-    NSString *markupString = [node _nodeImpl]->recursive_toHTMLWithOptions(false, NULL, subresourceURLs).getNSString();
-    if (subresourceURLStrings) {
-        *subresourceURLStrings = subresourceURLs->getNSArray();
+    NSString *markupString = [node _nodeImpl]->recursive_toHTMLWithOptions(false, NULL, nodeList).getNSString();
+    if (nodes) {
+        *nodes = [self nodesFromList:nodeList];
+        delete nodeList;
     }
     return [self _stringWithDocumentTypeStringAndMarkupString:markupString];
 }
 
-- (NSString *)markupStringFromRange:(DOMRange *)range subresourceURLStrings:(NSArray **)subresourceURLStrings
+- (NSString *)markupStringFromRange:(DOMRange *)range nodes:(NSArray **)nodes
 {
-    QStringList *subresourceURLs = NULL;
-    if (subresourceURLStrings) {
-        subresourceURLs = new QStringList();
+    QPtrList<NodeImpl> *nodeList = NULL;
+    if (nodes) {
+        nodeList = new QPtrList<NodeImpl>;
     }
-    NSString *markupString = [range _rangeImpl]->toHTMLWithOptions(subresourceURLs).string().getNSString();
-    if (subresourceURLStrings) {
-        *subresourceURLStrings = subresourceURLs->getNSArray();
+    NSString *markupString = [range _rangeImpl]->toHTMLWithOptions(nodeList).string().getNSString();
+    if (nodes) {
+        *nodes = [self nodesFromList:nodeList];
+        delete nodeList;
     }
     return [self _stringWithDocumentTypeStringAndMarkupString:markupString];
 }
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index a73c728..d98c83d 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,84 @@
+2004-04-16  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed: <rdar://problem/3587599>: Mail Page, Web Archives don't preserve subframes
+	Moved code that assembled subresource URLs from DOM nodes from WebCore to WebKit.
+
+        Reviewed by rjw.
+
+        * DOM.subproj/DOMExtensions.h: copied from WebCore
+        * DOM.subproj/WebDOMOperations.h:
+        * DOM.subproj/WebDOMOperations.m:
+        (-[DOMNode webArchive]): call renamed methods
+        (-[DOMNode markupString]): ditto
+        (-[DOMNode _URLsFromSelectors:]): new, returns array of URLs given selectors
+        (-[DOMNode _subresourceURLs]): new, base class does nothing, subclasses call _URLsFromSelectors with URL selectors
+        (-[DOMDocument webFrame]): new
+        (-[DOMRange webArchive]): call renamed methods
+        (-[DOMRange markupString]): ditto
+        (-[DOMHTMLBodyElement _subresourceURLs]): new
+        (-[DOMHTMLInputElement _subresourceURLs]): new
+        (-[DOMHTMLLinkElement _subresourceURLs]): new
+        (-[DOMHTMLScriptElement _subresourceURLs]): new
+        (-[DOMHTMLImageElement _subresourceURLs]): new
+        (-[DOMHTMLEmbedElement _subresourceURLs]): new
+        (-[DOMHTMLObjectElement _subresourceURLs]): new
+        (-[DOMHTMLParamElement _subresourceURLs]): new
+        (-[DOMHTMLTableElement _subresourceURLs]): new
+        (-[DOMHTMLTableCellElement _subresourceURLs]): new
+        * WebKit.pbproj/project.pbxproj:
+        * WebView.subproj/WebArchive.h:
+        * WebView.subproj/WebArchive.m:
+        (-[WebArchivePrivate dealloc]): release new subframeArchives ivar
+        (-[WebArchive initWithMainResource:subresources:subframeArchives:]): take subframeArchives
+        (-[WebArchive _initWithPropertyList:]): new, recursively creates WebArchives
+        (-[WebArchive initWithData:]): call _initWithPropertyList
+        (-[WebArchive subframeArchives]): new
+        (-[WebArchive _propertyListRepresentation]): new, recursively creates property lists of WebArchives
+        (-[WebArchive data]): call _propertyListRepresentation
+        * WebView.subproj/WebBaseResourceHandleDelegate.m:
+        (-[WebBaseResourceHandleDelegate saveResource]): call renamed methods
+        * WebView.subproj/WebDataSource.m:
+        (-[WebDataSourcePrivate dealloc]): release new pendingSubframeArchives ivar
+        (-[WebDataSource _archiveWithMarkupString:nodes:]): renamed and reimplemented, handles subframes
+        (-[WebDataSource _archive]): new
+        (-[WebDataSource _setPendingSubframeArchives:]): new
+        (-[WebDataSource _archiveForFrameName:]): new
+        * WebView.subproj/WebDataSourcePrivate.h:
+        * WebView.subproj/WebFrame.m:
+        (-[WebFrame loadArchive:]): handle subframes
+        (-[WebFrame _loadRequest:subresources:subframeArchives:]): ditto
+        (-[WebFrame _loadURL:intoChild:]): use the subframe archive if we have it
+        (-[WebFrame loadRequest:]): call renamed methods
+        * WebView.subproj/WebFramePrivate.h:
+        * WebView.subproj/WebHTMLRepresentation.m:
+        (-[WebHTMLRepresentation loadWebArchive]): call renamed methods and handle subframes
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView _selectedArchive:]): call renamed methods
+        (-[WebHTMLView _pasteFromPasteboard:]): call renamed methods
+        * WebView.subproj/WebHTMLViewPrivate.h:
+        * WebView.subproj/WebImageRepresentation.h:
+        * WebView.subproj/WebImageRepresentation.m: instead of storing some items from the data source, just store the data source
+        (-[WebImageRepresentation dealloc]): removed use of deleted ivars
+        (-[WebImageRepresentation URL]): use dataSource instead of ivar
+        (-[WebImageRepresentation doneLoading]): use new boolean ivar
+        (-[WebImageRepresentation setDataSource:]): store the data source
+        (-[WebImageRepresentation receivedData:withDataSource:]): use dataSource instead of ivar
+        (-[WebImageRepresentation receivedError:withDataSource:]): ditto
+        (-[WebImageRepresentation finishedLoadingWithDataSource:]): ditto
+        (-[WebImageRepresentation title]): ditto
+        (-[WebImageRepresentation data]): ditto
+        (-[WebImageRepresentation filename]): ditto
+        (-[WebImageRepresentation archive]): ditto
+        * WebView.subproj/WebResource.h:
+        * WebView.subproj/WebResource.m:
+        (-[WebResourcePrivate dealloc]): release new frame name ivar
+        (-[WebResource initWithData:URL:MIMEType:textEncodingName:frameName:]): take a frame name
+        (-[WebResource frameName]): new
+        (-[WebResource _initWithPropertyList:]): handle frame name
+        (-[WebResource _initWithCachedResponse:originalURL:]): call renamed methods
+        (-[WebResource _propertyListRepresentation]):
+        * WebView.subproj/WebResourcePrivate.h: handle frame name
+
 2004-04-15  David Hyatt  <hyatt at apple.com>
 
 	Make sure isOpaque returns NO when the WebHTMLVIew doesn't draw its background.
diff --git a/WebKit/DOM.subproj/DOMExtensions.h b/WebKit/DOM.subproj/DOMExtensions.h
index 5bba3a3..c33861a 100644
--- a/WebKit/DOM.subproj/DOMExtensions.h
+++ b/WebKit/DOM.subproj/DOMExtensions.h
@@ -25,7 +25,22 @@
 
 #import "DOMHTML.h"
 
- at interface DOMElement (DOMHTMLExtensions)
+ at interface DOMHTMLEmbedElement : DOMHTMLElement
+- (NSString *)align;
+- (void)setAlign:(NSString *)align;
+- (long)height;
+- (void)setHeight:(long)height;
+- (NSString *)name;
+- (void)setName:(NSString *)name;
+- (NSString *)src;
+- (void)setSrc:(NSString *)src;
+- (NSString *)type;
+- (void)setType:(NSString *)type;
+- (long)width;
+- (void)setWidth:(long)width;
+ at end
+
+ at interface DOMHTMLElement (DOMHTMLElementExtensions)
 - (NSString *)innerHTML;
 - (void)setInnerHTML:(NSString *)innerHTML;
 - (NSString *)innerText;
@@ -35,3 +50,13 @@
 - (void)setContentEditable:(NSString *)contentEditable;
 - (BOOL)isContentEditable;
 @end
+
+ at interface DOMHTMLTableElement (DOMHTMLTableElementExtensions)
+- (NSString *)background;
+- (void)setBackground:(NSString *)background;
+ at end
+
+ at interface DOMHTMLTableCellElement (DOMHTMLTableCellElementExtensions)
+- (NSString *)background;
+- (void)setBackground:(NSString *)background;
+ at end
diff --git a/WebKit/DOM.subproj/WebDOMOperations.h b/WebKit/DOM.subproj/WebDOMOperations.h
index 4ae9914..56e78c0 100644
--- a/WebKit/DOM.subproj/WebDOMOperations.h
+++ b/WebKit/DOM.subproj/WebDOMOperations.h
@@ -9,6 +9,7 @@
 #import <WebKit/DOMRange.h>
 
 @class WebArchive;
+ at class WebFrame;
 
 @interface DOMNode (WebDOMNodeOperations)
 - (WebArchive *)webArchive;
@@ -16,6 +17,7 @@
 @end
 
 @interface DOMDocument (WebDOMDocumentOperations)
+- (WebFrame *)webFrame;
 - (NSURL *)URLWithRelativeString:(NSString *)string;
 @end
 
diff --git a/WebKit/DOM.subproj/WebDOMOperations.m b/WebKit/DOM.subproj/WebDOMOperations.m
index eb0c225..d62ab80 100644
--- a/WebKit/DOM.subproj/WebDOMOperations.m
+++ b/WebKit/DOM.subproj/WebDOMOperations.m
@@ -3,20 +3,16 @@
     Copyright 2004, Apple, Inc. All rights reserved.
 */
 
-#import <WebKit/WebDOMOperations.h>
+#import <WebKit/WebDOMOperationsPrivate.h>
 
+#import <WebKit/DOMExtensions.h>
+#import <WebKit/DOMHTML.h>
 #import <WebKit/WebAssertions.h>
 #import <WebKit/WebBridge.h>
 #import <WebKit/WebDataSourcePrivate.h>
 #import <WebKit/WebFramePrivate.h>
 
- at interface DOMNode (WebDOMNodeOperationsPrivate)
-- (WebBridge *)_bridge;
- at end
-
- at interface DOMRange (WebDOMRangeOperationsPrivate)
-- (WebBridge *)_bridge;
- at end
+#import <Foundation/NSString_NSURLExtras.h>
 
 @implementation DOMNode (WebDOMNodeOperations)
 
@@ -28,20 +24,50 @@
 - (WebArchive *)webArchive
 {
     WebBridge *bridge = [self _bridge];
-    NSArray *subresourceURLStrings;
-    NSString *markupString = [bridge markupStringFromNode:self subresourceURLStrings:&subresourceURLStrings];
-    return [[[bridge webFrame] dataSource] _archiveWithMarkupString:markupString subresourceURLStrings:subresourceURLStrings];
+    NSArray *nodes;
+    NSString *markupString = [bridge markupStringFromNode:self nodes:&nodes];
+    return [[[bridge webFrame] dataSource] _archiveWithMarkupString:markupString nodes:nodes];
 }
 
 - (NSString *)markupString
 {
-    return [[self _bridge] markupStringFromNode:self subresourceURLStrings:nil];
+    return [[self _bridge] markupStringFromNode:self nodes:nil];
+}
+
+- (NSArray *)_URLsFromSelectors:(SEL)firstSel, ...
+{
+    NSMutableArray *URLs = [NSMutableArray array];
+    
+    va_list args;
+    va_start(args, firstSel);
+    
+    SEL selector = firstSel;
+    do {
+        NSString *string = [self performSelector:selector];
+        if ([string length] > 0) {
+            [URLs addObject:[[self ownerDocument] URLWithRelativeString:string]];
+        }
+    } while ((selector = va_arg(args, SEL)) != nil);
+    
+    va_end(args);
+    
+    return URLs;
+}
+
+- (NSArray *)_subresourceURLs
+{
+    return nil;
 }
 
 @end
 
 @implementation DOMDocument (WebDOMDocumentOperations)
 
+- (WebFrame *)webFrame
+{
+    return [[self _bridge] webFrame];
+}
+
 - (NSURL *)URLWithRelativeString:(NSString *)string
 {
     return [[self _bridge] URLWithRelativeString:string];
@@ -59,14 +85,116 @@
 - (WebArchive *)webArchive
 {
     WebBridge *bridge = [self _bridge];
-    NSArray *subresourceURLStrings;
-    NSString *markupString = [bridge markupStringFromRange:self subresourceURLStrings:&subresourceURLStrings];
-    return [[[bridge webFrame] dataSource] _archiveWithMarkupString:markupString subresourceURLStrings:subresourceURLStrings];
+    NSArray *nodes;
+    NSString *markupString = [bridge markupStringFromRange:self nodes:&nodes];
+    return [[[bridge webFrame] dataSource] _archiveWithMarkupString:markupString nodes:nodes];
 }
 
 - (NSString *)markupString
 {		
-    return [[self _bridge] markupStringFromRange:self subresourceURLStrings:nil];
+    return [[self _bridge] markupStringFromRange:self nodes:nil];
+}
+
+ at end
+
+ at implementation DOMHTMLBodyElement (WebDOMHTMLBodyElementOperations)
+
+- (NSArray *)_subresourceURLs
+{
+    return [self _URLsFromSelectors:@selector(background), nil];
+}
+
+ at end
+
+ at implementation DOMHTMLInputElement (WebDOMHTMLInputElementOperations)
+
+- (NSArray *)_subresourceURLs
+{
+    return [self _URLsFromSelectors:@selector(src), nil];
+}
+
+ at end
+
+ at implementation DOMHTMLLinkElement (WebDOMHTMLLinkElementOperations)
+
+- (NSArray *)_subresourceURLs
+{
+    NSString *rel = [self rel];
+    if ([rel _web_isCaseInsensitiveEqualToString:@"stylesheet"] || [rel _web_isCaseInsensitiveEqualToString:@"icon"]) {
+        return [self _URLsFromSelectors:@selector(href), nil];
+    }
+    return nil;
+}
+
+ at end
+
+ at implementation DOMHTMLScriptElement (WebDOMHTMLScriptElementOperations)
+
+- (NSArray *)_subresourceURLs
+{
+    return [self _URLsFromSelectors:@selector(src), nil];
+}
+
+ at end
+
+ at implementation DOMHTMLImageElement (WebDOMHTMLImageElementOperations)
+
+- (NSArray *)_subresourceURLs
+{
+    SEL useMapSelector = [[self useMap] hasPrefix:@"#"] ? nil : @selector(useMap);
+    return [self _URLsFromSelectors:@selector(src), useMapSelector, nil];
+}
+
+ at end
+
+ at implementation DOMHTMLEmbedElement (WebDOMHTMLEmbedElementOperations)
+
+- (NSArray *)_subresourceURLs
+{
+    return [self _URLsFromSelectors:@selector(src), nil];
+}
+
+ at end
+
+ at implementation DOMHTMLObjectElement (WebDOMHTMLObjectElementOperations)
+
+- (NSArray *)_subresourceURLs
+{
+    SEL useMapSelector = [[self useMap] hasPrefix:@"#"] ? nil : @selector(useMap);
+    return [self _URLsFromSelectors:@selector(data), useMapSelector, nil];
+}
+
+ at end
+
+ at implementation DOMHTMLParamElement (WebDOMHTMLParamElementOperations)
+
+- (NSArray *)_subresourceURLs
+{
+    NSString *name = [self name];
+    if ([name _web_isCaseInsensitiveEqualToString:@"data"] ||
+        [name _web_isCaseInsensitiveEqualToString:@"movie"] ||
+        [name _web_isCaseInsensitiveEqualToString:@"src"]) {
+        return [self _URLsFromSelectors:@selector(value), nil];
+    }
+    return nil;
+}
+
+ at end
+
+ at implementation DOMHTMLTableElement (WebDOMHTMLTableElementOperations)
+
+- (NSArray *)_subresourceURLs
+{
+    return [self _URLsFromSelectors:@selector(background), nil];
+}
+
+ at end
+
+ at implementation DOMHTMLTableCellElement (WebDOMHTMLTableCellElementOperations)
+
+- (NSArray *)_subresourceURLs
+{
+    return [self _URLsFromSelectors:@selector(background), nil];
 }
 
 @end
diff --git a/WebKit/DOM.subproj/WebDOMOperationsPrivate.h b/WebKit/DOM.subproj/WebDOMOperationsPrivate.h
new file mode 100644
index 0000000..2b3a98e
--- /dev/null
+++ b/WebKit/DOM.subproj/WebDOMOperationsPrivate.h
@@ -0,0 +1,20 @@
+/*	
+    WebDOMOperationsPrivate.h
+    Copyright 2004, Apple, Inc. All rights reserved.
+
+    Private header file.
+*/
+
+ at class WebBridge;
+
+#import <WebKit/WebDOMOperations.h>
+
+ at interface DOMNode (WebDOMNodeOperationsPrivate)
+- (WebBridge *)_bridge;
+- (NSArray *)_URLsFromSelectors:(SEL)firstSel, ...;
+- (NSArray *)_subresourceURLs;
+ at end
+
+ at interface DOMRange (WebDOMRangeOperationsPrivate)
+- (WebBridge *)_bridge;
+ at end
\ No newline at end of file
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 5de78d0..b73346b 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -352,6 +352,7 @@
 				8373435C0624EE0D00F3B289,
 				930D02BC06275F640076701E,
 				930D02BE06275F710076701E,
+				84AE9060062DE6A80075BBF9,
 			);
 			isa = PBXHeadersBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -2420,6 +2421,21 @@
 			refType = 4;
 			sourceTree = "<group>";
 		};
+		84AE905F062DE6A80075BBF9 = {
+			fileEncoding = 4;
+			isa = PBXFileReference;
+			lastKnownFileType = sourcecode.c.h;
+			name = WebDOMOperationsPrivate.h;
+			path = DOM.subproj/WebDOMOperationsPrivate.h;
+			refType = 4;
+			sourceTree = "<group>";
+		};
+		84AE9060062DE6A80075BBF9 = {
+			fileRef = 84AE905F062DE6A80075BBF9;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
 		84AF355005C724FA00C5ACD9 = {
 			buildActionMask = 2147483647;
 			files = (
@@ -3900,6 +3916,7 @@
 				F57D194D034E734901A80180,
 				F57D1951034E734901A80180,
 				846171F90624AE5B0071A4A3,
+				84AE905F062DE6A80075BBF9,
 				846171FA0624AE5B0071A4A3,
 			);
 			isa = PBXGroup;
diff --git a/WebKit/WebView.subproj/WebArchive.h b/WebKit/WebView.subproj/WebArchive.h
index e057578..7136fb2 100644
--- a/WebKit/WebView.subproj/WebArchive.h
+++ b/WebKit/WebView.subproj/WebArchive.h
@@ -18,11 +18,12 @@ extern NSString *WebArchivePboardType;
     WebArchivePrivate *_private;
 }
 
-- (id)initWithMainResource:(WebResource *)mainResource subresources:(NSArray *)subresources;
+- (id)initWithMainResource:(WebResource *)mainResource subresources:(NSArray *)subresources subframeArchives:(NSArray *)subframeArchives;
 - (id)initWithData:(NSData *)data;
 
 - (WebResource *)mainResource;
 - (NSArray *)subresources;
+- (NSArray *)subframeArchives;
 
 - (NSData *)data;
 
diff --git a/WebKit/WebView.subproj/WebArchive.m b/WebKit/WebView.subproj/WebArchive.m
index 9d0092c..a824b91 100644
--- a/WebKit/WebView.subproj/WebArchive.m
+++ b/WebKit/WebView.subproj/WebArchive.m
@@ -8,11 +8,17 @@
 #import <WebKit/WebKitLogging.h>
 #import <WebKit/WebResourcePrivate.h>
 
+NSString *WebArchivePboardType =            @"Apple Web Archive pasteboard type";
+NSString *WebMainResourceKey =              @"WebMainResource";
+NSString *WebSubresourcesKey =              @"WebSubresources";
+NSString *WebSubframeArchivesKey =          @"WebSubframeArchives";
+
 @interface WebArchivePrivate : NSObject
 {
     @public
     WebResource *mainResource;
     NSArray *subresources;
+    NSArray *subframeArchives;
 }
 @end
 
@@ -22,6 +28,7 @@
 {
     [mainResource release];
     [subresources release];
+    [subframeArchives release];
     [super dealloc];
 }
 
@@ -36,14 +43,15 @@
     return self;
 }
 
-- (id)initWithMainResource:(WebResource *)mainResource subresources:(NSArray *)subresources
+- (id)initWithMainResource:(WebResource *)mainResource subresources:(NSArray *)subresources subframeArchives:(NSArray *)subframeArchives
 {
     [self init];
     
     _private->mainResource = [mainResource retain];
     _private->subresources = [subresources retain];
+    _private->subframeArchives = [subframeArchives retain];
     
-    if (!_private->mainResource && [_private->subresources count] == 0) {
+    if (!_private->mainResource) {
         [self release];
         return nil;
     }
@@ -51,10 +59,39 @@
     return self;
 }
 
-- (id)initWithData:(NSData *)data
+- (id)_initWithPropertyList:(id)propertyList
 {
     [self init];
     
+    if (![propertyList isKindOfClass:[NSDictionary class]]) {
+        [self release];
+        return nil;
+    }
+    
+    _private->mainResource = [[WebResource alloc] _initWithPropertyList:[propertyList objectForKey:WebMainResourceKey]];    
+    if (!_private->mainResource) {
+        [self release];
+        return nil;
+    }
+    
+    _private->subresources = [[WebResource _resourcesFromPropertyLists:[propertyList objectForKey:WebSubresourcesKey]] retain];
+    
+    NSEnumerator *enumerator = [[propertyList objectForKey:WebSubframeArchivesKey] objectEnumerator];
+    _private->subframeArchives = [[NSMutableArray alloc] init];
+    NSDictionary *archivePropertyList;
+    while ((archivePropertyList = [enumerator nextObject]) != nil) {
+        WebArchive *archive = [[WebArchive alloc] _initWithPropertyList:archivePropertyList];
+        if (archive) {
+            [(NSMutableArray *)_private->subframeArchives addObject:archive];
+            [archive release];
+        }
+    }
+           
+    return self;
+}
+
+- (id)initWithData:(NSData *)data
+{
 #if !LOG_DISABLED
     CFAbsoluteTime start = CFAbsoluteTimeGetCurrent();
 #endif
@@ -67,20 +104,8 @@
     CFAbsoluteTime duration = end - start;
 #endif
     LOG(Timing, "Parsing web archive with [NSPropertyListSerialization propertyListFromData::::] took %f seconds", duration);
-    if (![propertyList isKindOfClass:[NSDictionary class]]) {
-        [self release];
-        return nil;
-    }
-    
-    _private->mainResource = [[WebResource alloc] _initWithPropertyList:[propertyList objectForKey:WebMainResourceKey]];
-    _private->subresources = [[WebResource _resourcesFromPropertyLists:[propertyList objectForKey:WebSubresourcesKey]] retain];
     
-    if (!_private->mainResource && [_private->subresources count] == 0) {
-        [self release];
-        return nil;
-    }
-    
-    return self;
+    return [self _initWithPropertyList:propertyList];
 }
 
 - (void)dealloc
@@ -99,7 +124,12 @@
     return [[_private->subresources retain] autorelease];
 }
 
-- (NSData *)data
+- (NSArray *)subframeArchives
+{
+    return [[_private->subframeArchives retain] autorelease];
+}
+
+- (NSDictionary *)_propertyListRepresentation
 {
     NSMutableDictionary *propertyList = [NSMutableDictionary dictionary];
     if (_private->mainResource) {
@@ -109,6 +139,21 @@
     if ([propertyLists count] > 0) {
         [propertyList setObject:propertyLists forKey:WebSubresourcesKey];
     }
+    NSEnumerator *enumerator = [_private->subframeArchives objectEnumerator];
+    NSMutableArray *subarchivePropertyLists = [[NSMutableArray alloc] init];
+    WebArchive *archive;
+    while ((archive = [enumerator nextObject]) != nil) {
+        [subarchivePropertyLists addObject:[archive _propertyListRepresentation]];
+    }
+    if ([subarchivePropertyLists count] > 0) {
+        [propertyList setObject:subarchivePropertyLists forKey:WebSubframeArchivesKey];
+    }
+    return propertyList;
+}
+
+- (NSData *)data
+{
+    NSDictionary *propertyList = [self _propertyListRepresentation];
 #if !LOG_DISABLED
     CFAbsoluteTime start = CFAbsoluteTimeGetCurrent();
 #endif
diff --git a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
index 2449c3d..80a6ab5 100644
--- a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
+++ b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
@@ -242,7 +242,8 @@
         WebResource *newResource = [[WebResource alloc] initWithData:resourceData
                                                                  URL:originalURL
                                                             MIMEType:[response MIMEType]
-                                                    textEncodingName:[response textEncodingName]];
+                                                    textEncodingName:[response textEncodingName]
+                                                           frameName:nil];
         [dataSource addSubresource:newResource];
         [newResource release];
     }
diff --git a/WebKit/WebView.subproj/WebDataSource.m b/WebKit/WebView.subproj/WebDataSource.m
index da1300b..470c54a 100644
--- a/WebKit/WebView.subproj/WebDataSource.m
+++ b/WebKit/WebView.subproj/WebDataSource.m
@@ -5,44 +5,43 @@
 
 #import <WebKit/WebDataSourcePrivate.h>
 
+#import <WebKit/DOMHTML.h>
+#import <WebKit/WebAssertions.h>
 #import <WebKit/WebArchive.h>
 #import <WebKit/WebBridge.h>
 #import <WebKit/WebDataProtocol.h>
+#import <WebKit/WebDefaultResourceLoadDelegate.h>
 #import <WebKit/WebDocument.h>
+#import <WebKit/WebDOMOperationsPrivate.h>
 #import <WebKit/WebException.h>
+#import <WebKit/WebFrameLoadDelegate.h>
 #import <WebKit/WebFramePrivate.h>
+#import <WebKit/WebFrameViewPrivate.h>
+#import <WebKit/WebHistory.h>
+#import <WebKit/WebHistoryItemPrivate.h>
 #import <WebKit/WebHTMLRepresentation.h>
+#import <WebKit/WebHTMLViewPrivate.h>
+#import <WebKit/WebIconDatabasePrivate.h>
+#import <WebKit/WebIconLoader.h>
+#import <WebKit/WebImageRendererFactory.h>
+#import <WebKit/WebImageRepresentation.h>
+#import <WebKit/WebImageView.h>
+#import <WebKit/WebKitErrorsPrivate.h>
 #import <WebKit/WebKitLogging.h>
 #import <WebKit/WebKitStatisticsPrivate.h>
 #import <WebKit/WebMainResourceClient.h>
+#import <WebKit/WebNSURLExtras.h>
+#import <WebKit/WebResourceLoadDelegate.h>
 #import <WebKit/WebResourcePrivate.h>
-#import <WebKit/WebView.h>
+#import <WebKit/WebTextRepresentation.h>
+#import <WebKit/WebViewPrivate.h>
 
-#import <WebKit/WebAssertions.h>
-#import <Foundation/NSURLFileTypeMappings.h>
-#import <Foundation/NSURLConnection.h>
-#import <Foundation/NSURLRequest.h>
-#import <Foundation/NSURLResponse.h>
 #import <Foundation/NSDictionary_NSURLExtras.h>
-
-#import <WebKit/WebIconLoader.h>
-#import <WebKit/WebViewPrivate.h>
-#import <WebKit/WebFrameLoadDelegate.h>
-#import <WebKit/WebResourceLoadDelegate.h>
-#import <WebKit/WebDefaultResourceLoadDelegate.h>
-#import <WebKit/WebKitErrorsPrivate.h>
 #import <Foundation/NSString_NSURLExtras.h>
-#import <WebKit/WebNSURLExtras.h>
-#import <WebKit/WebFrameViewPrivate.h>
-#import <WebKit/WebHistory.h>
-#import <WebKit/WebHistoryItemPrivate.h>
-#import <WebKit/WebHTMLViewPrivate.h>
-#import <WebKit/WebTextRepresentation.h>
-#import <WebKit/WebImageRendererFactory.h>
-#import <WebKit/WebImageRepresentation.h>
-#import <WebKit/WebImageView.h>
+#import <Foundation/NSURLConnection.h>
+#import <Foundation/NSURLFileTypeMappings.h>
+#import <Foundation/NSURLRequest.h>
 #import <Foundation/NSURLResponsePrivate.h>
-#import <WebKit/WebIconDatabasePrivate.h>
 
 @implementation WebDataSourcePrivate 
 
@@ -72,6 +71,7 @@
     [responses release];
     [webFrame release];
     [subresources release];
+    [pendingSubframeArchives release];
 
     [super dealloc];
 }
@@ -126,31 +126,84 @@
     return nil;
 }
 
-- (WebArchive *)_archiveWithMarkupString:(NSString *)markupString subresourceURLStrings:(NSArray *)subresourceURLStrings
+- (WebArchive *)_archiveWithMarkupString:(NSString *)markupString nodes:(NSArray *)nodes
 { 
+    WebFrame *frame = [self webFrame];
     NSURLResponse *response = [self response];
     WebResource *mainResource = [[WebResource alloc] initWithData:[markupString dataUsingEncoding:NSUTF8StringEncoding]
                                                               URL:[response URL] 
                                                          MIMEType:[response MIMEType]
-                                                 textEncodingName:@"UTF-8"];
+                                                 textEncodingName:@"UTF-8"
+                                                        frameName:[frame name]];
     
-    NSEnumerator *enumerator = [subresourceURLStrings objectEnumerator];
+    NSMutableArray *subframeArchives = [[NSMutableArray alloc] init];
     NSMutableArray *subresources = [[NSMutableArray alloc] init];
-    NSString *URLString;
-    while ((URLString = [enumerator nextObject]) != nil) {
-        WebResource *subresource = [_private->subresources objectForKey:URLString];
-        if (subresource) {
-            [subresources addObject:subresource];
+    NSEnumerator *enumerator = [nodes objectEnumerator];
+    DOMNode *node;
+    while ((node = [enumerator nextObject]) != nil) {
+        if ([node isKindOfClass:[DOMHTMLFrameElement class]] || [node isKindOfClass:[DOMHTMLIFrameElement class]]) {
+            [subframeArchives addObject:[[[[(DOMHTMLFrameElement *)node contentDocument] webFrame] dataSource] _archive]];
         } else {
-            ERROR("Failed to copy subresource because data source does not have subresource for %@", URLString);
+            NSEnumerator *enumerator = [[node _subresourceURLs] objectEnumerator];
+            NSURL *URL;
+            while ((URL = [enumerator nextObject]) != nil) {
+                WebResource *subresource = [self subresourceForURL:URL];
+                if (subresource) {
+                    [subresources addObject:subresource];
+                } else {
+                    ERROR("Failed to archive subresource for %@", URL);
+                }
+            }
         }
     }
     
-    WebArchive *webArchive = [[[WebArchive alloc] initWithMainResource:mainResource subresources:subresources] autorelease];
+    WebArchive *archive = [[[WebArchive alloc] initWithMainResource:mainResource subresources:subresources subframeArchives:subframeArchives] autorelease];
     [mainResource release];
     [subresources release];
+    [subframeArchives release];
     
-    return webArchive;
+    return archive;
+}
+
+- (WebArchive *)_archive
+{
+    if ([[self representation] conformsToProtocol:@protocol(WebDocumentDOM)]) {
+        return [[(id <WebDocumentDOM>)[self representation] DOMDocument] webArchive];
+    } else {
+        NSURLResponse *response = [self response];
+        WebResource *mainResource = [[WebResource alloc] initWithData:[self data]
+                                                                  URL:[response URL] 
+                                                             MIMEType:[response MIMEType]
+                                                     textEncodingName:[response textEncodingName]
+                                                            frameName:[[self webFrame] name]];
+        WebArchive *archive = [[[WebArchive alloc] initWithMainResource:mainResource subresources:nil subframeArchives:nil] autorelease];
+        [mainResource release];
+        return archive;
+    }
+}
+
+- (void)_setPendingSubframeArchives:(NSArray *)subframeArchives
+{
+    ASSERT(_private->pendingSubframeArchives == nil);
+
+    if (subframeArchives == nil) {
+        return;
+    }
+    
+    _private->pendingSubframeArchives = [[NSMutableDictionary alloc] init];
+    NSEnumerator *enumerator = [subframeArchives objectEnumerator];
+    WebArchive *archive;
+    while ((archive = [enumerator nextObject]) != nil) {
+        NSString *frameName = [[archive mainResource] frameName];
+        if (frameName) {
+            [_private->pendingSubframeArchives setObject:archive forKey:frameName];
+        }
+    }
+}
+
+- (WebArchive *)_archiveForFrameName:(NSString *)frameName
+{
+    return [_private->pendingSubframeArchives objectForKey:frameName];
 }
 
 - (void)_replaceSelectionWithMarkupString:(NSString *)markupString baseURL:(NSURL *)baseURL
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.h b/WebKit/WebView.subproj/WebDataSourcePrivate.h
index 91789a0..265e4a8 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.h
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.h
@@ -110,6 +110,7 @@
     WebFrame *webFrame;
     
     NSMutableDictionary *subresources;
+    NSMutableDictionary *pendingSubframeArchives;
 }
 
 @end
@@ -124,7 +125,12 @@
 
 // Other private methods
 - (NSFileWrapper *)_fileWrapperForURL:(NSURL *)URL;
-- (WebArchive *)_archiveWithMarkupString:(NSString *)markupString subresourceURLStrings:(NSArray *)subresourceURLStrings;
+
+- (WebArchive *)_archive;
+- (WebArchive *)_archiveWithMarkupString:(NSString *)markupString nodes:(NSArray *)nodes;
+- (void)_setPendingSubframeArchives:(NSArray *)subframeArchives;
+- (WebArchive *)_archiveForFrameName:(NSString *)frameName;
+
 - (void)_replaceSelectionWithMarkupString:(NSString *)markupString baseURL:(NSURL *)baseURL;
 - (BOOL)_replaceSelectionWithWebArchive:(WebArchive *)archive;
 - (void)_replaceSelectionWithImageResource:(WebResource *)resource;
diff --git a/WebKit/WebView.subproj/WebFrame.m b/WebKit/WebView.subproj/WebFrame.m
index b7e3684..62e5149 100644
--- a/WebKit/WebView.subproj/WebFrame.m
+++ b/WebKit/WebView.subproj/WebFrame.m
@@ -247,21 +247,16 @@ NSString *WebPageCacheDocumentViewKey = @"WebPageCacheDocumentViewKey";
 
 @implementation WebFrame (WebPrivate)
 
-+ (WebFrame *)frameForDOMDocument:(DOMDocument *)document
+- (void)loadArchive:(WebArchive *)archive
 {
-    return [(WebBridge *)[WebBridge bridgeForDOMDocument:document] webFrame];
-}
-
-- (void)loadArchive:(WebArchive *)webArchive
-{
-    WebResource *mainResource = [webArchive mainResource];
+    WebResource *mainResource = [archive mainResource];
     if (mainResource) {
         NSURLRequest *request = [self _webDataRequestForData:[mainResource data] 
                                                     MIMEType:[mainResource MIMEType]
                                             textEncodingName:[mainResource textEncodingName]
                                                      baseURL:[mainResource URL]
                                               unreachableURL:nil];
-        [self _loadRequest:request subresources:[webArchive subresources]];
+        [self _loadRequest:request subresources:[archive subresources] subframeArchives:[archive subframeArchives]];
     }
 }
 
@@ -306,7 +301,7 @@ NSString *WebPageCacheDocumentViewKey = @"WebPageCacheDocumentViewKey";
     return compareDataSource != nil && [unreachableURL isEqual:[[compareDataSource request] URL]];
 }
 
-- (void)_loadRequest:(NSURLRequest *)request subresources:(NSArray *)subresources
+- (void)_loadRequest:(NSURLRequest *)request subresources:(NSArray *)subresources subframeArchives:(NSArray *)subframeArchives
 {
     WebFrameLoadType loadType;
     
@@ -323,6 +318,7 @@ NSString *WebPageCacheDocumentViewKey = @"WebPageCacheDocumentViewKey";
     
     [newDataSource _setOverrideEncoding:[[self dataSource] _overrideEncoding]];
     [newDataSource addSubresources:subresources];
+    [newDataSource _setPendingSubframeArchives:subframeArchives];
     
     // When we loading alternate content for an unreachable URL that we're
     // visiting in the b/f list, we treat it as a reload so the b/f list 
@@ -1940,8 +1936,13 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
         }
     }
 
-    // FIXME: is this the right referrer?
-    [childFrame _loadURL:URL referrer:[[self _bridge] referrer] loadType:childLoadType target:nil triggeringEvent:nil form:nil formValues:nil];
+    WebArchive *archive = [[self dataSource] _archiveForFrameName:[childFrame name]];
+    if (archive) {
+        [childFrame loadArchive:archive];
+    } else {
+        // FIXME: is this the right referrer?
+        [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:(DOMElement *)form formValues:(NSDictionary *)values
@@ -2582,7 +2583,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
 
 - (void)loadRequest:(NSURLRequest *)request
 {
-    [self _loadRequest:request subresources:nil];
+    [self _loadRequest:request subresources:nil subframeArchives:nil];
 }
 
 - (void)_loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)URL unreachableURL:(NSURL *)unreachableURL
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index 42db384..98981cf 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -123,12 +123,11 @@ extern NSString *WebPageCacheDocumentViewKey;
 @interface WebFrame (WebPrivate)
 
 // API Considerations:
-+ (WebFrame *)frameForDOMDocument:(DOMDocument *)document;
-- (void)loadArchive:(WebArchive *)webArchive;
+- (void)loadArchive:(WebArchive *)archive;
 
 // Other private methods
 - (NSURLRequest *)_webDataRequestForData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)URL unreachableURL:(NSURL *)unreachableURL;
-- (void)_loadRequest:(NSURLRequest *)request subresources:(NSArray *)subresources;
+- (void)_loadRequest:(NSURLRequest *)request subresources:(NSArray *)subresources subframeArchives:(NSArray *)subframeArchives;
 
 - (void)_setWebView:(WebView *)webView;
 - (void)_setName:(NSString *)name;
diff --git a/WebKit/WebView.subproj/WebHTMLRepresentation.m b/WebKit/WebView.subproj/WebHTMLRepresentation.m
index 229b9bf..84d9ec5 100644
--- a/WebKit/WebView.subproj/WebHTMLRepresentation.m
+++ b/WebKit/WebView.subproj/WebHTMLRepresentation.m
@@ -88,10 +88,11 @@
 
 - (void)loadWebArchive
 {
-    WebArchive *webArchive = [[WebArchive alloc] initWithData:[_private->dataSource data]];
-    WebResource *mainResource = [webArchive mainResource];
-    NSArray *subresources = [webArchive subresources];
-    [webArchive release];
+    WebArchive *archive = [[WebArchive alloc] initWithData:[_private->dataSource data]];
+    WebResource *mainResource = [archive mainResource];
+    NSArray *subresources = [archive subresources];
+    NSArray *subframeArchives = [archive subframeArchives];
+    [archive release];
     if (!mainResource) {
         return;
     }
@@ -102,6 +103,7 @@
     _private->parsedWebArchiveData = data;
     
     [_private->dataSource addSubresources:subresources];
+    [_private->dataSource _setPendingSubframeArchives:subframeArchives];
     [_private->bridge closeURL];
     [_private->bridge openURL:[mainResource URL]
                        reload:NO 
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 7a9513d..777efb1 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -529,9 +529,9 @@ static WebHTMLView *lastHitView = nil;
 
 - (WebArchive *)_selectedArchive:(NSString **)markupString
 {
-    NSArray *subresourceURLStrings;
-    *markupString = [[self _bridge] markupStringFromRange:[[self _bridge] selectedDOMRange] subresourceURLStrings:&subresourceURLStrings];
-    return [[self _dataSource] _archiveWithMarkupString:*markupString subresourceURLStrings:subresourceURLStrings];
+    NSArray *nodes;
+    *markupString = [[self _bridge] markupStringFromRange:[[self _bridge] selectedDOMRange] nodes:&nodes];
+    return [[self _dataSource] _archiveWithMarkupString:*markupString nodes:nodes];
 }
 
 - (void)_writeSelectionToPasteboard:(NSPasteboard *)pasteboard
@@ -607,14 +607,16 @@ static WebHTMLView *lastHitView = nil;
         WebResource *resource = [[WebResource alloc] initWithData:[pasteboard dataForType:NSTIFFPboardType]
                                                               URL:[NSURL _web_uniqueWebDataURLWithRelativeString:@"/image.tiff"]
                                                          MIMEType:@"image/tiff" 
-                                                 textEncodingName:nil];
+                                                 textEncodingName:nil
+                                                        frameName:nil];
         [[self _dataSource] _replaceSelectionWithImageResource:resource];
         [resource release];
     } else if ([types containsObject:NSPICTPboardType]) {
         WebResource *resource = [[WebResource alloc] initWithData:[pasteboard dataForType:NSPICTPboardType]
                                                               URL:[NSURL _web_uniqueWebDataURLWithRelativeString:@"/image.pict"]
                                                          MIMEType:@"image/pict" 
-                                                 textEncodingName:nil];
+                                                 textEncodingName:nil
+                                                        frameName:nil];
         [[self _dataSource] _replaceSelectionWithImageResource:resource];
         [resource release];
     } else if ((URL = [pasteboard _web_bestURL])) {
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.h b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
index 1fd2c4c..92998a6 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.h
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
@@ -1,9 +1,7 @@
 /*	WebHTMLViewPrivate.h
 	Copyright 2002, Apple, Inc. All rights reserved.
         
-        Private header file.  This file may reference classes (both ObjectiveC and C++)
-        in WebCore.  Instances of this class are referenced by _private in 
-        WebHTMLView.
+        Private header file.
 */
 
 #import <WebKit/WebHTMLView.h>
diff --git a/WebKit/WebView.subproj/WebImageRepresentation.h b/WebKit/WebView.subproj/WebImageRepresentation.h
index 5b0721c..b78504b 100644
--- a/WebKit/WebView.subproj/WebImageRepresentation.h
+++ b/WebKit/WebView.subproj/WebImageRepresentation.h
@@ -6,16 +6,16 @@
 #import <Cocoa/Cocoa.h>
 
 @class WebArchive;
+ at class WebDataSource;
 @class WebImageRenderer;
 
 @protocol WebDocumentRepresentation;
 
 @interface WebImageRepresentation : NSObject <WebDocumentRepresentation>
 {
+    WebDataSource *dataSource;
     WebImageRenderer *image;
-    NSString *filename;
-    NSData *data;
-    NSURL *URL;
+    BOOL doneLoading;
 }
 - (WebImageRenderer *)image;
 - (NSString *)filename;
diff --git a/WebKit/WebView.subproj/WebImageRepresentation.m b/WebKit/WebView.subproj/WebImageRepresentation.m
index f53f23d..b79ee2e 100644
--- a/WebKit/WebView.subproj/WebImageRepresentation.m
+++ b/WebKit/WebView.subproj/WebImageRepresentation.m
@@ -6,7 +6,7 @@
 #import "WebImageRepresentation.h"
 
 #import <WebKit/WebArchive.h>
-#import <WebKit/WebDataSource.h>
+#import <WebKit/WebDataSourcePrivate.h>
 #import <WebKit/WebImageRenderer.h>
 #import <WebKit/WebImageRendererFactory.h>
 #import <WebKit/WebLocalizableStrings.h>
@@ -20,10 +20,7 @@
 
 - (void)dealloc
 {
-    [filename release];
     [image release];
-    [data release];
-    [URL release];
     [super dealloc];
 }
 
@@ -34,39 +31,40 @@
 
 - (NSURL *)URL
 {
-    return URL;
+    return [[dataSource request] URL];
 }
 
 - (BOOL)doneLoading
 {
-    return data != nil;
+    return doneLoading;
 }
 
-- (void)setDataSource:(WebDataSource *)dataSource
+- (void)setDataSource:(WebDataSource *)theDataSource
 {
-    URL = [[[dataSource request] URL] retain];
-    filename = [[[dataSource response] suggestedFilename] retain];
+    dataSource = theDataSource;
     image = [[[WebImageRendererFactory sharedFactory] imageRendererWithMIMEType:[[dataSource response] MIMEType]] retain];
 }
 
-- (void)receivedData:(NSData *)data withDataSource:(WebDataSource *)dataSource
+- (void)receivedData:(NSData *)data withDataSource:(WebDataSource *)theDataSource
 {
     NSData *allData = [dataSource data];
     [image incrementalLoadWithBytes:[allData bytes] length:[allData length] complete:NO];
 }
 
-- (void)receivedError:(NSError *)error withDataSource:(WebDataSource *)dataSource
+- (void)receivedError:(NSError *)error withDataSource:(WebDataSource *)theDataSource
 {
-    data = [[dataSource data] retain];
-    if ([data length] > 0) {
-        [image incrementalLoadWithBytes:[data bytes] length:[data length] complete:YES];
+    NSData *allData = [dataSource data];
+    if ([allData length] > 0) {
+        [image incrementalLoadWithBytes:[allData bytes] length:[allData length] complete:YES];
     }
+    doneLoading = YES;
 }
 
-- (void)finishedLoadingWithDataSource:(WebDataSource *)dataSource
+- (void)finishedLoadingWithDataSource:(WebDataSource *)theDataSource
 {
-    data = [[dataSource data] retain];
-    [image incrementalLoadWithBytes:[data bytes] length:[data length] complete:YES];
+    NSData *allData = [dataSource data];
+    [image incrementalLoadWithBytes:[allData bytes] length:[allData length] complete:YES];
+    doneLoading = YES;
 }
 
 - (BOOL)canProvideDocumentSource
@@ -81,6 +79,7 @@
 
 - (NSString *)title
 {
+    NSString *filename = [self filename];
     NSSize size = [image size];
     if (!NSEqualSizes(size, NSZeroSize)) {
         return [NSString stringWithFormat:UI_STRING("%@ %.0f×%.0f pixels", "window title for a standalone image (uses multiplication symbol, not x)"), filename, size.width, size.height];
@@ -90,20 +89,17 @@
 
 - (NSData *)data
 {
-    return data;
+    return [dataSource data];
 }
 
 - (NSString *)filename
 {
-    return filename;
+    return [[dataSource response] suggestedFilename];
 }
 
 - (WebArchive *)archive
 {
-    WebResource *resource = [[WebResource alloc] initWithData:data URL:URL MIMEType:[image MIMEType] textEncodingName:nil];
-    WebArchive *archive = [[[WebArchive alloc] initWithMainResource:resource subresources:nil] autorelease];
-    [resource release];
-    return archive;
+    return [dataSource _archive];
 }
 
 @end
diff --git a/WebKit/WebView.subproj/WebLoader.m b/WebKit/WebView.subproj/WebLoader.m
index 2449c3d..80a6ab5 100644
--- a/WebKit/WebView.subproj/WebLoader.m
+++ b/WebKit/WebView.subproj/WebLoader.m
@@ -242,7 +242,8 @@
         WebResource *newResource = [[WebResource alloc] initWithData:resourceData
                                                                  URL:originalURL
                                                             MIMEType:[response MIMEType]
-                                                    textEncodingName:[response textEncodingName]];
+                                                    textEncodingName:[response textEncodingName]
+                                                           frameName:nil];
         [dataSource addSubresource:newResource];
         [newResource release];
     }
diff --git a/WebKit/WebView.subproj/WebResource.h b/WebKit/WebView.subproj/WebResource.h
index 5a1c660..f4851c4 100644
--- a/WebKit/WebView.subproj/WebResource.h
+++ b/WebKit/WebView.subproj/WebResource.h
@@ -7,6 +7,7 @@
 
 #import <Foundation/Foundation.h>
 
+ at class WebMainResourcePrivate;
 @class WebResourcePrivate;
 
 @interface WebResource : NSObject 
@@ -15,11 +16,12 @@
     WebResourcePrivate *_private;
 }
 
-- (id)initWithData:(NSData *)data URL:(NSURL *)URL MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)textEncodingName;
+- (id)initWithData:(NSData *)data URL:(NSURL *)URL MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)textEncodingName frameName:(NSString *)frameName;
 
 - (NSData *)data;
 - (NSURL *)URL;
 - (NSString *)MIMEType;
 - (NSString *)textEncodingName;
+- (NSString *)frameName;
 
 @end
diff --git a/WebKit/WebView.subproj/WebResource.m b/WebKit/WebView.subproj/WebResource.m
index f86cca7..51d1ed7 100644
--- a/WebKit/WebView.subproj/WebResource.m
+++ b/WebKit/WebView.subproj/WebResource.m
@@ -9,19 +9,24 @@
 #import <Foundation/NSDictionary_NSURLExtras.h>
 #import <Foundation/NSURL_NSURLExtras.h>
 
-NSString *WebArchivePboardType =            @"Apple Web Archive pasteboard type";
-NSString *WebMainResourceKey =              @"WebMainResource";
+extern NSString *WebResourceDataKey;
+extern NSString *WebResourceMIMETypeKey;
+extern NSString *WebResourceURLKey;
+extern NSString *WebResourceTextEncodingNameKey;
+
 NSString *WebResourceDataKey =              @"WebResourceData";
+NSString *WebResourceFrameNameKey =         @"WebResourceFrameName";
 NSString *WebResourceMIMETypeKey =          @"WebResourceMIMEType";
 NSString *WebResourceURLKey =               @"WebResourceURL";
 NSString *WebResourceTextEncodingNameKey =  @"WebResourceTextEncodingName";
-NSString *WebSubresourcesKey =              @"WebSubresources";
+
 
 @interface WebResourcePrivate : NSObject
 {
 @public
     NSData *data;
     NSURL *URL;
+    NSString *frameName;
     NSString *MIMEType;
     NSString *textEncodingName;
 }
@@ -33,6 +38,7 @@ NSString *WebSubresourcesKey =              @"WebSubresources";
 {
     [data release];
     [URL release];
+    [frameName release];
     [MIMEType release];
     [textEncodingName release];
     [super dealloc];
@@ -42,7 +48,7 @@ NSString *WebSubresourcesKey =              @"WebSubresources";
 
 @implementation WebResource
 
-- (id)initWithData:(NSData *)data URL:(NSURL *)URL MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)textEncodingName
+- (id)initWithData:(NSData *)data URL:(NSURL *)URL MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)textEncodingName frameName:(NSString *)frameName
 {
     _private = [[WebResourcePrivate alloc] init];
     
@@ -65,6 +71,7 @@ NSString *WebSubresourcesKey =              @"WebSubresources";
     _private->MIMEType = [MIMEType copy];
     
     _private->textEncodingName = [textEncodingName copy];
+    _private->frameName = [frameName copy];
     
     return self;
 }
@@ -95,6 +102,11 @@ NSString *WebSubresourcesKey =              @"WebSubresources";
     return _private->textEncodingName;
 }
 
+- (NSString *)frameName
+{
+    return _private->frameName;
+}
+
 @end
 
 @implementation WebResource (WebResourcePrivate)
@@ -139,7 +151,8 @@ NSString *WebSubresourcesKey =              @"WebSubresources";
     return [self initWithData:[data isKindOfClass:[NSData class]] ? data : nil
                           URL:URLString ? [NSURL _web_URLWithDataAsString:URLString] : nil
                      MIMEType:[propertyList _web_stringForKey:WebResourceMIMETypeKey]
-             textEncodingName:[propertyList _web_stringForKey:WebResourceTextEncodingNameKey]];
+             textEncodingName:[propertyList _web_stringForKey:WebResourceTextEncodingNameKey]
+                    frameName:[propertyList _web_stringForKey:WebResourceFrameNameKey]];
 }
 
 - (id)_initWithCachedResponse:(NSCachedURLResponse *)cachedResponse originalURL:(NSURL *)originalURL
@@ -148,7 +161,8 @@ NSString *WebSubresourcesKey =              @"WebSubresources";
     return [self initWithData:[cachedResponse data]
                           URL:originalURL
                      MIMEType:[response MIMEType]
-             textEncodingName:[response textEncodingName]];
+             textEncodingName:[response textEncodingName]
+                    frameName:nil];
 }
 
 - (NSFileWrapper *)_fileWrapperRepresentation
@@ -167,6 +181,9 @@ NSString *WebSubresourcesKey =              @"WebSubresources";
     if (_private->textEncodingName) {
         [propertyList setObject:_private->textEncodingName forKey:WebResourceTextEncodingNameKey];
     }
+    if (_private->frameName) {
+        [propertyList setObject:_private->frameName forKey:WebResourceFrameNameKey];
+    }
     return propertyList;
 }
 
@@ -179,3 +196,4 @@ NSString *WebSubresourcesKey =              @"WebSubresources";
 }
 
 @end
+
diff --git a/WebKit/WebView.subproj/WebResourcePrivate.h b/WebKit/WebView.subproj/WebResourcePrivate.h
index 939e4f0..5ec1927 100644
--- a/WebKit/WebView.subproj/WebResourcePrivate.h
+++ b/WebKit/WebView.subproj/WebResourcePrivate.h
@@ -7,13 +7,6 @@
 
 #import <WebKit/WebResource.h>
 
-extern NSString *WebMainResourceKey;
-extern NSString *WebResourceDataKey;
-extern NSString *WebResourceMIMETypeKey;
-extern NSString *WebResourceURLKey;
-extern NSString *WebResourceTextEncodingNameKey;
-extern NSString *WebSubresourcesKey;
-
 @interface WebResource (WebResourcePrivate)
 
 + (NSArray *)_resourcesFromPropertyLists:(NSArray *)propertyLists;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list