[scroll-animations-1] Use CSSTypedOM instead of strings (#5213)#5300
Conversation
|
|
||
| : <var>offset</var> is a <<length-percentage>> | ||
| : If <var>offset</var> is a {{CSSNumberish}} and matches <<number>>: | ||
| :: The distance indicated by the value in <a value>pixel unit</a> along |
There was a problem hiding this comment.
I was under the impression that treating plain numbers as px was a pattern we didn't want? Maybe get someone else's opinion on this. (@tabatkins ?)
There was a problem hiding this comment.
I personally felt allowing numbers to be interpreted as px would make the API easier to use in Javascript. Specially as it matches all existing scroll related APIs where numbers are treated as pixels
But I can also see at least two possible concerns:
- Automatic type conversion can be a footgun but perhaps this is limited enough to be safe
- Having every downstream spec convert
<numbers>differently would be bad. So perhaps have a common way to do this i.e.,<number>-><length>with pixel for all JS API's that accept length but want to accept number too.
BTW, does TypedOM have a special handling for 0 length for which in CSS the unit is optional?
In any case, this is a trade-off and @tabatkins expert's opinion is appreciated. :)
There was a problem hiding this comment.
We really don't want to interpret bare numbers as px. The definition of CSSNumberish interprets numeric values as a CSS "number" not a length. offset should simply be a CSSNumericValue or a CSSStyleValue.
There was a problem hiding this comment.
Done. I removed CSSNumberish and just use CSSNumericValue which I think is the right type.
Also added a procedure to validate the incoming values when they are being set.
| {{source}}'s scroll range in {{orientation}}. | ||
|
|
||
|
|
||
| : If <var>offset</var> is a {{CSSNumberish}} and matches |
There was a problem hiding this comment.
Can we link "matches" to https://drafts.css-houdini.org/css-typed-om-1/#cssstylevalue-match-a-grammar ?
| <pre class="idl"> | ||
| enum ScrollTimelineAutoKeyword { "auto" }; | ||
|
|
||
| typedef (CSSNumberish or ScrollTimelineAutoKeyword) ContainerBasedOffset; |
There was a problem hiding this comment.
We should IMO also accept CSSKeywordValue matching auto.
Would you want to use CSSKeywordish here (if it existed)?
There was a problem hiding this comment.
My bad, CSSKeywordish already exists: https://drafts.css-houdini.org/css-typed-om-1/#typedefdef-csskeywordish
Do we want to use that somehow, then?
There was a problem hiding this comment.
Done. As part of this I now have a procedure that rectifies strings into CSSKeyword and rejects invalid values at the time of setting the value.
The spec changed a while ago to use CSSNumericValue/CSSKeywordish for specifying container-based offsets [1]. This CL makes that switch. [1] w3c/csswg-drafts#5300 Bug: 1109769 Change-Id: I1d14d68008098e39035aecba940c0e02645f9d99
The spec changed a while ago to use CSSNumericValue/CSSKeywordish for specifying container-based offsets [1]. This CL makes that switch. [1] w3c/csswg-drafts#5300 Bug: 1109769 Change-Id: I1d14d68008098e39035aecba940c0e02645f9d99
The spec changed a while ago to use CSSNumericValue/CSSKeywordish for specifying container-based offsets [1]. This CL makes that switch. [1] w3c/csswg-drafts#5300 Bug: 1109769 Change-Id: I1d14d68008098e39035aecba940c0e02645f9d99
The spec changed a while ago to use CSSNumericValue/CSSKeywordish for specifying container-based offsets [1]. This CL makes that switch. [1] w3c/csswg-drafts#5300 Bug: 1109769 Change-Id: I1d14d68008098e39035aecba940c0e02645f9d99
The spec changed a while ago to use CSSNumericValue/CSSKeywordish for specifying container-based offsets [1]. This CL makes that switch. [1] w3c/csswg-drafts#5300 Bug: 1109769 Change-Id: I1d14d68008098e39035aecba940c0e02645f9d99 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2390740 Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> Reviewed-by: Yuki Shiino <yukishiino@chromium.org> Reviewed-by: Kevin Ellis <kevers@chromium.org> Cr-Commit-Position: refs/heads/master@{#806346}
The spec changed a while ago to use CSSNumericValue/CSSKeywordish for specifying container-based offsets [1]. This CL makes that switch. [1] w3c/csswg-drafts#5300 Bug: 1109769 Change-Id: I1d14d68008098e39035aecba940c0e02645f9d99 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2390740 Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> Reviewed-by: Yuki Shiino <yukishiino@chromium.org> Reviewed-by: Kevin Ellis <kevers@chromium.org> Cr-Commit-Position: refs/heads/master@{#806346}
The spec changed a while ago to use CSSNumericValue/CSSKeywordish for specifying container-based offsets [1]. This CL makes that switch. [1] w3c/csswg-drafts#5300 Bug: 1109769 Change-Id: I1d14d68008098e39035aecba940c0e02645f9d99 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2390740 Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> Reviewed-by: Yuki Shiino <yukishiino@chromium.org> Reviewed-by: Kevin Ellis <kevers@chromium.org> Cr-Commit-Position: refs/heads/master@{#806346}
…o specify offsets, a=testonly Automatic update from web-platform-tests [scroll-animations] Use CSSStyleValues to specify offsets The spec changed a while ago to use CSSNumericValue/CSSKeywordish for specifying container-based offsets [1]. This CL makes that switch. [1] w3c/csswg-drafts#5300 Bug: 1109769 Change-Id: I1d14d68008098e39035aecba940c0e02645f9d99 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2390740 Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> Reviewed-by: Yuki Shiino <yukishiino@chromium.org> Reviewed-by: Kevin Ellis <kevers@chromium.org> Cr-Commit-Position: refs/heads/master@{#806346} -- wpt-commits: c6ac22678d95c1a8414656822ff46d05ff0d1fed wpt-pr: 25366
…o specify offsets, a=testonly Automatic update from web-platform-tests [scroll-animations] Use CSSStyleValues to specify offsets The spec changed a while ago to use CSSNumericValue/CSSKeywordish for specifying container-based offsets [1]. This CL makes that switch. [1] w3c/csswg-drafts#5300 Bug: 1109769 Change-Id: I1d14d68008098e39035aecba940c0e02645f9d99 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2390740 Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> Reviewed-by: Yuki Shiino <yukishiino@chromium.org> Reviewed-by: Kevin Ellis <kevers@chromium.org> Cr-Commit-Position: refs/heads/master@{#806346} -- wpt-commits: c6ac22678d95c1a8414656822ff46d05ff0d1fed wpt-pr: 25366
…o specify offsets, a=testonly Automatic update from web-platform-tests [scroll-animations] Use CSSStyleValues to specify offsets The spec changed a while ago to use CSSNumericValue/CSSKeywordish for specifying container-based offsets [1]. This CL makes that switch. [1] w3c/csswg-drafts#5300 Bug: 1109769 Change-Id: I1d14d68008098e39035aecba940c0e02645f9d99 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2390740 Commit-Queue: Anders Hartvoll Ruud <andruudchromium.org> Reviewed-by: Yuki Shiino <yukishiinochromium.org> Reviewed-by: Kevin Ellis <keverschromium.org> Cr-Commit-Position: refs/heads/master{#806346} -- wpt-commits: c6ac22678d95c1a8414656822ff46d05ff0d1fed wpt-pr: 25366 UltraBlame original commit: ae84065cb5cf0390e0c328afcc132056e3943776
…o specify offsets, a=testonly Automatic update from web-platform-tests [scroll-animations] Use CSSStyleValues to specify offsets The spec changed a while ago to use CSSNumericValue/CSSKeywordish for specifying container-based offsets [1]. This CL makes that switch. [1] w3c/csswg-drafts#5300 Bug: 1109769 Change-Id: I1d14d68008098e39035aecba940c0e02645f9d99 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2390740 Commit-Queue: Anders Hartvoll Ruud <andruudchromium.org> Reviewed-by: Yuki Shiino <yukishiinochromium.org> Reviewed-by: Kevin Ellis <keverschromium.org> Cr-Commit-Position: refs/heads/master{#806346} -- wpt-commits: c6ac22678d95c1a8414656822ff46d05ff0d1fed wpt-pr: 25366 UltraBlame original commit: ae84065cb5cf0390e0c328afcc132056e3943776
…o specify offsets, a=testonly Automatic update from web-platform-tests [scroll-animations] Use CSSStyleValues to specify offsets The spec changed a while ago to use CSSNumericValue/CSSKeywordish for specifying container-based offsets [1]. This CL makes that switch. [1] w3c/csswg-drafts#5300 Bug: 1109769 Change-Id: I1d14d68008098e39035aecba940c0e02645f9d99 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2390740 Commit-Queue: Anders Hartvoll Ruud <andruudchromium.org> Reviewed-by: Yuki Shiino <yukishiinochromium.org> Reviewed-by: Kevin Ellis <keverschromium.org> Cr-Commit-Position: refs/heads/master{#806346} -- wpt-commits: c6ac22678d95c1a8414656822ff46d05ff0d1fed wpt-pr: 25366 UltraBlame original commit: ae84065cb5cf0390e0c328afcc132056e3943776
…o specify offsets, a=testonly Automatic update from web-platform-tests [scroll-animations] Use CSSStyleValues to specify offsets The spec changed a while ago to use CSSNumericValue/CSSKeywordish for specifying container-based offsets [1]. This CL makes that switch. [1] w3c/csswg-drafts#5300 Bug: 1109769 Change-Id: I1d14d68008098e39035aecba940c0e02645f9d99 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2390740 Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> Reviewed-by: Yuki Shiino <yukishiino@chromium.org> Reviewed-by: Kevin Ellis <kevers@chromium.org> Cr-Commit-Position: refs/heads/master@{#806346} -- wpt-commits: c6ac22678d95c1a8414656822ff46d05ff0d1fed wpt-pr: 25366
Use appropriate CSSTypedOM instead of DOMStrings in the API. Fixes #5213.
Changes:
CSSNumericValueorCSSKeywordishinstead of DOMString