mirror of
https://github.com/servo/servo.git
synced 2025-06-24 00:54:32 +01:00
Move WebIDL methods to traits implemented by JSRef types.
This commit is contained in:
parent
dfdda0098a
commit
76783b029e
106 changed files with 3644 additions and 1912 deletions
|
@ -28,28 +28,35 @@ impl Blob {
|
|||
window,
|
||||
BlobBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
||||
impl Blob {
|
||||
pub fn Constructor(window: &JSRef<Window>) -> Fallible<Unrooted<Blob>> {
|
||||
Ok(Blob::new(window))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn Size(&self) -> u64 {
|
||||
pub trait BlobMethods {
|
||||
fn Size(&self) -> u64;
|
||||
fn Type(&self) -> DOMString;
|
||||
fn Slice(&self, _start: Option<i64>, _end: Option<i64>, _contentType: Option<DOMString>) -> Unrooted<Blob>;
|
||||
fn Close(&self);
|
||||
}
|
||||
|
||||
impl<'a> BlobMethods for JSRef<'a, Blob> {
|
||||
fn Size(&self) -> u64 {
|
||||
0
|
||||
}
|
||||
|
||||
pub fn Type(&self) -> DOMString {
|
||||
fn Type(&self) -> DOMString {
|
||||
~""
|
||||
}
|
||||
|
||||
pub fn Slice(&self, _start: Option<i64>, _end: Option<i64>, _contentType: Option<DOMString>) -> Unrooted<Blob> {
|
||||
fn Slice(&self, _start: Option<i64>, _end: Option<i64>, _contentType: Option<DOMString>) -> Unrooted<Blob> {
|
||||
let roots = RootCollection::new();
|
||||
let window = self.window.root(&roots);
|
||||
Blob::new(&window.root_ref())
|
||||
}
|
||||
|
||||
pub fn Close(&self) {}
|
||||
fn Close(&self) {}
|
||||
}
|
||||
|
||||
impl Reflectable for Blob {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue