]> git.saurik.com Git - cydia.git/commitdiff
Use a real grouped table view to back our webviews.
authorJay Freeman (saurik) <saurik@saurik.com>
Fri, 25 Feb 2011 23:06:42 +0000 (15:06 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 7 Mar 2011 10:41:20 +0000 (02:41 -0800)
MobileCydia.mm
UICaboodle/BrowserView.mm

index 0b4b56e3e1eae0965e0a98bd4c7bdb9df4794fd3..3626b8845525f33ecca681b0dd2822b289733658 100644 (file)
@@ -4516,16 +4516,12 @@ static NSString *Warning_;
     } return self;
 }
 
-// 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) loadView {
     [self setView:[[[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] autorelease]];
-    [[self view] setBackgroundColor:[self groupTableViewBackgroundColor]];
+
+    UITableView *table([[[UITableView alloc] initWithFrame:[[self view] bounds] style:UITableViewStyleGrouped] autorelease]);
+    [table setAutoresizingMask:UIViewAutoresizingFlexibleBoth];
+    [[self view] addSubview:table];
 
     indicator_ = [[[CYLoadingIndicator alloc] initWithFrame:[[self view] bounds]] autorelease];
     [indicator_ setAutoresizingMask:UIViewAutoresizingFlexibleBoth];
index d1450671cf7a35afb868828f4f05d0905a2aed61..985859895cb969031de3a30299852bc59a47a4f7 100644 (file)
@@ -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;