mirror of
https://github.com/servo/servo.git
synced 2025-06-12 18:34:39 +00:00
Cargoify servo
This commit is contained in:
parent
db2f642c32
commit
c6ab60dbfc
1761 changed files with 8423 additions and 2294 deletions
59
components/script/dom/blob.rs
Normal file
59
components/script/dom/blob.rs
Normal file
|
@ -0,0 +1,59 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::bindings::codegen::InheritTypes::FileDerived;
|
||||
use dom::bindings::global::GlobalRef;
|
||||
use dom::bindings::js::Temporary;
|
||||
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
|
||||
use dom::bindings::error::Fallible;
|
||||
use dom::bindings::codegen::Bindings::BlobBinding;
|
||||
|
||||
#[deriving(Encodable)]
|
||||
pub enum BlobType {
|
||||
BlobTypeId,
|
||||
FileTypeId
|
||||
}
|
||||
|
||||
#[deriving(Encodable)]
|
||||
pub struct Blob {
|
||||
reflector_: Reflector,
|
||||
type_: BlobType
|
||||
}
|
||||
|
||||
impl Blob {
|
||||
pub fn new_inherited() -> Blob {
|
||||
Blob {
|
||||
reflector_: Reflector::new(),
|
||||
type_: BlobTypeId
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalRef) -> Temporary<Blob> {
|
||||
reflect_dom_object(box Blob::new_inherited(),
|
||||
global,
|
||||
BlobBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &GlobalRef) -> Fallible<Temporary<Blob>> {
|
||||
Ok(Blob::new(global))
|
||||
}
|
||||
}
|
||||
|
||||
pub trait BlobMethods {
|
||||
}
|
||||
|
||||
impl Reflectable for Blob {
|
||||
fn reflector<'a>(&'a self) -> &'a Reflector {
|
||||
&self.reflector_
|
||||
}
|
||||
}
|
||||
|
||||
impl FileDerived for Blob {
|
||||
fn is_file(&self) -> bool {
|
||||
match self.type_ {
|
||||
FileTypeId => true,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue