summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CyteKit/WebViewController.h5
-rw-r--r--CyteKit/WebViewController.mm28
-rw-r--r--MobileCydia.app/iframe.html6
-rw-r--r--MobileCydia.mm8
-rw-r--r--iPhonePrivate.h5
5 files changed, 52 insertions, 0 deletions
diff --git a/CyteKit/WebViewController.h b/CyteKit/WebViewController.h
index d3ded44..b827020 100644
--- a/CyteKit/WebViewController.h
+++ b/CyteKit/WebViewController.h
@@ -78,6 +78,9 @@
_H<NSString> title_;
_H<NSMutableSet> loading_;
+ _H<NSMutableSet> registered_;
+ _H<NSTimer> timer_;
+
// XXX: NSString * or UIImage *
_H<NSObject> custom_;
_H<NSString> style_;
@@ -152,6 +155,8 @@
- (void) setScrollAlwaysBounceVertical:(bool)value;
- (void) setScrollIndicatorStyle:(UIScrollViewIndicatorStyle)style;
+- (void) registerFrame:(WebFrame *)frame;
+
@end
#endif//CyteKit_WebViewController_H
diff --git a/CyteKit/WebViewController.mm b/CyteKit/WebViewController.mm
index 5d15213..ccb1823 100644
--- a/CyteKit/WebViewController.mm
+++ b/CyteKit/WebViewController.mm
@@ -48,12 +48,24 @@ float CYScrollViewDecelerationRateNormal;
- (void) _setAllowsMessaging:(BOOL)allows;
@end
+@interface WebFrame (Cydia)
+- (void) cydia$updateHeight;
+@end
+
@implementation WebFrame (Cydia)
- (NSString *) description {
return [NSString stringWithFormat:@"<%s: %p, %@>", class_getName([self class]), self, [[[([self provisionalDataSource] ?: [self dataSource]) request] URL] absoluteString]];
}
+- (void) cydia$updateHeight {
+ [[[self frameElement] style]
+ setProperty:@"height"
+ value:[NSString stringWithFormat:@"%dpx",
+ [[[self DOMDocument] body] scrollHeight]]
+ priority:nil];
+}
+
@end
/* Indirect Delegate {{{ */
@@ -595,6 +607,9 @@ float CYScrollViewDecelerationRateNormal;
style_ = nil;
function_ = nil;
+ [registered_ removeAllObjects];
+ timer_ = nil;
+
allowsNavigationAction_ = true;
[self setHidesNavigationBar:NO];
@@ -811,6 +826,7 @@ float CYScrollViewDecelerationRateNormal;
allowsNavigationAction_ = true;
loading_ = [NSMutableSet setWithCapacity:5];
+ registered_ = [NSMutableSet setWithCapacity:5];
indirect_ = [[[IndirectDelegate alloc] initWithDelegate:self] autorelease];
reloaditem_ = [[[UIBarButtonItem alloc]
@@ -1122,4 +1138,16 @@ float CYScrollViewDecelerationRateNormal;
[self dispatchEvent:@"CydiaViewDidDisappear"];
}
+- (void) updateHeights:(NSTimer *)timer {
+ for (WebFrame *frame in (id) registered_)
+ [frame cydia$updateHeight];
+}
+
+- (void) registerFrame:(WebFrame *)frame {
+ [registered_ addObject:frame];
+
+ if (timer_ == nil)
+ timer_ = [NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(updateHeights:) userInfo:nil repeats:YES];
+}
+
@end
diff --git a/MobileCydia.app/iframe.html b/MobileCydia.app/iframe.html
new file mode 100644
index 0000000..f35ef99
--- /dev/null
+++ b/MobileCydia.app/iframe.html
@@ -0,0 +1,6 @@
+<html><head>
+</head><body>
+ <script type="text/javascript">
+ document.write();
+ </script>
+</body></html>
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 3b3347f..e2f1d85 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -69,6 +69,7 @@
#include <QuartzCore/CALayer.h>
#include <WebCore/WebCoreThread.h>
+#include <WebKit/DOMHTMLIFrameElement.h>
#include <algorithm>
#include <iomanip>
@@ -4169,6 +4170,8 @@ static _H<NSMutableSet> Diversions_;
return @"popViewController";
else if (selector == @selector(refreshSources))
return @"refreshSources";
+ else if (selector == @selector(registerFrame:))
+ return @"registerFrame";
else if (selector == @selector(removeButton))
return @"removeButton";
else if (selector == @selector(saveConfig))
@@ -4294,6 +4297,11 @@ static _H<NSMutableSet> Diversions_;
return [Values_ allKeys];
} }
+- (void) registerFrame:(DOMHTMLIFrameElement *)iframe {
+ WebFrame *frame([iframe contentFrame]);
+ [indirect_ registerFrame:frame];
+}
+
- (void) _setShowPromoted:(NSNumber *)value {
[Metadata_ setObject:value forKey:@"ShowPromoted"];
Changed_ = true;
diff --git a/iPhonePrivate.h b/iPhonePrivate.h
index 98f86b4..80aed02 100644
--- a/iPhonePrivate.h
+++ b/iPhonePrivate.h
@@ -6,6 +6,7 @@
#include <UIKit/UIKit.h>
// }}}
// #import <*> {{{
+#import <WebKit/DOMHTMLIFrameElement.h>
#import <WebKit/WebFrame.h>
#import <WebKit/WebPreferences.h>
// }}}
@@ -413,6 +414,10 @@ extern float const UIScrollViewDecelerationRateNormal;
@property(nonatomic,readonly) CGFloat scale;
@end
+@interface DOMHTMLIFrameElement (IDL)
+- (WebFrame *) contentFrame;
+@end
+
// extern *; {{{
extern CFStringRef const kGSDisplayIdentifiersCapability;
extern float const UIWebViewGrowsAndShrinksToFitHeight;