Skip to content

Update width/height comment#93

Open
foolip wants to merge 1 commit intomainfrom
width-height-coordinate-space
Open

Update width/height comment#93
foolip wants to merge 1 commit intomainfrom
width-height-coordinate-space

Conversation

@foolip
Copy link
Copy Markdown
Member

@foolip foolip commented Mar 19, 2026

No description provided.

@foolip
Copy link
Copy Markdown
Member Author

foolip commented Mar 19, 2026

@Kaiido FYI since you asked about this. Device pixels is wrong, or only true if you also size the canvas to match the pixel size reported by ResizeObserver, which is a good idea.

// dimensions in device pixels
readonly attribute unsigned long width;
readonly attribute unsigned long height;
// dimensions scaled such that when drawing to canvas, the element will appear
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we call this "intrinsic size" and define it as a first-class concept? It's a subtle enough concept that we had a lengthy discussion about it. The definition would be something like:

"the size, in canvas coordinate space, at which an Element or ElementImage will have the same proportions when drawn into the canvas as it would have were it placed outside the canvas with the same ComputedStyle."

These attributes can then simply be described as "intrinsic size of the element", and we would refer to the "intrinsic size" concept again in the IDL for drawElementImage, because that's the size we will use if the optional destination size parameters are omitted.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The concept definition of "intrinsic size" could also contain polyfill code to compute it based on canvas.(width|height) and canvas.client(Width|Height) and element_style.(width|height)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants