[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:32:49 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit a59182d36fd1a222c7cf1000474e3b6f96b01bbe
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Apr 8 00:46:35 2004 +0000
Tests:
Interact with WebArchives via WebDOMOperations.
Reviewed by rjw.
* Blot/BlotApp.m:
(-[BlotApp handleNewMessageEvent:withReplyEvent:]):
* Blot/BlotDocument.h:
* Blot/BlotDocument.m:
(-[BlotDocument dataRepresentationOfType:]):
(-[BlotDocument loadArchive:]):
WebCore:
WebCore side for supporting WebDOMOperations.
Reviewed by rjw.
* WebCore-combined.exp:
* WebCore.exp:
* kwq/DOM.mm:
* kwq/DOMExtensions.h:
* kwq/WebCoreBridge.h:
* kwq/WebCoreBridge.mm:
(+[WebCoreBridge bridgeForDOMDocument:]): new
(-[WebCoreBridge imageForImageElement:]): new
WebKit:
Created WebDOMOperations which are WebKit-specific categories on DOM objects.
Reviewed by rjw.
* DOM.subproj/DOMExtensions.h:
* DOM.subproj/WebDOMOperations.h: Added.
* DOM.subproj/WebDOMOperations.m: Added.
(-[DOMNode _bridge]): new
(-[DOMNode archive]): new
(-[DOMNode markupString]): new
(-[DOMRange _bridge]): new
(-[DOMRange archive]): new
(-[DOMRange markupString]): new
(-[DOMHTMLImageElement image]):
* WebCoreSupport.subproj/WebBridge.h:
* WebCoreSupport.subproj/WebBridge.m:
(-[WebBridge webFrame]): new
* WebKit.pbproj/project.pbxproj:
* WebView.subproj/WebDataSource.m:
(-[WebDataSource _archiveWithMarkupString:subresourceURLStrings:]): moved from WebHTMLRepresentation
* WebView.subproj/WebDataSourcePrivate.h:
* WebView.subproj/WebDefaultContextMenuDelegate.m:
(-[WebDefaultUIDelegate copyImageToClipboard:]): call markupString on the node
* WebView.subproj/WebDocumentPrivate.h:
* WebView.subproj/WebFrame.m:
(+[WebFrame frameForDOMDocument:]): new
(-[WebFrame loadArchive:]): renamed
* WebView.subproj/WebFramePrivate.h:
* WebView.subproj/WebHTMLRepresentation.h:
* WebView.subproj/WebHTMLRepresentation.m:
* WebView.subproj/WebHTMLRepresentationPrivate.h:
* WebView.subproj/WebHTMLView.m:
(-[WebHTMLView _selectedArchive:]): renamed
(-[WebHTMLView _handleMouseDragged:]): called renamed methods
WebBrowser:
Interact with WebArchives via WebDOMOperations.
Reviewed by rjw.
* BrowserDocument.m:
(-[BrowserDocument canSaveAsWebArchive]): check for the renamed WebDocumentDOM protocol
(-[BrowserDocument dataRepresentationOfType:]): use the archive method on node
(-[BrowserDocument validateUserInterfaceItem:]): check for the renamed WebDocumentDOM protocol
(-[BrowserDocument mailPage:]): use the archive method on node
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6329 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 3e9ea7d..3580a6a 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,18 @@
+2004-04-07 Chris Blumenberg <cblu at apple.com>
+
+ WebCore side for supporting WebDOMOperations.
+
+ Reviewed by rjw.
+
+ * WebCore-combined.exp:
+ * WebCore.exp:
+ * kwq/DOM.mm:
+ * kwq/DOMExtensions.h:
+ * kwq/WebCoreBridge.h:
+ * kwq/WebCoreBridge.mm:
+ (+[WebCoreBridge bridgeForDOMDocument:]): new
+ (-[WebCoreBridge imageForImageElement:]): new
+
2004-04-07 Darin Adler <darin at apple.com>
Reviewed by Chris.
diff --git a/WebCore/WebCore-combined.exp b/WebCore/WebCore-combined.exp
index d2707d8..aa56999 100644
--- a/WebCore/WebCore-combined.exp
+++ b/WebCore/WebCore-combined.exp
@@ -1,3 +1,5 @@
+.objc_class_name_DOMHTMLImageElement
+.objc_class_name_DOMNode
.objc_class_name_DOMRange
.objc_class_name_WebCoreBridge
.objc_class_name_WebCoreCache
diff --git a/WebCore/WebCore.exp b/WebCore/WebCore.exp
index b8fa376..589727a 100644
--- a/WebCore/WebCore.exp
+++ b/WebCore/WebCore.exp
@@ -1,3 +1,5 @@
+.objc_class_name_DOMHTMLImageElement
+.objc_class_name_DOMNode
.objc_class_name_DOMRange
.objc_class_name_WebCoreBridge
.objc_class_name_WebCoreCache
diff --git a/WebCore/kwq/DOM.mm b/WebCore/kwq/DOM.mm
index 2f6b7fd..1f866df 100644
--- a/WebCore/kwq/DOM.mm
+++ b/WebCore/kwq/DOM.mm
@@ -338,15 +338,6 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
@end
- at implementation DOMNode (DOMExtensions)
-
-- (NSString *)HTMLString
-{
- return [self _nodeImpl]->recursive_toHTML(true).getNSString();
-}
-
- at end
-
@implementation DOMNode (WebCoreInternal)
- (id)_initWithNodeImpl:(NodeImpl *)impl
diff --git a/WebCore/kwq/DOMExtensions.h b/WebCore/kwq/DOMExtensions.h
index cfc6ff3..5bba3a3 100644
--- a/WebCore/kwq/DOMExtensions.h
+++ b/WebCore/kwq/DOMExtensions.h
@@ -25,10 +25,6 @@
#import "DOMHTML.h"
- at interface DOMNode (DOMHTMLExtensions)
-- (NSString *)HTMLString; // FIXME: Should this be renamed innerHTML or outerHTML? Is this the same as innerHTML?
- at end
-
@interface DOMElement (DOMHTMLExtensions)
- (NSString *)innerHTML;
- (void)setInnerHTML:(NSString *)innerHTML;
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index 60fefea..63c6fcb 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -52,8 +52,9 @@ typedef khtml::RenderPart KHTMLRenderPart;
#endif
@class DOMDocument;
- at class DOMNode;
@class DOMElement;
+ at class DOMHTMLImageElement;
+ at class DOMNode;
@class DOMRange;
@class WebCoreSettings;
@@ -122,6 +123,8 @@ typedef enum {
BOOL _shouldCreateRenderers;
}
++ (WebCoreBridge *)bridgeForDOMDocument:(DOMDocument *)document;
+
- (void)initializeSettings:(WebCoreSettings *)settings;
- (void)setRenderPart:(KHTMLRenderPart *)renderPart;
@@ -246,6 +249,8 @@ typedef enum {
- (NSRect)visibleSelectionRect;
- (NSImage *)selectionImage;
+- (NSImage *)imageForImageElement:(DOMHTMLImageElement *)element;
+
- (DOMNode *)selectionStart;
- (int)selectionStartOffset;
- (DOMNode *)selectionEnd;
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index d49092c..caab38e 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -60,6 +60,7 @@
#import "KWQEditCommand.h"
#import "KWQFont.h"
#import "KWQFrame.h"
+#import "KWQKHTMLPart.h"
#import "KWQLoader.h"
#import "KWQPageState.h"
#import "KWQRenderTreeDebug.h"
@@ -147,6 +148,11 @@ static RootObject *rootForView(void *v)
static bool initializedObjectCacheSize = FALSE;
static bool initializedKJS = FALSE;
++ (WebCoreBridge *)bridgeForDOMDocument:(DOMDocument *)document
+{
+ return ((KWQKHTMLPart *)[document _documentImpl]->part())->bridge();
+}
+
- init
{
[super init];
@@ -1150,6 +1156,15 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
return selectionImage;
}
+- (NSImage *)imageForImageElement:(DOMHTMLImageElement *)element
+{
+ RenderImage *r = static_cast<RenderImage *>([element _nodeImpl]->renderer());
+ if (r && r->isImage() && !r->isDisplayingError()) {
+ return r->pixmap().image();
+ }
+ return nil;
+}
+
- (void)setName:(NSString *)name
{
_part->KHTMLPart::setName(QString::fromNSString(name));
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 153e479..2e869bb 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,40 @@
+2004-04-07 Chris Blumenberg <cblu at apple.com>
+
+ Created WebDOMOperations which are WebKit-specific categories on DOM objects.
+
+ Reviewed by rjw.
+
+ * DOM.subproj/DOMExtensions.h:
+ * DOM.subproj/WebDOMOperations.h: Added.
+ * DOM.subproj/WebDOMOperations.m: Added.
+ (-[DOMNode _bridge]): new
+ (-[DOMNode archive]): new
+ (-[DOMNode markupString]): new
+ (-[DOMRange _bridge]): new
+ (-[DOMRange archive]): new
+ (-[DOMRange markupString]): new
+ (-[DOMHTMLImageElement image]):
+ * WebCoreSupport.subproj/WebBridge.h:
+ * WebCoreSupport.subproj/WebBridge.m:
+ (-[WebBridge webFrame]): new
+ * WebKit.pbproj/project.pbxproj:
+ * WebView.subproj/WebDataSource.m:
+ (-[WebDataSource _archiveWithMarkupString:subresourceURLStrings:]): moved from WebHTMLRepresentation
+ * WebView.subproj/WebDataSourcePrivate.h:
+ * WebView.subproj/WebDefaultContextMenuDelegate.m:
+ (-[WebDefaultUIDelegate copyImageToClipboard:]): call markupString on the node
+ * WebView.subproj/WebDocumentPrivate.h:
+ * WebView.subproj/WebFrame.m:
+ (+[WebFrame frameForDOMDocument:]): new
+ (-[WebFrame loadArchive:]): renamed
+ * WebView.subproj/WebFramePrivate.h:
+ * WebView.subproj/WebHTMLRepresentation.h:
+ * WebView.subproj/WebHTMLRepresentation.m:
+ * WebView.subproj/WebHTMLRepresentationPrivate.h:
+ * WebView.subproj/WebHTMLView.m:
+ (-[WebHTMLView _selectedArchive:]): renamed
+ (-[WebHTMLView _handleMouseDragged:]): called renamed methods
+
2004-04-07 Darin Adler <darin at apple.com>
Reviewed by Chris.
diff --git a/WebKit/DOM.subproj/DOMExtensions.h b/WebKit/DOM.subproj/DOMExtensions.h
index cfc6ff3..5bba3a3 100644
--- a/WebKit/DOM.subproj/DOMExtensions.h
+++ b/WebKit/DOM.subproj/DOMExtensions.h
@@ -25,10 +25,6 @@
#import "DOMHTML.h"
- at interface DOMNode (DOMHTMLExtensions)
-- (NSString *)HTMLString; // FIXME: Should this be renamed innerHTML or outerHTML? Is this the same as innerHTML?
- at end
-
@interface DOMElement (DOMHTMLExtensions)
- (NSString *)innerHTML;
- (void)setInnerHTML:(NSString *)innerHTML;
diff --git a/WebKit/DOM.subproj/WebDOMOperations.h b/WebKit/DOM.subproj/WebDOMOperations.h
new file mode 100644
index 0000000..edea1e9
--- /dev/null
+++ b/WebKit/DOM.subproj/WebDOMOperations.h
@@ -0,0 +1,24 @@
+/*
+ WebDOMOperations.h
+ Copyright (C) 2004 Apple, Inc. All rights reserved.
+
+ Public header file.
+*/
+
+#import <WebKit/DOM.h>
+
+ at class WebArchive;
+
+ at interface DOMNode (WebDOMNodeOperations)
+- (WebArchive *)archive;
+- (NSString *)markupString;
+ at end
+
+ at interface DOMRange (WebDOMRangeOperations)
+- (WebArchive *)archive;
+- (NSString *)markupString;
+ at end
+
+ at interface DOMHTMLImageElement (WebDOMHTMLImageElementOperations)
+- (NSImage *)image;
+ at end
diff --git a/WebKit/DOM.subproj/WebDOMOperations.m b/WebKit/DOM.subproj/WebDOMOperations.m
new file mode 100644
index 0000000..8597660
--- /dev/null
+++ b/WebKit/DOM.subproj/WebDOMOperations.m
@@ -0,0 +1,71 @@
+/*
+ WebDOMOperations.m
+ Copyright 2004, Apple, Inc. All rights reserved.
+*/
+
+#import <WebKit/WebDOMOperations.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
+
+ at implementation DOMNode (WebDOMNodeOperations)
+
+- (WebBridge *)_bridge
+{
+ return (WebBridge *)[WebBridge bridgeForDOMDocument:[self ownerDocument]];
+}
+
+- (WebArchive *)archive
+{
+ WebBridge *bridge = [self _bridge];
+ NSArray *subresourceURLStrings;
+ NSString *markupString = [bridge markupStringFromNode:self subresourceURLStrings:&subresourceURLStrings];
+ return [[[bridge webFrame] dataSource] _archiveWithMarkupString:markupString subresourceURLStrings:subresourceURLStrings];
+}
+
+- (NSString *)markupString
+{
+ return [[self _bridge] markupStringFromNode:self subresourceURLStrings:nil];
+}
+
+ at end
+
+ at implementation DOMRange (WebDOMRangeOperations)
+
+- (WebBridge *)_bridge
+{
+ return [[self startContainer] _bridge];
+}
+
+- (WebArchive *)archive
+{
+ WebBridge *bridge = [self _bridge];
+ NSArray *subresourceURLStrings;
+ NSString *markupString = [bridge markupStringFromRange:self subresourceURLStrings:&subresourceURLStrings];
+ return [[[bridge webFrame] dataSource] _archiveWithMarkupString:markupString subresourceURLStrings:subresourceURLStrings];
+}
+
+- (NSString *)markupString
+{
+ return [[self _bridge] markupStringFromRange:self subresourceURLStrings:nil];
+}
+
+ at end
+
+ at implementation DOMHTMLImageElement (WebDOMHTMLImageElementOperations)
+
+- (NSImage *)image
+{
+ return [[self _bridge] imageForImageElement:self];
+}
+
+ at end
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.h b/WebKit/WebCoreSupport.subproj/WebBridge.h
index 6a085bf..d0d10e2 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.h
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.h
@@ -28,4 +28,6 @@
- (void)runOpenPanelForFileButtonWithResultListener:(id <WebOpenPanelResultListener>)resultListener;
- (BOOL)inNextKeyViewOutsideWebFrameViews;
+- (WebFrame *)webFrame;
+
@end
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index 15da3c6..4f200f4 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -112,6 +112,11 @@
[super dealloc];
}
+- (WebFrame *)webFrame
+{
+ return _frame;
+}
+
- (NSArray *)childFrames
{
ASSERT(_frame != nil);
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 259973c..33a7e03 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -348,6 +348,7 @@
51C16E090613868100A1657B,
51C16E4106138EB400A1657B,
83255720061DF71E007B8054,
+ 846171FB0624AE5B0071A4A3,
);
isa = PBXHeadersBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -464,6 +465,7 @@
EDD1A5C905C83987008E3150,
84311A1505EAAAF00088EDA4,
BE95BEE705FD0805006E1513,
+ 846171FC0624AE5B0071A4A3,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -2221,6 +2223,39 @@
);
};
};
+ 846171F90624AE5B0071A4A3 = {
+ fileEncoding = 4;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ name = WebDOMOperations.h;
+ path = DOM.subproj/WebDOMOperations.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ 846171FA0624AE5B0071A4A3 = {
+ fileEncoding = 4;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.objc;
+ name = WebDOMOperations.m;
+ path = DOM.subproj/WebDOMOperations.m;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ 846171FB0624AE5B0071A4A3 = {
+ fileRef = 846171F90624AE5B0071A4A3;
+ isa = PBXBuildFile;
+ settings = {
+ ATTRIBUTES = (
+ Private,
+ );
+ };
+ };
+ 846171FC0624AE5B0071A4A3 = {
+ fileRef = 846171FA0624AE5B0071A4A3;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
8467275C0367158500CA2ACA = {
fileEncoding = 30;
isa = PBXFileReference;
@@ -3797,6 +3832,8 @@
F57D194B034E734901A80180,
F57D194D034E734901A80180,
F57D1951034E734901A80180,
+ 846171F90624AE5B0071A4A3,
+ 846171FA0624AE5B0071A4A3,
);
isa = PBXGroup;
name = DOM;
diff --git a/WebKit/WebView.subproj/WebDataSource.m b/WebKit/WebView.subproj/WebDataSource.m
index be18ac8..48c303e 100644
--- a/WebKit/WebView.subproj/WebDataSource.m
+++ b/WebKit/WebView.subproj/WebDataSource.m
@@ -101,11 +101,6 @@
}
}
-- (NSDictionary *)_subresourcesDictionary
-{
- return _private->subresources;
-}
-
- (NSFileWrapper *)_fileWrapperForURL:(NSURL *)URL
{
if ([URL isFileURL]) {
@@ -128,6 +123,33 @@
return nil;
}
+- (WebArchive *)_archiveWithMarkupString:(NSString *)markupString subresourceURLStrings:(NSArray *)subresourceURLStrings
+{
+ NSURLResponse *response = [self response];
+ WebResource *mainResource = [[WebResource alloc] initWithData:[markupString dataUsingEncoding:NSUTF8StringEncoding]
+ URL:[response URL]
+ MIMEType:[response MIMEType]
+ textEncodingName:@"UTF-8"];
+
+ NSEnumerator *enumerator = [subresourceURLStrings objectEnumerator];
+ NSMutableArray *subresources = [[NSMutableArray alloc] init];
+ NSString *URLString;
+ while ((URLString = [enumerator nextObject]) != nil) {
+ WebResource *subresource = [_private->subresources objectForKey:URLString];
+ if (subresource) {
+ [subresources addObject:subresource];
+ } else {
+ ERROR("Failed to copy subresource because data source does not have subresource for %@", URLString);
+ }
+ }
+
+ WebArchive *webArchive = [[[WebArchive alloc] initWithMainResource:mainResource subresources:subresources] autorelease];
+ [mainResource release];
+ [subresources release];
+
+ return webArchive;
+}
+
- (WebView *)_webView
{
return _private->webView;
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.h b/WebKit/WebView.subproj/WebDataSourcePrivate.h
index ec8768f..a8f57d0 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.h
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.h
@@ -11,6 +11,7 @@
@class NSError;
@class NSURLRequest;
@class NSURLResponse;
+ at class WebArchive;
@class WebBaseResourceHandleDelegate;
@class WebBridge;
@class WebHistoryItem;
@@ -122,8 +123,8 @@
- (void)addSubresources:(NSArray *)subresources;
// Other private methods
-- (NSDictionary *)_subresourcesDictionary;
- (NSFileWrapper *)_fileWrapperForURL:(NSURL *)URL;
+- (WebArchive *)_archiveWithMarkupString:(NSString *)markupString subresourceURLStrings:(NSArray *)subresourceURLStrings;
- (NSError *)_mainDocumentError;
- (NSString *)_stringWithData:(NSData *)data;
diff --git a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
index 22a94d9..da94e00 100644
--- a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
+++ b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
@@ -10,6 +10,7 @@
#import <WebKit/WebBridge.h>
#import <WebKit/WebDataSourcePrivate.h>
#import <WebKit/WebDefaultUIDelegate.h>
+#import <WebKit/WebDOMOperations.h>
#import <WebKit/WebFramePrivate.h>
#import <WebKit/WebLocalizableStrings.h>
#import <WebKit/WebNSPasteboardExtras.h>
@@ -218,7 +219,7 @@
URL:linkURL ? linkURL : imageURL
title:[element objectForKey:WebElementImageAltStringKey]
fileWrapper:wrapper
- HTMLString:[[element objectForKey:WebCoreElementDOMNodeKey] HTMLString]];
+ HTMLString:[[element objectForKey:WebCoreElementDOMNodeKey] markupString]];
}
- (void)openFrameInNewWindow:(id)sender
diff --git a/WebKit/WebView.subproj/WebDocumentPrivate.h b/WebKit/WebView.subproj/WebDocumentPrivate.h
index e4b5c5a..c9ce9ae 100644
--- a/WebKit/WebView.subproj/WebDocumentPrivate.h
+++ b/WebKit/WebView.subproj/WebDocumentPrivate.h
@@ -14,14 +14,6 @@
- (NSImage *)image;
@end
- at protocol WebDocumentMarkup <NSObject>
-
+ at protocol WebDocumentDOM <NSObject>
- (DOMDocument *)DOMDocument;
-
-- (NSString *)markupStringFromNode:(DOMNode *)node;
-- (NSString *)markupStringFromRange:(DOMRange *)range;
-
-- (WebArchive *)webArchiveFromNode:(DOMNode *)node;
-- (WebArchive *)webArchiveFromRange:(DOMRange *)range;
-
@end
\ No newline at end of file
diff --git a/WebKit/WebView.subproj/WebFrame.m b/WebKit/WebView.subproj/WebFrame.m
index 47899a7..317924f 100644
--- a/WebKit/WebView.subproj/WebFrame.m
+++ b/WebKit/WebView.subproj/WebFrame.m
@@ -254,7 +254,12 @@ NSString *WebPageCacheDocumentViewKey = @"WebPageCacheDocumentViewKey";
@implementation WebFrame (WebPrivate)
-- (void)loadWebArchive:(WebArchive *)webArchive
++ (WebFrame *)frameForDOMDocument:(DOMDocument *)document
+{
+ return [(WebBridge *)[WebBridge bridgeForDOMDocument:document] webFrame];
+}
+
+- (void)loadArchive:(WebArchive *)webArchive
{
WebResource *mainResource = [webArchive mainResource];
if (mainResource) {
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index 1efcad6..05c6382 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -9,6 +9,7 @@
#import <WebKit/WebFrame.h>
#import <WebKit/WebPolicyDelegatePrivate.h>
+ at class DOMDocument;
@class DOMElement;
@class NSMutableURLRequest;
@class NSURLRequest;
@@ -118,7 +119,8 @@ extern NSString *WebPageCacheDocumentViewKey;
@interface WebFrame (WebPrivate)
// API Considerations:
-- (void)loadWebArchive:(WebArchive *)webArchive;
++ (WebFrame *)frameForDOMDocument:(DOMDocument *)document;
+- (void)loadArchive:(WebArchive *)webArchive;
// Other private methods
- (NSURLRequest *)_webDataRequestForData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)URL unreachableURL:(NSURL *)unreachableURL;
diff --git a/WebKit/WebView.subproj/WebHTMLRepresentation.h b/WebKit/WebView.subproj/WebHTMLRepresentation.h
index 6315f1e..081cd9f 100644
--- a/WebKit/WebView.subproj/WebHTMLRepresentation.h
+++ b/WebKit/WebView.subproj/WebHTMLRepresentation.h
@@ -20,7 +20,7 @@
/*!
@class WebHTMLRepresentation
*/
- at interface WebHTMLRepresentation : NSObject <WebDocumentRepresentation, WebDocumentMarkup>
+ at interface WebHTMLRepresentation : NSObject <WebDocumentRepresentation, WebDocumentDOM>
{
WebHTMLRepresentationPrivate *_private;
}
diff --git a/WebKit/WebView.subproj/WebHTMLRepresentation.m b/WebKit/WebView.subproj/WebHTMLRepresentation.m
index a6d98b4..84328cd 100644
--- a/WebKit/WebView.subproj/WebHTMLRepresentation.m
+++ b/WebKit/WebView.subproj/WebHTMLRepresentation.m
@@ -208,56 +208,4 @@
return [_private->bridge matchLabels:labels againstElement:element];
}
-- (WebArchive *)_webArchiveWithMarkupString:(NSString *)markupString subresourceURLStrings:(NSArray *)subresourceURLStrings
-{
- NSURLResponse *response = [_private->dataSource response];
- WebResource *mainResource = [[WebResource alloc] initWithData:[markupString dataUsingEncoding:NSUTF8StringEncoding]
- URL:[response URL]
- MIMEType:[response MIMEType]
- textEncodingName:@"UTF-8"];
-
- NSDictionary *subresourcesDictionary = [_private->dataSource _subresourcesDictionary];
- NSEnumerator *enumerator = [subresourceURLStrings objectEnumerator];
- NSMutableArray *subresources = [[NSMutableArray alloc] init];
- NSString *URLString;
- while ((URLString = [enumerator nextObject]) != nil) {
- WebResource *subresource = [subresourcesDictionary objectForKey:URLString];
- if (subresource) {
- [subresources addObject:subresource];
- } else {
- ERROR("Failed to copy subresource because data source does not have subresource for %@", URLString);
- }
- }
-
- WebArchive *webArchive = [[[WebArchive alloc] initWithMainResource:mainResource subresources:subresources] autorelease];
- [mainResource release];
- [subresources release];
-
- return webArchive;
-}
-
-- (NSString *)markupStringFromNode:(DOMNode *)node
-{
- return [_private->bridge markupStringFromNode:node subresourceURLStrings:nil];
-}
-
-- (NSString *)markupStringFromRange:(DOMRange *)range
-{
- return [_private->bridge markupStringFromRange:range subresourceURLStrings:nil];
-}
-
-- (WebArchive *)webArchiveFromNode:(DOMNode *)node
-{
- NSArray *subresourceURLStrings;
- NSString *markupString = [_private->bridge markupStringFromNode:node subresourceURLStrings:&subresourceURLStrings];
- return [self _webArchiveWithMarkupString:markupString subresourceURLStrings:subresourceURLStrings];
-}
-
-- (WebArchive *)webArchiveFromRange:(DOMRange *)range
-{
- NSArray *subresourceURLStrings;
- NSString *markupString = [_private->bridge markupStringFromRange:range subresourceURLStrings:&subresourceURLStrings];
- return [self _webArchiveWithMarkupString:markupString subresourceURLStrings:subresourceURLStrings];
-}
-
@end
diff --git a/WebKit/WebView.subproj/WebHTMLRepresentationPrivate.h b/WebKit/WebView.subproj/WebHTMLRepresentationPrivate.h
index 63f9e87..c4ff384 100644
--- a/WebKit/WebView.subproj/WebHTMLRepresentationPrivate.h
+++ b/WebKit/WebView.subproj/WebHTMLRepresentationPrivate.h
@@ -10,5 +10,4 @@
@interface WebHTMLRepresentation (WebPrivate)
- (WebBridge *)_bridge;
- (void)printDOMTree;
-- (WebArchive *)_webArchiveWithMarkupString:(NSString *)markupString subresourceURLStrings:(NSArray *)subresourceURLStrings;
@end
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 29f6319..a63005d 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -10,6 +10,7 @@
#import <WebKit/WebClipView.h>
#import <WebKit/WebDataSourcePrivate.h>
#import <WebKit/WebDocumentInternal.h>
+#import <WebKit/WebDOMOperations.h>
#import <WebKit/WebException.h>
#import <WebKit/WebFrame.h>
#import <WebKit/WebFramePrivate.h>
@@ -19,7 +20,7 @@
#import <WebKit/WebNetscapePluginEmbeddedView.h>
#import <WebKit/WebKitLogging.h>
#import <WebKit/WebNSPasteboardExtras.h>
-#import "WebNSPrintOperationExtras.h"
+#import <WebKit/WebNSPrintOperationExtras.h>
#import <WebKit/WebNSViewExtras.h>
#import <WebKit/WebPluginController.h>
#import <WebKit/WebResourcePrivate.h>
@@ -525,12 +526,11 @@ static WebHTMLView *lastHitView = nil;
return [NSArray arrayWithObjects:WebArchivePboardType, NSHTMLPboardType, NSRTFPboardType, NSRTFDPboardType, NSStringPboardType, nil];
}
-- (WebArchive *)_selectedWebArchive:(NSString **)markupString
+- (WebArchive *)_selectedArchive:(NSString **)markupString
{
NSArray *subresourceURLStrings;
- WebHTMLRepresentation *rep = [[self _dataSource] representation];
*markupString = [[self _bridge] markupStringFromRange:[[self _bridge] selectedDOMRange] subresourceURLStrings:&subresourceURLStrings];
- return [rep _webArchiveWithMarkupString:*markupString subresourceURLStrings:subresourceURLStrings];
+ return [[self _dataSource] _archiveWithMarkupString:*markupString subresourceURLStrings:subresourceURLStrings];
}
- (void)_writeSelectionToPasteboard:(NSPasteboard *)pasteboard
@@ -539,9 +539,9 @@ static WebHTMLView *lastHitView = nil;
// Put HTML on the pasteboard.
NSString *markupString;
- WebArchive *webArchive = [self _selectedWebArchive:&markupString];
+ WebArchive *archive = [self _selectedArchive:&markupString];
[pasteboard setString:markupString forType:NSHTMLPboardType];
- [pasteboard setData:[webArchive dataRepresentation] forType:WebArchivePboardType];
+ [pasteboard setData:[archive dataRepresentation] forType:WebArchivePboardType];
// Put attributed string on the pasteboard (RTF format).
NSAttributedString *attributedString = [self selectedAttributedString];
@@ -584,13 +584,13 @@ static WebHTMLView *lastHitView = nil;
NSString *markupString = nil;
if ([types containsObject:WebArchivePboardType]) {
- WebArchive *webArchive = [[WebArchive alloc] initWithData:[pasteboard dataForType:WebArchivePboardType]];
- WebResource *mainResource = [webArchive mainResource];
+ WebArchive *archive = [[WebArchive alloc] initWithData:[pasteboard dataForType:WebArchivePboardType]];
+ WebResource *mainResource = [archive mainResource];
if (mainResource) {
markupString = [[[NSString alloc] initWithData:[mainResource data] encoding:NSUTF8StringEncoding] autorelease];
- [[self _dataSource] addSubresources:[webArchive subresources]];
+ [[self _dataSource] addSubresources:[archive subresources]];
}
- [webArchive release];
+ [archive release];
}
if (!markupString && [types containsObject:NSHTMLPboardType]) {
@@ -719,7 +719,7 @@ static WebHTMLView *lastHitView = nil;
rect:[[element objectForKey:WebElementImageRectKey] rectValue]
URL:linkURL ? linkURL : imageURL
title:[element objectForKey:WebElementImageAltStringKey]
- HTMLString:[[element objectForKey:WebCoreElementDOMNodeKey] HTMLString]
+ HTMLString:[[element objectForKey:WebCoreElementDOMNodeKey] markupString]
event:_private->mouseDownEvent];
} else if (linkURL) {
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list