summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MobileCydia.mm6
-rw-r--r--UICaboodle/BrowserView.mm11
2 files changed, 17 insertions, 0 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 51843a7..948bb60 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -4001,6 +4001,8 @@ static NSString *Warning_;
return @"refreshSources";
else if (selector == @selector(removeButton))
return @"removeButton";
+ else if (selector == @selector(scrollToBottom:))
+ return @"scrollToBottom";
else if (selector == @selector(setButtonImage:withStyle:toFunction:))
return @"setButtonImage";
else if (selector == @selector(setButtonTitle:withStyle:toFunction:))
@@ -4184,6 +4186,10 @@ static NSString *Warning_;
[indirect_ setPopupHook:function];
}
+- (void) scrollToBottom:(NSNumber *)animated {
+ [indirect_ performSelectorOnMainThread:@selector(scrollToBottomAnimated:) withObject:animated waitUntilDone:NO];
+}
+
- (void) setViewportWidth:(float)width {
[indirect_ setViewportWidthOnMainThread:width];
}
diff --git a/UICaboodle/BrowserView.mm b/UICaboodle/BrowserView.mm
index 07a92ee..d5116cf 100644
--- a/UICaboodle/BrowserView.mm
+++ b/UICaboodle/BrowserView.mm
@@ -601,6 +601,17 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
closer_ = [function retain];
}
+- (void) scrollToBottomAnimated:(NSNumber *)animated {
+ CGSize size([scroller_ contentSize]);
+ CGPoint offset([scroller_ contentOffset]);
+ CGRect frame([scroller_ frame]);
+
+ if (size.height - offset.y < frame.size.height + 20.f) {
+ CGRect rect = {{0, size.height-1}, {size.width, 1}};
+ [scroller_ scrollRectToVisible:rect animated:[animated boolValue]];
+ }
+}
+
- (void) _setViewportWidth {
[[webview_ _documentView] setViewportSize:CGSizeMake(width_, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x10];
}