summaryrefslogtreecommitdiff
path: root/CyteKit/WebViewController.mm
diff options
context:
space:
mode:
Diffstat (limited to 'CyteKit/WebViewController.mm')
-rw-r--r--CyteKit/WebViewController.mm28
1 files changed, 28 insertions, 0 deletions
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