Auto merge of #23844 - saschanaz:tojson, r=Manishearth

Support default toJSON in WebIDL

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

Ported related lines from gecko.

---
<!-- 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 #22781

<!-- 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/23844)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-08-20 17:27:14 -04:00 committed by GitHub
commit 4275420a56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 99 additions and 158 deletions

View file

@ -81,7 +81,6 @@ interface DOMMatrixReadOnly {
DOMPoint transformPoint(optional DOMPointInit point = {});
Float32Array toFloat32Array();
Float64Array toFloat64Array();
// stringifier;
// serializer = { attribute };
// [Exposed=Window] stringifier;
[Default] object toJSON();
};

View file

@ -20,4 +20,6 @@ interface DOMPointReadOnly {
readonly attribute unrestricted double y;
readonly attribute unrestricted double z;
readonly attribute unrestricted double w;
[Default] object toJSON();
};

View file

@ -22,6 +22,8 @@ interface DOMQuad {
[SameObject] readonly attribute DOMPoint p3;
[SameObject] readonly attribute DOMPoint p4;
[NewObject] DOMRect getBounds();
[Default] object toJSON();
};
dictionary DOMQuadInit {

View file

@ -17,6 +17,8 @@ interface DOMRectReadOnly {
readonly attribute unrestricted double right;
readonly attribute unrestricted double bottom;
readonly attribute unrestricted double left;
[Default] object toJSON();
};
// https://drafts.fxtf.org/geometry/#dictdef-domrectinit