Skip to content

[css-paint-api] Allow custom paint to optionally declare an intrinsic size. #31

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

Open
bfgeek opened this issue Aug 31, 2015 · 4 comments

Comments

@bfgeek
Copy link
Contributor

bfgeek commented Aug 31, 2015

This would allow for things like:

  • border-image.
  • tiling of background image.
  • keeping aspect ratio.

Should this be declared ahead of time, or set within a callback?

@frivoal
Copy link
Contributor

frivoal commented Sep 3, 2015

Ahead of time seems simpler. Do we have any other animated image type whose intrinsic size/ratio can change on each frame? If yes, maybe within the callback is fine, but that seems to introduce unnecessary complications for little to no benefit.

@tabatkins
Copy link
Member

Yes, we do have such an image type - crossfade(), when given two images with different intrinsic dimensions, transitions those dimensions as its own.

So we do indeed need some way to declare that your dimensions can change. On the other hand, the 99% case is dimensions not changing.

How about:

  • Add a "dimensions" key to PaintInitializionOptions, which accepts a (PaintDimensionsDict or DOMString). PaintDimensionsDict should be a dict with width/height/aspectratio keys. The accepted DOMString is "dynamic". Omitting implies no dimensions.
  • Add a "sizeCallback" key to PaintInitializationOptions. It takes the same params as paintCallback, and is expected to return a PaintDimensionsDict. We call it any time we call paintCallback (before or after doesn't matter, it's just important that they always be called together). It is only called if you passed "dynamic" to the "dimensions" key.

@frivoal
Copy link
Contributor

frivoal commented Sep 6, 2015

@tabatkins, that sounds reasonable.

@bfgeek
Copy link
Contributor Author

bfgeek commented Feb 2, 2016

Moving this to lvl-2 at the moment as per f2f. We can revisit once we've had some implementation experience. Specified that they have no intrinsic dimensions in 2b7a93b .

majido pushed a commit to majido/css-houdini-drafts that referenced this issue Aug 8, 2018
… root. (w3c#31)

We should only have one instance of a named animator per animator-root
element.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants