Re: [css-houdini-drafts] [typed-om] Trim CSSResourceValue and subclasses to opaque objects for this level, punt rest to level 2

Okay, I think I've hit on the necessary design.

I need a CSSImageValue, subclass of CSSStyleValue, representing all images. In the next level we'll add some subtypes for this, like CSSLinearGradientFunctionValue or something.

I also need a CSSURLValue, subclass of CSSStyleValue, representing the `url()` syntax.  *All* `url()`s are reified as this, because in some cases we can't tell what type a `url()` should resolve to until after we fetch it, and this behavior might spread to *all* `<image>` cases (if we ever allow, for example, pointing to an SVG `<linearGradient>` as an `<image>`, which seems reasonable).

We'll add a CSSImageish typedef that accepts CSSImageValue and CSSURLValue, and things that want to take a CSSImageValue should take the typedef instead; if a CSSURLValue is used and doesn't end up pointing to an image, it'll just be an invalid image, no problem.

In the next level we'll add a `CSSURLImageValue`, which you can obtain from a `CSSURLValue` (either thru a constructor, or a promise-returning method, or something), which exposes the width/height/etc stuff that you expect from an image.  This will *never* be reified directly from an underlying value, you must *always* manually obtain it via the converter.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/716#issuecomment-368656793 using your GitHub account

Received on Monday, 26 February 2018 21:28:28 UTC