Closed Bug 1931478 Opened 9 months ago Closed 9 months ago

Replace mozilla::Clamp with std::clamp in nsGridContainerFrame.cpp

Categories

(Core :: Layout: Grid, task)

task

Tracking

()

RESOLVED FIXED
134 Branch
Tracking Status
firefox134 --- fixed

People

(Reporter: TYLin, Assigned: TYLin)

References

Details

Attachments

(1 file, 1 obsolete file)

I'm planning to change RepeatTrackSizingInput::InitFromStyle() to fix bug 1930672, and I found https://phabricator.services.mozilla.com/D227254 is replacing mozilla::Clamp with std::clamp. I can provide a correct fix with an analysis in grid container.

std::clamp() requires min <= max. In
RepeatTrackSizingInput::InitFromStyle(), it computes max as
max = std::max(min, resolved-max-value) in
https://searchfox.org/mozilla-central/rev/4e69784010d271c0fce0927442e4f8e66ffe645b/layout/generic/nsGridContainerFrame.cpp#326-337

Therefore, the max value is never less than min, satisfying min <= max
when calling std::clamp to compute size. Hence, this patch doesn't change
behavior.

Assignee: nobody → aethanyc
Status: NEW → ASSIGNED
Pushed by aethanyc@gmail.com: https://hg.mozilla.org/integration/autoland/rev/e6e0a8c205ae Replace mozilla::Clamp with std::clamp in nsGridContainerFrame.cpp. r=layout-reviewers,emilio
Status: ASSIGNED → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → 134 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: