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

[css-paint-api] Box concrete object size #417

Closed
asajeffrey opened this issue Jun 21, 2017 · 6 comments
Closed

[css-paint-api] Box concrete object size #417

asajeffrey opened this issue Jun 21, 2017 · 6 comments

Comments

@asajeffrey
Copy link

When drawing a paint image (https://drafts.css-houdini.org/css-paint-api/#draw-a-paint-image), the image size is defined to be the concrete object size of the box (https://drafts.csswg.org/css-images-3/#concrete-object-size).

Experimentally, chrome uses the size in px, including the padding but not the border or margin. If this is the intended behaviour, the spec should probably say so.

@tabatkins
Copy link
Member

It is indeed supposed to be the size in px.

Padding/border/margin is irrelevant here; you're not painting an element, you're painting an <image>. Every place that accepts an <image> defines how it gets sized. The spec's language is a little confusing/confused here; boxes don't have "concrete object sizes" (well, not by default at least; it's possible to invoke that algorithm to size a box).

@asajeffrey
Copy link
Author

Not sure that padding/border/margin is irrelevant here, given a box we need to know which size to use, the only way I could see to calculate it involved border + margin.

@tabatkins
Copy link
Member

Yeah, but that's all encapsulated in the "figure out the size of the background-image"/whatever algorithm. It's not directly relevant to this specification at all; it just needs to know the concrete object size.

@asajeffrey
Copy link
Author

OK, but in might be nice to link to https://drafts.csswg.org/css-images-3/#object-sizing-examples, and perhaps put a note to the effect that for background images the default sizing algorithm is the box size including padding, but excluding border and margin.

@tabatkins
Copy link
Member

Agree that linking there would be useful.

bfgeek added a commit that referenced this issue Nov 9, 2017
@bfgeek
Copy link
Contributor

bfgeek commented Nov 9, 2017

I've added a link to the object-sizing-examples just below where {{PaintSize}} is defined. I didn't add the note about how it excludes border & margin out of risk that css-images will change the definition someday :).

@bfgeek bfgeek closed this as completed Nov 9, 2017
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