From 6a2e2be4905a5bfe7c39ef8acaaef3f6c46d2b91 Mon Sep 17 00:00:00 2001 From: sullivan Date: Tue, 14 Jun 2005 18:06:00 +0000 Subject: [PATCH 1/1] Changes by Devin Lane. Reviewed by me. - fixed PDF viewing could use a zoom control other than the one in the context menu * WebView.subproj/WebPDFView.h: now implements protocol _web_WebDocumentTextSizing * WebView.subproj/WebPDFView.m: (-[WebPDFView _updateScalingToReflectTextSize]): new method, sets the PDF scaling from the text size multiplier (-[WebPDFView setDataSource:]): call _updateScalingToReflectTextSize (-[WebPDFView _web_textSizeMultiplierChanged]): implementation of protocol _web_WebDocumentTextSizing, calls _updateScalingToReflectTextSize git-svn-id: https://svn.webkit.org/repository/webkit/trunk@9393 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- WebKit/ChangeLog | 17 +++++++++++++++++ WebKit/WebView.subproj/WebPDFView.h | 4 +++- WebKit/WebView.subproj/WebPDFView.m | 20 ++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog index 653c7cb..27d2277 100644 --- a/WebKit/ChangeLog +++ b/WebKit/ChangeLog @@ -1,5 +1,22 @@ 2005-06-14 John Sullivan + Changes by Devin Lane. + Reviewed by me. + + - fixed PDF viewing could use a zoom control other than the one in the context menu + + * WebView.subproj/WebPDFView.h: + now implements protocol _web_WebDocumentTextSizing + * WebView.subproj/WebPDFView.m: + (-[WebPDFView _updateScalingToReflectTextSize]): + new method, sets the PDF scaling from the text size multiplier + (-[WebPDFView setDataSource:]): + call _updateScalingToReflectTextSize + (-[WebPDFView _web_textSizeMultiplierChanged]): + implementation of protocol _web_WebDocumentTextSizing, calls _updateScalingToReflectTextSize + +2005-06-14 John Sullivan + Reviewed by Dave Harrison. * WebView.subproj/WebHTMLView.m: diff --git a/WebKit/WebView.subproj/WebPDFView.h b/WebKit/WebView.subproj/WebPDFView.h index ecac153..93489d6 100644 --- a/WebKit/WebView.subproj/WebPDFView.h +++ b/WebKit/WebView.subproj/WebPDFView.h @@ -31,7 +31,9 @@ @class PDFView; @class WebDataSource; -@interface WebPDFView : NSView +@protocol _web_WebDocumentTextSizing; + +@interface WebPDFView : NSView { PDFView *PDFSubview; WebDataSource *dataSource; diff --git a/WebKit/WebView.subproj/WebPDFView.m b/WebKit/WebView.subproj/WebPDFView.m index 7ba8beb..0e0ee65 100644 --- a/WebKit/WebView.subproj/WebPDFView.m +++ b/WebKit/WebView.subproj/WebPDFView.m @@ -30,9 +30,12 @@ #import #import +#import +#import #import #import #import +#import #import @@ -188,10 +191,22 @@ static void applicationInfoForMIMEType(NSString *type, NSString **name, NSImage return menu; } +- (void)_updateScalingToReflectTextSize +{ + WebView *view = [[dataSource webFrame] webView]; + + // The scale factor and text size multiplier conveniently use the same units, so we can just + // treat the values as interchangeable. + if (view != nil) { + [PDFSubview setScaleFactor:[view textSizeMultiplier]]; + } +} + - (void)setDataSource:(WebDataSource *)ds { dataSource = ds; [self setFrame:[[self superview] frame]]; + [self _updateScalingToReflectTextSize]; } - (void)dataSourceUpdated:(WebDataSource *)dataSource @@ -231,6 +246,11 @@ static void applicationInfoForMIMEType(NSString *type, NSString **name, NSImage } } +- (void)_web_textSizeMultiplierChanged +{ + [self _updateScalingToReflectTextSize]; +} + - (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag; { int options = 0; -- 1.8.3.1