Skip to content

Provide generalized resource mechanism #215

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
shans opened this issue Jun 8, 2016 · 0 comments
Open

Provide generalized resource mechanism #215

shans opened this issue Jun 8, 2016 · 0 comments

Comments

@shans
Copy link
Contributor

shans commented Jun 8, 2016

Custom Properties and paint function arguments will give us most of the mechanisms available for CSS to feed data into a paint routine, but there's still one missing - custom resources.

For example, keyframes are passed into the animation subsystem via a specific @Keyframes resource dictionary, while fonts are configured using an @fontface dictionary.

A specific use-case for allowing custom resource dictionaries is replicating the paint server idea from SVG - it'd be really nice to be able to specify paint resources that can be incorporated into custom paint routines across the document in a manner analogous to the way that backgrounds can currently reference any paint server in the document.

A very rough V0 API sketch would be:

  • a way of programmatically defining a resource dictionary with a name
  • a way of programmatically inserting resources into the dictionary
  • a way of registering a custom paint dependency on a resource dictionary
  • a way of fetching resources from the resource dictionary into the custom painter

A major caveat that will need to be solved here is that we either need to make the paint routine re-run every time any value is inserted into the resource dictionary, or we'll need to be smarter about tracking runtime dependencies for resource dictionaries (e.g. the paint function might have an API to register an explicit dependency on a name in the resource dictionary too).

Once the parser API is up and running then it will be very natural to hook parser output up to resource population, so we might want to add declarative affordances for that too.

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

2 participants