-
Notifications
You must be signed in to change notification settings - Fork 143
[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
Conversation
Right now when we set the PaintSize in CSSPaintDefinition::Paint(), the size is the concrete object size. There has been some discussion around here: w3c/css-houdini-drafts#508 and the solution is to pass the snapped concrete object size divided by device scale factor. The ongoing pull request to change the spec is here: w3c/css-houdini-drafts#518 This CL corrects the PaintSize to reflect the spec changes. It also adds a layout test to ensure the correctness. Bug: 774810 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Change-Id: I42b57db6ac0d40be2b408cb733a659f5ea14dfa0
Right now when we set the PaintSize in CSSPaintDefinition::Paint(), the size is the concrete object size. There has been some discussion around here: w3c/css-houdini-drafts#508 and the solution is to pass the snapped concrete object size divided by device scale factor. The ongoing pull request to change the spec is here: w3c/css-houdini-drafts#518 This CL corrects the PaintSize to reflect the spec changes. It also adds a layout test to ensure the correctness. Bug: 774810 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Change-Id: I42b57db6ac0d40be2b408cb733a659f5ea14dfa0
css-paint-api/Overview.bs
Outdated
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
new space?
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.
Looks great, @flackr ok?
css-paint-api/Overview.bs
Outdated
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 |
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
- this only affects objects whose size is non-integral - this is not true as it affects integral sizes when they are rastered into a non-integral transformed space (i.e. non-integer devicePixelRatio).
- we always snap an object of a particular size in the same direction, but it actually depends on the object's location.
- all browsers snap the same way. This seems to be the case but should probably not be required.
Instead, I think we should specify this in a way that allows the browser to use its own subpixel snapping determination.
Right now when we set the PaintSize in CSSPaintDefinition::Paint(), the size is the concrete object size. There has been some discussion around here: w3c/css-houdini-drafts#508 and the solution is to pass the snapped concrete object size divided by device scale factor. The ongoing pull request to change the spec is here: w3c/css-houdini-drafts#518 This CL corrects the PaintSize to reflect the spec changes. It also adds a layout test to ensure the correctness. Bug: 774810 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Change-Id: I42b57db6ac0d40be2b408cb733a659f5ea14dfa0
Right now when we set the PaintSize in CSSPaintDefinition::Paint(), the size is the concrete object size. There has been some discussion around here: w3c/css-houdini-drafts#508 and the solution is to pass the snapped concrete object size divided by device scale factor. The ongoing pull request to change the spec is here: w3c/css-houdini-drafts#518 This CL corrects the PaintSize to reflect the spec changes. It also adds a layout test to ensure the correctness. Bug: 774810 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Change-Id: I42b57db6ac0d40be2b408cb733a659f5ea14dfa0 Reviewed-on: https://chromium-review.googlesource.com/733862 Reviewed-by: Chris Harrelson <chrishtr@chromium.org> Commit-Queue: Xida Chen <xidachen@chromium.org> Cr-Commit-Position: refs/heads/master@{#516872}
Right now when we set the PaintSize in CSSPaintDefinition::Paint(), the size is the concrete object size. There has been some discussion around here: w3c/css-houdini-drafts#508 and the solution is to pass the snapped concrete object size divided by device scale factor. The ongoing pull request to change the spec is here: w3c/css-houdini-drafts#518 This CL corrects the PaintSize to reflect the spec changes. It also adds a layout test to ensure the correctness. Bug: 774810 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Change-Id: I42b57db6ac0d40be2b408cb733a659f5ea14dfa0 Reviewed-on: https://chromium-review.googlesource.com/733862 Reviewed-by: Chris Harrelson <chrishtr@chromium.org> Commit-Queue: Xida Chen <xidachen@chromium.org> Cr-Commit-Position: refs/heads/master@{#516872}
Right now when we set the PaintSize in CSSPaintDefinition::Paint(), the size is the concrete object size. There has been some discussion around here: w3c/css-houdini-drafts#508 and the solution is to pass the snapped concrete object size divided by device scale factor. The ongoing pull request to change the spec is here: w3c/css-houdini-drafts#518 This CL corrects the PaintSize to reflect the spec changes. It also adds a layout test to ensure the correctness. Bug: 774810 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Change-Id: I42b57db6ac0d40be2b408cb733a659f5ea14dfa0 Reviewed-on: https://chromium-review.googlesource.com/733862 Reviewed-by: Chris Harrelson <chrishtr@chromium.org> Commit-Queue: Xida Chen <xidachen@chromium.org> Cr-Commit-Position: refs/heads/master@{#516872}
flackr@: I changed the description of |snappedConcreteSize|, let me know if it is better or worse. |
css-paint-api/Overview.bs
Outdated
negotiation</a> algorithm which is responsible for rendering an <<image>>, with |snappedConcreteObjectSize| | ||
defined as follows. Let |concreateObjectSize| be the <a>concrete object size</a> of the <a>box</a>, and | ||
|deviceObjectSize| be the |concreateObjectSize| multiplied by the {{PaintWorkletGlobalScope/devicePixelRatio}}. | ||
If the |deviceObjectSize| is non-integral, then adjust it to align with pixel boundary. Finally, set |
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.
It's not a requirement to snap, but the browser is allowed to. How about something like this?
The |snappedConcreteObjectSize| is usually the same as the |concreteObjectSize|; however, the user agent may adjust the size such that it paints to pixel boundaries. If it does, the user agent should adjust the |snappedConcreteObjectSize| by the proportional change from its original size so that the paint function can adjust the drawing accordingly.
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.
Done.
css-paint-api/Overview.bs
Outdated
If the |deviceObjectSize| is non-integral, then adjust it to align with pixel boundary. Finally, set | ||
|snappedConcreateObjectSize| to the adjusted |deviceObjectSize| divided by the | ||
{{PaintWorkletGlobalScope/devicePixelRatio}}. | ||
defined as follows. Let |concreateObjectSize| be the <a>concrete object size</a> of the <a>box</a>. |
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.
s/concreateObjectSize/concreteObjectSize/ here and below.
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.
Fixed :)
css-paint-api/Overview.bs
Outdated
defined as follows. Let |concreateObjectSize| be the <a>concrete object size</a> of the <a>box</a>. | ||
The |snappedConcreateObjectSize| is usually the same as the |concreateObjectSize|. However, the | ||
defined as follows. Let |concreteObjectSize| be the <a>concrete object size</a> of the <a>box</a>. | ||
The |snappedConcreateObjectSize| is usually the same as the |concreteObjectSize|. However, the |
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.
s/snappedConcreateObjectSize/snappedConcreteObjectSize here and below
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.
Done.
This pull request address the issue here:
#508
Basically, instead of passing the concrete object size to the paint function, we let it pass the round(concrete object size) / device pixel ratio.
Please review. @bfgeek @flackr