summaryrefslogtreecommitdiff
path: root/UICaboodle/BrowserView.mm
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2010-10-04 02:40:27 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2010-10-04 09:45:29 +0000
commitc21004b921c67b3e7748cc1f0c53d02deec1ebca (patch)
treeac3a8f0eacec9e3a9ed56d073bfc6567c4eed502 /UICaboodle/BrowserView.mm
parent6d16684908fdd65f8cc7e000f8c28624a4aa0516 (diff)
Rewrote the build environment from scratch.
Diffstat (limited to 'UICaboodle/BrowserView.mm')
-rw-r--r--UICaboodle/BrowserView.mm79
1 files changed, 54 insertions, 25 deletions
diff --git a/UICaboodle/BrowserView.mm b/UICaboodle/BrowserView.mm
index 5fa21e1..8dd2afa 100644
--- a/UICaboodle/BrowserView.mm
+++ b/UICaboodle/BrowserView.mm
@@ -1,12 +1,28 @@
+#include <UIKit/UIKit.h>
+#include "iPhonePrivate.h"
+
+#include "UCPlatform.h"
+
#include <UICaboodle/BrowserView.h>
#include <UICaboodle/UCLocalize.h>
-#import <QuartzCore/CALayer.h>
+//#include <QuartzCore/CALayer.h>
// XXX: fix the minimum requirement
extern NSString * const kCAFilterNearest;
#include <WebCore/WebCoreThread.h>
-#include <WebKit/WebPreferences-WebPrivate.h>
+
+#include <WebKit/WebPolicyDelegate.h>
+#include <WebKit/WebPreferences.h>
+
+#include <WebKit/DOMCSSPrimitiveValue.h>
+#include <WebKit/DOMCSSStyleDeclaration.h>
+#include <WebKit/DOMDocument.h>
+#include <WebKit/DOMHTMLBodyElement.h>
+#include <WebKit/DOMRGBColor.h>
+
+//#include <WebCore/Page.h>
+//#include <WebCore/Settings.h>
#include "substrate.h"
@@ -19,12 +35,10 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef);
static Class $UIFormAssistant;
static Class $UIWebBrowserView;
-@interface NSString (UIKit)
-- (NSString *) stringByAddingPercentEscapes;
-@end
-
/* Indirect Delegate {{{ */
-@interface IndirectDelegate : NSObject {
+@interface IndirectDelegate : NSObject <
+ HookProtocol
+> {
_transient volatile id delegate_;
}
@@ -89,6 +103,11 @@ static Class $UIWebBrowserView;
return nil;
}
+- (void) didDismissModalViewController {
+ if (delegate_ != nil)
+ return [delegate_ didDismissModalViewController];
+}
+
- (IMP) methodForSelector:(SEL)sel {
if (IMP method = [super methodForSelector:sel])
return method;
@@ -125,11 +144,19 @@ static Class $UIWebBrowserView;
/* }}} */
@interface WebView (UICaboodle)
-- (void) setScriptDebugDelegate:(id)delegate;
++ (BOOL) _canHandleRequest:(NSURLRequest *)request;
- (void) _setFormDelegate:(id)delegate;
+- (void) _setLayoutInterval:(float)interval;
+- (void) setScriptDebugDelegate:(id)delegate;
- (void) _setUIKitDelegate:(id)delegate;
+- (void) _setUsesLoaderCache:(BOOL)uses;
- (void) setWebMailDelegate:(id)delegate;
-- (void) _setLayoutInterval:(float)interval;
+@end
+
+@interface WebPreferences (Apple)
++ (void) _setInitialDefaultTextEncodingToSystemEncoding;
+- (void) _setLayoutInterval:(NSInteger)interval;
+- (void) setOfflineWebApplicationCacheEnabled:(BOOL)enabled;
@end
@implementation WebScriptObject (UICaboodle)
@@ -356,7 +383,7 @@ static Class $UIWebBrowserView;
if ([scroller_ respondsToSelector:@selector(setScrollerIndicatorSubrect:)])
[scroller_ setScrollerIndicatorSubrect:subrect];
- [document_ setValue:[NSValue valueWithSize:NSMakeSize(subrect.size.width, subrect.size.height)] forGestureAttribute:UIGestureAttributeVisibleSize];
+ [document_ setValue:[NSValue valueWithSize:CGSizeMake(subrect.size.width, subrect.size.height)] forGestureAttribute:UIGestureAttributeVisibleSize];
CGSize size(size_);
size.height += extra;
@@ -581,7 +608,7 @@ static Class $UIWebBrowserView;
}
- (void) _openMailToURL:(NSURL *)url {
- [UIApp openURL:url];// asPanel:YES];
+ [[UIApplication sharedApplication] openURL:url];// asPanel:YES];
}
- (void) webView:(WebView *)sender willBeginEditingFormElement:(id)element {
@@ -675,7 +702,7 @@ static Class $UIWebBrowserView;
WebView *webview([document_ webView]);
if (frame == [webview mainFrame])
- [UIApp openURL:[request URL]];
+ [[UIApplication sharedApplication] openURL:[request URL]];
}
}
@@ -728,7 +755,7 @@ static Class $UIWebBrowserView;
)) {
url = open;
open:
- [UIApp openURL:url];
+ [[UIApplication sharedApplication] openURL:url];
goto ignore;
}
@@ -1027,17 +1054,13 @@ static Class $UIWebBrowserView;
[self _startLoading];
}
-- (UINavigationButtonStyle) rightButtonStyle {
+- (UIBarButtonItemStyle) rightButtonStyle {
if (style_ == nil) normal:
- return UINavigationButtonStyleNormal;
+ return UIBarButtonItemStylePlain;
else if ([style_ isEqualToString:@"Normal"])
- return UINavigationButtonStyleNormal;
- else if ([style_ isEqualToString:@"Back"])
- return UINavigationButtonStyleBack;
+ return UIBarButtonItemStylePlain;
else if ([style_ isEqualToString:@"Highlighted"])
- return UINavigationButtonStyleHighlighted;
- else if ([style_ isEqualToString:@"Destructive"])
- return UINavigationButtonStyleDestructive;
+ return UIBarButtonItemStyleDone;
else goto normal;
}
@@ -1522,8 +1545,12 @@ static Class $UIWebBrowserView;
WebView *webview([document_ webView]);
WebFrame *frame([webview mainFrame]);
+ WebPreferences *preferences([webview preferences]);
+
+ bool maybe([preferences javaScriptCanOpenWindowsAutomatically]);
+ [preferences setJavaScriptCanOpenWindowsAutomatically:NO];
- id _private(MSHookIvar<id>(webview, "_private"));
+ /*id _private(MSHookIvar<id>(webview, "_private"));
WebCore::Page *page(_private == nil ? NULL : MSHookIvar<WebCore::Page *>(_private, "page"));
WebCore::Settings *settings(page == NULL ? NULL : page->settings());
@@ -1533,7 +1560,7 @@ static Class $UIWebBrowserView;
else {
no = settings->JavaScriptCanOpenWindowsAutomatically();
settings->setJavaScriptCanOpenWindowsAutomatically(true);
- }
+ }*/
if (UIWindow *window = [[self view] window])
if (UIResponder *responder = [window firstResponder])
@@ -1543,8 +1570,10 @@ static Class $UIWebBrowserView;
JSGlobalContextRef context([frame globalContext]);
JSObjectCallAsFunction(context, object, NULL, 0, NULL, NULL);
- if (settings != NULL)
- settings->setJavaScriptCanOpenWindowsAutomatically(no);
+ /*if (settings != NULL)
+ settings->setJavaScriptCanOpenWindowsAutomatically(no);*/
+
+ [preferences setJavaScriptCanOpenWindowsAutomatically:maybe];
WebThreadUnlock();
}