Changeset 48586 in webkit
- Timestamp:
- Sep 21, 2009, 11:01:10 AM (15 years ago)
- Location:
- trunk/WebKit
- Files:
-
- 4 added
- 4 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/ChangeLog
r48144 r48586 1 2009-09-21 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Anders Carlsson. 4 5 <rdar://problem/4137135> iFrame with PDF not being handled correctly on 6 usps.com 7 https://bugs.webkit.org/show_bug.cgi?id=4151 8 9 * WebKit.xcodeproj/project.pbxproj: Added WebPDFDocumentExtras.{h,mm} 10 and WebJSPDFDoc.{h,mm} and changed WebPDFRepresentation to 11 Objective-C++. 12 1 13 2009-09-07 Steve Block <steveblock@google.com> 2 14 -
trunk/WebKit/WebKit.xcodeproj/project.pbxproj
r48144 r48586 72 72 226E9E6B09D0AA8200F3A2BC /* WebNetscapeDeprecatedFunctions.c in Sources */ = {isa = PBXBuildFile; fileRef = 226E9E6909D0AA8200F3A2BC /* WebNetscapeDeprecatedFunctions.c */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; }; 73 73 22F219CC08D236730030E078 /* WebBackForwardListPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 22F219CB08D236730030E078 /* WebBackForwardListPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 74 37B6FB4E1063530C000FDB3B /* WebPDFDocumentExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 37B6FB4C1063530C000FDB3B /* WebPDFDocumentExtras.h */; }; 75 37B6FB4F1063530C000FDB3B /* WebPDFDocumentExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37B6FB4D1063530C000FDB3B /* WebPDFDocumentExtras.mm */; }; 76 37D1DCA81065928C0068F7EF /* WebJSPDFDoc.h in Headers */ = {isa = PBXBuildFile; fileRef = 37D1DCA61065928C0068F7EF /* WebJSPDFDoc.h */; }; 77 37D1DCA91065928C0068F7EF /* WebJSPDFDoc.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37D1DCA71065928C0068F7EF /* WebJSPDFDoc.mm */; }; 74 78 41F4484F10338E8C0030E55E /* WebWorkersPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 41F4484D10338E8C0030E55E /* WebWorkersPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 75 79 41F4485010338E8C0030E55E /* WebWorkersPrivate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 41F4484E10338E8C0030E55E /* WebWorkersPrivate.mm */; }; … … 292 296 9398111D0824BF01008DF038 /* WebArchive.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8373435B0624EE0D00F3B289 /* WebArchive.mm */; }; 293 297 9398111E0824BF01008DF038 /* WebPDFView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E94C3506C0321200A9B09E /* WebPDFView.mm */; }; 294 9398111F0824BF01008DF038 /* WebPDFRepresentation.m in Sources */ = {isa = PBXBuildFile; fileRef = 51E94C6906C0347500A9B09E /* WebPDFRepresentation.m */; };298 9398111F0824BF01008DF038 /* WebPDFRepresentation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E94C6906C0347500A9B09E /* WebPDFRepresentation.mm */; }; 295 299 939811260824BF01008DF038 /* WebPluginContainerCheck.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65E1150407EFFEBF009B8BF7 /* WebPluginContainerCheck.mm */; }; 296 300 939811290824BF01008DF038 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5C2869402846DCD018635CA /* Carbon.framework */; }; … … 410 414 35081D9602B6D4D80ACA2ACA /* WebHTMLViewPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebHTMLViewPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 411 415 35081DAE02B6D4F50ACA2ACA /* WebDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDocument.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 416 37B6FB4C1063530C000FDB3B /* WebPDFDocumentExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPDFDocumentExtras.h; sourceTree = "<group>"; }; 417 37B6FB4D1063530C000FDB3B /* WebPDFDocumentExtras.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPDFDocumentExtras.mm; sourceTree = "<group>"; }; 418 37D1DCA61065928C0068F7EF /* WebJSPDFDoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebJSPDFDoc.h; sourceTree = "<group>"; }; 419 37D1DCA71065928C0068F7EF /* WebJSPDFDoc.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = WebJSPDFDoc.mm; sourceTree = "<group>"; }; 412 420 3944606B020F50ED0ECA1767 /* WebDynamicScrollBarsView.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDynamicScrollBarsView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 413 421 3944606C020F50ED0ECA1767 /* WebDynamicScrollBarsView.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; indentWidth = 4; path = WebDynamicScrollBarsView.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; … … 465 473 51E94C3506C0321200A9B09E /* WebPDFView.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPDFView.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 466 474 51E94C6806C0347500A9B09E /* WebPDFRepresentation.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPDFRepresentation.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 467 51E94C6906C0347500A9B09E /* WebPDFRepresentation.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebPDFRepresentation.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };475 51E94C6906C0347500A9B09E /* WebPDFRepresentation.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPDFRepresentation.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 468 476 51FDC4D20B0AF5C100F84EB3 /* WebHistoryItemPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebHistoryItemPrivate.h; sourceTree = "<group>"; }; 469 477 5241ADF30B1BC48A004012BD /* WebCache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCache.h; sourceTree = "<group>"; }; … … 961 969 isa = PBXGroup; 962 970 children = ( 971 37D1DCA61065928C0068F7EF /* WebJSPDFDoc.h */, 972 37D1DCA71065928C0068F7EF /* WebJSPDFDoc.mm */, 973 37B6FB4C1063530C000FDB3B /* WebPDFDocumentExtras.h */, 974 37B6FB4D1063530C000FDB3B /* WebPDFDocumentExtras.mm */, 963 975 51E94C6806C0347500A9B09E /* WebPDFRepresentation.h */, 964 51E94C6906C0347500A9B09E /* WebPDFRepresentation.m */,976 51E94C6906C0347500A9B09E /* WebPDFRepresentation.mm */, 965 977 51E94C3406C0321200A9B09E /* WebPDFView.h */, 966 978 51E94C3506C0321200A9B09E /* WebPDFView.mm */, … … 1454 1466 41F4484F10338E8C0030E55E /* WebWorkersPrivate.h in Headers */, 1455 1467 59C77F4B105471E700506104 /* WebGeolocationMockPrivate.h in Headers */, 1468 37B6FB4E1063530C000FDB3B /* WebPDFDocumentExtras.h in Headers */, 1469 37D1DCA81065928C0068F7EF /* WebJSPDFDoc.h in Headers */, 1456 1470 ); 1457 1471 runOnlyForDeploymentPostprocessing = 0; … … 1760 1774 939810D00824BF01008DF038 /* WebPanelAuthenticationHandler.m in Sources */, 1761 1775 A7D3C5BD0B5773C5002CA450 /* WebPasteboardHelper.mm in Sources */, 1762 9398111F0824BF01008DF038 /* WebPDFRepresentation.m in Sources */,1776 9398111F0824BF01008DF038 /* WebPDFRepresentation.mm in Sources */, 1763 1777 9398111E0824BF01008DF038 /* WebPDFView.mm in Sources */, 1764 1778 939811260824BF01008DF038 /* WebPluginContainerCheck.mm in Sources */, … … 1786 1800 41F4485010338E8C0030E55E /* WebWorkersPrivate.mm in Sources */, 1787 1801 59C77F3510545F7E00506104 /* WebGeolocationMock.mm in Sources */, 1802 37B6FB4F1063530C000FDB3B /* WebPDFDocumentExtras.mm in Sources */, 1803 37D1DCA91065928C0068F7EF /* WebJSPDFDoc.mm in Sources */, 1788 1804 ); 1789 1805 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebKit/mac/ChangeLog
r48526 r48586 1 2009-09-21 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Anders Carlsson. 4 5 <rdar://problem/4137135> iFrame with PDF not being handled correctly on 6 usps.com 7 https://bugs.webkit.org/show_bug.cgi?id=4151 8 9 * WebView/WebJSPDFDoc.h: Added. 10 * WebView/WebJSPDFDoc.mm: Added. 11 (jsPDFDocInitialize): Retains the WebDataSource. 12 (jsPDFDocFinalize): Releases the WebDataSource. 13 (jsPDFDocPrint): Call the WebUIDelegate method -webView:printFrameView: 14 with the PDF document's view. 15 (makeJSPDFDoc): Makes and returns a JavaScript Doc instance that wraps 16 the WebDataSource. 17 * WebView/WebPDFDocumentExtras.h: Added. 18 * WebView/WebPDFDocumentExtras.mm: Added. 19 (appendValuesInPDFNameSubtreeToArray): Traverses a subtree of a PDF name 20 tree and adds all values in the subtree to an array. 21 (allValuesInPDFNameTree): Returns an array with all of the values in a 22 PDF name tree. 23 (web_PDFDocumentAllScripts): This is the implementation of -[PDFDocument 24 _web_allScripts]. It gets all values in the document-level "JavaScript" 25 name tree, which are action dictionaries, and returns an array of the 26 actions' scripts. 27 (addWebPDFDocumentExtras): Adds the -_web_allScripts method to 28 PDFDocument. 29 * WebView/WebPDFRepresentation.h: 30 * WebView/WebPDFRepresentation.m: Removed. 31 * WebView/WebPDFRepresentation.mm: Copied from WebKit/mac/WebView/WebPDFRepresentation.m. 32 (+[WebPDFRepresentation initialize]): Added. Calls 33 addWebPDFDocumentExtras(). 34 (-[WebPDFRepresentation finishedLoadingWithDataSource:]): Get the 35 scripts from the PDF document, create a JavaScript Doc object for the 36 document, and a JavaScript execution context, then execute every script 37 in the context, with the Doc object as "this". 38 1 39 2009-09-17 Simon Fraser <simon.fraser@apple.com> 2 40 -
trunk/WebKit/mac/WebView/WebPDFRepresentation.h
r11962 r48586 27 27 */ 28 28 29 #import <Foundation/Foundation.h>29 #import "WebDocument.h" 30 30 31 31 @protocol WebDocumentRepresentation; -
trunk/WebKit/mac/WebView/WebPDFRepresentation.mm
r48585 r48586 27 27 */ 28 28 29 #import <WebKit/WebDataSourcePrivate.h> 30 #import <WebKit/WebFrame.h> 31 #import <WebKit/WebFrameView.h> 32 #import <WebKit/WebNSObjectExtras.h> 33 #import <WebKit/WebPDFRepresentation.h> 34 #import <WebKit/WebPDFView.h> 35 #import <wtf/Assertions.h> 29 #import "WebPDFRepresentation.h" 36 30 37 #import <PDFKit/PDFDocument.h> 31 #import "WebDataSourcePrivate.h" 32 #import "WebFrame.h" 33 #import "WebJSPDFDoc.h" 34 #import "WebNSObjectExtras.h" 35 #import "WebPDFDocumentExtras.h" 36 #import "WebPDFView.h" 37 #import <JavaScriptCore/Assertions.h> 38 #import <JavaScriptCore/JSContextRef.h> 39 #import <JavaScriptCore/JSStringRef.h> 40 #import <JavaScriptCore/JSStringRefCF.h> 38 41 39 42 @implementation WebPDFRepresentation … … 65 68 } 66 69 return PDFDocumentClass; 70 } 71 72 + (void)initialize 73 { 74 if (self != [WebPDFRepresentation class]) 75 return; 76 77 Class pdfDocumentClass = [self PDFDocumentClass]; 78 if (pdfDocumentClass) 79 addWebPDFDocumentExtras(pdfDocumentClass); 67 80 } 68 81 … … 122 135 PDFDocument *doc = [[[[self class] PDFDocumentClass] alloc] initWithData:data]; 123 136 [view setPDFDocument:doc]; 137 138 NSArray *scripts = [doc _web_allScripts]; 124 139 [doc release]; 140 doc = nil; 141 142 NSUInteger scriptCount = [scripts count]; 143 if (!scriptCount) 144 return; 145 146 JSGlobalContextRef ctx = JSGlobalContextCreate(0); 147 JSObjectRef jsPDFDoc = makeJSPDFDoc(ctx, dataSource); 148 149 for (NSUInteger i = 0; i < scriptCount; ++i) { 150 JSStringRef script = JSStringCreateWithCFString((CFStringRef)[scripts objectAtIndex:i]); 151 JSEvaluateScript(ctx, script, jsPDFDoc, 0, 0, 0); 152 JSStringRelease(script); 153 } 154 155 JSGlobalContextRelease(ctx); 125 156 } 126 127 157 128 158 - (BOOL)canProvideDocumentSource
Note:
See TracChangeset
for help on using the changeset viewer.