Auto merge of #23685 - saschanaz:scalenonuniform, r=paulrouget

Add DOMMatrix.prototype.scaleNonUniform

<!-- Please describe your changes on the following line: -->

Implements `scaleNonUniform()` [per the spec](https://drafts.fxtf.org/geometry/#dom-dommatrixreadonly-scalenonuniform).

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #23683

<!-- Either: -->
- [x] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23685)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-07-03 05:20:14 -04:00 committed by GitHub
commit fee1418b43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 32 deletions

View file

@ -571,6 +571,18 @@ impl DOMMatrixReadOnlyMethods for DOMMatrixReadOnly {
.ScaleSelf(scaleX, scaleY, scaleZ, originX, originY, originZ)
}
// https://drafts.fxtf.org/geometry/#dom-dommatrixreadonly-scalenonuniform
fn ScaleNonUniform(&self, scaleX: f64, scaleY: f64) -> DomRoot<DOMMatrix> {
DOMMatrix::from_readonly(&self.global(), self).ScaleSelf(
scaleX,
Some(scaleY),
1.0,
0.0,
0.0,
0.0,
)
}
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-scale3d
fn Scale3d(&self, scale: f64, originX: f64, originY: f64, originZ: f64) -> DomRoot<DOMMatrix> {
DOMMatrix::from_readonly(&self.global(), self).Scale3dSelf(scale, originX, originY, originZ)

View file

@ -56,6 +56,8 @@ interface DOMMatrixReadOnly {
optional unrestricted double originX = 0,
optional unrestricted double originY = 0,
optional unrestricted double originZ = 0);
[NewObject] DOMMatrix scaleNonUniform(optional unrestricted double scaleX = 1,
optional unrestricted double scaleY = 1);
DOMMatrix scale3d(optional unrestricted double scale = 1,
optional unrestricted double originX = 0,
optional unrestricted double originY = 0,