X-Git-Url: https://git.saurik.com/winterboard.git/blobdiff_plain/0fa37711e712065c6d15a8ea18f4780002035095..62ab6edbb3f23b74650ddb7e3ad054702f7eaa43:/WBMarkup.mm diff --git a/WBMarkup.mm b/WBMarkup.mm index 9918a28..ff7c98a 100644 --- a/WBMarkup.mm +++ b/WBMarkup.mm @@ -2,6 +2,8 @@ #include +MSClassHook(UIWebDocumentView) + @class WKView; extern "C" void WebThreadLock(); @@ -61,15 +63,19 @@ static void (*WKViewDisplayRect$)(WKView *, CGRect); - (void) setContentView:(WebView *)view; @end +@interface UIWebDocumentView : NSObject +- (WebView *) webView; +@end + static WBMarkup *SharedMarkup_; @implementation WBMarkup + (void) initialize { MSImageRef WebCore(MSGetImageByName("/System/Library/PrivateFrameworks/WebCore.framework/WebCore")); - MSHookSymbol(WKViewLockFocus$, "WKViewLockFocus", WebCore); - MSHookSymbol(WKViewUnlockFocus$, "WKViewUnlockFocus", WebCore); - MSHookSymbol(WKViewDisplayRect$, "WKViewDisplayRect", WebCore); + MSHookSymbol(WKViewLockFocus$, "_WKViewLockFocus", WebCore); + MSHookSymbol(WKViewUnlockFocus$, "_WKViewUnlockFocus", WebCore); + MSHookSymbol(WKViewDisplayRect$, "_WKViewDisplayRect", WebCore); MSImageRef JavaScriptCore(MSGetImageByName("/System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore")); @@ -93,9 +99,11 @@ static WBMarkup *SharedMarkup_; if ((self = [super init]) != nil) { WebThreadLock(); - SharedMarkup_ = self; + if ($UIWebDocumentView == Nil) + view_ = [[WebView alloc] initWithFrame:CGRectMake(0, 0, 640, 5000)]; + else + view_ = [[[$UIWebDocumentView alloc] initWithFrame:CGRectMake(0, 0, 640, 5000)] webView]; - view_ = [[WebView alloc] initWithFrame:CGRectMake(0, 0, 640, 5000)]; [view_ setDrawsBackground:NO]; WebPreferences *preferences([[WebPreferences alloc] initWithIdentifier:@"com.apple.webkit.webmarkup"]);