Commit 403c505
Implement basic support for random() function
Add random function to CSSMathExpressionNode.
Random base value cache [0] is stored on the Document.
There are two major remaining things:
1. Currently we don't store correct property name and property value
index in random caching key [1]. There are failing tests reflecting
that.
2. If a random() function can’t be simplified by computed value time,
then it should compute to its maximally-simplified form,
but with its <random-value-sharing> set to its random base value, [2].
This currently doesn't work correctly since we just resolve to
computed percentage value instead, i.e. same as min-max percentage
serialization doesn't work correctly in chrome [3].
Note: There are some failing tests that allows calc expressions and
random function inside fixed value, like:
random(fixed calc(2 / 4), 0px, 100px)
Though according to spec only numbers from 0 to 1
(fixed <number [0,1]>) should be allowed. These tests
should probably be removed.
Tests with invalidation to be added in the next CL.
[0] https://drafts.csswg.org/css-values-5/#random-caching
[1] https://drafts.csswg.org/css-values-5/#random-caching-key
[2] https://drafts.csswg.org/css-values-5/#random
[3] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/css/css-values/minmax-percentage-serialize-expected.txt
[4] https://drafts.csswg.org/css-values-5/#valdef-random-fixed
Bug: 413385732
Change-Id: I350a1c616d69302353c935dd12580f846ec59a53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7170451
Commit-Queue: Munira Tursunova <[email protected]>
Reviewed-by: Rune Lillesveen <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1549109}1 parent 7d1c922 commit 403c505
1 file changed
+21
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
53 | 60 | | |
54 | 61 | | |
55 | 62 | | |
| |||
68 | 75 | | |
69 | 76 | | |
70 | 77 | | |
71 | | - | |
| 78 | + | |
72 | 79 | | |
73 | 80 | | |
74 | 81 | | |
75 | 82 | | |
76 | | - | |
| 83 | + | |
77 | 84 | | |
78 | 85 | | |
79 | 86 | | |
| |||
163 | 170 | | |
164 | 171 | | |
165 | 172 | | |
166 | | - | |
| 173 | + | |
167 | 174 | | |
168 | | - | |
| 175 | + | |
169 | 176 | | |
170 | 177 | | |
171 | 178 | | |
172 | 179 | | |
173 | | - | |
174 | | - | |
| 180 | + | |
| 181 | + | |
175 | 182 | | |
176 | 183 | | |
177 | 184 | | |
| |||
323 | 330 | | |
324 | 331 | | |
325 | 332 | | |
326 | | - | |
| 333 | + | |
327 | 334 | | |
328 | 335 | | |
329 | 336 | | |
| |||
338 | 345 | | |
339 | 346 | | |
340 | 347 | | |
341 | | - | |
| 348 | + | |
| 349 | + | |
342 | 350 | | |
343 | 351 | | |
344 | 352 | | |
| |||
384 | 392 | | |
385 | 393 | | |
386 | 394 | | |
387 | | - | |
| 395 | + | |
| 396 | + | |
388 | 397 | | |
389 | 398 | | |
390 | 399 | | |
| |||
430 | 439 | | |
431 | 440 | | |
432 | 441 | | |
433 | | - | |
| 442 | + | |
| 443 | + | |
434 | 444 | | |
435 | 445 | | |
436 | 446 | | |
| |||
472 | 482 | | |
473 | 483 | | |
474 | 484 | | |
475 | | - | |
| 485 | + | |
476 | 486 | | |
477 | 487 | | |
478 | 488 | | |
| |||
0 commit comments