Skip to content

[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 6 commits into from
Apr 5, 2018

Conversation

xidachen
Copy link
Contributor

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

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Nov 14, 2017
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
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Nov 14, 2017
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
@@ -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|.
Copy link
Contributor

Choose a reason for hiding this comment

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

new space?

Copy link
Contributor

@bfgeek bfgeek left a 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?

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
Copy link
Contributor

@flackr flackr Nov 14, 2017

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.

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Nov 15, 2017
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
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Nov 15, 2017
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}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Nov 15, 2017
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}
MXEBot pushed a commit to mirror/chromium that referenced this pull request Nov 16, 2017
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}
@xidachen
Copy link
Contributor Author

flackr@: I changed the description of |snappedConcreteSize|, let me know if it is better or worse.

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
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

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>.
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed :)

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
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@bfgeek bfgeek merged commit dcfdb44 into w3c:master Apr 5, 2018
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.

3 participants