#490: Image Resource

Visit on Github.

Opened Mar 25, 2020

Hello TAG!

I'm requesting a TAG review of Image Resource.

The specification defines the concept of an "image resource" and a corresponding WebIDL ImageResource dictionary. Web APIs can use the ImageResource dictionary to represent an image resource in contexts where an HTMLImageElement is not suitable or available (e.g., in a Worker).

Further details:

  • I have reviewed the TAG's API Design Principles
  • Relevant time constraints or deadlines: We would like to move this to FPWD soon.
  • The group where the work on this specification is currently being done: Web Apps WG
  • The group where standardization of this work is intended to be done (if current group is a community group or other incubation venue):
  • Major unresolved issues with or opposition to this specification: None
  • This work is being funded by: Google, Microsoft, Mozilla

You should also know that this proposed spec is an extraction of Image Resource from the Web App Manifest.

We'd prefer the TAG provide feedback as a comment in this issue and @-notify @marcoscaceres @aarongustafson @rayankans

Discussions

Comment by @dbaron Mar 25, 2020 (See Github)

Seems like it might be worth briefly explaining how this differs (it does!) from CanvasImageSource or ImageBitmapSource.

Comment by @aarongustafson Mar 27, 2020 (See Github)

Adding @rayankans & @marcoscaceres for visibility

Comment by @aarongustafson Mar 27, 2020 (See Github)

@torgo As ImageResource exists within the Web App Manifest currently, do we need to create an explainer for it or would the repo readme suffice?

Discussed Apr 6, 2020 (See Github)

[ran out of time; push out one week

Discussed Apr 13, 2020 (See Github)

Rossen: This seems quite straightforward. David had some questions unaddressed.

David: Not sure if it makes sense to go in to the technicalities, this is effectively a struct

Rossen: The sizes part of this spec is a bit strange, do we have other cases that provide an interface that should be matched for consistency?

My question is - if a specific size fails, should it throw or try to fall back to a default size?

David: There is a section in the HTML spec about parsing (shares link)

Rossen: But this doesn't match up with what the spec says. The spec has a hard throw if it fails, which doesn't look possible in the HTML spec parsing.

Peter: Explainer?

Sangwhan: Doesn't exist but not sure if it's worth picking the figh

Comment by @dbaron Apr 13, 2020 (See Github)

Also, it seems like the Status of this document section should be for the Web Apps WG, given that it seems that's where the doc is being developed.

Comment by @cynthia Apr 14, 2020 (See Github)

Is there a destined final home (as a section of some other spec, presumably manifest) for this, or will this live on as a separate spec? Curious if there are other struct specs in the pipeline that could be also put into the same spec in that case.

Comment by @aarongustafson Apr 14, 2020 (See Github)

Also, it seems like the Status of this document section should be for the Web Apps WG, given that it seems that's where the doc is being developed.

This request is coming from the Web Apps WG, prior to us graduating this and making the edits necessary to the manifest spec.

Is there a destined final home (as a section of some other spec, presumably manifest) for this, or will this live on as a separate spec? Curious if there are other struct specs in the pipeline that could be also put into the same spec in that case.

We extracted this from the Manifest spec specifically because the same concept is being used elsewhere (e.g., payments and notifications). Our plan is to have it remain independent and get pulled into other specs and extended as necessary (e.g., the manifest spec as a purpose member).

Comment by @dbaron Apr 14, 2020 (See Github)

One other thing we discussed during the breakout was the differences between the sizes attribute on link versus img and what definition was being linked to.

Following up afterwards, it looks like the section titles like § 4.8.4.2 Attributes common to source, img, and link elements seem to imply that the attribute is the same for both, though I didn't trace all the definitions. We found very detailed processing rules that apply to these attributes, and found things in the HTML spec that link to that definition, but don't see how this spec links to that definition, since it use the text (twice, with link) "as if it was a sizes attribute" which links to the attribute's description and not to that detailed processing model.

It seems like something in this spec should reference those parsing rules.

Comment by @rayankans Apr 15, 2020 (See Github)

@dbaron I'm not sure if that's the right thing to link to. For one thing, what counts as a valid value for the definitions do not overlap.

Comment by @domenic Apr 15, 2020 (See Github)

@dbaron is correct. "Validity" is for HTML conformance checkers, not for browsers. The parsing rules are what browsers need to implement.

Comment by @rayankans Apr 15, 2020 (See Github)

Ok I see the source of the confusion now, that's the processing rule for the img's sizes attribute instead of the one for link.

https://html.spec.whatwg.org/multipage/links.html#attr-link-sizes-any

Comment by @dbaron Apr 15, 2020 (See Github)

The point I was trying to make is that if you want to define how implementations should process something, you should link to the rules for how an implementation processes something, not to the rules describing the semantics or the rules describing the set of valid values for documents. The wording about the semantics of the attributes appears to be different for <img> and <link> (I think -- there's a lot of links to follow), but the implementation processing rules are common.

In particular, § 4.8.4.3.9 Parsing a sizes attribute applies to both img and link since it's linked from update the source set which is linked from select an image source which is linked from:

Comment by @dbaron Apr 15, 2020 (See Github)

(Some useful background for understanding that distinction might be Hixie's old blog post on Kinds of statements which is linked from § 10.1 Other resources in the TAG's design-principles document.)

Comment by @domenic Apr 15, 2020 (See Github)

Note "parsing a sizes attribute" for <link> is for the imagesizes attribute, not the sizes attribute. 🙃

Comment by @dbaron Apr 15, 2020 (See Github)

Oh well. Maybe I need a summary of what's what, since I've lost track. :-/

Discussed Apr 20, 2020 (See Github)

David: Propose closing it - we spent a lot of time on this given its small size. I think we've given them a lot more feedback than those 3 paragraphs would have gotten had they stayed in their original spec.

Ken: I am OK with that.

David: Defer to plenary whether we will close or not.

Comment by @dbaron Apr 22, 2020 (See Github)

In any case, at this point the TAG has reviewed this in rather more detail than we'd normally have reviewed this set of paragraphs had they not moved into their own spec. At the level we'd normally review something, we're happy with this, and don't see a need to leave this issue open.

That said, there's a bit of low-level feedback in this issue on both what to refer to, and a little other stuff that might make the point of the separate spec clearer to readers. If you'd like us to file issues on that stuff, let us know, although you did request feedback in this issue rather than in your own repo.

In any case, thanks for requesting TAG review.