Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS page-break-after / before / inside (avoid / always / etc.). #127

Open
danielweck opened this issue Oct 14, 2014 · 4 comments
Open

CSS page-break-after / before / inside (avoid / always / etc.). #127

danielweck opened this issue Oct 14, 2014 · 4 comments

Comments

@danielweck
Copy link
Member

Issue moved from readium-js-viewer:
readium/readium-js-viewer#217

@rkwright rkwright added this to the m1.1 milestone Oct 14, 2014
@rkwright rkwright modified the milestones: m1.2, m1.1 Oct 24, 2014
@acepub
Copy link

acepub commented Jun 16, 2015

It would be really helpful if Readium can support page-break-inside: avoid property. The tables and images splitting across the page don't look professional.

@danielweck
Copy link
Member Author

@olivierkorner wrote a nice ContentFilter for ReadiumSDK:
readium/readium-sdk#229

A similar approach in ReadiumJS would not be implemented in _contentDocumentTextPreprocessor (as that's only for transforming HTML files):
https://github.com/readium/readium-js/blob/develop/js/Readium.js#L27

Instead, this would require the full "programmatic resource fetching" triggered by zipped EPUB loading, or by obfuscated fonts, see shouldConstructDomProgrammatically in:
https://github.com/readium/readium-js/blob/develop/js/epub-fetch/iframe_zip_loader.js#L69
...and the actual resource fetcher resolveDocumentLinkStylesheets and resolveDocumentEmbeddedStylesheets:
https://github.com/readium/readium-js/blob/develop/js/epub-fetch/content_document_fetcher.js#L77
Also see _shouldConstructDomProgrammatically = true when _encryptionHandler.isEncryptionSpecified():
https://github.com/readium/readium-js/blob/develop/js/epub-fetch/publication_fetcher.js#L422

Bottom line: I do not think that this is a very realistic approach, because of the caveats associated with "programmatic resource fetching" via BlobURIs (performance, error prone-ness, lack of audio/video streaming, broken Media Overlays).

So, a better approach for ReadiumJS could be to perform a second layout / render path after modifying the CSS-OM (after the DOM is loaded)? to update the computed style?

@kidwm
Copy link

kidwm commented Apr 15, 2016

I think that after Houdini giving more control to CSSOM would help to solve this problem.

@jccr
Copy link
Member

jccr commented May 13, 2016

@danielweck
The better approach would be to perform a second layout/render like you said, but we can leverage Shadow DOM and its scoped CSS approach. Using the shadow DOM would also keep CFI references intact :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants