X-Git-Url: https://git.saurik.com/cydia.git/blobdiff_plain/670a04941260717d9759a85b8d20585bc976e56e..ebffe5ce84afa3a899197eb2dce8babbf32efc8c:/UICaboodle/BrowserView.mm diff --git a/UICaboodle/BrowserView.mm b/UICaboodle/BrowserView.mm index 61437118..caa2ba28 100644 --- a/UICaboodle/BrowserView.mm +++ b/UICaboodle/BrowserView.mm @@ -12,8 +12,12 @@ extern NSString * const kCAFilterNearest; #define ForSaurik 0 +static bool Wildcat_; + static CFArrayRef (*$GSSystemCopyCapability)(CFStringRef); static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); +static Class $UIFormAssistant; +static Class $UIWebBrowserView; @interface NSString (UIKit) - (NSString *) stringByAddingPercentEscapes; @@ -166,6 +170,15 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); $GSSystemCopyCapability = reinterpret_cast(dlsym(RTLD_DEFAULT, "GSSystemCopyCapability")); $GSSystemGetCapability = reinterpret_cast(dlsym(RTLD_DEFAULT, "GSSystemGetCapability")); + $UIFormAssistant = objc_getClass("UIFormAssistant"); + + $UIWebBrowserView = objc_getClass("UIWebBrowserView"); + if ($UIWebBrowserView == nil) { + Wildcat_ = false; + $UIWebBrowserView = objc_getClass("UIWebDocumentView"); + } else { + Wildcat_ = true; + } } - (void) dealloc { @@ -178,7 +191,7 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); WebThreadLock(); - WebView *webview = [webview_ webView]; + WebView *webview = [document_ webView]; [webview setFrameLoadDelegate:nil]; [webview setResourceLoadDelegate:nil]; [webview setUIDelegate:nil]; @@ -194,10 +207,13 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); /* XXX: no one sets this, ever [webview setWebMailDelegate:nil];*/ - [webview_ setDelegate:nil]; - [webview_ setGestureDelegate:nil]; - [webview_ setFormEditingDelegate:nil]; - [webview_ setInteractionDelegate:nil]; + [document_ setDelegate:nil]; + [document_ setGestureDelegate:nil]; + + if ([document_ respondsToSelector:@selector(setFormEditingDelegate:)]) + [document_ setFormEditingDelegate:nil]; + + [document_ setInteractionDelegate:nil]; [indirect_ setDelegate:nil]; @@ -206,10 +222,10 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); [webview close]; #if RecycleWebViews - [webview_ removeFromSuperview]; - [Documents_ addObject:[webview_ autorelease]]; + [document_ removeFromSuperview]; + [Documents_ addObject:[document_ autorelease]]; #else - [webview_ release]; + [document_ release]; #endif [indirect_ release]; @@ -246,7 +262,7 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); [self loadRequest:[NSURLRequest requestWithURL:url cachePolicy:policy - timeoutInterval:30.0 + timeoutInterval:120.0 ]]; } @@ -259,7 +275,7 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); error_ = false; WebThreadLock(); - [webview_ loadRequest:request]; + [document_ loadRequest:request]; WebThreadUnlock(); } @@ -278,26 +294,29 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); context:@"submit" ] autorelease]; + [sheet setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)]; + [sheet setNumberOfRows:1]; [sheet popupAlertAnimated:YES]; } } - (WebView *) webView { - return [webview_ webView]; + return [document_ webView]; } - (UIWebDocumentView *) documentView { - return webview_; + return document_; } /* XXX: WebThreadLock? */ - (void) _fixScroller:(CGRect)bounds { float extra; - if (!editing_) + + if (!editing_ || $UIFormAssistant == nil) extra = 0; else { - UIFormAssistant *assistant([UIFormAssistant sharedFormAssistant]); + UIFormAssistant *assistant([$UIFormAssistant sharedFormAssistant]); CGRect peripheral([assistant peripheralFrame]); #if LogBrowser NSLog(@"per:%f", peripheral.size.height); @@ -307,20 +326,22 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); CGRect subrect([scroller_ frame]); subrect.size.height -= extra; - [scroller_ setScrollerIndicatorSubrect:subrect]; - NSSize visible(NSMakeSize(subrect.size.width, subrect.size.height)); - [webview_ setValue:[NSValue valueWithSize:visible] forGestureAttribute:UIGestureAttributeVisibleSize]; + if ([scroller_ respondsToSelector:@selector(setScrollerIndicatorSubrect:)]) + [scroller_ setScrollerIndicatorSubrect:subrect]; + + [document_ setValue:[NSValue valueWithSize:NSMakeSize(subrect.size.width, subrect.size.height)] forGestureAttribute:UIGestureAttributeVisibleSize]; CGSize size(size_); size.height += extra; [scroller_ setContentSize:size]; - [scroller_ releaseRubberBandIfNecessary]; + if ([scroller_ respondsToSelector:@selector(releaseRubberBandIfNecessary)]) + [scroller_ releaseRubberBandIfNecessary]; } - (void) fixScroller { - CGRect bounds([webview_ documentBounds]); + CGRect bounds([document_ documentBounds]); #if TrackResize NSLog(@"_fs:(%f,%f+%f,%f)", bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height); #endif @@ -407,6 +428,8 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); context:@"sensitive" ] autorelease]; + [sheet setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)]; + NSString *host(@"XXX"); [sheet setNumberOfRows:1]; @@ -449,6 +472,8 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); context:@"alert" ] autorelease]; + [sheet setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)]; + [sheet setBodyText:message]; [sheet popupAlertAnimated:YES]; } @@ -466,6 +491,8 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); context:@"confirm" ] autorelease]; + [sheet setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)]; + [sheet setNumberOfRows:1]; [sheet setBodyText:message]; [sheet popupAlertAnimated:YES]; @@ -622,7 +649,7 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); // XXX: handle more mime types! [listener ignore]; - WebView *webview([webview_ webView]); + WebView *webview([document_ webView]); if (frame == [webview mainFrame]) [UIApp openURL:[request URL]]; } @@ -649,7 +676,7 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); [listener use]; - WebView *webview([webview_ webView]); + WebView *webview([document_ webView]); if (frame == [webview mainFrame]) [self _pushPage]; return; @@ -784,7 +811,7 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); case 2: if (request_ != nil) { WebThreadLock(); - [webview_ loadRequest:request_]; + [document_ loadRequest:request_]; WebThreadUnlock(); } break; @@ -812,6 +839,8 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); context:@"challenge" ] autorelease]; + [sheet setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)]; + [sheet setNumberOfRows:1]; [sheet addTextFieldWithValue:@"" label:UCLocalize("USERNAME")]; @@ -897,7 +926,7 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); [loading_ addObject:[NSValue valueWithNonretainedObject:frame]]; if ([frame parentFrame] == nil) { - [webview_ resignFirstResponder]; + [document_ resignFirstResponder]; reloading_ = false; @@ -938,7 +967,16 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); [book_ reloadTitleForPage:self]; - [scroller_ scrollPointVisibleAtTopLeft:CGPointZero]; + if (Wildcat_) { + CGRect webrect = [scroller_ bounds]; + webrect.size.height = 1; + [document_ setFrame:webrect]; + } + + if ([scroller_ respondsToSelector:@selector(scrollPointVisibleAtTopLeft:)]) + [scroller_ scrollPointVisibleAtTopLeft:CGPointZero]; + else + [scroller_ scrollRectToVisible:CGRectZero animated:NO]; if ([scroller_ respondsToSelector:@selector(setZoomScale:duration:)]) [scroller_ setZoomScale:1 duration:0]; @@ -947,9 +985,11 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); /*else if ([scroller_ respondsToSelector:@selector(setZoomScale:animated:)]) [scroller_ setZoomScale:1 animated:NO];*/ - CGRect webrect = [scroller_ bounds]; - webrect.size.height = 0; - [webview_ setFrame:webrect]; + if (!Wildcat_) { + CGRect webrect = [scroller_ bounds]; + webrect.size.height = 0; + [document_ setFrame:webrect]; + } } [self reloadButtons]; @@ -979,24 +1019,24 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); } - (BOOL) webView:(WebView *)sender shouldScrollToPoint:(struct CGPoint)point forFrame:(WebFrame *)frame { - return [webview_ webView:sender shouldScrollToPoint:point forFrame:frame]; + return [document_ webView:sender shouldScrollToPoint:point forFrame:frame]; } - (void) webView:(WebView *)sender didReceiveViewportArguments:(id)arguments forFrame:(WebFrame *)frame { - return [webview_ webView:sender didReceiveViewportArguments:arguments forFrame:frame]; + return [document_ webView:sender didReceiveViewportArguments:arguments forFrame:frame]; } - (void) webView:(WebView *)sender needsScrollNotifications:(id)notifications forFrame:(WebFrame *)frame { - return [webview_ webView:sender needsScrollNotifications:notifications forFrame:frame]; + return [document_ webView:sender needsScrollNotifications:notifications forFrame:frame]; } - (void) webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)frame { [self _pushPage]; - return [webview_ webView:sender didCommitLoadForFrame:frame]; + return [document_ webView:sender didCommitLoadForFrame:frame]; } - (void) webView:(WebView *)sender didReceiveDocTypeForFrame:(WebFrame *)frame { - return [webview_ webView:sender didReceiveDocTypeForFrame:frame]; + return [document_ webView:sender didReceiveDocTypeForFrame:frame]; } - (void) webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame { @@ -1045,7 +1085,7 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); } } - return [webview_ webView:sender didFinishLoadForFrame:frame]; + return [document_ webView:sender didFinishLoadForFrame:frame]; } - (void) _didFailWithError:(NSError *)error forFrame:(WebFrame *)frame { @@ -1071,6 +1111,8 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); - (void) webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame { [self _didFailWithError:error forFrame:frame]; + if ([document_ respondsToSelector:@selector(webView:didFailLoadWithError:forFrame:)]) + [document_ webView:sender didFailLoadWithError:error forFrame:frame]; } - (void) webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame { @@ -1083,18 +1125,100 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); #endif } +- (void) webView:(WebView *)sender didReceiveMessage:(NSDictionary *)dictionary { +#if LogBrowser || ForSaurik + lprintf("Console:%s\n", [[dictionary description] UTF8String]); +#endif + if ([document_ respondsToSelector:@selector(webView:didReceiveMessage:)]) + [document_ webView:sender didReceiveMessage:dictionary]; +} + +- (void) webView:(id)sender willCloseFrame:(id)frame { + if ([document_ respondsToSelector:@selector(webView:willCloseFrame:)]) + [document_ webView:sender willCloseFrame:frame]; +} + +- (void) webView:(id)sender didFinishDocumentLoadForFrame:(id)frame { + if ([document_ respondsToSelector:@selector(webView:didFinishDocumentLoadForFrame:)]) + [document_ webView:sender didFinishDocumentLoadForFrame:frame]; +} + +- (void) webView:(id)sender didFirstLayoutInFrame:(id)frame { + if ([document_ respondsToSelector:@selector(webView:didFirstLayoutInFrame:)]) + [document_ webView:sender didFirstLayoutInFrame:frame]; +} + +- (void) webViewFormEditedStatusHasChanged:(id)changed { + if ([document_ respondsToSelector:@selector(webViewFormEditedStatusHasChanged:)]) + [document_ webViewFormEditedStatusHasChanged:changed]; +} + +- (void) webView:(id)sender formStateDidFocusNode:(id)formState { + if ([document_ respondsToSelector:@selector(webView:formStateDidFocusNode:)]) + [document_ webView:sender formStateDidFocusNode:formState]; +} + +- (void) webView:(id)sender formStateDidBlurNode:(id)formState { + if ([document_ respondsToSelector:@selector(webView:formStateDidBlurNode:)]) + [document_ webView:sender formStateDidBlurNode:formState]; +} + /* XXX: fix this stupid include file - (void) webView:(WebView *)sender frame:(WebFrame *)frame exceededDatabaseQuotaForSecurityOrigin:(WebSecurityOrigin *)origin database:(NSString *)database { [origin setQuota:0x500000]; }*/ +- (void) webViewDidLayout:(id)sender { + [document_ webViewDidLayout:sender]; +} + +- (void) webView:(id)sender didFirstVisuallyNonEmptyLayoutInFrame:(id)frame { + [document_ webView:sender didFirstVisuallyNonEmptyLayoutInFrame:frame]; +} + +- (void) webView:(id)sender saveStateToHistoryItem:(id)item forFrame:(id)frame { + [document_ webView:sender saveStateToHistoryItem:item forFrame:frame]; +} + +- (void) webView:(id)sender restoreStateFromHistoryItem:(id)item forFrame:(id)frame force:(BOOL)force { + [document_ webView:sender restoreStateFromHistoryItem:item forFrame:frame force:force]; +} + +- (void) webView:(id)sender attachRootLayer:(id)layer { + [document_ webView:sender attachRootLayer:layer]; +} + +- (id) webView:(id)sender plugInViewWithArguments:(id)arguments fromPlugInPackage:(id)package { + return [document_ webView:sender plugInViewWithArguments:arguments fromPlugInPackage:package]; +} + +- (void) webView:(id)sender willShowFullScreenForPlugInView:(id)view { + [document_ webView:sender willShowFullScreenForPlugInView:view]; +} + +- (void) webView:(id)sender didHideFullScreenForPlugInView:(id)view { + [document_ webView:sender didHideFullScreenForPlugInView:view]; +} + +- (void) webView:(id)sender willAddPlugInView:(id)view { + [document_ webView:sender willAddPlugInView:view]; +} + +- (void) webView:(id)sender didObserveDeferredContentChange:(int)change forFrame:(id)frame { + [document_ webView:sender didObserveDeferredContentChange:change forFrame:frame]; +} + +- (void) webViewDidPreventDefaultForEvent:(id)sender { + [document_ webViewDidPreventDefaultForEvent:sender]; +} + - (void) _setTileDrawingEnabled:(BOOL)enabled { - //[webview_ setTileDrawingEnabled:enabled]; + //[document_ setTileDrawingEnabled:enabled]; } - (void) setViewportWidth:(float)width { width_ = width != 0 ? width : [[self class] defaultWidth]; - [webview_ setViewportSize:CGSizeMake(width_, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x10]; + [document_ setViewportSize:CGSizeMake(width_, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x10]; } - (void) willStartGesturesInView:(UIView *)view forEvent:(GSEventRef)event { @@ -1103,7 +1227,7 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); - (void) didFinishGesturesInView:(UIView *)view forEvent:(GSEventRef)event { [self _setTileDrawingEnabled:YES]; - [webview_ redrawScaledDocument]; + [document_ redrawScaledDocument]; } - (void) scrollerWillStartDragging:(UIScroller *)scroller { @@ -1126,7 +1250,7 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); struct CGRect bounds = [self bounds]; - scroller_ = [[UIScroller alloc] initWithFrame:bounds]; + scroller_ = [[objc_getClass(Wildcat_ ? "UIScrollView" : "UIScroller") alloc] initWithFrame:bounds]; [self addSubview:scroller_]; [scroller_ setFixedBackgroundPattern:YES]; @@ -1134,18 +1258,34 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); [scroller_ setScrollingEnabled:YES]; [scroller_ setClipsSubviews:YES]; - [scroller_ setAllowsRubberBanding:YES]; + + if (!Wildcat_) + [scroller_ setAllowsRubberBanding:YES]; [scroller_ setDelegate:self]; [scroller_ setBounces:YES]; - [scroller_ setScrollHysteresis:8]; - [scroller_ setThumbDetectionEnabled:NO]; - [scroller_ setDirectionalScrolling:YES]; - [scroller_ setScrollDecelerationFactor:0.99]; /* 0.989324 */ - [scroller_ setEventMode:YES]; + + if (!Wildcat_) { + [scroller_ setScrollHysteresis:8]; + [scroller_ setThumbDetectionEnabled:NO]; + [scroller_ setDirectionalScrolling:YES]; + //[scroller_ setScrollDecelerationFactor:0.99]; /* 0.989324 */ + [scroller_ setEventMode:YES]; + } + + if (Wildcat_) { + UIScrollView *scroller((UIScrollView *)scroller_); + //[scroller setDirectionalLockEnabled:NO]; + [scroller setDelaysContentTouches:NO]; + //[scroller setScrollsToTop:NO]; + //[scroller setCanCancelContentTouches:NO]; + } + [scroller_ setShowBackgroundShadow:NO]; /* YES */ - [scroller_ setAllowsRubberBanding:YES]; /* Vertical */ - [scroller_ setAdjustForContentSizeChange:YES]; /* NO */ + //[scroller_ setAllowsRubberBanding:YES]; /* Vertical */ + + if (!Wildcat_) + [scroller_ setAdjustForContentSizeChange:YES]; /* NO */ CGRect webrect = [scroller_ bounds]; webrect.size.height = 0; @@ -1155,68 +1295,67 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); WebThreadLock(); #if RecycleWebViews - webview_ = [Documents_ lastObject]; - if (webview_ != nil) { - webview_ = [webview_ retain]; - webview = [webview_ webView]; + document_ = [Documents_ lastObject]; + if (document_ != nil) { + document_ = [document_ retain]; + webview = [document_ webView]; [Documents_ removeLastObject]; - [webview_ setFrame:webrect]; + [document_ setFrame:webrect]; } else { #else if (true) { #endif - webview_ = [[UIWebDocumentView alloc] initWithFrame:webrect]; - webview = [webview_ webView]; + document_ = [[$UIWebBrowserView alloc] initWithFrame:webrect]; + webview = [document_ webView]; // XXX: this is terribly (too?) expensive - //[webview_ setDrawsBackground:NO]; + //[document_ setDrawsBackground:NO]; [webview setPreferencesIdentifier:@"Cydia"]; - [webview_ setTileSize:CGSizeMake(webrect.size.width, 500)]; + [document_ setTileSize:CGSizeMake(webrect.size.width, 500)]; - if ([webview_ respondsToSelector:@selector(enableReachability)]) - [webview_ enableReachability]; + if ([document_ respondsToSelector:@selector(enableReachability)]) + [document_ enableReachability]; + if ([document_ respondsToSelector:@selector(setAllowsMessaging:)]) + [document_ setAllowsMessaging:YES]; + if ([document_ respondsToSelector:@selector(useSelectionAssistantWithMode:)]) + [document_ useSelectionAssistantWithMode:0]; - [webview_ setAllowsMessaging:YES]; + [document_ setTilingEnabled:YES]; + [document_ setDrawsGrid:NO]; + [document_ setLogsTilingChanges:NO]; + [document_ setTileMinificationFilter:kCAFilterNearest]; - if ([webview_ respondsToSelector:@selector(useSelectionAssistantWithMode:)]) - [webview_ useSelectionAssistantWithMode:0]; - - [webview_ setTilingEnabled:YES]; - [webview_ setDrawsGrid:NO]; - [webview_ setLogsTilingChanges:NO]; - [webview_ setTileMinificationFilter:kCAFilterNearest]; - - if ([webview_ respondsToSelector:@selector(setDataDetectorTypes:)]) + if ([document_ respondsToSelector:@selector(setDataDetectorTypes:)]) /* XXX: abstractify */ - [webview_ setDataDetectorTypes:0x80000000]; + [document_ setDataDetectorTypes:0x80000000]; else - [webview_ setDetectsPhoneNumbers:NO]; + [document_ setDetectsPhoneNumbers:NO]; - [webview_ setAutoresizes:YES]; + [document_ setAutoresizes:YES]; - [webview_ setMinimumScale:0.25f forDocumentTypes:0x10]; - [webview_ setMaximumScale:5.00f forDocumentTypes:0x10]; - [webview_ setInitialScale:UIWebViewScalesToFitScale forDocumentTypes:0x10]; - //[webview_ setViewportSize:CGSizeMake(980, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x10]; + [document_ setMinimumScale:0.25f forDocumentTypes:0x10]; + [document_ setMaximumScale:5.00f forDocumentTypes:0x10]; + [document_ setInitialScale:UIWebViewScalesToFitScale forDocumentTypes:0x10]; + //[document_ setViewportSize:CGSizeMake(980, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x10]; - [webview_ setViewportSize:CGSizeMake(320, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x2]; + [document_ setViewportSize:CGSizeMake(320, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x2]; - [webview_ setMinimumScale:1.00f forDocumentTypes:0x8]; - [webview_ setInitialScale:UIWebViewScalesToFitScale forDocumentTypes:0x8]; - [webview_ setViewportSize:CGSizeMake(320, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x8]; + [document_ setMinimumScale:1.00f forDocumentTypes:0x8]; + [document_ setInitialScale:UIWebViewScalesToFitScale forDocumentTypes:0x8]; + [document_ setViewportSize:CGSizeMake(320, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x8]; - [webview_ _setDocumentType:0x4]; + [document_ _setDocumentType:0x4]; - if ([webview_ respondsToSelector:@selector(UIWebDocumentView:)]) - [webview_ setZoomsFocusedFormControl:YES]; - [webview_ setContentsPosition:7]; - [webview_ setEnabledGestures:0xa]; - [webview_ setValue:[NSNumber numberWithBool:YES] forGestureAttribute:UIGestureAttributeIsZoomRubberBandEnabled]; - [webview_ setValue:[NSNumber numberWithBool:YES] forGestureAttribute:UIGestureAttributeUpdatesScroller]; + if ([document_ respondsToSelector:@selector(setZoomsFocusedFormControl:)]) + [document_ setZoomsFocusedFormControl:YES]; + [document_ setContentsPosition:7]; + [document_ setEnabledGestures:0xa]; + [document_ setValue:[NSNumber numberWithBool:YES] forGestureAttribute:UIGestureAttributeIsZoomRubberBandEnabled]; + [document_ setValue:[NSNumber numberWithBool:YES] forGestureAttribute:UIGestureAttributeUpdatesScroller]; - [webview_ setSmoothsFonts:YES]; - [webview_ setAllowsImageSheet:YES]; + [document_ setSmoothsFonts:YES]; + [document_ setAllowsImageSheet:YES]; [webview _setUsesLoaderCache:YES]; [webview setGroupName:@"CydiaGroup"]; @@ -1231,12 +1370,15 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); [self setViewportWidth:width]; - [webview_ setDelegate:self]; - [webview_ setGestureDelegate:self]; - [webview_ setFormEditingDelegate:self]; - [webview_ setInteractionDelegate:self]; + [document_ setDelegate:self]; + [document_ setGestureDelegate:self]; + + if ([document_ respondsToSelector:@selector(setFormEditingDelegate:)]) + [document_ setFormEditingDelegate:self]; + + [document_ setInteractionDelegate:self]; - [scroller_ addSubview:webview_]; + [scroller_ addSubview:document_]; //NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; @@ -1253,11 +1395,13 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); WebThreadUnlock(); CGSize indsize = [UIProgressIndicator defaultSizeForStyle:UIProgressIndicatorStyleMediumWhite]; - indicator_ = [[UIProgressIndicator alloc] initWithFrame:CGRectMake(281, 12, indsize.width, indsize.height)]; + indicator_ = [[UIProgressIndicator alloc] initWithFrame:CGRectMake(bounds.size.width - 39, 12, indsize.width, indsize.height)]; [indicator_ setStyle:UIProgressIndicatorStyleMediumWhite]; - [self setAutoresizingMask:UIViewAutoresizingFlexibleHeight]; - [scroller_ setAutoresizingMask:UIViewAutoresizingFlexibleHeight]; + [self setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)]; + [scroller_ setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)]; + [indicator_ setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin]; + [document_ setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)]; /*UIWebView *test([[[UIWebView alloc] initWithFrame:[self bounds]] autorelease]); [test loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.saurik.com/"]]]; @@ -1275,7 +1419,7 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); - (NSString *) stringByEvaluatingJavaScriptFromString:(NSString *)script { WebThreadLock(); - WebView *webview([webview_ webView]); + WebView *webview([document_ webView]); NSString *string([webview stringByEvaluatingJavaScriptFromString:script]); WebThreadUnlock(); return string; @@ -1284,7 +1428,7 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); - (void) callFunction:(WebScriptObject *)function { WebThreadLock(); - WebView *webview([webview_ webView]); + WebView *webview([document_ webView]); WebFrame *frame([webview mainFrame]); id _private(MSHookIvar(webview, "_private"));