Closed Bug 2087573 Opened 1 month ago Closed 24 days ago

[wpt-sync] Sync PR 64231 - Keep percent hint of math functions returning a number

Categories

(Core :: CSS Parsing and Computation, task, P4)

task

Tracking

()

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Attachments

(1 file)

Sync web-platform-tests PR 64231 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/64231
Details from upstream follow.

Sampath Samaraweera <sampath.samaraweera@codimite.com> wrote:

Keep percent hint of math functions returning a number

Math functions that return a \<number>, like round(), mod(), sign()
or exp(), are typed by their category alone, which can't express a
percent hint. So in e.g. calc(100% / round(100% / 10px)), the fact
that the percentage inside round() resolves against a length was
lost, and the whole expression was categorized as a plain
\<percentage>. CSSPrimitiveValue::ConvertToLength() then resolved it
before layout via ComputePercentage(), which treats every percentage
as a plain number, i.e. as if 100% were always 100px.

Per css-values-4, such functions are made consistent with the type
of their arguments, so they keep the arguments' percent hint.
Recover that hint from the operands when computing the CSSMathType
of a \<number> math function, and keep it for the invert node created
for division. The example above is then a \<length-percentage> and is
resolved against the actual percentage basis at layout time.

The change is guarded by the CSSNumberMathFunctionPercentHint
runtime flag.

Fixed: 562857754
Change-Id: Ia0554fe14dff632357fe33365a63ca7293db7527
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8607729
Reviewed-by: Rune Lillesveen \<futhark@chromium.org>
Commit-Queue: Rune Lillesveen \<futhark@chromium.org>
Reviewed-by: Fredrik Söderquist \<fs@opera.com>
Cr-Commit-Position: refs/heads/main@{#1727822}

Whiteboard: [wptsync downstream] → [wptsync downstream error]
Component: web-platform-tests → CSS Parsing and Computation
Product: Testing → Core
Whiteboard: [wptsync downstream error] → [wptsync downstream]
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]
Attached file Notable wpt changes —

CI Results

Ran 11 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 522 tests and 23 subtests

Status Summary

Firefox

OK : 1[GitHub] 286[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
PASS: 22[Gecko-linux2204-64-wayland-debug, Gecko-linux2204-64-wayland-opt, GitHub] 6307[Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt] 6460[Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt] 6461[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt] 6473[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview]
FAIL: 4100[Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt] 4146[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview] 4160[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt] 4161[Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]

Chrome

OK : 1
PASS: 4
FAIL: 18

Safari

OK : 1
PASS: 3
FAIL: 19

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

(See attachment for full changes)

Status: NEW → RESOLVED
Closed: 24 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: