-
Notifications
You must be signed in to change notification settings - Fork 142
[CSS Paint API] Pass snapped concrete size to paint function #518
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
09bd3e2
changed to snapped concret size
xidachen ece4b77
updated rendering context width height
xidachen afc97a4
change the description of snappedConcreteObjectSize
xidachen 5ae88e0
change the description
xidachen 738c81b
fix typo
xidachen 9413d54
fix more typo
xidachen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -451,8 +451,9 @@ Note: The user agent can optionally defer drawing images which are <a>paint-inva | |
</div> | ||
|
||
The <a>draw a paint image</a> function is invoked by the user agent during the <a>object size | ||
negotiation</a> algorithm which is responsible for rendering an <<image>>, with |concreteObjectSize| | ||
set to the <a>concrete object size</a> of the <a>box</a>. | ||
negotiation</a> algorithm which is responsible for rendering an <<image>>, with |snappedConcreteObjectSize| | ||
set to the rounded <a>concrete object size</a> of the <a>box</a>, divided by the | ||
{{PaintWorkletGlobalScope/devicePixelRatio}}. | ||
|
||
For the purposes of the <a>object size negotiation</a> algorithm, the paint image has no | ||
<a>intrinsic dimensions</a>. | ||
|
@@ -463,15 +464,15 @@ Note: In a future version of the spec, the author could have the ability to spec | |
dimensions</a> based on computed style and size changes. | ||
|
||
The {{PaintSize}} object represents the size of the image that the author should draw. This is | ||
the <a>concrete object size</a> given by the user agent. | ||
the |snappedConcreteObjectSize| given by the user agent. | ||
|
||
Note: See [[css-images-3#object-sizing-examples]] for examples on how the <a>concrete object | ||
size</a> is calculated. | ||
|
||
The <a>draw a paint image</a> function may be speculatively invoked by the user agent at any point, | ||
with any |concreteObjectSize|. The resulting image is not displayed. | ||
with any |snappedConcreteObjectSize|. The resulting image is not displayed. | ||
|
||
Note: User agents may use any heuristic to speculate a possible future value for |concretObjectSize|, | ||
Note: User agents may use any heuristic to speculate a possible future value for |snappedConcretObjectSize|, | ||
for example speculating that the size remains unchanged. | ||
|
||
Note: Although the image is not displayed, it may still be cached, and subsequent invocations of | ||
|
@@ -488,12 +489,12 @@ interface PaintSize { | |
<div algorithm> | ||
When the user agent wants to <dfn>draw a paint image</dfn> of a <<paint()>> function for a |box| | ||
into its appropriate stacking level (as defined by the property the CSS property its associated | ||
with), given |concreteObjectSize| it <em>must</em> run the following steps: | ||
with), given |snappedConcreteObjectSize| it <em>must</em> run the following steps: | ||
1. Let |paintFunction| be the <<paint()>> function on the |box| which the user agent wants to | ||
draw. | ||
|
||
2. If the <a>paint valid flag</a> for the |paintFunction| is <a>paint-valid</a>, and the | ||
previous invocation had the same |concreteObjectSize|, the user agent <em>may</em> use the | ||
previous invocation had the same |snappedConcreteObjectSize|, the user agent <em>may</em> use the | ||
drawn image from the previous invocation. If so it <em>may</em> abort all these steps and | ||
use the previously drawn image. | ||
|
||
|
@@ -572,7 +573,7 @@ with), given |concreteObjectSize| it <em>must</em> run the following steps: | |
The user agent <em>may</em> also <a>create a WorkletGlobalScope</a> at this time, given the | ||
paint {{Worklet}}. | ||
|
||
13. Run <a>invoke a paint callback</a> given |name|, |inputArguments|, |concreteObjectSize|, | ||
13. Run <a>invoke a paint callback</a> given |name|, |inputArguments|, |snappedConcreteObjectSize|, | ||
|workletGlobalScope| optionally <a>in parallel</a>. | ||
|
||
Note: If the user agent runs <a>invoke a paint callback</a> on a thread <a>in parallel</a>, | ||
|
@@ -581,7 +582,7 @@ with), given |concreteObjectSize| it <em>must</em> run the following steps: | |
|
||
<div algorithm> | ||
When the user agent wants to <dfn>invoke a paint callback</dfn> given |name|, |inputArguments|, | ||
|concreteObjectSize|, and |workletGlobalScope|, it <em>must</em> run the following steps: | ||
|snappedConcreteObjectSize|, and |workletGlobalScope|, it <em>must</em> run the following steps: | ||
|
||
1. Let |paintDefinitionMap| be |workletGlobalScope|'s <a>paint definitions</a> map. | ||
|
||
|
@@ -630,7 +631,7 @@ When the user agent wants to <dfn>invoke a paint callback</dfn> given |name|, |i | |
<a>computed value</a>'s for properties listed in |inputProperties|. | ||
|
||
8. Let |renderingContext| be the result of <a>create a PaintRenderingContext2D object</a> given: | ||
- "width" - The width given by |concreteObjectSize|. | ||
- "width" - The width given by |concreteObjectSize|. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. new space? |
||
- "height" - The height given by |concreteObjectSize|. | ||
- "paintRenderingContext2DSettings" - The | ||
<a for="paint definition">PaintRenderingContext2DSettings object</a> given by |definition|. | ||
|
@@ -646,7 +647,7 @@ When the user agent wants to <dfn>invoke a paint callback</dfn> given |name|, |i | |
images. | ||
|
||
9. Let |paintSize| be a new {{PaintSize}} initialized to the width and height defined by | ||
|concreteObjectSize|. | ||
|snappedConcreteObjectSize|. | ||
|
||
10. At this stage the user agent may re-use an image from a previous invocation if |paintSize|, | ||
|styleMap|, |inputArguments| are equivalent to that previous invocation. If so let the image | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this phrasing captures pixel snapping correctly. Also, AFAICT, concrete object size is in CSS pixels. Rounding the concrete object size would suggests that
Instead, I think we should specify this in a way that allows the browser to use its own subpixel snapping determination.