Closed Bug 1559874 Opened 1 year ago Closed 1 year ago

DOMMatrix constructor incorrectly creates a 2d matrix from 16 sequence elements

Categories

(Core :: DOM: Core & HTML, defect)

69 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla69
Tracking Status
firefox69 --- fixed

People

(Reporter: saschanaz, Assigned: saschanaz)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

var float32Array = [2.0, 0.0, 0.0, 0.0,
                    0.0, 2.0, 0.0, 0.0,
                    0.0, 0.0, 1.0, 0.0,
                    10.0, 10.0, 0.0, 1.0]
new DOMMatrixReadOnly(float32Array).is2D // expected `false`, actual `true`

// Replacing the 15th element with 1.0 properly creates a 3d matrix.

Per the spec it should always create a 3d matrix.

if init is a sequence with 16 elements
Return the result of invoking create a 3d matrix of type DOMMatrixReadOnly or DOMMatrix as appropriate, with the sequence init.

Blocks: 1346399
Assignee: nobody → saschanaz

Currently Firefox creates a 2D DOMMatrix when certain values of 16 elements are zero, so this change fixes it to align with the spec.

Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/acfb79396a5b
Always create 3D DOMMatrix from 16 elements r=bzbarsky
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69
You need to log in before you can comment on or make changes to this bug.