You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ed7012d
Browse filesBrowse the repository at this point in the historyBrowse files
fix(css): keep the digits Firefox lays a percentage out with (#22718)
* fix(css): keep the digits Firefox lays a percentage out with
Six significant digits are calibrated on Blink's 1/64px layout. Gecko
parses a percentage as a single-precision float and lays it out in
1/60px, so `calc(100% / 3)` printed as `33.3333%` moved a
`translateX(100%)` by 0.03px in the Radix Themes benchmark. A
percentage now keeps the fewest digits, six or more, that parse to the
same float (`33.333333%`). An alpha value or `scale` written as a
number rounds again as one.
* test(css): update the percentage outputs the config cases record
* fix(css): keep a percentage as written where no nine digits reach its float
* fix(css): compare a percentage as the fraction Gecko stores
Gecko parses `14.285714%` as the single-precision fraction 0.14285713,
one float step from the 0.14285715 `calc(100% / 7)` computes, which
moved a seven-segment Radix indicator by 0.1px. The digits are now
chosen to reach the fraction's float, not the percentage's.
"/*! width: calc(100% / 3 + 100% / 3) — same as lightningcss: 66.6667% */.k053{width:66.6667%}",
228
+
"/*! width: calc(100% / 3 + 100% / 3) — lightningcss: 66.6667% — ours keeps the digits Firefox lays a percentage out with */.k053{width:66.66667%}",
229
229
"/*! opacity: calc(1 / 3) — same as lightningcss: .333333 */.k054{opacity:.333333}",
230
230
"/*! opacity: calc(1 / 2) — same as lightningcss: .5 */.k055{opacity:.5}",
231
231
"/*! opacity: calc(0.5 + 0.25) — same as lightningcss: .75 */.k056{opacity:.75}",
@@ -309,20 +309,20 @@ Array [
309
309
"/*! width: -moz-calc(1px + 2px) — same as lightningcss: -moz-calc(1px + 2px) */.k134{width:-moz-calc(1px+ 2px)}",
310
310
"/*! margin: calc(1px + 1px) calc(2px * 2) — same as lightningcss: 2px 4px */.k135{margin:2px 4px}",
311
311
"/*! margin: calc(10px / 3) 0 — same as lightningcss: 3.33333px 0 */.k136{margin:3.33333px0}",
312
-
"/*! transform: translateX(calc(100% / 3)) — same as lightningcss: translate(33.3333%) */.k137{transform:translate(33.3333%)}",
313
-
"/*! transform: translate(calc(10px + 5px), calc(100% / 3)) — same as lightningcss: translate(15px,33.3333%) */.k138{transform:translate(15px,33.3333%)}",
312
+
"/*! transform: translateX(calc(100% / 3)) — lightningcss: translate(33.3333%) — ours keeps the digits Firefox lays a percentage out with */.k137{transform:translate(33.333333%)}",
313
+
"/*! transform: translate(calc(10px + 5px), calc(100% / 3)) — lightningcss: translate(15px,33.3333%) — ours keeps the digits Firefox lays a percentage out with */.k138{transform:translate(15px,33.333333%)}",
314
314
"/*! transform: rotate(calc(45deg * 2)) — same as lightningcss: rotate(90deg) */.k139{transform:rotate(90deg)}",
315
315
"/*! transform: scale(calc(1 / 3)) — same as lightningcss: scale(.333333) */.k140{transform:scale(.333333)}",
316
-
"/*! background-position: calc(100% / 3) calc(50% + 10px) — lightningcss: 33.3333% calc(50% + 10px) — the same value, ours dropping a space the tokens do not need */.k141{background-position:33.3333%calc(50%+ 10px)}",
317
-
"/*! grid-template-columns: repeat(3, calc(100% / 3)) — same as lightningcss: repeat(3,33.3333%) */.k142{grid-template-columns:repeat(3,33.3333%)}",
316
+
"/*! background-position: calc(100% / 3) calc(50% + 10px) — lightningcss: 33.3333% calc(50% + 10px) — ours keeps the digits Firefox lays a percentage out with */.k141{background-position:33.333333%calc(50%+ 10px)}",
317
+
"/*! grid-template-columns: repeat(3, calc(100% / 3)) — lightningcss: repeat(3,33.3333%) — ours keeps the digits Firefox lays a percentage out with */.k142{grid-template-columns:repeat(3,33.333333%)}",
318
318
"/*! box-shadow: calc(1px + 1px) 0 calc(4px / 3) #000 — lightningcss: 2px 0 1.33333px #000 — the same value, ours dropping a space the tokens do not need */.k143{box-shadow:2px0 1.33333px#000}",
319
319
"/*! color: rgb(calc(255 / 3) 0 0) — same as lightningcss: #500 */.k144{color:#500}",
320
320
"/*! color: rgb(calc(100 + 55) 0 0) — same as lightningcss: #9b0000 */.k145{color:#9b0000}",
321
321
"/*! color: hsl(calc(360 / 7) 50% 50%) — same as lightningcss: #bfad40 */.k146{color:#bfad40}",
322
322
"/*! color: rgb(0 0 0 / calc(1 / 3)) — same as lightningcss: #0005 */.k147{color:#0005}",
323
323
"/*! font: calc(10px + 2px)/1.5 serif — same as lightningcss: 12px/1.5 serif */.k148{font:12px/1.5serif}",
324
-
"/*! border-radius: calc(100% / 3) — same as lightningcss: 33.3333% */.k149{border-radius:33.3333%}",
325
-
"/*! inset: calc(100% / 3) 0 0 0 — lightningcss: 33.3333% 0 0 — the same value, ours dropping a space the tokens do not need */.k150{inset:33.3333%00}",
324
+
"/*! border-radius: calc(100% / 3) — lightningcss: 33.3333% — ours keeps the digits Firefox lays a percentage out with */.k149{border-radius:33.333333%}",
325
+
"/*! inset: calc(100% / 3) 0 0 0 — lightningcss: 33.3333% 0 0 — ours keeps the digits Firefox lays a percentage out with */.k150{inset:33.333333%00}",
326
326
"/*! width: calc(100% / 3 * 3) — same as lightningcss: 100% */.k151{width:100%}",
327
327
"/*! width: calc(1px * 3 / 3) — same as lightningcss: 1px */.k152{width:1px}",
328
328
"/*! width: calc(1 / 3 * 3px) — same as lightningcss: 1px */.k153{width:1px}",
@@ -348,7 +348,7 @@ Array [
348
348
"/*! rotate: calc(1turn - 90deg) — same as lightningcss: 270deg */.k173{rotate:270deg}",
349
349
"/*! aspect-ratio: 16 / 9 — same as lightningcss: 16/9 */.k174{aspect-ratio:16/9}",
350
350
"/*! aspect-ratio: auto 16 / 9 — same as lightningcss: auto 16/9 */.k175{aspect-ratio:auto16/9}",
351
-
"/*! background: linear-gradient(red calc(100% / 3), blue) — lightningcss: linear-gradient(red 33.3333%,#00f) — the same length either way */.k176{background:linear-gradient(red33.3333%,blue)}",
351
+
"/*! background: linear-gradient(red calc(100% / 3), blue) — lightningcss: linear-gradient(red 33.3333%,#00f) — ours keeps the digits Firefox lays a percentage out with */.k176{background:linear-gradient(red33.333333%,blue)}",
352
352
]
353
353
`;
354
354
@@ -1537,7 +1537,7 @@ Array [
1537
1537
"/*! webpack: \`@container\` carries media features too, name and all */@container card (width>=1px){.t69{color:red}}",
1538
1538
"/*! declined: a plain feature has no range spelling to reach for */@media (width:100px){.t70{color:red}}",
1539
1539
"/*! declined: a \`@supports\` condition is a declaration, not a media feature */@supports (min-width:1px){.t71{color:red}}",
1540
-
"/*! webpack: 6 significant digits is below what the engine reports */.t72{width:33.3333%}",
1540
+
"/*! webpack: a percentage keeps the digits of the float Firefox parses */.t72{width:33.333333%}",
1541
1541
"/*! webpack: ...and below the 1/64px it lays a length out in */.t73{width:1px}",
1542
1542
"/*! webpack: ...for a unitless number too */.t74{opacity:.123457}",
1543
1543
"/*! webpack: declined: an angle is amplified by the trig in rotate() */.t75{transform:rotate(33.33333333deg)}",
0 commit comments