mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Implement DOMPoint.fromPoint
This commit is contained in:
parent
5f477707a1
commit
40dbb2c100
19 changed files with 30 additions and 133 deletions
|
@ -6414,7 +6414,8 @@ class CGDictionary(CGThing):
|
|||
conversion = (
|
||||
"{\n"
|
||||
" rooted!(in(cx) let mut rval = UndefinedValue());\n"
|
||||
" if r#try!(get_dictionary_property(cx, object.handle(), \"%s\", rval.handle_mut())) {\n"
|
||||
" if r#try!(get_dictionary_property(cx, object.handle(), \"%s\", rval.handle_mut()))"
|
||||
" && !rval.is_undefined() {\n"
|
||||
"%s\n"
|
||||
" } else {\n"
|
||||
"%s\n"
|
||||
|
|
|
@ -40,6 +40,11 @@ impl DOMPoint {
|
|||
Ok(DOMPoint::new(global, x, y, z, w))
|
||||
}
|
||||
|
||||
// https://drafts.fxtf.org/geometry/#dom-dompoint-frompoint
|
||||
pub fn FromPoint(global: &GlobalScope, init: &DOMPointInit) -> DomRoot<Self> {
|
||||
Self::new_from_init(global, init)
|
||||
}
|
||||
|
||||
pub fn new_from_init(global: &GlobalScope, p: &DOMPointInit) -> DomRoot<DOMPoint> {
|
||||
DOMPoint::new(global, p.x, p.y, p.z, p.w)
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit;
|
||||
use crate::dom::bindings::codegen::Bindings::DOMPointReadOnlyBinding::{
|
||||
DOMPointReadOnlyMethods, Wrap,
|
||||
};
|
||||
|
@ -50,6 +51,11 @@ impl DOMPointReadOnly {
|
|||
) -> Fallible<DomRoot<DOMPointReadOnly>> {
|
||||
Ok(DOMPointReadOnly::new(global, x, y, z, w))
|
||||
}
|
||||
|
||||
// https://drafts.fxtf.org/geometry/#dom-dompointreadonly-frompoint
|
||||
pub fn FromPoint(global: &GlobalScope, init: &DOMPointInit) -> DomRoot<Self> {
|
||||
Self::new(global, init.x, init.y, init.z, init.w)
|
||||
}
|
||||
}
|
||||
|
||||
impl DOMPointReadOnlyMethods for DOMPointReadOnly {
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
optional unrestricted double z = 0, optional unrestricted double w = 1),
|
||||
Exposed=(Window,Worker)]
|
||||
interface DOMPoint : DOMPointReadOnly {
|
||||
[NewObject] static DOMPoint fromPoint(optional DOMPointInit other = null);
|
||||
|
||||
inherit attribute unrestricted double x;
|
||||
inherit attribute unrestricted double y;
|
||||
inherit attribute unrestricted double z;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
optional unrestricted double z = 0, optional unrestricted double w = 1),
|
||||
Exposed=(Window,Worker)]
|
||||
interface DOMPointReadOnly {
|
||||
[NewObject] static DOMPointReadOnly fromPoint(optional DOMPointInit other = null);
|
||||
|
||||
readonly attribute unrestricted double x;
|
||||
readonly attribute unrestricted double y;
|
||||
readonly attribute unrestricted double z;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue