Closed Bug 2038219 Opened 4 months ago Closed 3 months ago

Avoid extra work and allocations when resolving non-length calc expressions.

Categories

(Core :: CSS Parsing and Computation, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
152 Branch
Tracking Status
firefox152 --- fixed

People

(Reporter: emilio, Assigned: sajidanwar)

References

Details

Attachments

(2 files)

Bug 2035572 introduces a pattern like:

calc.node.with_computed_context(context).resolve()

Where with_computed_context will traverse the tree and allocate a bunch of nodes, and resolve() will do the same again.

Instead, it seems it'd be easier to just pass an Option<&Context> down to resolve() and friends, or something along those lines?

Assignee: nobody → sajidanwar94
Status: NEW → ASSIGNED
Pushed by ealvarez@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/acdfef6ab551 https://hg.mozilla.org/integration/autoland/rev/0fbdc86f8666 Resolve CalcNumeric in a single calc tree pass. r=firefox-style-system-reviewers,emilio https://github.com/mozilla-firefox/firefox/commit/15959078236a https://hg.mozilla.org/integration/autoland/rev/1b655ed2cf31 Re-introduce specified CalcLengthPercentage as newtype. r=firefox-style-system-reviewers,emilio
Pushed by agoloman@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/928268942327 https://hg.mozilla.org/integration/autoland/rev/ace061dc3060 Revert "Bug 2038219 - Re-introduce specified CalcLengthPercentage as newtype. r=firefox-style-system-reviewers,emilio" for causing wpt failures @calc-infinity-nan-computed.html.

Backed out for causing wpt failures @calc-infinity-nan-computed.html.

Flags: needinfo?(sajidanwar94)

Failure here was from having moved the normalize(value).min(f32::MAX).max(f32::MIN) to inside the CalcNumeric::resolve, which made that fire on the computed angle degrees before performing the Infinity/NaN → 0deg replacement. That causes the Infinity values to turn into f32::MAX/MIN which are nonsensical for angles.

Going to push an update to the patch to move the normalize/min/max back out to the individual callers so that it can be skipped for angle.

Flags: needinfo?(sajidanwar94)
Pushed by ealvarez@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/f6f7bc5b3ba4 https://hg.mozilla.org/integration/autoland/rev/839c4f0555e6 Resolve CalcNumeric in a single calc tree pass. r=firefox-style-system-reviewers,emilio https://github.com/mozilla-firefox/firefox/commit/95c3711a2d14 https://hg.mozilla.org/integration/autoland/rev/c5b468db452a Re-introduce specified CalcLengthPercentage as newtype. r=firefox-style-system-reviewers,emilio
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 152 Branch
Depends on: 2039780
Depends on: 2040168
No longer depends on: 2040168
No longer depends on: 2039780
QA Whiteboard: [qa-triage-done-c153/b152]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: