diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2010-11-20 22:17:28 -0800 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2010-11-20 22:17:28 -0800 |
commit | 7e37a67619923da62b21ca0d4527ccd5ec0bf1b7 (patch) | |
tree | f35e2cfbc1f7983408b53674f92bbb5df9ce4bb8 /UICaboodle | |
parent | 6a575b5e80ea78e300112949b58ab7315f7c40b4 (diff) |
Make cydia.setViewportWidth() work again with CYWebView.
Diffstat (limited to 'UICaboodle')
-rw-r--r-- | UICaboodle/BrowserView.h | 1 | ||||
-rw-r--r-- | UICaboodle/BrowserView.mm | 18 |
2 files changed, 18 insertions, 1 deletions
diff --git a/UICaboodle/BrowserView.h b/UICaboodle/BrowserView.h index e2da3c0..22a4f10 100644 --- a/UICaboodle/BrowserView.h +++ b/UICaboodle/BrowserView.h @@ -38,6 +38,7 @@ - (bool) webView:(WebView *)view shouldRunJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame; - (bool) webView:(WebView *)view shouldRunJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame; - (bool) webView:(WebView *)view shouldRunJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)text initiatedByFrame:(WebFrame *)frame; +- (void) webViewUpdateViewSettings:(UIWebView *)view; @end @interface CYWebView : UIWebView diff --git a/UICaboodle/BrowserView.mm b/UICaboodle/BrowserView.mm index e446d60..705c7e1 100644 --- a/UICaboodle/BrowserView.mm +++ b/UICaboodle/BrowserView.mm @@ -376,6 +376,14 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se } // }}} +- (void) _updateViewSettings { + [super _updateViewSettings]; + + id<CYWebViewDelegate> delegate([self delegate]); + if ([delegate respondsToSelector:@selector(webViewUpdateViewSettings:)]) + [delegate webViewUpdateViewSettings:self]; +} + + (void) initialize { if (Class $UIWebViewWebViewDelegate = objc_getClass("UIWebViewWebViewDelegate")) { class_addMethod($UIWebViewWebViewDelegate, @selector(webView:decidePolicyForNewWindowAction:request:newFrameName:decisionListener:), (IMP) &$UIWebViewWebViewDelegate$webView$decidePolicyForNewWindowAction$request$newFrameName$decisionListener$, "v28@0:4@8@12@16@20@24"); @@ -552,9 +560,17 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se closer_ = [function retain]; } +- (void) _setViewportWidth { + [[webview_ _documentView] setViewportSize:CGSizeMake(width_, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x10]; +} + - (void) setViewportWidth:(float)width { width_ = width != 0 ? width : [[self class] defaultWidth]; - [[webview_ _documentView] setViewportSize:CGSizeMake(width_, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x10]; + [self _setViewportWidth]; +} + +- (void) webViewUpdateViewSettings:(UIWebView *)view { + [self _setViewportWidth]; } - (void) _openMailToURL:(NSURL *)url { |