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

picture element and image CMTs #781

Closed
mattgarrish opened this issue Jul 12, 2017 · 4 comments
Closed

picture element and image CMTs #781

mattgarrish opened this issue Jul 12, 2017 · 4 comments
Assignees
Labels
spec: EPUB 3.2 Impacting the support of EPUB 3.2 status: has PR The issue is being processed in a pull request type: feature The issue describes a new feature request
Milestone

Comments

@mattgarrish
Copy link
Member

Noting that HTML 5.1 adds the picture element, which allows multiple source images to be specified. This means that you can provide a fallback CMT image for a non-CMT image type without having to use manifest fallbacks.

epubcheck will need to account for the child source elements in determining whether a CMT is available.

This doesn't change fallbacks for images outside the picture element.

@tofi86
Copy link
Collaborator

tofi86 commented Jul 12, 2017

Is this only EPUB 3.1 or also EPUB 3.0?

@tofi86 tofi86 added the type: feature The issue describes a new feature request label Jul 12, 2017
@mattgarrish
Copy link
Member Author

Only for 3.1.

The picture element wasn't in HTML 5.0, and EPUB 3.0(.1) have hard references to that version.

@mattgarrish mattgarrish added spec: EPUB 3.2 Impacting the support of EPUB 3.2 status: accepted Ready to be further processed and removed epub-3.1 labels Nov 12, 2018
@rdeltour rdeltour self-assigned this Feb 19, 2019
@rdeltour rdeltour added this to the 4.2.0-beta milestone Feb 19, 2019
@rdeltour
Copy link
Member

epubcheck will need to account for the child source elements in determining whether a CMT is available.

I'm not sure what the rule should be, given that a non-naïve check would need to compute not-only the image source set, but also the image selection algorithm (in other words, an image from the source set can only be considered as a fallback when it can be selected in the same conditions –viewport size, etc– as the non-CMT image).

Thoughts?

@rdeltour
Copy link
Member

So after discussed with @mattgarrish we agreed we should at least:

  • add support for the source element and srcset attribute (i.e. parse srcset and add the found paths to the xref checker)
  • once the above is done, make sure the img is accepted as a fallback for previous source siblings

This requires however a correct implementation of srcset parsing.

As the full requirements depend on the discussion happening in the CG, and it's unlikely that srcset is heavily used in EPUB, at least not critically, let’s tackle this issue in the RC.

rdeltour added a commit that referenced this issue Mar 15, 2019
Message changes:

- new `MED-007` (`ERROR`) message is reported when an image source
  references a foreign resource (unless on `source` elements which
  `type` attribute specify non-core media type).
- reworded `MED-003`; it now includes the resource path.

Internal changes:

- add a `SourceSet` class to represent an image source set, along with
  a parser folloing the "parsing a srcset attribute" algorithm from HTML.
  See https://html.spec.whatwg.org/#parsing-a-srcset-attribute
- add to new reference types to the `XRefChecker` class, `PICTURE_SOURCE`
  and `PICTURE_SOURCE_FOREIGN`, to identify image source references in
  `picture` elements.
- add tests, for both the `srcset` parser and the new fallback rules.

Fix #781
@rdeltour rdeltour added status: has PR The issue is being processed in a pull request and removed status: accepted Ready to be further processed labels Mar 15, 2019
rdeltour added a commit that referenced this issue Mar 17, 2019
Message changes:

- new `MED-007` (`ERROR`) message is reported when an image source
  references a foreign resource (unless on `source` elements which
  `type` attribute specify non-core media type).
- reworded `MED-003`; it now includes the resource path.

Internal changes:

- add a `SourceSet` class to represent an image source set, along with
  a parser folloing the "parsing a srcset attribute" algorithm from HTML.
  See https://html.spec.whatwg.org/#parsing-a-srcset-attribute
- add to new reference types to the `XRefChecker` class, `PICTURE_SOURCE`
  and `PICTURE_SOURCE_FOREIGN`, to identify image source references in
  `picture` elements.
- add tests, for both the `srcset` parser and the new fallback rules.

Fix #781
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec: EPUB 3.2 Impacting the support of EPUB 3.2 status: has PR The issue is being processed in a pull request type: feature The issue describes a new feature request
Projects
None yet
Development

No branches or pull requests

3 participants