Closed Bug 1863779 Opened 11 months ago Closed 11 months ago

Invalid CSS abs() subtraction

Categories

(Core :: CSS Parsing and Computation, defect, P2)

Firefox 121
defect

Tracking

()

RESOLVED FIXED
121 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox119 --- wontfix
firefox120 --- wontfix
firefox121 --- fixed

People

(Reporter: bali, Assigned: tlouw)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0

Steps to reproduce:

transform: translateX(calc(100px - abs(100px)));

Example JSFiddle: https://jsfiddle.net/d4zk3has/

Actual results:

The element is translated by 200px to the right, as if the following was used:
calc(100px + abs(-100px))

Expected results:

The element should not be translated horizontally (the result of the operation should be 0px).

A current workaround is to multiply by -1:
calc(100px + -1 * abs(100px))

The Bugbug bot thinks this bug should belong to the 'Core::CSS Parsing and Computation' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core

Indeed, negate() for Abs is incorrect here. Tiaan, do you have cycles to look? Presumably we can just wrap_in_negate. Let me know if not and I can look myself.

Kind of surprised no tests fail due to this.

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(tlouw)
Keywords: regression
Priority: -- → P2
Regressed by: 1838600

Set release status flags based on info from the regressing bug 1838600

Assignee: nobody → tlouw
Flags: needinfo?(tlouw)

The abs() function is not distributive, so should be wrapped in a negate
node rather than negating its child during simplification. E.g.:

10 - abs(10) != 10 + abs(-10)

Attachment #9362980 - Attachment description: WIP: Bug 1863779 - abs() function should not negate its child r=emilio,#layout → Bug 1863779 - abs() function should not negate its child r=emilio,#layout
Pushed by tlouw@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f90b853d9b0b abs() function should not negate its child r=emilio,layout-reviewers
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/43078 for changes under testing/web-platform/tests
Status: NEW → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 121 Branch
Upstream PR merged by moz-wptsync-bot

The patch landed in nightly and beta is affected.
:tlouw, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox120 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(tlouw)
Flags: needinfo?(tlouw)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: