readium / readium-css

🌈 A set of reference stylesheets for EPUB Reading Systems, starting with Readium Mobile
https://readium.org/readium-css/
BSD 3-Clause "New" or "Revised" License
90 stars 20 forks source link

Handling missing prefixed CSS properties #44

Open JayPanoz opened 6 years ago

JayPanoz commented 6 years ago

This is the crux of issue #19 about vertical-writing so I decided to open a more specific issue.

To put things simply, a lot of stylesheets won’t ship with all the necessary prefixed and/or unprefixed properties, especially the -epub-props, which can create quite a visible issue with writing-mode, and some others as well.

In the alpha version of ReadiumCSS, we’re enforcing writing-mode when needed, based on a chain of educated guesses (language of the publication, page-progression-direction, etc.) but that’s at the document :root level, and doesn’t take children into account.

And there’s a lot more:

See this mappings table in this PostCSS plugin (which is a proof of concept).

From Laurent:

A radical solution would be to avoid treating such issues "on the fly", but as a "repair" action activated by the user himself. Because after all, the culprit is the missing standard CSS property, and this should be solved once for all in the EPUB file. To do this, we would have to a/ developer a "repair" (or "cleaning") lib b/ offer it as a command line tool and/or c/ plug it into the Readium test apps in some way.

I really can’t see any other way than preprocessing stylesheets to add the missing properties, to be honest, since unsupported properties can’t be retrieved using getComputedStyle.

This primarily impacts Gecko/Quantum and Trident/EdgeHTML so we’re talking about web apps there, although some developers could decide to use the native Windows WebView – also heard about an Electron-like framework built on top of Quantum but I can’t find any info about that right now.