diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2011-02-25 15:06:42 -0800 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-07 02:41:20 -0800 |
commit | 65ea9562dea67390b0d4a1d8d6ed2f1593d4418b (patch) | |
tree | 966c952e6c7c7d55795e788b8e8ac61367bf59b3 /UICaboodle | |
parent | 740b712de9e2b43b52af962810595303c935c688 (diff) |
Use a real grouped table view to back our webviews.
Diffstat (limited to 'UICaboodle')
-rw-r--r-- | UICaboodle/BrowserView.mm | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/UICaboodle/BrowserView.mm b/UICaboodle/BrowserView.mm index d145067..9858598 100644 --- a/UICaboodle/BrowserView.mm +++ b/UICaboodle/BrowserView.mm @@ -769,13 +769,6 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se [self _didFailWithError:error forFrame:frame]; } -// XXX: factor this out somewhere -- (UIColor *) groupTableViewBackgroundColor { - UIDevice *device([UIDevice currentDevice]); - bool iPad([device respondsToSelector:@selector(userInterfaceIdiom)] && [device userInterfaceIdiom] == UIUserInterfaceIdiomPad); - return iPad ? [UIColor colorWithRed:0.821 green:0.834 blue:0.860 alpha:1] : [UIColor groupTableViewBackgroundColor]; -} - - (void) webView:(WebView *)view didFinishLoadForFrame:(WebFrame *)frame { [loading_ removeObject:[NSValue valueWithNonretainedObject:frame]]; @@ -785,7 +778,7 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se for (DOMHTMLBodyElement *body in (id) bodies) { DOMCSSStyleDeclaration *style([document getComputedStyle:body pseudoElement:nil]); - UIColor *uic([self groupTableViewBackgroundColor]); + UIColor *uic(nil); if (DOMCSSPrimitiveValue *color = static_cast<DOMCSSPrimitiveValue *>([style getPropertyCSSValue:@"background-color"])) { if ([color primitiveType] == DOM_CSS_RGBCOLOR) { @@ -808,7 +801,7 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se } } - [scroller_ setBackgroundColor:uic]; + [scroller_ setBackgroundColor:(uic ?: [UIColor clearColor])]; break; } } @@ -1017,7 +1010,9 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se indirect_ = [[IndirectDelegate alloc] initWithDelegate:self]; - webview_ = [[[CYWebView alloc] initWithFrame:[[self view] bounds]] autorelease]; + CGRect bounds([[self view] bounds]); + + webview_ = [[[CYWebView alloc] initWithFrame:bounds] autorelease]; [webview_ setDelegate:self]; [self setView:webview_]; @@ -1084,7 +1079,7 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se } [scroller_ setFixedBackgroundPattern:YES]; - [scroller_ setBackgroundColor:[self groupTableViewBackgroundColor]]; + [scroller_ setBackgroundColor:[UIColor clearColor]]; [scroller_ setClipsSubviews:YES]; [scroller_ setBounces:YES]; @@ -1110,6 +1105,10 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se indicator_ = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; [indicator_ setFrame:CGRectMake(15, 5, [indicator_ frame].size.width, [indicator_ frame].size.height)]; + UITableView *table([[[UITableView alloc] initWithFrame:bounds style:UITableViewStyleGrouped] autorelease]); + [webview_ insertSubview:table atIndex:0]; + + [table setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)]; [webview_ setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)]; [indicator_ setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin]; } return self; |