Closed Bug 1397945 Opened 7 years ago Closed 5 years ago

Support six-parameter version of DOMMatrix scale method

Categories

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

57 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla69
Tracking Status
firefox69 --- fixed

People

(Reporter: bjornson, Assigned: saschanaz)

References

Details

(Keywords: dev-doc-complete)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0
Build ID: 20170904100131

Steps to reproduce:

I think DOMMatrix.prototype.scale() is wrong in certain circumstances:

(Correct values are per Chrome and my own implementation.)

Example 1:
> var x = new DOMMatrix() // identity matrix
> x.scale(5,-1,2,1,3,2).toFloat64Array().join(",")
"5,0,0,0,0,5,0,0,0,0,1,0,4,-8,0,1" // wrong
"5,0,0,0,0,-1,0,0,0,0,2,0,-4,6,-2,1" // <-- correct

Example 2:
> x.scale(2, 3, 2, 0, 0, 0).toFloat64Array().join(",")
"2,0,0,0,0,2,0,0,0,0,1,0,-3,-2,0,1" // wrong
"2,0,0,0,0,3,0,0,0,0,2,0,0,0,0,1" // <-- correct

Example 3:
> x.scale(2,3).toFloat64Array().join(",")
"2,0,0,0,0,2,0,0,0,0,1,0,-3,0,0,1" // wrong
"2,0,0,0,0,3,0,0,0,0,1,0,0,0,0,1" // <-- correct

Looks like the argument parsing is perhaps wrong.
Component: Untriaged → DOM
Product: Firefox → Core
Component: DOM → DOM: CSS Object Model
Priority: -- → P3
Similar to bug 1397949, our scale() method only accepts 3 arguments, which is the reason behind this bug.
Status: UNCONFIRMED → NEW
Component: DOM: CSS Object Model → DOM
Ever confirmed: true
See Also: → 1397949

Looks like some people ran into this, so we're adding this to the MDN compat table per https://github.com/mdn/browser-compat-data/pull/3476 which will show up on https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrixReadOnly/scale#Browser_compatibility

Keywords: dev-doc-needed
Summary: Some DOMMatrix scale calculations are wrong → Support six-parameter version of DOMMatrix scale method
Component: DOM → DOM: Core & HTML
Assignee: nobody → saschanaz

WPT tests for scale() depends on .fromMatrix() so I'd say this depends on Bug 1560462.

Depends on: 1560462

Adjusted scale() to receive six arguments, scale3d() to allow zero argument, and scaleNonUniform to support only two arguments. Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=e6484802f1961c7fe881b4d1d7f4309ec19110a7

Keywords: checkin-needed

Pushed by csabou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5084ca5c7896
Align DOMMatrix scale* operations to the spec r=bzbarsky

Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/17691 for changes under testing/web-platform/tests

Documentation updated:

Please advise if there are any remaining issues with the content affected here.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: