readium-css

Reading Systems Requirements for reflowable text

[Implementers’ doc] [Authors’ doc]

Source: EPUB Content Documents 3.2

There’s a few criteria Reading Systems must meet in order to be conformant:

In addition:

CSS Snapshot

Since we’re relying on web browsers’ rendering engine and web views, this should not be an issue. Our main concern should be future-proofing Readium CSS to stay up-to-date with current/modern CSS authoring (cf. issue #12)

Prefixed properties

Blink and Webkit rendering engines may support some but it is unclear how we can be 100% conformant there, as it would require parsing the CSS to replace -epub-properties with the standard ones if the author has not used them.

As a matter of fact,

Authors are advised to use CSS-native solutions for the removed properties where and when they are available.

and,

Authors currently using these prefixed properties are advised to move to unprefixed versions as soon as support allows.

Proposal: let the rendering engine/web view deal with this. We don’t have Houdini yet and parsing CSS is a heavy process altering performance pretty badly.

HTML Suggested Rendering

We made sure we can rely on UA Stylesheets and have created a patch for paged views.

The patch deals with:

It doesn’t change the nature of HTML Suggested Rendering though, it only builds on it for EPUB rendering (adjustments).

Reading System Overrides

What’s important:

We meet both requirements by default.

As regards the cascade, the following list is the priority order we should emulate:

  1. important user agent declarations;
  2. important user declarations;
  3. important author declarations;
  4. normal author declarations;
  5. normal user declarations;
  6. normal user agent declarations.

Most user declarations have to use !important to make sure they are applied, which is conformant. However, we try to manage “normal author declarations” by carefully targeting selectors for each user setting.

Few user agent declarations have to use !important as well, in order to make sure the EPUB file displays as expected (pagination, page margins, etc.). In other words, those overrides are strictly necessary.

Please make sure to check the “CSS User Setting Recommendations” and “Stylesheets Order” to manage overrides as best as possible.

Notes

A conformant author’s stylesheet must not: