{ "id": "117808", "key": "TIMOB-14993", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "15699", "description": "2013 Sprint 21", "name": "2013 Sprint 21", "archived": true, "released": true, "releaseDate": "2013-10-18" }, { "id": "15700", "description": "2013 Sprint 21 API", "name": "2013 Sprint 21 API", "archived": true, "released": true, "releaseDate": "2013-10-18" } ], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2013-10-09T21:16:07.000+0000", "created": "2013-07-31T05:15:40.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "ios", "ipass1", "regression" ], "versions": [ { "id": "15478", "description": "Release 3.1.1", "name": "Release 3.1.1", "archived": true, "released": true, "releaseDate": "2013-06-17" } ], "issuelinks": [ { "id": "31494", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "104999", "key": "TIMOB-11777", "fields": { "summary": "Kitchen Sink: Views - Auto Size unexpected behavior on continuous device rotation", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2017-04-10T08:15:46.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "I have typed up a detailed description here:\r\nhttps://developer.appcelerator.com/question/155469/tiuisize-is-not-working-for-a-webviews-height-any-more-sample-code-included\r\n\r\nBasically when trying to use Ti.UI.SIZE to automatically size the Height of a WebView to fit the contents, it does not work when spaces are included in the HTML string. No spaces - it works fine. Spaces included - the height of the WebView is far too large.\r\n\r\nYou can see a screenshot example here:\r\nhttp://www.imattsolutions.com/images/TiWebView_Height.png\r\n\r\nHere is some example code you can run in a new Project's app.js using 3.1.1 SDK:\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor:'#ffffff'\r\n});\r\n\t\r\nvar html = 'This is not ok.';\r\n\r\nvar view = Ti.UI.createWebView({\r\n\thtml: html,\r\n\theight: Ti.UI.SIZE,\r\n\twidth: Ti.UI.FILL,\r\n\ttop: 0,\r\n\tbackgroundColor:'red'\r\n});\r\nwin.add(view);\r\n\r\nwin.open();\r\n{code}\r\n\r\nNote: This used to work fine in SDK 2.1.4.", "attachment": [ { "id": "41166", "filename": "TiWebView_Height.png", "author": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "created": "2013-07-31T05:15:40.000+0000", "size": 10661, "mimeType": "image/png" } ], "flagged": false, "summary": "iOS: Ti.UI.SIZE height of a WebView is incorrectly calculated", "creator": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "subtasks": [], "reporter": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "environment": "Ti.UI.createWebView in SDK 3.1.1.GA on iOS devices.", "comment": { "comments": [ { "id": "266214", "author": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "body": "I have fixed the issue in 3.1.1.GA by doing the following:\n\nIn the SDK locate the file \"iphone/Classes/TiUIWebView.m\".\n\nReplace:\n\n{code}\n-(CGFloat)contentHeightForWidth:(CGFloat)value\n{\n CGRect oldBounds = [[self webview] bounds];\n BOOL oldVal = webview.scalesPageToFit;\n [webview setScalesPageToFit:NO];\n [webview setBounds:CGRectMake(0, 0, 10, 1)];\n CGFloat ret = [webview sizeThatFits:CGSizeMake(10, 1)].height;\n [webview setBounds:oldBounds];\n [webview setScalesPageToFit:oldVal];\n return ret;\n}\n{code}\n\nWith:\n\n{code}\n-(CGFloat)contentHeightForWidth:(CGFloat)value\n{\n CGRect oldBounds = [[self webview] bounds];\n [webview setBounds:CGRectMake(0, 0, MAX(value,10), 1)];\n CGFloat result = [[webview stringByEvaluatingJavaScriptFromString:@\"document.height\"] floatValue];\n [webview setBounds:oldBounds];\n return result;\n}\n{code}", "updateAuthor": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "created": "2013-08-13T16:11:33.000+0000", "updated": "2013-08-13T16:11:33.000+0000" }, { "id": "268877", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~srahim], thoughts?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-08-29T16:47:35.000+0000", "updated": "2013-08-29T16:47:35.000+0000" }, { "id": "274469", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Setting plain text without a proper mime type will return incorrect results.\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor:'#ffffff'\r\n});\r\n \r\nvar html = 'This is not ok.';\r\n \r\nvar view = Ti.UI.createWebView({\r\n height: Ti.UI.SIZE,\r\n width: Ti.UI.FILL,\r\n top: 40,\r\n backgroundColor:'red'\r\n});\r\nview.setHtml(html,{mimeType:'text/plain'});\r\nwin.add(view);\r\n \r\nwin.open();\r\n{code}", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-10-09T21:16:07.000+0000", "updated": "2013-10-09T21:16:07.000+0000" }, { "id": "277134", "author": { "name": "tomboman", "key": "tomboman", "displayName": "Tom aan 't Goor", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This bug also exsits on Android.", "updateAuthor": { "name": "tomboman", "key": "tomboman", "displayName": "Tom aan 't Goor", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-10-29T13:08:14.000+0000", "updated": "2013-10-29T13:08:14.000+0000" }, { "id": "277150", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~tomboman] Test case?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-10-29T15:47:37.000+0000", "updated": "2013-10-29T15:47:37.000+0000" }, { "id": "416037", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I don't think a test case is coming. Closing. Please reopen if still an issue. \r\n", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-03-28T20:26:02.000+0000", "updated": "2017-03-28T20:26:02.000+0000" }, { "id": "417091", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "This is related to TIMOB-20482, thx!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-04-10T08:15:46.000+0000", "updated": "2017-04-10T08:15:46.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }