{"action":"created","issue":{"url":"https://api.github.com/repos/koreader/crengine/issues/246","repository_url":"https://api.github.com/repos/koreader/crengine","labels_url":"https://api.github.com/repos/koreader/crengine/issues/246/labels{/name}","comments_url":"https://api.github.com/repos/koreader/crengine/issues/246/comments","events_url":"https://api.github.com/repos/koreader/crengine/issues/246/events","html_url":"https://github.com/koreader/crengine/pull/246","id":388949422,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM3MDg1MzMw","number":246,"title":"Fix max image height, hide <epub:case> in <epub:switch>","user":{"login":"poire-z","id":24273478,"node_id":"MDQ6VXNlcjI0MjczNDc4","avatar_url":"https://avatars0.githubusercontent.com/u/24273478?v=4","gravatar_id":"","url":"https://api.github.com/users/poire-z","html_url":"https://github.com/poire-z","followers_url":"https://api.github.com/users/poire-z/followers","following_url":"https://api.github.com/users/poire-z/following{/other_user}","gists_url":"https://api.github.com/users/poire-z/gists{/gist_id}","starred_url":"https://api.github.com/users/poire-z/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poire-z/subscriptions","organizations_url":"https://api.github.com/users/poire-z/orgs","repos_url":"https://api.github.com/users/poire-z/repos","events_url":"https://api.github.com/users/poire-z/events{/privacy}","received_events_url":"https://api.github.com/users/poire-z/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-12-08T19:01:48Z","updated_at":"2018-12-08T19:51:45Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/koreader/crengine/pulls/246","html_url":"https://github.com/koreader/crengine/pull/246","diff_url":"https://github.com/koreader/crengine/pull/246.diff","patch_url":"https://github.com/koreader/crengine/pull/246.patch"},"body":"#### Fix max image height to prevent spurious page breaks\r\n\r\nImages are enforced a max height, which was the page height.\r\nTo prevent any uneeded page break before or after a big image (originally or scaled by CSS), we should additionally take into account the image container margins/borders/padding, and the space below added by the recently enforced strut (Some details in https://github.com/koreader/koreader/pull/4378#issuecomment-444771941)\r\nCould happen with a cover page set like:\r\n`<div><p style=\"margin-top: 20px\"><img src=\"\" style=\"height: 100%\"/></p></div>`\r\n\r\n(Before https://github.com/koreader/crengine/commit/08adb23425350ff02ace9cec3280d68e9f0d75bb, a first page bigger than page-height was simply truncated, and the bottom part just lost. https://github.com/koreader/crengine/commit/08adb23425350ff02ace9cec3280d68e9f0d75bb fixed that, but then, cover pages may be splitted into multiple pages. This commit fixes that by ensuring the whole image and surrounding space fit in page-height.)\r\n\r\n#### Hide `<epub:case>` in `<epub:switch>`, show only `<epub:default>`\r\n\r\nThis EPUB3 feature provides alternative content for engines that support their namespace. Details in https://github.com/koreader/koreader/issues/4381#issuecomment-444995517, [specs](http://www.idpf.org/epub/30/spec/epub30-contentdocs.html#sec-xhtml-epub-case).\r\nAs we don't currently support any, just set them to `display:none` so that only the `<epub:default>` content is shown (usually, an image).\r\nThe curious person (who will now possibly not know there is a `<epub:switch>` with a hidden `<epub:case>`) will be able to toggle that alternate content with a style tweak:\r\n<kbd>![image](https://user-images.githubusercontent.com/24273478/49689489-3ddaa800-fb22-11e8-9eaa-60d07d2fc9fa.png)</kbd>\r\n\r\n<kbd>![image](https://user-images.githubusercontent.com/24273478/49689516-81cdad00-fb22-11e8-92d2-20fca11f989e.png)</kbd>\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/koreader/crengine/issues/comments/445485254","html_url":"https://github.com/koreader/crengine/pull/246#issuecomment-445485254","issue_url":"https://api.github.com/repos/koreader/crengine/issues/246","id":445485254,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NTQ4NTI1NA==","user":{"login":"poire-z","id":24273478,"node_id":"MDQ6VXNlcjI0MjczNDc4","avatar_url":"https://avatars0.githubusercontent.com/u/24273478?v=4","gravatar_id":"","url":"https://api.github.com/users/poire-z","html_url":"https://github.com/poire-z","followers_url":"https://api.github.com/users/poire-z/followers","following_url":"https://api.github.com/users/poire-z/following{/other_user}","gists_url":"https://api.github.com/users/poire-z/gists{/gist_id}","starred_url":"https://api.github.com/users/poire-z/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poire-z/subscriptions","organizations_url":"https://api.github.com/users/poire-z/orgs","repos_url":"https://api.github.com/users/poire-z/repos","events_url":"https://api.github.com/users/poire-z/events{/privacy}","received_events_url":"https://api.github.com/users/poire-z/received_events","type":"User","site_admin":false},"created_at":"2018-12-08T19:51:45Z","updated_at":"2018-12-08T19:51:45Z","author_association":"CONTRIBUTOR","body":"No, in scroll mode everything was/is fine: I see nowhere where such a cut could be made.\r\n\r\nThey could still be split in 2 in page mode as long as it was not on the first page: that's the role of the `splitLineIfOverflowPage()` I added months ago (i just forgot to add it for the first page) - now it shouldn't have to do it for images anymore, but it did and still should do that for `<TR>` whose height is larger than a page.\r\n(I didnt think about cover images when adding it recently for first page - just though about what could happen if a document starts with a TABLE and a tall TR.)"}}
{"actor":{"display_login":"poire-z"}}