Closed Bug 1577052 Opened 6 years ago Closed 5 years ago

remove manual PartialEq impl for LengthPercentage

Categories

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

enhancement

Tracking

()

RESOLVED INVALID

People

(Reporter: heycam, Assigned: heycam)

References

Details

I played around with some <position>-related animations involving calc and didn't notice anything wrong after this change.

OK, the try run failed with a bunch of cases like:

TEST-UNEXPECTED-FAIL | layout/style/test/test_transitions_per_property.html | radius-valued property border-bottom-left-radius: interpolation of radius with calc() units - got "25px 50px", expected "10px 20px"

Cam said he didn't have time to look at those... I think I can try while I rest from debugging resize events :)

Flags: needinfo?(emilio)

So I took a look, and the test fails because the value differs, and thus we stop the transition.

That happens because:

calc(25px).to_computed_value(..) -> LengthPercentage { length: 25px, percentage: 0, has_percentage: false, clamping_mode: NonNegative, was_calc: true }

But from_computed_value(calc(25px)) returns Length::Absolute(25px).

Then 25px.to_computed_value(..) -> LengthPercentage { length: 25px, percentage: 0, has_percentage: false, clamping_mode: All, was_calc: false }

Now, was_calc shouldn't even exist in the first place. There's no reason why we have behavior differences based on it. We have two uses of it and both are extremely fishy / wrong.

The clamping_mode is kind of an implementation detail, in the sense that we set it to All when we know we don't have to clamp already...

Flags: needinfo?(emilio)

We probably don't want to do this given the current representation we have for computed::LengthPercentage.

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.