UIWebView: issues with line-height in iOS11b9

(please refer to Radar #34263778)


Hello Apple,


We have noticed a problem in our production app, related to zooming of text in a UIWebView, in iOS11b9.


We have simple HTML content in a UIWebView, with a "line-height" value in "px":

"<html><head><style type=\"text/css\">body {line-height:20px;}</style></head><body>test test test<br>test test test</body></html>"


and we affect the zoom with this:

"[self.webview stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.getElementsByTagName(\"body\")[0].style.webkitTextSizeAdjust = \"%d%%\"", size]];"


On iOS10.3 it works correctly (the line height is resized automatically with "webkitTextSizeAdjust") (see screenshot test1_ios10.png), but on iOS11b9 the line height is not resized (see screenshot test1_ios11b.png with text overlap)



As a workaround, using "line-height: 130%" seems to work correctly, but we're not ready to make this change in our production app, without knowing the reason for the change.


Notes:

-the problem appears in iOS11b9 (latest developer beta), but also since iOS11b6, using Xcode 8.3.3. But works correctly in iOS10.3

-we also tested similar code on our macOS application and it seems to be working correctly on macOS 10.12.6 and macOS10.13b9



A few Questions:

-Is this a bug or a new feature in iOS11?

-Is there documentation for these changes?

-Are there any workarounds we could use in our production app that would work on iOS10 and iOS11?

UIWebview was deprecated as of iOS 8, in favor of WKWebView...perhaps that is related to your issue(s).

Note, seems to ony affect the iPad, seems ok when testing on an iPod touch.

UIWebView: issues with line-height in iOS11b9
 
 
Q