New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TIMOB-20482]:iOS WebView converting spaces into extra lines #8892
Conversation
@@ -715,8 +715,8 @@ -(CGFloat)contentHeightForWidth:(CGFloat)value | |||
CGRect oldBounds = [[self webview] bounds]; | |||
BOOL oldVal = webview.scalesPageToFit; | |||
[webview setScalesPageToFit:NO]; | |||
[webview setBounds:CGRectMake(0, 0, 10, 1)]; | |||
CGFloat ret = [webview sizeThatFits:CGSizeMake(10, 1)].height; | |||
[webview setBounds:CGRectMake(0, 0, value, 1)]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did the static 10 come from? Wondering why that particular value was used (and is also still used in contentWidthForWidth :
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hansemannn That value has been made 10 for ticket TIMOB-11777 .I verified the rotation as mentioned in TIMOB-117777, it is working fine with this change as well. I couldn't get exact test case of TIMOB-11777 as this is very old ticket. If you can get exact test case we can verify same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a test-case in TIMOB-14993 that also suggested this solution instead:
-(CGFloat)contentHeightForWidth:(CGFloat)value
{
CGRect oldBounds = [[self webview] bounds];
[webview setBounds:CGRectMake(0, 0, MAX(value,10), 1)];
CGFloat result = [[webview stringByEvaluatingJavaScriptFromString:@"document.height"] floatValue];
[webview setBounds:oldBounds];
return result;
}
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This problem is similar to TIMOB-14993. In comment of TIMOB-14993 it is mentioned that with proper mime type, it will work fine else not. But this PR works fine with proper mime type and without mime type (plain text). So I think we should go ahead with this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FR passed, using:
MacOS 10.12 (16A323)
Studio 4.9.0.201704061825
Ti SDK 6.1.0
Appc NPM 4.2.9
Appc CLI 6.2.0
Alloy 1.9.11
Xcode 8.3.2 (8E2002)
No additional lines were shown when setting the webview to a local file, using setHTLP or setURL. Tested using the provided sample with modifications.
https://jira.appcelerator.org/browse/TIMOB-20482