UIWebView displays margins incorrectly with black background and paginationMode = UIWebPaginationModeLeftToRight
UIWebView displays margins incorrectly with black background and paginationMode = UIWebPaginationModeLeftToRight
- Subject: UIWebView displays margins incorrectly with black background and paginationMode = UIWebPaginationModeLeftToRight
- From: Steve Christensen <email@hidden>
- Date: Thu, 04 May 2017 09:24:16 -0700
Xcode 8.3.1, iOS Simulator 10.3 and iOS 10.3.1
I am using a paginated UIWebView to display some HTML. Everything appeared to be working OK until I changed the CSS to set the background color to black and the foreground (text) color to white. Then I found that wherever there is a non-zero margin on an element then the space occupied by the margin is white, even though parent elements have a black background.
If I set the margins to zero and instead set the corresponding padding property then the content is drawn correctly, but that causes issues when a non-black background needs to be set on an element.
If I don't set webView.paginationMode then the HTML renders correctly.
I reduced the HTML to a simple test case that is reproducible, appended below. I'm stuck right now since I can't really peek inside the web view to see what it's thinking. Looking at the Simulator view in Safari just shows the expected properties, so no help there.
Has anybody else run across this and come up with a solution? Is this a known bug?
Thanks,
Steve
-------------
<html>
<head>
<title>Title</title>
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<style type="text/css">
body,body * {background:#000000; color:#ffffff}
p {margin-bottom:10px; margin-top:10px}
</style>
</head>
<body>
<p>Paragraph 1</p>
<p>Paragraph 2</p>
</body>
</html>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden