UIWebView: issues with line-height in iOS11b9

Number:rdar://34263778 Date Originated:2017.09.05
Status:Open Resolved:
Product: Product Version:
Classification: Reproducible:
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":
"  body {line-height:20px;}  test test test test test test "

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)

See attached test project "webviewtest_apple_sample2.zip" for details, and zoom to the maximum value using the "Bigger" button.

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. 

-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?


Note: seems to be a problem only on iPad, it seems fine when tested on an iPod touch.

Related forum post: https://forums.developer.apple.com/message/257772

Unescaped HTML:

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

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

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!