mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Support arbitrary protos when wrapping DOM objects with constructors.
This commit is contained in:
parent
d9600ff50f
commit
dbff26bce0
197 changed files with 2028 additions and 586 deletions
|
@ -5,10 +5,11 @@
|
|||
use crate::dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit;
|
||||
use crate::dom::bindings::codegen::Bindings::DOMPointReadOnlyBinding::DOMPointReadOnlyMethods;
|
||||
use crate::dom::bindings::error::Fallible;
|
||||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||
use crate::dom::bindings::reflector::{reflect_dom_object2, Reflector};
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use js::rust::HandleObject;
|
||||
use std::cell::Cell;
|
||||
|
||||
// http://dev.w3.org/fxtf/geometry/Overview.html#dompointreadonly
|
||||
|
@ -34,20 +35,26 @@ impl DOMPointReadOnly {
|
|||
}
|
||||
|
||||
pub fn new(global: &GlobalScope, x: f64, y: f64, z: f64, w: f64) -> DomRoot<DOMPointReadOnly> {
|
||||
reflect_dom_object(
|
||||
Self::new_with_proto(global, None, x, y, z, w)
|
||||
}
|
||||
|
||||
fn new_with_proto(global: &GlobalScope, proto: Option<HandleObject>, x: f64, y: f64, z: f64, w: f64) -> DomRoot<DOMPointReadOnly> {
|
||||
reflect_dom_object2(
|
||||
Box::new(DOMPointReadOnly::new_inherited(x, y, z, w)),
|
||||
global,
|
||||
proto,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn Constructor(
|
||||
global: &GlobalScope,
|
||||
proto: Option<HandleObject>,
|
||||
x: f64,
|
||||
y: f64,
|
||||
z: f64,
|
||||
w: f64,
|
||||
) -> Fallible<DomRoot<DOMPointReadOnly>> {
|
||||
Ok(DOMPointReadOnly::new(global, x, y, z, w))
|
||||
Ok(DOMPointReadOnly::new_with_proto(global, proto, x, y, z, w))
|
||||
}
|
||||
|
||||
// https://drafts.fxtf.org/geometry/#dom-dompointreadonly-frompoint
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue