Move WebIDL methods to traits implemented by JSRef types.

This commit is contained in:
Josh Matthews 2014-04-10 21:29:54 -04:00
parent dfdda0098a
commit 76783b029e
106 changed files with 3644 additions and 1912 deletions

View file

@ -91,31 +91,40 @@ impl Attr {
}
}
impl Attr {
pub fn LocalName(&self) -> DOMString {
pub trait AttrMethods {
fn LocalName(&self) -> DOMString;
fn Value(&self) -> DOMString;
fn SetValue(&mut self, value: DOMString);
fn Name(&self) -> DOMString;
fn GetNamespaceURI(&self) -> Option<DOMString>;
fn GetPrefix(&self) -> Option<DOMString>;
}
impl<'a> AttrMethods for JSRef<'a, Attr> {
fn LocalName(&self) -> DOMString {
self.local_name.clone()
}
pub fn Value(&self) -> DOMString {
fn Value(&self) -> DOMString {
self.value.clone()
}
pub fn SetValue(&mut self, value: DOMString) {
fn SetValue(&mut self, value: DOMString) {
self.set_value(ReplacedAttr, value);
}
pub fn Name(&self) -> DOMString {
fn Name(&self) -> DOMString {
self.name.clone()
}
pub fn GetNamespaceURI(&self) -> Option<DOMString> {
fn GetNamespaceURI(&self) -> Option<DOMString> {
match self.namespace.to_str() {
"" => None,
url => Some(url.to_owned()),
}
}
pub fn GetPrefix(&self) -> Option<DOMString> {
fn GetPrefix(&self) -> Option<DOMString> {
self.prefix.clone()
}
}

View file

@ -29,18 +29,26 @@ impl AttrList {
reflect_dom_object(~AttrList::new_inherited(window.unrooted(), elem.unrooted()),
window, AttrListBinding::Wrap)
}
}
pub fn Length(&self) -> u32 {
pub trait AttrListMethods {
fn Length(&self) -> u32;
fn Item(&self, index: u32) -> Option<Unrooted<Attr>>;
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Unrooted<Attr>>;
}
impl<'a> AttrListMethods for JSRef<'a, AttrList> {
fn Length(&self) -> u32 {
let roots = RootCollection::new();
self.owner.root(&roots).attrs.len() as u32
}
pub fn Item(&self, index: u32) -> Option<Unrooted<Attr>> {
fn Item(&self, index: u32) -> Option<Unrooted<Attr>> {
let roots = RootCollection::new();
self.owner.root(&roots).attrs.as_slice().get(index as uint).map(|x| Unrooted::new(x.clone()))
}
pub fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Unrooted<Attr>> {
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Unrooted<Attr>> {
let item = self.Item(index);
*found = item.is_some();
item

View file

@ -1395,7 +1395,7 @@ class CGImports(CGWrapper):
"""
Generates the appropriate import/use statements.
"""
def __init__(self, child, imports):
def __init__(self, child, descriptors, imports):
"""
Adds a set of imports.
"""
@ -1415,6 +1415,10 @@ class CGImports(CGWrapper):
'dead_code',
]
for d in descriptors:
name = d.interface.identifier.name
imports.append('dom::%s::%sMethods' % (name.lower(), name))
statements = ['#![allow(%s)]' % ','.join(ignored_warnings)]
statements.extend('use %s;' % i for i in sorted(imports))
@ -2499,7 +2503,8 @@ class CGSpecializedMethod(CGAbstractExternMethod):
return CGWrapper(CGMethodCall(argsPre, nativeName, self.method.isStatic(),
self.descriptor, self.method),
pre=extraPre +
" let this = &mut *this;\n").define()
" let this = JS::from_raw(this);\n" +
" let mut this = this.root(&roots);\n").define()
class CGGenericGetter(CGAbstractBindingMethod):
"""
@ -2558,7 +2563,8 @@ class CGSpecializedGetter(CGAbstractExternMethod):
return CGWrapper(CGIndenter(CGGetterCall(argsPre, self.attr.type, nativeName,
self.descriptor, self.attr)),
pre=extraPre +
" let this = &mut *this;\n").define()
" let this = JS::from_raw(this);\n" +
" let mut this = this.root(&roots);\n").define()
class CGGenericSetter(CGAbstractBindingMethod):
"""
@ -2617,7 +2623,8 @@ class CGSpecializedSetter(CGAbstractExternMethod):
return CGWrapper(CGIndenter(CGSetterCall(argsPre, self.attr.type, nativeName,
self.descriptor, self.attr)),
pre=extraPre +
" let this = &mut *this;\n").define()
" let this = JS::from_raw(this);\n" +
" let mut this = this.root(&roots);\n").define()
class CGMemberJITInfo(CGThing):
@ -3508,14 +3515,14 @@ class CGProxyNamedSetter(CGProxySpecialOperation):
class CGProxyUnwrap(CGAbstractMethod):
def __init__(self, descriptor):
args = [Argument('*JSObject', 'obj')]
CGAbstractMethod.__init__(self, descriptor, "UnwrapProxy", '*' + descriptor.concreteType, args, alwaysInline=True)
CGAbstractMethod.__init__(self, descriptor, "UnwrapProxy", '*mut ' + descriptor.concreteType, args, alwaysInline=True)
def definition_body(self):
return """ /*if (xpc::WrapperFactory::IsXrayWrapper(obj)) {
obj = js::UnwrapObject(obj);
}*/
//MOZ_ASSERT(IsProxy(obj));
let box_: *%s = cast::transmute(GetProxyPrivate(obj).to_private());
let box_: *mut %s = cast::transmute(GetProxyPrivate(obj).to_private());
return box_;""" % (self.descriptor.concreteType)
class CGDOMJSProxyHandler_getOwnPropertyDescriptor(CGAbstractExternMethod):
@ -3540,9 +3547,11 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(CGAbstractExternMethod):
templateValues = {'jsvalRef': '(*desc).value', 'successCode': fillDescriptor}
get = ("if index.is_some() {\n" +
" let index = index.unwrap();\n" +
" let this: *%s = UnwrapProxy(proxy);\n" +
" let this = UnwrapProxy(proxy);\n" +
" let this = JS::from_raw(this);\n" +
" let mut this = this.root(&roots);\n" +
CGIndenter(CGProxyIndexedGetter(self.descriptor, templateValues)).define() + "\n" +
"}\n") % (self.descriptor.concreteType)
"}\n")
if indexedSetter or self.descriptor.operations['NamedSetter']:
setOrIndexedGet += "if set != 0 {\n"
@ -3585,9 +3594,11 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(CGAbstractExternMethod):
namedGet = ("\n" +
"if set == 0 && RUST_JSID_IS_STRING(id) != 0 && !HasPropertyOnPrototype(cx, proxy, id) {\n" +
" let name = Some(jsid_to_str(cx, id));\n" +
" let this: *%s = UnwrapProxy(proxy);\n" +
" let this = UnwrapProxy(proxy);\n" +
" let this = JS::from_raw(this);\n" +
" let mut this = this.root(&roots);\n" +
CGIndenter(CGProxyNamedGetter(self.descriptor, templateValues)).define() + "\n" +
"}\n") % (self.descriptor.concreteType)
"}\n")
else:
namedGet = ""
@ -3628,10 +3639,12 @@ class CGDOMJSProxyHandler_defineProperty(CGAbstractExternMethod):
set += ("let index = GetArrayIndexFromId(cx, id);\n" +
"if index.is_some() {\n" +
" let index = index.unwrap();\n" +
" let this: *mut %s = UnwrapProxy(proxy) as *mut %s;\n" +
" let this = UnwrapProxy(proxy);\n" +
" let this = JS::from_raw(this);\n" +
" let mut this = this.root(&roots);\n" +
CGIndenter(CGProxyIndexedSetter(self.descriptor)).define() +
" return 1;\n" +
"}\n") % (self.descriptor.concreteType, self.descriptor.concreteType)
"}\n")
elif self.descriptor.operations['IndexedGetter']:
set += ("if GetArrayIndexFromId(cx, id).is_some() {\n" +
" return 0;\n" +
@ -3644,20 +3657,24 @@ class CGDOMJSProxyHandler_defineProperty(CGAbstractExternMethod):
raise TypeError("Can't handle creator that's different from the setter")
set += ("if RUST_JSID_IS_STRING(id) != 0 {\n" +
" let name = Some(jsid_to_str(cx, id));\n" +
" let this: *%s = UnwrapProxy(proxy);\n" +
" let this = UnwrapProxy(proxy);\n" +
" let this = JS::from_raw(this);\n" +
" let mut this = this.root(&roots);\n" +
CGIndenter(CGProxyNamedSetter(self.descriptor)).define() + "\n" +
"}\n") % (self.descriptor.concreteType)
"}\n")
elif self.descriptor.operations['NamedGetter']:
set += ("if RUST_JSID_IS_STRING(id) {\n" +
" let name = Some(jsid_to_str(cx, id));\n" +
" let this: %%s = UnwrapProxy(proxy);\n" +
" let this = UnwrapProxy(proxy);\n" +
" let this = JS::from_raw(this);\n" +
" let mut this = this.root(&roots);\n" +
CGIndenter(CGProxyNamedGetter(self.descriptor)).define() +
" if (found) {\n"
" return 0;\n" +
" //return ThrowErrorMessage(cx, MSG_NO_PROPERTY_SETTER, \"%s\");\n" +
" }\n" +
" return 1;\n"
"}\n") % (self.descriptor.concreteType, self.descriptor.name)
"}\n") % (self.descriptor.name)
return set + """return proxyhandler::defineProperty_(%s);""" % ", ".join(a.name for a in self.args)
def definition_body(self):
@ -3675,11 +3692,13 @@ class CGDOMJSProxyHandler_hasOwn(CGAbstractExternMethod):
indexed = ("let index = GetArrayIndexFromId(cx, id);\n" +
"if index.is_some() {\n" +
" let index = index.unwrap();\n" +
" let this: *%s = UnwrapProxy(proxy);\n" +
" let this = UnwrapProxy(proxy);\n" +
" let this = JS::from_raw(this);\n" +
" let mut this = this.root(&roots);\n" +
CGIndenter(CGProxyIndexedGetter(self.descriptor)).define() + "\n" +
" *bp = found as JSBool;\n" +
" return 1;\n" +
"}\n\n") % (self.descriptor.concreteType)
"}\n\n")
else:
indexed = ""
@ -3687,12 +3706,14 @@ class CGDOMJSProxyHandler_hasOwn(CGAbstractExternMethod):
if namedGetter:
named = ("if RUST_JSID_IS_STRING(id) != 0 && !HasPropertyOnPrototype(cx, proxy, id) {\n" +
" let name = Some(jsid_to_str(cx, id));\n" +
" let this: *%s = UnwrapProxy(proxy);\n" +
" let this = UnwrapProxy(proxy);\n" +
" let this = JS::from_raw(this);\n" +
" let mut this = this.root(&roots);\n" +
CGIndenter(CGProxyNamedGetter(self.descriptor)).define() + "\n" +
" *bp = found as JSBool;\n"
" return 1;\n"
"}\n" +
"\n") % (self.descriptor.concreteType)
"\n")
else:
named = ""
@ -3740,6 +3761,8 @@ if expando.is_not_null() {
"if index.is_some() {\n" +
" let index = index.unwrap();\n" +
" let this = UnwrapProxy(proxy);\n" +
" let this = JS::from_raw(this);\n" +
" let mut this = this.root(&roots);\n" +
CGIndenter(CGProxyIndexedGetter(self.descriptor, templateValues)).define())
getIndexedOrExpando += """
// Even if we don't have this index, we don't forward the
@ -3756,6 +3779,8 @@ if expando.is_not_null() {
getNamed = ("if (JSID_IS_STRING(id)) {\n" +
" let name = Some(jsid_to_str(cx, id));\n" +
" let this = UnwrapProxy(proxy);\n" +
" let this = JS::from_raw(this);\n" +
" let mut this = this.root(&roots);\n" +
CGIndenter(CGProxyNamedGetter(self.descriptor, templateValues)).define() +
"}\n") % (self.descriptor.concreteType)
else:
@ -4288,7 +4313,7 @@ class CGBindingRoot(CGThing):
# Add imports
#XXXjdm This should only import the namespace for the current binding,
# not every binding ever.
curr = CGImports(curr, [
curr = CGImports(curr, descriptors, [
'js',
'js::{JS_ARGV, JS_CALLEE, JS_THIS_OBJECT}',
'js::{JSCLASS_GLOBAL_SLOT_COUNT, JSCLASS_IS_DOMJSCLASS}',
@ -5253,7 +5278,7 @@ class GlobalGenRoots():
@staticmethod
def RegisterBindings(config):
# TODO - Generate the methods we want
return CGImports(CGRegisterProtos(config), [
return CGImports(CGRegisterProtos(config), [], [
'dom::bindings::codegen',
'dom::bindings::js::{JS, JSRef}',
'dom::window::Window',
@ -5372,7 +5397,7 @@ class GlobalGenRoots():
curr = UnionTypes(config.getDescriptors())
curr = CGImports(curr, [
curr = CGImports(curr, [], [
'dom::bindings::utils::unwrap_jsmanaged',
'dom::bindings::codegen::PrototypeList',
'dom::bindings::conversions::{FromJSValConvertible, ToJSValConvertible}',

View file

@ -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 {

View file

@ -5,7 +5,7 @@
//! DOM bindings for `CharacterData`.
use dom::bindings::codegen::InheritTypes::CharacterDataDerived;
use dom::bindings::js::JS;
use dom::bindings::js::{JS, JSRef};
use dom::bindings::error::{Fallible, ErrorResult, IndexSize};
use dom::bindings::utils::{Reflectable, Reflector};
use dom::document::Document;
@ -37,38 +37,51 @@ impl CharacterData {
data: data
}
}
}
pub fn Data(&self) -> DOMString {
pub trait CharacterDataMethods {
fn Data(&self) -> DOMString;
fn SetData(&mut self, arg: DOMString) -> ErrorResult;
fn Length(&self) -> u32;
fn SubstringData(&self, offset: u32, count: u32) -> Fallible<DOMString>;
fn AppendData(&mut self, arg: DOMString) -> ErrorResult;
fn InsertData(&mut self, _offset: u32, _arg: DOMString) -> ErrorResult;
fn DeleteData(&mut self, _offset: u32, _count: u32) -> ErrorResult;
fn ReplaceData(&mut self, _offset: u32, _count: u32, _arg: DOMString) -> ErrorResult;
}
impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
fn Data(&self) -> DOMString {
self.data.clone()
}
pub fn SetData(&mut self, arg: DOMString) -> ErrorResult {
fn SetData(&mut self, arg: DOMString) -> ErrorResult {
self.data = arg;
Ok(())
}
pub fn Length(&self) -> u32 {
fn Length(&self) -> u32 {
self.data.len() as u32
}
pub fn SubstringData(&self, offset: u32, count: u32) -> Fallible<DOMString> {
fn SubstringData(&self, offset: u32, count: u32) -> Fallible<DOMString> {
Ok(self.data.slice(offset as uint, count as uint).to_str())
}
pub fn AppendData(&mut self, arg: DOMString) -> ErrorResult {
fn AppendData(&mut self, arg: DOMString) -> ErrorResult {
self.data.push_str(arg);
Ok(())
}
pub fn InsertData(&mut self, offset: u32, arg: DOMString) -> ErrorResult {
fn InsertData(&mut self, offset: u32, arg: DOMString) -> ErrorResult {
self.ReplaceData(offset, 0, arg)
}
pub fn DeleteData(&mut self, offset: u32, count: u32) -> ErrorResult {
fn DeleteData(&mut self, offset: u32, count: u32) -> ErrorResult {
self.ReplaceData(offset, count, ~"")
}
pub fn ReplaceData(&mut self, offset: u32, count: u32, arg: DOMString) -> ErrorResult {
fn ReplaceData(&mut self, offset: u32, count: u32, arg: DOMString) -> ErrorResult {
let length = self.data.len() as u32;
if offset > length {
return Err(IndexSize);

View file

@ -38,29 +38,39 @@ impl ClientRect {
let rect = ClientRect::new_inherited(window.unrooted(), top, bottom, left, right);
reflect_dom_object(~rect, window, ClientRectBinding::Wrap)
}
}
pub trait ClientRectMethods {
fn Top(&self) -> f32;
fn Bottom(&self) -> f32;
fn Left(&self) -> f32;
fn Right(&self) -> f32;
fn Width(&self) -> f32;
fn Height(&self) -> f32;
}
pub fn Top(&self) -> f32 {
impl<'a> ClientRectMethods for JSRef<'a, ClientRect> {
fn Top(&self) -> f32 {
self.top
}
pub fn Bottom(&self) -> f32 {
fn Bottom(&self) -> f32 {
self.bottom
}
pub fn Left(&self) -> f32 {
fn Left(&self) -> f32 {
self.left
}
pub fn Right(&self) -> f32 {
fn Right(&self) -> f32 {
self.right
}
pub fn Width(&self) -> f32 {
fn Width(&self) -> f32 {
(self.right - self.left).abs()
}
pub fn Height(&self) -> f32 {
fn Height(&self) -> f32 {
(self.bottom - self.top).abs()
}
}

View file

@ -30,12 +30,20 @@ impl ClientRectList {
reflect_dom_object(~ClientRectList::new_inherited(window.unrooted(), rects),
window, ClientRectListBinding::Wrap)
}
}
pub fn Length(&self) -> u32 {
pub trait ClientRectListMethods {
fn Length(&self) -> u32;
fn Item(&self, index: u32) -> Option<Unrooted<ClientRect>>;
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Unrooted<ClientRect>>;
}
impl<'a> ClientRectListMethods for JSRef<'a, ClientRectList> {
fn Length(&self) -> u32 {
self.rects.len() as u32
}
pub fn Item(&self, index: u32) -> Option<Unrooted<ClientRect>> {
fn Item(&self, index: u32) -> Option<Unrooted<ClientRect>> {
if index < self.rects.len() as u32 {
Some(Unrooted::new(self.rects.get(index as uint).clone()))
} else {
@ -43,7 +51,7 @@ impl ClientRectList {
}
}
pub fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Unrooted<ClientRect>> {
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Unrooted<ClientRect>> {
*found = index < self.rects.len() as u32;
self.Item(index)
}

View file

@ -10,7 +10,7 @@ use dom::characterdata::CharacterData;
use dom::document::Document;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
use dom::node::{CommentNodeTypeId, Node};
use dom::window::Window;
use dom::window::{Window, WindowMethods};
use servo_util::str::DOMString;
/// An HTML comment.
@ -42,9 +42,10 @@ impl Comment {
pub fn Constructor(owner: &JSRef<Window>, data: DOMString) -> Fallible<Unrooted<Comment>> {
let roots = RootCollection::new();
let document = owner.get().Document();
let document = document.root(&roots);
Ok(Comment::new(data, &document.root_ref()))
let document = owner.Document().root(&roots);
Ok(Comment::new(data, &*document))
}
}
pub trait CommentMethods {
}

View file

@ -23,24 +23,34 @@ impl Console {
pub fn new(window: &JSRef<Window>) -> Unrooted<Console> {
reflect_dom_object(~Console::new_inherited(), window, ConsoleBinding::Wrap)
}
}
pub fn Log(&self, message: DOMString) {
pub trait ConsoleMethods {
fn Log(&self, message: DOMString);
fn Debug(&self, message: DOMString);
fn Info(&self, message: DOMString);
fn Warn(&self, message: DOMString);
fn Error(&self, message: DOMString);
}
impl<'a> ConsoleMethods for JSRef<'a, Console> {
fn Log(&self, message: DOMString) {
println!("{:s}", message);
}
pub fn Debug(&self, message: DOMString) {
fn Debug(&self, message: DOMString) {
println!("{:s}", message);
}
pub fn Info(&self, message: DOMString) {
fn Info(&self, message: DOMString) {
println!("{:s}", message);
}
pub fn Warn(&self, message: DOMString) {
fn Warn(&self, message: DOMString) {
println!("{:s}", message);
}
pub fn Error(&self, message: DOMString) {
fn Error(&self, message: DOMString) {
println!("{:s}", message);
}
}

View file

@ -33,7 +33,7 @@ use dom::nodelist::NodeList;
use dom::text::Text;
use dom::processinginstruction::ProcessingInstruction;
use dom::uievent::UIEvent;
use dom::window::Window;
use dom::window::{Window, WindowMethods};
use dom::location::Location;
use html::hubbub_html_parser::build_element_from_tag;
use hubbub::hubbub::{QuirksMode, NoQuirks, LimitedQuirks, FullQuirks};
@ -122,22 +122,108 @@ impl Document {
}
}
// http://dom.spec.whatwg.org/#dom-document
pub fn Constructor(owner: &JSRef<Window>) -> Fallible<Unrooted<Document>> {
Ok(Document::new(owner, None, NonHTMLDocument, None))
}
pub fn new(window: &JSRef<Window>, url: Option<Url>, doctype: IsHTMLDocument, content_type: Option<DOMString>) -> Unrooted<Document> {
let document = Document::new_inherited(window.unrooted(), url, doctype, content_type);
Document::reflect_document(~document, window, DocumentBinding::Wrap)
}
}
impl Document {
pub fn url<'a>(&'a self) -> &'a Url {
&*self.url
}
}
impl Document {
// http://dom.spec.whatwg.org/#dom-document
pub fn Constructor(owner: &JSRef<Window>) -> Fallible<Unrooted<Document>> {
Ok(Document::new(owner, None, NonHTMLDocument, None))
pub fn quirks_mode(&self) -> QuirksMode {
*self.quirks_mode
}
pub fn set_quirks_mode(&mut self, mode: QuirksMode) {
*self.quirks_mode = mode;
}
pub fn set_encoding_name(&mut self, name: DOMString) {
self.encoding_name = name;
}
pub fn content_changed(&self) {
self.damage_and_reflow(ContentChangedDocumentDamage);
}
pub fn damage_and_reflow(&self, damage: DocumentDamageLevel) {
let roots = RootCollection::new();
self.window.root(&roots).damage_and_reflow(damage);
}
pub fn wait_until_safe_to_modify_dom(&self) {
let roots = RootCollection::new();
self.window.root(&roots).wait_until_safe_to_modify_dom();
}
/// Remove any existing association between the provided id and any elements in this document.
pub fn unregister_named_element(&mut self,
abstract_self: &JSRef<Element>,
id: DOMString) {
let roots = RootCollection::new();
let mut is_empty = false;
match self.idmap.find_mut(&id) {
None => {},
Some(elements) => {
let position = elements.iter()
.map(|elem| elem.root(&roots))
.position(|element| &*element == abstract_self)
.expect("This element should be in registered.");
elements.remove(position);
is_empty = elements.is_empty();
}
}
if is_empty {
self.idmap.remove(&id);
}
}
/// Associate an element present in this document with the provided id.
pub fn register_named_element(&mut self,
abstract_self: &JSRef<Document>,
element: &JSRef<Element>,
id: DOMString) {
let roots = RootCollection::new();
assert!({
let node: &JSRef<Node> = NodeCast::from_ref(element);
node.is_in_doc()
});
// FIXME https://github.com/mozilla/rust/issues/13195
// Use mangle() when it exists again.
let root = abstract_self.GetDocumentElement().expect("The element is in the document, so there must be a document element.").root(&roots);
match self.idmap.find_mut(&id) {
Some(elements) => {
let new_node: &JSRef<Node> = NodeCast::from_ref(element);
let mut head : uint = 0u;
let root: &JSRef<Node> = NodeCast::from_ref(&*root);
for node in root.traverse_preorder(&roots) {
let elem: Option<&JSRef<Element>> = ElementCast::to_ref(&node);
match elem {
Some(elem) => {
if elements.get(head) == &elem.unrooted() {
head = head + 1;
}
if new_node == &node || head == elements.len() {
break;
}
}
None => {}
}
}
elements.insert(head, element.unrooted());
return;
},
None => (),
}
self.idmap.insert(id, vec!(element.unrooted()));
}
}
@ -151,9 +237,87 @@ impl Reflectable for Document {
}
}
impl Document {
trait DocumentHelpers {
fn createNodeList(&self, callback: |node: &JSRef<Node>| -> bool) -> Unrooted<NodeList>;
fn get_html_element(&self) -> Option<Unrooted<HTMLHtmlElement>>;
}
impl<'a> DocumentHelpers for JSRef<'a, Document> {
fn createNodeList(&self, callback: |node: &JSRef<Node>| -> bool) -> Unrooted<NodeList> {
let roots = RootCollection::new();
let window = self.window.root(&roots);
let mut nodes = vec!();
match self.GetDocumentElement().root(&roots) {
None => {},
Some(root) => {
let root: &JSRef<Node> = NodeCast::from_ref(&*root);
for child in root.traverse_preorder(&roots) {
if callback(&child) {
nodes.push(child);
}
}
}
}
NodeList::new_simple_list(&*window, nodes)
}
fn get_html_element(&self) -> Option<Unrooted<HTMLHtmlElement>> {
let roots = RootCollection::new();
self.GetDocumentElement().root(&roots).filtered(|root| {
root.node.type_id == ElementNodeTypeId(HTMLHtmlElementTypeId)
}).map(|elem| {
Unrooted::new_rooted(HTMLHtmlElementCast::to_ref(&*elem).unwrap())
})
}
}
pub trait DocumentMethods {
fn Implementation(&mut self) -> Unrooted<DOMImplementation>;
fn URL(&self) -> DOMString;
fn DocumentURI(&self) -> DOMString;
fn CompatMode(&self) -> DOMString;
fn CharacterSet(&self) -> DOMString;
fn ContentType(&self) -> DOMString;
fn GetDoctype(&self) -> Option<Unrooted<DocumentType>>;
fn GetDocumentElement(&self) -> Option<Unrooted<Element>>;
fn GetElementsByTagName(&self, abstract_self: &JSRef<Document>, tag_name: DOMString) -> Unrooted<HTMLCollection>;
fn GetElementsByTagNameNS(&self, abstract_self: &JSRef<Document>, maybe_ns: Option<DOMString>, tag_name: DOMString) -> Unrooted<HTMLCollection>;
fn GetElementsByClassName(&self, abstract_self: &JSRef<Document>, classes: DOMString) -> Unrooted<HTMLCollection>;
fn GetElementById(&self, id: DOMString) -> Option<Unrooted<Element>>;
fn CreateElement(&self, abstract_self: &JSRef<Document>, local_name: DOMString) -> Fallible<Unrooted<Element>>;
fn CreateElementNS(&self, abstract_self: &JSRef<Document>,
namespace: Option<DOMString>,
qualified_name: DOMString) -> Fallible<Unrooted<Element>>;
fn CreateDocumentFragment(&self, abstract_self: &JSRef<Document>) -> Unrooted<DocumentFragment>;
fn CreateTextNode(&self, abstract_self: &JSRef<Document>, data: DOMString) -> Unrooted<Text>;
fn CreateComment(&self, abstract_self: &JSRef<Document>, data: DOMString) -> Unrooted<Comment>;
fn CreateProcessingInstruction(&self, abstract_self: &JSRef<Document>, target: DOMString, data: DOMString) -> Fallible<Unrooted<ProcessingInstruction>>;
fn ImportNode(&self, abstract_self: &JSRef<Document>, node: &JSRef<Node>, deep: bool) -> Fallible<Unrooted<Node>>;
fn AdoptNode(&self, abstract_self: &JSRef<Document>, node: &mut JSRef<Node>) -> Fallible<Unrooted<Node>>;
fn CreateEvent(&self, interface: DOMString) -> Fallible<Unrooted<Event>>;
fn Title(&self, _: &JSRef<Document>) -> DOMString;
fn SetTitle(&self, abstract_self: &JSRef<Document>, title: DOMString) -> ErrorResult;
fn GetHead(&self) -> Option<Unrooted<HTMLHeadElement>>;
fn GetBody(&self, _: &JSRef<Document>) -> Option<Unrooted<HTMLElement>>;
fn SetBody(&self, abstract_self: &JSRef<Document>, new_body: Option<JSRef<HTMLElement>>) -> ErrorResult;
fn GetElementsByName(&self, name: DOMString) -> Unrooted<NodeList>;
fn Images(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection>;
fn Embeds(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection>;
fn Plugins(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection>;
fn Links(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection>;
fn Forms(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection>;
fn Scripts(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection>;
fn Anchors(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection>;
fn Applets(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection>;
fn Location(&mut self, _abstract_self: &JSRef<Document>) -> Unrooted<Location>;
fn Children(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection>;
}
impl<'a> DocumentMethods for JSRef<'a, Document> {
// http://dom.spec.whatwg.org/#dom-document-implementation
pub fn Implementation(&mut self) -> Unrooted<DOMImplementation> {
fn Implementation(&mut self) -> Unrooted<DOMImplementation> {
if self.implementation.is_none() {
let roots = RootCollection::new();
let window = self.window.root(&roots);
@ -163,47 +327,35 @@ impl Document {
}
// http://dom.spec.whatwg.org/#dom-document-url
pub fn URL(&self) -> DOMString {
fn URL(&self) -> DOMString {
self.url().to_str()
}
// http://dom.spec.whatwg.org/#dom-document-documenturi
pub fn DocumentURI(&self) -> DOMString {
fn DocumentURI(&self) -> DOMString {
self.URL()
}
// http://dom.spec.whatwg.org/#dom-document-compatmode
pub fn CompatMode(&self) -> DOMString {
fn CompatMode(&self) -> DOMString {
match *self.quirks_mode {
NoQuirks => ~"CSS1Compat",
LimitedQuirks | FullQuirks => ~"BackCompat"
}
}
pub fn quirks_mode(&self) -> QuirksMode {
*self.quirks_mode
}
pub fn set_quirks_mode(&mut self, mode: QuirksMode) {
*self.quirks_mode = mode;
}
// http://dom.spec.whatwg.org/#dom-document-characterset
pub fn CharacterSet(&self) -> DOMString {
fn CharacterSet(&self) -> DOMString {
self.encoding_name.to_ascii_lower()
}
pub fn set_encoding_name(&mut self, name: DOMString) {
self.encoding_name = name;
}
// http://dom.spec.whatwg.org/#dom-document-content_type
pub fn ContentType(&self) -> DOMString {
fn ContentType(&self) -> DOMString {
self.content_type.clone()
}
// http://dom.spec.whatwg.org/#dom-document-doctype
pub fn GetDoctype(&self) -> Option<Unrooted<DocumentType>> {
fn GetDoctype(&self) -> Option<Unrooted<DocumentType>> {
self.node.children().find(|child| {
child.is_doctype()
}).map(|node| {
@ -213,19 +365,19 @@ impl Document {
}
// http://dom.spec.whatwg.org/#dom-document-documentelement
pub fn GetDocumentElement(&self) -> Option<Unrooted<Element>> {
fn GetDocumentElement(&self) -> Option<Unrooted<Element>> {
self.node.child_elements().next().map(|elem| Unrooted::new_rooted(&elem))
}
// http://dom.spec.whatwg.org/#dom-document-getelementsbytagname
pub fn GetElementsByTagName(&self, abstract_self: &JSRef<Document>, tag_name: DOMString) -> Unrooted<HTMLCollection> {
fn GetElementsByTagName(&self, abstract_self: &JSRef<Document>, tag_name: DOMString) -> Unrooted<HTMLCollection> {
let roots = RootCollection::new();
let window = self.window.root(&roots);
HTMLCollection::by_tag_name(&*window, NodeCast::from_ref(abstract_self), tag_name)
}
// http://dom.spec.whatwg.org/#dom-document-getelementsbytagnamens
pub fn GetElementsByTagNameNS(&self, abstract_self: &JSRef<Document>, maybe_ns: Option<DOMString>, tag_name: DOMString) -> Unrooted<HTMLCollection> {
fn GetElementsByTagNameNS(&self, abstract_self: &JSRef<Document>, maybe_ns: Option<DOMString>, tag_name: DOMString) -> Unrooted<HTMLCollection> {
let roots = RootCollection::new();
let window = self.window.root(&roots);
@ -237,7 +389,7 @@ impl Document {
}
// http://dom.spec.whatwg.org/#dom-document-getelementsbyclassname
pub fn GetElementsByClassName(&self, abstract_self: &JSRef<Document>, classes: DOMString) -> Unrooted<HTMLCollection> {
fn GetElementsByClassName(&self, abstract_self: &JSRef<Document>, classes: DOMString) -> Unrooted<HTMLCollection> {
let roots = RootCollection::new();
let window = self.window.root(&roots);
@ -245,7 +397,7 @@ impl Document {
}
// http://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid
pub fn GetElementById(&self, id: DOMString) -> Option<Unrooted<Element>> {
fn GetElementById(&self, id: DOMString) -> Option<Unrooted<Element>> {
match self.idmap.find_equiv(&id) {
None => None,
Some(ref elements) => Some(Unrooted::new(elements.get(0).clone())),
@ -253,7 +405,7 @@ impl Document {
}
// http://dom.spec.whatwg.org/#dom-document-createelement
pub fn CreateElement(&self, abstract_self: &JSRef<Document>, local_name: DOMString)
fn CreateElement(&self, abstract_self: &JSRef<Document>, local_name: DOMString)
-> Fallible<Unrooted<Element>> {
if xml_name_type(local_name) == InvalidXMLName {
debug!("Not a valid element name");
@ -264,7 +416,7 @@ impl Document {
}
// http://dom.spec.whatwg.org/#dom-document-createelementns
pub fn CreateElementNS(&self, abstract_self: &JSRef<Document>,
fn CreateElementNS(&self, abstract_self: &JSRef<Document>,
namespace: Option<DOMString>,
qualified_name: DOMString) -> Fallible<Unrooted<Element>> {
let ns = Namespace::from_str(null_str_as_empty_ref(&namespace));
@ -310,23 +462,23 @@ impl Document {
}
// http://dom.spec.whatwg.org/#dom-document-createdocumentfragment
pub fn CreateDocumentFragment(&self, abstract_self: &JSRef<Document>) -> Unrooted<DocumentFragment> {
fn CreateDocumentFragment(&self, abstract_self: &JSRef<Document>) -> Unrooted<DocumentFragment> {
DocumentFragment::new(abstract_self)
}
// http://dom.spec.whatwg.org/#dom-document-createtextnode
pub fn CreateTextNode(&self, abstract_self: &JSRef<Document>, data: DOMString)
fn CreateTextNode(&self, abstract_self: &JSRef<Document>, data: DOMString)
-> Unrooted<Text> {
Text::new(data, abstract_self)
}
// http://dom.spec.whatwg.org/#dom-document-createcomment
pub fn CreateComment(&self, abstract_self: &JSRef<Document>, data: DOMString) -> Unrooted<Comment> {
fn CreateComment(&self, abstract_self: &JSRef<Document>, data: DOMString) -> Unrooted<Comment> {
Comment::new(data, abstract_self)
}
// http://dom.spec.whatwg.org/#dom-document-createprocessinginstruction
pub fn CreateProcessingInstruction(&self, abstract_self: &JSRef<Document>, target: DOMString,
fn CreateProcessingInstruction(&self, abstract_self: &JSRef<Document>, target: DOMString,
data: DOMString) -> Fallible<Unrooted<ProcessingInstruction>> {
// Step 1.
if xml_name_type(target) == InvalidXMLName {
@ -343,7 +495,7 @@ impl Document {
}
// http://dom.spec.whatwg.org/#dom-document-importnode
pub fn ImportNode(&self, abstract_self: &JSRef<Document>, node: &JSRef<Node>, deep: bool) -> Fallible<Unrooted<Node>> {
fn ImportNode(&self, abstract_self: &JSRef<Document>, node: &JSRef<Node>, deep: bool) -> Fallible<Unrooted<Node>> {
// Step 1.
if node.is_document() {
return Err(NotSupported);
@ -359,7 +511,7 @@ impl Document {
}
// http://dom.spec.whatwg.org/#dom-document-adoptnode
pub fn AdoptNode(&self, abstract_self: &JSRef<Document>, node: &mut JSRef<Node>) -> Fallible<Unrooted<Node>> {
fn AdoptNode(&self, abstract_self: &JSRef<Document>, node: &mut JSRef<Node>) -> Fallible<Unrooted<Node>> {
// Step 1.
if node.is_document() {
return Err(NotSupported);
@ -373,7 +525,7 @@ impl Document {
}
// http://dom.spec.whatwg.org/#dom-document-createevent
pub fn CreateEvent(&self, interface: DOMString) -> Fallible<Unrooted<Event>> {
fn CreateEvent(&self, interface: DOMString) -> Fallible<Unrooted<Event>> {
let roots = RootCollection::new();
let window = self.window.root(&roots);
@ -387,7 +539,7 @@ impl Document {
}
// http://www.whatwg.org/specs/web-apps/current-work/#document.title
pub fn Title(&self, _: &JSRef<Document>) -> DOMString {
fn Title(&self, _: &JSRef<Document>) -> DOMString {
let mut title = ~"";
let roots = RootCollection::new();
self.GetDocumentElement().root(&roots).map(|root| {
@ -409,7 +561,7 @@ impl Document {
}
// http://www.whatwg.org/specs/web-apps/current-work/#document.title
pub fn SetTitle(&self, abstract_self: &JSRef<Document>, title: DOMString) -> ErrorResult {
fn SetTitle(&self, abstract_self: &JSRef<Document>, title: DOMString) -> ErrorResult {
let roots = RootCollection::new();
self.GetDocumentElement().root(&roots).map(|root| {
@ -446,17 +598,8 @@ impl Document {
Ok(())
}
fn get_html_element(&self) -> Option<Unrooted<HTMLHtmlElement>> {
let roots = RootCollection::new();
self.GetDocumentElement().root(&roots).filtered(|root| {
root.node.type_id == ElementNodeTypeId(HTMLHtmlElementTypeId)
}).map(|elem| {
Unrooted::new_rooted(HTMLHtmlElementCast::to_ref(&*elem).unwrap())
})
}
// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-head
pub fn GetHead(&self) -> Option<Unrooted<HTMLHeadElement>> {
fn GetHead(&self) -> Option<Unrooted<HTMLHeadElement>> {
let roots = RootCollection::new();
self.get_html_element().and_then(|root| {
let root = root.root(&roots);
@ -470,7 +613,7 @@ impl Document {
}
// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-body
pub fn GetBody(&self, _: &JSRef<Document>) -> Option<Unrooted<HTMLElement>> {
fn GetBody(&self, _: &JSRef<Document>) -> Option<Unrooted<HTMLElement>> {
let roots = RootCollection::new();
self.get_html_element().and_then(|root| {
let root = root.root(&roots);
@ -488,7 +631,7 @@ impl Document {
}
// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-body
pub fn SetBody(&self, abstract_self: &JSRef<Document>, new_body: Option<JSRef<HTMLElement>>) -> ErrorResult {
fn SetBody(&self, abstract_self: &JSRef<Document>, new_body: Option<JSRef<HTMLElement>>) -> ErrorResult {
let roots = RootCollection::new();
// Step 1.
@ -532,7 +675,7 @@ impl Document {
}
// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-getelementsbyname
pub fn GetElementsByName(&self, name: DOMString) -> Unrooted<NodeList> {
fn GetElementsByName(&self, name: DOMString) -> Unrooted<NodeList> {
let roots = RootCollection::new();
self.createNodeList(|node| {
@ -547,7 +690,7 @@ impl Document {
})
}
pub fn Images(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection> {
fn Images(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection> {
let roots = RootCollection::new();
let window = self.window.root(&roots);
@ -562,7 +705,7 @@ impl Document {
HTMLCollection::create(&*window, NodeCast::from_ref(abstract_self), filter)
}
pub fn Embeds(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection> {
fn Embeds(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection> {
let roots = RootCollection::new();
let window = self.window.root(&roots);
@ -577,12 +720,12 @@ impl Document {
HTMLCollection::create(&*window, NodeCast::from_ref(abstract_self), filter)
}
pub fn Plugins(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection> {
fn Plugins(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection> {
// FIXME: https://github.com/mozilla/servo/issues/1847
self.Embeds(abstract_self)
}
pub fn Links(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection> {
fn Links(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection> {
let roots = RootCollection::new();
let window = self.window.root(&roots);
@ -598,7 +741,7 @@ impl Document {
HTMLCollection::create(&*window, NodeCast::from_ref(abstract_self), filter)
}
pub fn Forms(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection> {
fn Forms(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection> {
let roots = RootCollection::new();
let window = self.window.root(&roots);
@ -613,7 +756,7 @@ impl Document {
HTMLCollection::create(&*window, NodeCast::from_ref(abstract_self), filter)
}
pub fn Scripts(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection> {
fn Scripts(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection> {
let roots = RootCollection::new();
let window = self.window.root(&roots);
@ -628,7 +771,7 @@ impl Document {
HTMLCollection::create(&*window, NodeCast::from_ref(abstract_self), filter)
}
pub fn Anchors(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection> {
fn Anchors(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection> {
let roots = RootCollection::new();
let window = self.window.root(&roots);
@ -643,7 +786,7 @@ impl Document {
HTMLCollection::create(&*window, NodeCast::from_ref(abstract_self), filter)
}
pub fn Applets(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection> {
fn Applets(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection> {
let roots = RootCollection::new();
let window = self.window.root(&roots);
@ -658,113 +801,16 @@ impl Document {
HTMLCollection::create(&*window, NodeCast::from_ref(abstract_self), filter)
}
pub fn Location(&mut self, _abstract_self: &JSRef<Document>) -> Unrooted<Location> {
fn Location(&mut self, _abstract_self: &JSRef<Document>) -> Unrooted<Location> {
let roots = RootCollection::new();
let mut window = self.window.root(&roots);
let window_alias = self.window.root(&roots);
window.get_mut().Location(&*window_alias)
window.Location(&*window_alias)
}
pub fn Children(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection> {
fn Children(&self, abstract_self: &JSRef<Document>) -> Unrooted<HTMLCollection> {
let roots = RootCollection::new();
let window = self.window.root(&roots);
HTMLCollection::children(&*window, NodeCast::from_ref(abstract_self))
}
pub fn createNodeList(&self, callback: |node: &JSRef<Node>| -> bool) -> Unrooted<NodeList> {
let roots = RootCollection::new();
let window = self.window.root(&roots);
let mut nodes = vec!();
match self.GetDocumentElement().root(&roots) {
None => {},
Some(root) => {
let root: &JSRef<Node> = NodeCast::from_ref(&*root);
for child in root.traverse_preorder(&roots) {
if callback(&child) {
nodes.push(child);
}
}
}
}
NodeList::new_simple_list(&*window, nodes)
}
pub fn content_changed(&self) {
self.damage_and_reflow(ContentChangedDocumentDamage);
}
pub fn damage_and_reflow(&self, damage: DocumentDamageLevel) {
let roots = RootCollection::new();
self.window.root(&roots).damage_and_reflow(damage);
}
pub fn wait_until_safe_to_modify_dom(&self) {
let roots = RootCollection::new();
self.window.root(&roots).wait_until_safe_to_modify_dom();
}
/// Remove any existing association between the provided id and any elements in this document.
pub fn unregister_named_element(&mut self,
abstract_self: &JSRef<Element>,
id: DOMString) {
let roots = RootCollection::new();
let mut is_empty = false;
match self.idmap.find_mut(&id) {
None => {},
Some(elements) => {
let position = elements.iter()
.map(|elem| elem.root(&roots))
.position(|element| &*element == abstract_self)
.expect("This element should be in registered.");
elements.remove(position);
is_empty = elements.is_empty();
}
}
if is_empty {
self.idmap.remove(&id);
}
}
/// Associate an element present in this document with the provided id.
pub fn register_named_element(&mut self,
element: &JSRef<Element>,
id: DOMString) {
let roots = RootCollection::new();
assert!({
let node: &JSRef<Node> = NodeCast::from_ref(element);
node.is_in_doc()
});
// FIXME https://github.com/mozilla/rust/issues/13195
// Use mangle() when it exists again.
let root = self.GetDocumentElement().expect("The element is in the document, so there must be a document element.").root(&roots);
match self.idmap.find_mut(&id) {
Some(elements) => {
let new_node: &JSRef<Node> = NodeCast::from_ref(element);
let mut head : uint = 0u;
let root: &JSRef<Node> = NodeCast::from_ref(&*root);
for node in root.traverse_preorder(&roots) {
let elem: Option<&JSRef<Element>> = ElementCast::to_ref(&node);
match elem {
Some(elem) => {
if elements.get(head) == &elem.unrooted() {
head = head + 1;
}
if new_node == &node || head == elements.len() {
break;
}
}
None => {}
}
}
elements.insert(head, element.unrooted());
return;
},
None => (),
}
self.idmap.insert(id, vec!(element.unrooted()));
}
}

View file

@ -10,7 +10,7 @@ use dom::document::Document;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
use dom::htmlcollection::HTMLCollection;
use dom::node::{DocumentFragmentNodeTypeId, Node, window_from_node};
use dom::window::Window;
use dom::window::{Window, WindowMethods};
#[deriving(Encodable)]
pub struct DocumentFragment {
@ -38,20 +38,22 @@ impl DocumentFragment {
let node = DocumentFragment::new_inherited(document.unrooted());
Node::reflect_node(~node, document, DocumentFragmentBinding::Wrap)
}
}
impl DocumentFragment {
pub fn Constructor(owner: &JSRef<Window>) -> Fallible<Unrooted<DocumentFragment>> {
let roots = RootCollection::new();
let document = owner.get().Document();
let document = owner.Document();
let document = document.root(&roots);
Ok(DocumentFragment::new(&document.root_ref()))
}
}
impl DocumentFragment {
pub fn Children(&self, abstract_self: &JSRef<DocumentFragment>) -> Unrooted<HTMLCollection> {
pub trait DocumentFragmentMethods {
fn Children(&self, abstract_self: &JSRef<DocumentFragment>) -> Unrooted<HTMLCollection>;
}
impl<'a> DocumentFragmentMethods for JSRef<'a, DocumentFragment> {
fn Children(&self, abstract_self: &JSRef<DocumentFragment>) -> Unrooted<HTMLCollection> {
let roots = RootCollection::new();
let window = window_from_node(abstract_self).root(&roots);
HTMLCollection::children(&window.root_ref(), NodeCast::from_ref(abstract_self))

View file

@ -55,16 +55,23 @@ impl DocumentType {
}
}
impl DocumentType {
pub fn Name(&self) -> DOMString {
pub trait DocumentTypeMethods {
fn Name(&self) -> DOMString;
fn PublicId(&self) -> DOMString;
fn SystemId(&self) -> DOMString;
}
impl<'a> DocumentTypeMethods for JSRef<'a, DocumentType> {
fn Name(&self) -> DOMString {
self.name.clone()
}
pub fn PublicId(&self) -> DOMString {
fn PublicId(&self) -> DOMString {
self.public_id.clone()
}
pub fn SystemId(&self) -> DOMString {
fn SystemId(&self) -> DOMString {
self.system_id.clone()
}
}

View file

@ -64,9 +64,15 @@ impl Reflectable for DOMException {
}
}
impl DOMException {
pub trait DOMExceptionMethods {
fn Code(&self) -> u16;
fn Name(&self) -> DOMString;
fn Message(&self) -> DOMString;
}
impl<'a> DOMExceptionMethods for JSRef<'a, DOMException> {
// http://dom.spec.whatwg.org/#dom-domexception-code
pub fn Code(&self) -> u16 {
fn Code(&self) -> u16 {
match self.code {
// http://dom.spec.whatwg.org/#concept-throw
EncodingError => 0,
@ -75,12 +81,12 @@ impl DOMException {
}
// http://dom.spec.whatwg.org/#error-names-0
pub fn Name(&self) -> DOMString {
fn Name(&self) -> DOMString {
self.code.to_str()
}
// http://dom.spec.whatwg.org/#error-names-0
pub fn Message(&self) -> DOMString {
fn Message(&self) -> DOMString {
match self.code {
IndexSizeError => ~"The index is not in the allowed range.",
HierarchyRequestError => ~"The operation would yield an incorrect node tree.",

View file

@ -8,7 +8,7 @@ use dom::bindings::js::{JS, JSRef, RootCollection, Unrooted, OptionalRootable};
use dom::bindings::utils::{Reflector, Reflectable, reflect_dom_object};
use dom::bindings::error::{Fallible, InvalidCharacter, NamespaceError};
use dom::bindings::utils::{QName, Name, InvalidXMLName, xml_name_type};
use dom::document::{Document, HTMLDocument, NonHTMLDocument};
use dom::document::{Document, HTMLDocument, NonHTMLDocument, DocumentMethods};
use dom::documenttype::DocumentType;
use dom::htmlbodyelement::HTMLBodyElement;
use dom::htmlheadelement::HTMLHeadElement;
@ -16,7 +16,7 @@ use dom::htmlhtmlelement::HTMLHtmlElement;
use dom::htmltitleelement::HTMLTitleElement;
use dom::node::{Node, AppendChild};
use dom::text::Text;
use dom::window::Window;
use dom::window::{Window, WindowMethods};
use servo_util::str::DOMString;
#[deriving(Encodable)]
@ -49,10 +49,17 @@ impl Reflectable for DOMImplementation {
}
}
pub trait DOMImplementationMethods {
fn CreateDocumentType(&self, qname: DOMString, pubid: DOMString, sysid: DOMString) -> Fallible<Unrooted<DocumentType>>;
fn CreateDocument(&self, namespace: Option<DOMString>, qname: DOMString,
mut maybe_doctype: Option<JSRef<DocumentType>>) -> Fallible<Unrooted<Document>>;
fn CreateHTMLDocument(&self, title: Option<DOMString>) -> Unrooted<Document>;
}
// http://dom.spec.whatwg.org/#domimplementation
impl DOMImplementation {
impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> {
// http://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype
pub fn CreateDocumentType(&self, qname: DOMString, pubid: DOMString, sysid: DOMString) -> Fallible<Unrooted<DocumentType>> {
fn CreateDocumentType(&self, qname: DOMString, pubid: DOMString, sysid: DOMString) -> Fallible<Unrooted<DocumentType>> {
let roots = RootCollection::new();
match xml_name_type(qname) {
// Step 1.
@ -69,7 +76,7 @@ impl DOMImplementation {
}
// http://dom.spec.whatwg.org/#dom-domimplementation-createdocument
pub fn CreateDocument(&self, namespace: Option<DOMString>, qname: DOMString,
fn CreateDocument(&self, namespace: Option<DOMString>, qname: DOMString,
mut maybe_doctype: Option<JSRef<DocumentType>>) -> Fallible<Unrooted<Document>> {
let roots = RootCollection::new();
let win = self.owner.root(&roots);
@ -80,7 +87,7 @@ impl DOMImplementation {
let mut maybe_elem = if qname.is_empty() {
None
} else {
match doc.get().CreateElementNS(&*doc, namespace, qname) {
match doc.deref().CreateElementNS(&*doc, namespace, qname) {
Err(error) => return Err(error),
Ok(elem) => Some(elem)
}
@ -114,7 +121,7 @@ impl DOMImplementation {
}
// http://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument
pub fn CreateHTMLDocument(&self, title: Option<DOMString>) -> Unrooted<Document> {
fn CreateHTMLDocument(&self, title: Option<DOMString>) -> Unrooted<Document> {
let roots = RootCollection::new();
let owner = self.owner.root(&roots);

View file

@ -33,8 +33,14 @@ impl DOMParser {
pub fn Constructor(owner: &JSRef<Window>) -> Fallible<Unrooted<DOMParser>> {
Ok(DOMParser::new(owner))
}
}
pub fn ParseFromString(&self,
pub trait DOMParserMethods {
fn ParseFromString(&self, _s: DOMString, ty: DOMParserBinding::SupportedType) -> Fallible<Unrooted<Document>>;
}
impl<'a> DOMParserMethods for JSRef<'a, DOMParser> {
fn ParseFromString(&self,
_s: DOMString,
ty: DOMParserBinding::SupportedType)
-> Fallible<Unrooted<Document>> {

View file

@ -4,7 +4,7 @@
//! Element nodes.
use dom::attr::{Attr, ReplacedAttr, FirstSetAttr};
use dom::attr::{Attr, ReplacedAttr, FirstSetAttr, AttrMethods};
use dom::attrlist::AttrList;
use dom::bindings::codegen::BindingDeclarations::ElementBinding;
use dom::bindings::codegen::InheritTypes::{ElementDerived, NodeCast};
@ -458,23 +458,51 @@ impl Element {
}
}
impl Element {
pub trait ElementMethods {
fn NamespaceURI(&self) -> DOMString;
fn LocalName(&self) -> DOMString;
fn GetPrefix(&self) -> Option<DOMString>;
fn TagName(&self) -> DOMString;
fn Id(&self, abstract_self: &JSRef<Element>) -> DOMString;
fn SetId(&mut self, abstract_self: &mut JSRef<Element>, id: DOMString);
fn ClassName(&self, abstract_self: &JSRef<Element>) -> DOMString;
fn SetClassName(&self, abstract_self: &mut JSRef<Element>, class: DOMString);
fn Attributes(&mut self, abstract_self: &JSRef<Element>) -> Unrooted<AttrList>;
fn GetAttribute(&self, abstract_self: &JSRef<Element>, name: DOMString) -> Option<DOMString>;
fn GetAttributeNS(&self, abstract_self: &JSRef<Element>, namespace: Option<DOMString>, local_name: DOMString) -> Option<DOMString>;
fn SetAttribute(&self, abstract_self: &mut JSRef<Element>, name: DOMString, value: DOMString) -> ErrorResult;
fn SetAttributeNS(&self, abstract_self: &mut JSRef<Element>, namespace_url: Option<DOMString>, name: DOMString, value: DOMString) -> ErrorResult;
fn RemoveAttribute(&mut self, abstract_self: &mut JSRef<Element>, name: DOMString) -> ErrorResult;
fn RemoveAttributeNS(&mut self, abstract_self: &mut JSRef<Element>, namespace: Option<DOMString>, localname: DOMString) -> ErrorResult;
fn HasAttribute(&self, abstract_self: &JSRef<Element>, name: DOMString) -> bool;
fn HasAttributeNS(&self, abstract_self: &JSRef<Element>, namespace: Option<DOMString>, local_name: DOMString) -> bool;
fn GetElementsByTagName(&self, abstract_self: &JSRef<Element>, localname: DOMString) -> Unrooted<HTMLCollection>;
fn GetElementsByTagNameNS(&self, abstract_self: &JSRef<Element>, maybe_ns: Option<DOMString>, localname: DOMString) -> Unrooted<HTMLCollection>;
fn GetElementsByClassName(&self, abstract_self: &JSRef<Element>, classes: DOMString) -> Unrooted<HTMLCollection>;
fn GetClientRects(&self, abstract_self: &JSRef<Element>) -> Unrooted<ClientRectList>;
fn GetBoundingClientRect(&self, abstract_self: &JSRef<Element>) -> Unrooted<ClientRect>;
fn GetInnerHTML(&self, abstract_self: &JSRef<Element>) -> Fallible<DOMString>;
fn GetOuterHTML(&self, abstract_self: &JSRef<Element>) -> Fallible<DOMString>;
fn Children(&self, abstract_self: &JSRef<Element>) -> Unrooted<HTMLCollection>;
}
impl<'a> ElementMethods for JSRef<'a, Element> {
// http://dom.spec.whatwg.org/#dom-element-namespaceuri
pub fn NamespaceURI(&self) -> DOMString {
fn NamespaceURI(&self) -> DOMString {
self.namespace.to_str().to_owned()
}
pub fn LocalName(&self) -> DOMString {
fn LocalName(&self) -> DOMString {
self.local_name.clone()
}
// http://dom.spec.whatwg.org/#dom-element-prefix
pub fn GetPrefix(&self) -> Option<DOMString> {
fn GetPrefix(&self) -> Option<DOMString> {
self.prefix.clone()
}
// http://dom.spec.whatwg.org/#dom-element-tagname
pub fn TagName(&self) -> DOMString {
fn TagName(&self) -> DOMString {
match self.prefix {
None => {
self.local_name.to_ascii_upper()
@ -486,42 +514,42 @@ impl Element {
}
// http://dom.spec.whatwg.org/#dom-element-id
pub fn Id(&self, abstract_self: &JSRef<Element>) -> DOMString {
fn Id(&self, abstract_self: &JSRef<Element>) -> DOMString {
abstract_self.get_string_attribute("id")
}
// http://dom.spec.whatwg.org/#dom-element-id
pub fn SetId(&mut self, abstract_self: &mut JSRef<Element>, id: DOMString) {
fn SetId(&mut self, abstract_self: &mut JSRef<Element>, id: DOMString) {
abstract_self.set_string_attribute("id", id);
}
// http://dom.spec.whatwg.org/#dom-element-classname
pub fn ClassName(&self, abstract_self: &JSRef<Element>) -> DOMString {
fn ClassName(&self, abstract_self: &JSRef<Element>) -> DOMString {
abstract_self.get_string_attribute("class")
}
// http://dom.spec.whatwg.org/#dom-element-classname
pub fn SetClassName(&self, abstract_self: &mut JSRef<Element>, class: DOMString) {
fn SetClassName(&self, abstract_self: &mut JSRef<Element>, class: DOMString) {
abstract_self.set_string_attribute("class", class);
}
// http://dom.spec.whatwg.org/#dom-element-attributes
pub fn Attributes(&mut self, abstract_self: &JSRef<Element>) -> Unrooted<AttrList> {
fn Attributes(&mut self, abstract_self: &JSRef<Element>) -> Unrooted<AttrList> {
let roots = RootCollection::new();
match self.attr_list {
None => {
None => (),
Some(ref list) => return Unrooted::new(list.clone()),
}
let doc = self.node.owner_doc().root(&roots);
let window = doc.deref().window.root(&roots);
let list = AttrList::new(&window.root_ref(), abstract_self);
self.attr_list.assign(Some(list));
Unrooted::new(self.attr_list.get_ref().clone())
}
Some(ref list) => Unrooted::new(list.clone())
}
}
// http://dom.spec.whatwg.org/#dom-element-getattribute
pub fn GetAttribute(&self, abstract_self: &JSRef<Element>, name: DOMString) -> Option<DOMString> {
fn GetAttribute(&self, abstract_self: &JSRef<Element>, name: DOMString) -> Option<DOMString> {
let roots = RootCollection::new();
let name = if abstract_self.get().html_element_in_html_document() {
name.to_ascii_lower()
@ -533,7 +561,7 @@ impl Element {
}
// http://dom.spec.whatwg.org/#dom-element-getattributens
pub fn GetAttributeNS(&self, abstract_self: &JSRef<Element>,
fn GetAttributeNS(&self, abstract_self: &JSRef<Element>,
namespace: Option<DOMString>,
local_name: DOMString) -> Option<DOMString> {
let roots = RootCollection::new();
@ -543,14 +571,14 @@ impl Element {
}
// http://dom.spec.whatwg.org/#dom-element-setattribute
pub fn SetAttribute(&self, abstract_self: &mut JSRef<Element>,
fn SetAttribute(&self, abstract_self: &mut JSRef<Element>,
name: DOMString,
value: DOMString) -> ErrorResult {
abstract_self.SetAttribute_(name, value)
}
// http://dom.spec.whatwg.org/#dom-element-setattributens
pub fn SetAttributeNS(&self,
fn SetAttributeNS(&self,
abstract_self: &mut JSRef<Element>,
namespace_url: Option<DOMString>,
name: DOMString,
@ -559,7 +587,7 @@ impl Element {
}
// http://dom.spec.whatwg.org/#dom-element-removeattribute
pub fn RemoveAttribute(&mut self,
fn RemoveAttribute(&mut self,
abstract_self: &mut JSRef<Element>,
name: DOMString) -> ErrorResult {
let name = if self.html_element_in_html_document() {
@ -571,7 +599,7 @@ impl Element {
}
// http://dom.spec.whatwg.org/#dom-element-removeattributens
pub fn RemoveAttributeNS(&mut self,
fn RemoveAttributeNS(&mut self,
abstract_self: &mut JSRef<Element>,
namespace: Option<DOMString>,
localname: DOMString) -> ErrorResult {
@ -580,25 +608,25 @@ impl Element {
}
// http://dom.spec.whatwg.org/#dom-element-hasattribute
pub fn HasAttribute(&self, abstract_self: &JSRef<Element>,
fn HasAttribute(&self, abstract_self: &JSRef<Element>,
name: DOMString) -> bool {
self.GetAttribute(abstract_self, name).is_some()
}
// http://dom.spec.whatwg.org/#dom-element-hasattributens
pub fn HasAttributeNS(&self, abstract_self: &JSRef<Element>,
fn HasAttributeNS(&self, abstract_self: &JSRef<Element>,
namespace: Option<DOMString>,
local_name: DOMString) -> bool {
self.GetAttributeNS(abstract_self, namespace, local_name).is_some()
}
pub fn GetElementsByTagName(&self, abstract_self: &JSRef<Element>, localname: DOMString) -> Unrooted<HTMLCollection> {
fn GetElementsByTagName(&self, abstract_self: &JSRef<Element>, localname: DOMString) -> Unrooted<HTMLCollection> {
let roots = RootCollection::new();
let window = window_from_node(abstract_self).root(&roots);
HTMLCollection::by_tag_name(&*window, NodeCast::from_ref(abstract_self), localname)
}
pub fn GetElementsByTagNameNS(&self, abstract_self: &JSRef<Element>, maybe_ns: Option<DOMString>,
fn GetElementsByTagNameNS(&self, abstract_self: &JSRef<Element>, maybe_ns: Option<DOMString>,
localname: DOMString) -> Unrooted<HTMLCollection> {
let roots = RootCollection::new();
let namespace = match maybe_ns {
@ -609,14 +637,14 @@ impl Element {
HTMLCollection::by_tag_name_ns(&*window, NodeCast::from_ref(abstract_self), localname, namespace)
}
pub fn GetElementsByClassName(&self, abstract_self: &JSRef<Element>, classes: DOMString) -> Unrooted<HTMLCollection> {
fn GetElementsByClassName(&self, abstract_self: &JSRef<Element>, classes: DOMString) -> Unrooted<HTMLCollection> {
let roots = RootCollection::new();
let window = window_from_node(abstract_self).root(&roots);
HTMLCollection::by_class_name(&*window, NodeCast::from_ref(abstract_self), classes)
}
// http://dev.w3.org/csswg/cssom-view/#dom-element-getclientrects
pub fn GetClientRects(&self, abstract_self: &JSRef<Element>) -> Unrooted<ClientRectList> {
fn GetClientRects(&self, abstract_self: &JSRef<Element>) -> Unrooted<ClientRectList> {
let roots = RootCollection::new();
let win = window_from_node(abstract_self).root(&roots);
let node: &JSRef<Node> = NodeCast::from_ref(abstract_self);
@ -634,7 +662,7 @@ impl Element {
}
// http://dev.w3.org/csswg/cssom-view/#dom-element-getboundingclientrect
pub fn GetBoundingClientRect(&self, abstract_self: &JSRef<Element>) -> Unrooted<ClientRect> {
fn GetBoundingClientRect(&self, abstract_self: &JSRef<Element>) -> Unrooted<ClientRect> {
let roots = RootCollection::new();
let win = window_from_node(abstract_self).root(&roots);
let node: &JSRef<Node> = NodeCast::from_ref(abstract_self);
@ -647,18 +675,18 @@ impl Element {
rect.origin.x + rect.size.width)
}
pub fn GetInnerHTML(&self, abstract_self: &JSRef<Element>) -> Fallible<DOMString> {
fn GetInnerHTML(&self, abstract_self: &JSRef<Element>) -> Fallible<DOMString> {
//XXX TODO: XML case
let roots = RootCollection::new();
Ok(serialize(&mut NodeIterator::new(&roots, NodeCast::from_ref(abstract_self), false, false)))
}
pub fn GetOuterHTML(&self, abstract_self: &JSRef<Element>) -> Fallible<DOMString> {
fn GetOuterHTML(&self, abstract_self: &JSRef<Element>) -> Fallible<DOMString> {
let roots = RootCollection::new();
Ok(serialize(&mut NodeIterator::new(&roots, NodeCast::from_ref(abstract_self), true, false)))
}
pub fn Children(&self, abstract_self: &JSRef<Element>) -> Unrooted<HTMLCollection> {
fn Children(&self, abstract_self: &JSRef<Element>) -> Unrooted<HTMLCollection> {
let roots = RootCollection::new();
let window = window_from_node(abstract_self).root(&roots);
HTMLCollection::children(&window.root_ref(), NodeCast::from_ref(abstract_self))
@ -701,7 +729,8 @@ impl<'a> VirtualMethods for JSRef<'a, Element> {
let node: &JSRef<Node> = NodeCast::from_ref(self);
if node.is_in_doc() {
let mut doc = document_from_node(self).root(&roots);
doc.register_named_element(self, value.clone());
let doc_alias = (*doc).clone();
doc.register_named_element(&doc_alias, self, value.clone());
}
}
_ => ()
@ -744,7 +773,8 @@ impl<'a> VirtualMethods for JSRef<'a, Element> {
match self.get_attribute(Null, "id").root(&roots) {
Some(attr) => {
let mut doc = document_from_node(self).root(&roots);
doc.register_named_element(self, attr.deref().Value());
let doc_alias = (*doc).clone();
doc.register_named_element(&doc_alias, self, attr.deref().Value());
}
_ => ()
}

View file

@ -86,54 +86,81 @@ impl Event {
EventBinding::Wrap)
}
pub fn EventPhase(&self) -> u16 {
pub fn Constructor(global: &JSRef<Window>,
type_: DOMString,
init: &EventBinding::EventInit) -> Fallible<Unrooted<Event>> {
let roots = RootCollection::new();
let mut ev = Event::new(global).root(&roots);
ev.InitEvent(type_, init.bubbles, init.cancelable);
Ok(Unrooted::new_rooted(&*ev))
}
}
pub trait EventMethods {
fn EventPhase(&self) -> u16;
fn Type(&self) -> DOMString;
fn GetTarget(&self) -> Option<Unrooted<EventTarget>>;
fn GetCurrentTarget(&self) -> Option<Unrooted<EventTarget>>;
fn DefaultPrevented(&self) -> bool;
fn PreventDefault(&mut self);
fn StopPropagation(&mut self);
fn StopImmediatePropagation(&mut self);
fn Bubbles(&self) -> bool;
fn Cancelable(&self) -> bool;
fn TimeStamp(&self) -> u64;
fn InitEvent(&mut self, type_: DOMString, bubbles: bool, cancelable: bool);
fn IsTrusted(&self) -> bool;
}
impl<'a> EventMethods for JSRef<'a, Event> {
fn EventPhase(&self) -> u16 {
self.phase as u16
}
pub fn Type(&self) -> DOMString {
fn Type(&self) -> DOMString {
self.type_.clone()
}
pub fn GetTarget(&self) -> Option<Unrooted<EventTarget>> {
fn GetTarget(&self) -> Option<Unrooted<EventTarget>> {
self.target.as_ref().map(|target| Unrooted::new(target.clone()))
}
pub fn GetCurrentTarget(&self) -> Option<Unrooted<EventTarget>> {
fn GetCurrentTarget(&self) -> Option<Unrooted<EventTarget>> {
self.current_target.as_ref().map(|target| Unrooted::new(target.clone()))
}
pub fn DefaultPrevented(&self) -> bool {
fn DefaultPrevented(&self) -> bool {
self.canceled
}
pub fn PreventDefault(&mut self) {
fn PreventDefault(&mut self) {
if self.cancelable {
self.canceled = true
}
}
pub fn StopPropagation(&mut self) {
fn StopPropagation(&mut self) {
self.stop_propagation = true;
}
pub fn StopImmediatePropagation(&mut self) {
fn StopImmediatePropagation(&mut self) {
self.stop_immediate = true;
self.stop_propagation = true;
}
pub fn Bubbles(&self) -> bool {
fn Bubbles(&self) -> bool {
self.bubbles
}
pub fn Cancelable(&self) -> bool {
fn Cancelable(&self) -> bool {
self.cancelable
}
pub fn TimeStamp(&self) -> u64 {
fn TimeStamp(&self) -> u64 {
self.timestamp
}
pub fn InitEvent(&mut self,
fn InitEvent(&mut self,
type_: DOMString,
bubbles: bool,
cancelable: bool) {
@ -151,18 +178,9 @@ impl Event {
self.cancelable = cancelable;
}
pub fn IsTrusted(&self) -> bool {
fn IsTrusted(&self) -> bool {
self.trusted
}
pub fn Constructor(global: &JSRef<Window>,
type_: DOMString,
init: &EventBinding::EventInit) -> Fallible<Unrooted<Event>> {
let roots = RootCollection::new();
let mut ev = Event::new(global).root(&roots);
ev.InitEvent(type_, init.bubbles, init.cancelable);
Ok(Unrooted::new_rooted(&*ev))
}
}
impl Reflectable for Event {

View file

@ -6,7 +6,7 @@ use dom::bindings::callback::ReportExceptions;
use dom::bindings::codegen::InheritTypes::{EventTargetCast, NodeCast, NodeDerived};
use dom::bindings::js::{JSRef, OptionalAssignable, RootCollection, Root};
use dom::eventtarget::{Capturing, Bubbling, EventTarget};
use dom::event::{Event, PhaseAtTarget, PhaseNone, PhaseBubbling, PhaseCapturing};
use dom::event::{Event, PhaseAtTarget, PhaseNone, PhaseBubbling, PhaseCapturing, EventMethods};
use dom::node::{Node, NodeHelpers};
// See http://dom.spec.whatwg.org/#concept-event-dispatch for the full dispatch algorithm
@ -119,7 +119,6 @@ pub fn dispatch_event<'a>(target: &JSRef<'a, EventTarget>,
let _ = chain.pop();
}
let event = event.get_mut();
event.dispatching = false;
event.phase = PhaseNone;
event.current_target = None;

View file

@ -65,7 +65,32 @@ impl EventTarget {
})
}
pub fn AddEventListener(&mut self,
pub fn dispatch_event_with_target<'a>(&self,
abstract_self: &JSRef<'a, EventTarget>,
abstract_target: Option<JSRef<'a, EventTarget>>,
event: &mut JSRef<Event>) -> Fallible<bool> {
if event.get().dispatching || !event.get().initialized {
return Err(InvalidState);
}
Ok(dispatch_event(abstract_self, abstract_target, event))
}
}
pub trait EventTargetMethods {
fn AddEventListener(&mut self,
ty: DOMString,
listener: Option<EventListener>,
capture: bool);
fn RemoveEventListener(&mut self,
ty: DOMString,
listener: Option<EventListener>,
capture: bool);
fn DispatchEvent(&self, abstract_self: &JSRef<EventTarget>,
event: &mut JSRef<Event>) -> Fallible<bool>;
}
impl<'a> EventTargetMethods for JSRef<'a, EventTarget> {
fn AddEventListener(&mut self,
ty: DOMString,
listener: Option<EventListener>,
capture: bool) {
@ -82,7 +107,7 @@ impl EventTarget {
}
}
pub fn RemoveEventListener(&mut self,
fn RemoveEventListener(&mut self,
ty: DOMString,
listener: Option<EventListener>,
capture: bool) {
@ -102,20 +127,10 @@ impl EventTarget {
}
}
pub fn DispatchEvent(&self, abstract_self: &JSRef<EventTarget>,
fn DispatchEvent(&self, abstract_self: &JSRef<EventTarget>,
event: &mut JSRef<Event>) -> Fallible<bool> {
self.dispatch_event_with_target(abstract_self, None, event)
}
pub fn dispatch_event_with_target<'a>(&self,
abstract_self: &JSRef<'a, EventTarget>,
abstract_target: Option<JSRef<'a, EventTarget>>,
event: &mut JSRef<Event>) -> Fallible<bool> {
if event.get().dispatching || !event.get().initialized {
return Err(InvalidState);
}
Ok(dispatch_event(abstract_self, abstract_target, event))
}
}
impl Reflectable for EventTarget {

View file

@ -41,12 +41,18 @@ impl FormData {
reflect_dom_object(~FormData::new_inherited(form, window.unrooted()), window, FormDataBinding::Wrap)
}
pub fn Constructor(window: &JSRef<Window>, form: Option<JSRef<HTMLFormElement>>)
-> Fallible<Unrooted<FormData>> {
pub fn Constructor(window: &JSRef<Window>, form: Option<JSRef<HTMLFormElement>>) -> Fallible<Unrooted<FormData>> {
Ok(FormData::new(form, window))
}
}
pub fn Append(&mut self, name: DOMString, value: &JSRef<Blob>, filename: Option<DOMString>) {
pub trait FormDataMethods {
fn Append(&mut self, name: DOMString, value: &JSRef<Blob>, filename: Option<DOMString>);
fn Append_(&mut self, name: DOMString, value: DOMString);
}
impl<'a> FormDataMethods for JSRef<'a, FormData> {
fn Append(&mut self, name: DOMString, value: &JSRef<Blob>, filename: Option<DOMString>) {
let blob = BlobData {
blob: value.unrooted(),
name: filename.unwrap_or(~"default")
@ -54,7 +60,7 @@ impl FormData {
self.data.insert(name.clone(), blob);
}
pub fn Append_(&mut self, name: DOMString, value: DOMString) {
fn Append_(&mut self, name: DOMString, value: DOMString) {
self.data.insert(name, StringData(value));
}
}

View file

@ -40,108 +40,137 @@ impl HTMLAnchorElement {
}
}
impl HTMLAnchorElement {
pub fn Href(&self) -> DOMString {
pub trait HTMLAnchorElementMethods {
fn Href(&self) -> DOMString;
fn SetHref(&mut self, _href: DOMString) -> ErrorResult;
fn Target(&self) -> DOMString;
fn SetTarget(&self, _target: DOMString) -> ErrorResult;
fn Download(&self) -> DOMString;
fn SetDownload(&self, _download: DOMString) -> ErrorResult;
fn Ping(&self) -> DOMString;
fn SetPing(&self, _ping: DOMString) -> ErrorResult;
fn Rel(&self) -> DOMString;
fn SetRel(&self, _rel: DOMString) -> ErrorResult;
fn Hreflang(&self) -> DOMString;
fn SetHreflang(&self, _href_lang: DOMString) -> ErrorResult;
fn Type(&self) -> DOMString;
fn SetType(&mut self, _type: DOMString) -> ErrorResult;
fn Text(&self) -> DOMString;
fn SetText(&mut self, _text: DOMString) -> ErrorResult;
fn Coords(&self) -> DOMString;
fn SetCoords(&mut self, _coords: DOMString) -> ErrorResult;
fn Charset(&self) -> DOMString;
fn SetCharset(&mut self, _charset: DOMString) -> ErrorResult;
fn Name(&self) -> DOMString;
fn SetName(&mut self, _name: DOMString) -> ErrorResult;
fn Rev(&self) -> DOMString;
fn SetRev(&mut self, _rev: DOMString) -> ErrorResult;
fn Shape(&self) -> DOMString;
fn SetShape(&mut self, _shape: DOMString) -> ErrorResult;
}
impl<'a> HTMLAnchorElementMethods for JSRef<'a, HTMLAnchorElement> {
fn Href(&self) -> DOMString {
~""
}
pub fn SetHref(&mut self, _href: DOMString) -> ErrorResult {
fn SetHref(&mut self, _href: DOMString) -> ErrorResult {
Ok(())
}
pub fn Target(&self) -> DOMString {
fn Target(&self) -> DOMString {
~""
}
pub fn SetTarget(&self, _target: DOMString) -> ErrorResult {
fn SetTarget(&self, _target: DOMString) -> ErrorResult {
Ok(())
}
pub fn Download(&self) -> DOMString {
fn Download(&self) -> DOMString {
~""
}
pub fn SetDownload(&self, _download: DOMString) -> ErrorResult {
fn SetDownload(&self, _download: DOMString) -> ErrorResult {
Ok(())
}
pub fn Ping(&self) -> DOMString {
fn Ping(&self) -> DOMString {
~""
}
pub fn SetPing(&self, _ping: DOMString) -> ErrorResult {
fn SetPing(&self, _ping: DOMString) -> ErrorResult {
Ok(())
}
pub fn Rel(&self) -> DOMString {
fn Rel(&self) -> DOMString {
~""
}
pub fn SetRel(&self, _rel: DOMString) -> ErrorResult {
fn SetRel(&self, _rel: DOMString) -> ErrorResult {
Ok(())
}
pub fn Hreflang(&self) -> DOMString {
fn Hreflang(&self) -> DOMString {
~""
}
pub fn SetHreflang(&self, _href_lang: DOMString) -> ErrorResult {
fn SetHreflang(&self, _href_lang: DOMString) -> ErrorResult {
Ok(())
}
pub fn Type(&self) -> DOMString {
fn Type(&self) -> DOMString {
~""
}
pub fn SetType(&mut self, _type: DOMString) -> ErrorResult {
fn SetType(&mut self, _type: DOMString) -> ErrorResult {
Ok(())
}
pub fn Text(&self) -> DOMString {
fn Text(&self) -> DOMString {
~""
}
pub fn SetText(&mut self, _text: DOMString) -> ErrorResult {
fn SetText(&mut self, _text: DOMString) -> ErrorResult {
Ok(())
}
pub fn Coords(&self) -> DOMString {
fn Coords(&self) -> DOMString {
~""
}
pub fn SetCoords(&mut self, _coords: DOMString) -> ErrorResult {
fn SetCoords(&mut self, _coords: DOMString) -> ErrorResult {
Ok(())
}
pub fn Charset(&self) -> DOMString {
fn Charset(&self) -> DOMString {
~""
}
pub fn SetCharset(&mut self, _charset: DOMString) -> ErrorResult {
fn SetCharset(&mut self, _charset: DOMString) -> ErrorResult {
Ok(())
}
pub fn Name(&self) -> DOMString {
fn Name(&self) -> DOMString {
~""
}
pub fn SetName(&mut self, _name: DOMString) -> ErrorResult {
fn SetName(&mut self, _name: DOMString) -> ErrorResult {
Ok(())
}
pub fn Rev(&self) -> DOMString {
fn Rev(&self) -> DOMString {
~""
}
pub fn SetRev(&mut self, _rev: DOMString) -> ErrorResult {
fn SetRev(&mut self, _rev: DOMString) -> ErrorResult {
Ok(())
}
pub fn Shape(&self) -> DOMString {
fn Shape(&self) -> DOMString {
~""
}
pub fn SetShape(&mut self, _shape: DOMString) -> ErrorResult {
fn SetShape(&mut self, _shape: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -40,92 +40,117 @@ impl HTMLAppletElement {
}
}
impl HTMLAppletElement {
pub fn Align(&self) -> DOMString {
pub trait HTMLAppletElementMethods {
fn Align(&self) -> DOMString;
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult;
fn Alt(&self) -> DOMString;
fn SetAlt(&self, _alt: DOMString) -> ErrorResult;
fn Archive(&self) -> DOMString;
fn SetArchive(&self, _archive: DOMString) -> ErrorResult;
fn Code(&self) -> DOMString;
fn SetCode(&self, _code: DOMString) -> ErrorResult;
fn CodeBase(&self) -> DOMString;
fn SetCodeBase(&self, _code_base: DOMString) -> ErrorResult;
fn Height(&self) -> DOMString;
fn SetHeight(&self, _height: DOMString) -> ErrorResult;
fn Hspace(&self) -> u32;
fn SetHspace(&mut self, _hspace: u32) -> ErrorResult;
fn Name(&self) -> DOMString;
fn SetName(&mut self, _name: DOMString) -> ErrorResult;
fn Object(&self) -> DOMString;
fn SetObject(&mut self, _object: DOMString) -> ErrorResult;
fn Vspace(&self) -> u32;
fn SetVspace(&mut self, _vspace: u32) -> ErrorResult;
fn Width(&self) -> DOMString;
fn SetWidth(&mut self, _width: DOMString) -> ErrorResult;
}
impl<'a> HTMLAppletElementMethods for JSRef<'a, HTMLAppletElement> {
fn Align(&self) -> DOMString {
~""
}
pub fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
Ok(())
}
pub fn Alt(&self) -> DOMString {
fn Alt(&self) -> DOMString {
~""
}
pub fn SetAlt(&self, _alt: DOMString) -> ErrorResult {
fn SetAlt(&self, _alt: DOMString) -> ErrorResult {
Ok(())
}
pub fn Archive(&self) -> DOMString {
fn Archive(&self) -> DOMString {
~""
}
pub fn SetArchive(&self, _archive: DOMString) -> ErrorResult {
fn SetArchive(&self, _archive: DOMString) -> ErrorResult {
Ok(())
}
pub fn Code(&self) -> DOMString {
fn Code(&self) -> DOMString {
~""
}
pub fn SetCode(&self, _code: DOMString) -> ErrorResult {
fn SetCode(&self, _code: DOMString) -> ErrorResult {
Ok(())
}
pub fn CodeBase(&self) -> DOMString {
fn CodeBase(&self) -> DOMString {
~""
}
pub fn SetCodeBase(&self, _code_base: DOMString) -> ErrorResult {
fn SetCodeBase(&self, _code_base: DOMString) -> ErrorResult {
Ok(())
}
pub fn Height(&self) -> DOMString {
fn Height(&self) -> DOMString {
~""
}
pub fn SetHeight(&self, _height: DOMString) -> ErrorResult {
fn SetHeight(&self, _height: DOMString) -> ErrorResult {
Ok(())
}
pub fn Hspace(&self) -> u32 {
fn Hspace(&self) -> u32 {
0
}
pub fn SetHspace(&mut self, _hspace: u32) -> ErrorResult {
fn SetHspace(&mut self, _hspace: u32) -> ErrorResult {
Ok(())
}
pub fn Name(&self) -> DOMString {
fn Name(&self) -> DOMString {
~""
}
pub fn SetName(&mut self, _name: DOMString) -> ErrorResult {
fn SetName(&mut self, _name: DOMString) -> ErrorResult {
Ok(())
}
pub fn Object(&self) -> DOMString {
fn Object(&self) -> DOMString {
~""
}
pub fn SetObject(&mut self, _object: DOMString) -> ErrorResult {
fn SetObject(&mut self, _object: DOMString) -> ErrorResult {
Ok(())
}
pub fn Vspace(&self) -> u32 {
fn Vspace(&self) -> u32 {
0
}
pub fn SetVspace(&mut self, _vspace: u32) -> ErrorResult {
fn SetVspace(&mut self, _vspace: u32) -> ErrorResult {
Ok(())
}
pub fn Width(&self) -> DOMString {
fn Width(&self) -> DOMString {
~""
}
pub fn SetWidth(&mut self, _width: DOMString) -> ErrorResult {
fn SetWidth(&mut self, _width: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -40,68 +40,87 @@ impl HTMLAreaElement {
}
}
impl HTMLAreaElement {
pub fn Alt(&self) -> DOMString {
pub trait HTMLAreaElementMethods {
fn Alt(&self) -> DOMString;
fn SetAlt(&self, _alt: DOMString) -> ErrorResult;
fn Coords(&self) -> DOMString;
fn SetCoords(&self, _coords: DOMString) -> ErrorResult;
fn Shape(&self) -> DOMString;
fn SetShape(&self, _shape: DOMString) -> ErrorResult;
fn Href(&self) -> DOMString;
fn SetHref(&self, _href: DOMString) -> ErrorResult;
fn Target(&self) -> DOMString;
fn SetTarget(&self, _target: DOMString) -> ErrorResult;
fn Download(&self) -> DOMString;
fn SetDownload(&self, _download: DOMString) -> ErrorResult;
fn Ping(&self) -> DOMString;
fn SetPing(&self, _ping: DOMString) -> ErrorResult;
fn NoHref(&self) -> bool;
fn SetNoHref(&mut self, _no_href: bool) -> ErrorResult;
}
impl<'a> HTMLAreaElementMethods for JSRef<'a, HTMLAreaElement> {
fn Alt(&self) -> DOMString {
~""
}
pub fn SetAlt(&self, _alt: DOMString) -> ErrorResult {
fn SetAlt(&self, _alt: DOMString) -> ErrorResult {
Ok(())
}
pub fn Coords(&self) -> DOMString {
fn Coords(&self) -> DOMString {
~""
}
pub fn SetCoords(&self, _coords: DOMString) -> ErrorResult {
fn SetCoords(&self, _coords: DOMString) -> ErrorResult {
Ok(())
}
pub fn Shape(&self) -> DOMString {
fn Shape(&self) -> DOMString {
~""
}
pub fn SetShape(&self, _shape: DOMString) -> ErrorResult {
fn SetShape(&self, _shape: DOMString) -> ErrorResult {
Ok(())
}
pub fn Href(&self) -> DOMString {
fn Href(&self) -> DOMString {
~""
}
pub fn SetHref(&self, _href: DOMString) -> ErrorResult {
fn SetHref(&self, _href: DOMString) -> ErrorResult {
Ok(())
}
pub fn Target(&self) -> DOMString {
fn Target(&self) -> DOMString {
~""
}
pub fn SetTarget(&self, _target: DOMString) -> ErrorResult {
fn SetTarget(&self, _target: DOMString) -> ErrorResult {
Ok(())
}
pub fn Download(&self) -> DOMString {
fn Download(&self) -> DOMString {
~""
}
pub fn SetDownload(&self, _download: DOMString) -> ErrorResult {
fn SetDownload(&self, _download: DOMString) -> ErrorResult {
Ok(())
}
pub fn Ping(&self) -> DOMString {
fn Ping(&self) -> DOMString {
~""
}
pub fn SetPing(&self, _ping: DOMString) -> ErrorResult {
fn SetPing(&self, _ping: DOMString) -> ErrorResult {
Ok(())
}
pub fn NoHref(&self) -> bool {
fn NoHref(&self) -> bool {
false
}
pub fn SetNoHref(&mut self, _no_href: bool) -> ErrorResult {
fn SetNoHref(&mut self, _no_href: bool) -> ErrorResult {
Ok(())
}
}

View file

@ -38,3 +38,6 @@ impl HTMLAudioElement {
Node::reflect_node(~element, document, HTMLAudioElementBinding::Wrap)
}
}
pub trait HTMLAudioElementMethods {
}

View file

@ -40,20 +40,28 @@ impl HTMLBaseElement {
}
}
impl HTMLBaseElement {
pub fn Href(&self) -> DOMString {
pub trait HTMLBaseElementMethods {
fn Href(&self) -> DOMString;
fn SetHref(&self, _href: DOMString) -> ErrorResult;
fn Target(&self) -> DOMString;
fn SetTarget(&self, _target: DOMString) -> ErrorResult;
}
impl<'a> HTMLBaseElementMethods for JSRef<'a, HTMLBaseElement> {
fn Href(&self) -> DOMString {
~""
}
pub fn SetHref(&self, _href: DOMString) -> ErrorResult {
fn SetHref(&self, _href: DOMString) -> ErrorResult {
Ok(())
}
pub fn Target(&self) -> DOMString {
fn Target(&self) -> DOMString {
~""
}
pub fn SetTarget(&self, _target: DOMString) -> ErrorResult {
fn SetTarget(&self, _target: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -40,52 +40,68 @@ impl HTMLBodyElement {
}
}
impl HTMLBodyElement {
pub fn Text(&self) -> DOMString {
pub trait HTMLBodyElementMethods {
fn Text(&self) -> DOMString;
fn SetText(&mut self, _text: DOMString) -> ErrorResult;
fn Link(&self) -> DOMString;
fn SetLink(&self, _link: DOMString) -> ErrorResult;
fn VLink(&self) -> DOMString;
fn SetVLink(&self, _v_link: DOMString) -> ErrorResult;
fn ALink(&self) -> DOMString;
fn SetALink(&self, _a_link: DOMString) -> ErrorResult;
fn BgColor(&self) -> DOMString;
fn SetBgColor(&self, _bg_color: DOMString) -> ErrorResult;
fn Background(&self) -> DOMString;
fn SetBackground(&self, _background: DOMString) -> ErrorResult;
}
impl<'a> HTMLBodyElementMethods for JSRef<'a, HTMLBodyElement> {
fn Text(&self) -> DOMString {
~""
}
pub fn SetText(&mut self, _text: DOMString) -> ErrorResult {
fn SetText(&mut self, _text: DOMString) -> ErrorResult {
Ok(())
}
pub fn Link(&self) -> DOMString {
fn Link(&self) -> DOMString {
~""
}
pub fn SetLink(&self, _link: DOMString) -> ErrorResult {
fn SetLink(&self, _link: DOMString) -> ErrorResult {
Ok(())
}
pub fn VLink(&self) -> DOMString {
fn VLink(&self) -> DOMString {
~""
}
pub fn SetVLink(&self, _v_link: DOMString) -> ErrorResult {
fn SetVLink(&self, _v_link: DOMString) -> ErrorResult {
Ok(())
}
pub fn ALink(&self) -> DOMString {
fn ALink(&self) -> DOMString {
~""
}
pub fn SetALink(&self, _a_link: DOMString) -> ErrorResult {
fn SetALink(&self, _a_link: DOMString) -> ErrorResult {
Ok(())
}
pub fn BgColor(&self) -> DOMString {
fn BgColor(&self) -> DOMString {
~""
}
pub fn SetBgColor(&self, _bg_color: DOMString) -> ErrorResult {
fn SetBgColor(&self, _bg_color: DOMString) -> ErrorResult {
Ok(())
}
pub fn Background(&self) -> DOMString {
fn Background(&self) -> DOMString {
~""
}
pub fn SetBackground(&self, _background: DOMString) -> ErrorResult {
fn SetBackground(&self, _background: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -40,12 +40,18 @@ impl HTMLBRElement {
}
}
impl HTMLBRElement {
pub fn Clear(&self) -> DOMString {
pub trait HTMLBRElementMethods {
fn Clear(&self) -> DOMString;
fn SetClear(&mut self, _text: DOMString) -> ErrorResult;
}
impl<'a> HTMLBRElementMethods for JSRef<'a, HTMLBRElement> {
fn Clear(&self) -> DOMString {
~""
}
pub fn SetClear(&mut self, _text: DOMString) -> ErrorResult {
fn SetClear(&mut self, _text: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -42,119 +42,152 @@ impl HTMLButtonElement {
}
}
impl HTMLButtonElement {
pub fn Autofocus(&self) -> bool {
pub trait HTMLButtonElementMethods {
fn Autofocus(&self) -> bool;
fn SetAutofocus(&mut self, _autofocus: bool) -> ErrorResult;
fn Disabled(&self) -> bool;
fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult;
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>>;
fn FormAction(&self) -> DOMString;
fn SetFormAction(&mut self, _formaction: DOMString) -> ErrorResult;
fn FormEnctype(&self) -> DOMString;
fn SetFormEnctype(&mut self, _formenctype: DOMString) -> ErrorResult;
fn FormMethod(&self) -> DOMString;
fn SetFormMethod(&mut self, _formmethod: DOMString) -> ErrorResult;
fn FormNoValidate(&self) -> bool;
fn SetFormNoValidate(&mut self, _novalidate: bool) -> ErrorResult;
fn FormTarget(&self) -> DOMString;
fn SetFormTarget(&mut self, _formtarget: DOMString) -> ErrorResult;
fn Name(&self) -> DOMString;
fn SetName(&mut self, _name: DOMString) -> ErrorResult;
fn Type(&self) -> DOMString;
fn SetType(&mut self, _type: DOMString) -> ErrorResult;
fn Value(&self) -> DOMString;
fn SetValue(&mut self, _value: DOMString) -> ErrorResult;
fn WillValidate(&self) -> bool;
fn SetWillValidate(&mut self, _will_validate: bool);
fn Validity(&self) -> Unrooted<ValidityState>;
fn SetValidity(&mut self, _validity: JS<ValidityState>);
fn ValidationMessage(&self) -> DOMString;
fn SetValidationMessage(&mut self, _message: DOMString) -> ErrorResult;
fn CheckValidity(&self) -> bool;
fn SetCustomValidity(&mut self, _error: DOMString);
}
impl<'a> HTMLButtonElementMethods for JSRef<'a, HTMLButtonElement> {
fn Autofocus(&self) -> bool {
false
}
pub fn SetAutofocus(&mut self, _autofocus: bool) -> ErrorResult {
fn SetAutofocus(&mut self, _autofocus: bool) -> ErrorResult {
Ok(())
}
pub fn Disabled(&self) -> bool {
fn Disabled(&self) -> bool {
false
}
pub fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult {
fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult {
Ok(())
}
pub fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>> {
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>> {
None
}
pub fn FormAction(&self) -> DOMString {
fn FormAction(&self) -> DOMString {
~""
}
pub fn SetFormAction(&mut self, _formaction: DOMString) -> ErrorResult {
fn SetFormAction(&mut self, _formaction: DOMString) -> ErrorResult {
Ok(())
}
pub fn FormEnctype(&self) -> DOMString {
fn FormEnctype(&self) -> DOMString {
~""
}
pub fn SetFormEnctype(&mut self, _formenctype: DOMString) -> ErrorResult {
fn SetFormEnctype(&mut self, _formenctype: DOMString) -> ErrorResult {
Ok(())
}
pub fn FormMethod(&self) -> DOMString {
fn FormMethod(&self) -> DOMString {
~""
}
pub fn SetFormMethod(&mut self, _formmethod: DOMString) -> ErrorResult {
fn SetFormMethod(&mut self, _formmethod: DOMString) -> ErrorResult {
Ok(())
}
pub fn FormNoValidate(&self) -> bool {
fn FormNoValidate(&self) -> bool {
false
}
pub fn SetFormNoValidate(&mut self, _novalidate: bool) -> ErrorResult {
fn SetFormNoValidate(&mut self, _novalidate: bool) -> ErrorResult {
Ok(())
}
pub fn FormTarget(&self) -> DOMString {
fn FormTarget(&self) -> DOMString {
~""
}
pub fn SetFormTarget(&mut self, _formtarget: DOMString) -> ErrorResult {
fn SetFormTarget(&mut self, _formtarget: DOMString) -> ErrorResult {
Ok(())
}
pub fn Name(&self) -> DOMString {
fn Name(&self) -> DOMString {
~""
}
pub fn SetName(&mut self, _name: DOMString) -> ErrorResult {
fn SetName(&mut self, _name: DOMString) -> ErrorResult {
Ok(())
}
pub fn Type(&self) -> DOMString {
fn Type(&self) -> DOMString {
~""
}
pub fn SetType(&mut self, _type: DOMString) -> ErrorResult {
fn SetType(&mut self, _type: DOMString) -> ErrorResult {
Ok(())
}
pub fn Value(&self) -> DOMString {
fn Value(&self) -> DOMString {
~""
}
pub fn SetValue(&mut self, _value: DOMString) -> ErrorResult {
fn SetValue(&mut self, _value: DOMString) -> ErrorResult {
Ok(())
}
pub fn WillValidate(&self) -> bool {
fn WillValidate(&self) -> bool {
false
}
pub fn SetWillValidate(&mut self, _will_validate: bool) {
fn SetWillValidate(&mut self, _will_validate: bool) {
}
pub fn Validity(&self) -> Unrooted<ValidityState> {
fn Validity(&self) -> Unrooted<ValidityState> {
let roots = RootCollection::new();
let doc = self.htmlelement.element.node.owner_doc().root(&roots);
ValidityState::new(&*doc.deref().window.root(&roots))
}
pub fn SetValidity(&mut self, _validity: JS<ValidityState>) {
fn SetValidity(&mut self, _validity: JS<ValidityState>) {
}
pub fn ValidationMessage(&self) -> DOMString {
fn ValidationMessage(&self) -> DOMString {
~""
}
pub fn SetValidationMessage(&mut self, _message: DOMString) -> ErrorResult {
fn SetValidationMessage(&mut self, _message: DOMString) -> ErrorResult {
Ok(())
}
pub fn CheckValidity(&self) -> bool {
fn CheckValidity(&self) -> bool {
true
}
pub fn SetCustomValidity(&mut self, _error: DOMString) {
fn SetCustomValidity(&mut self, _error: DOMString) {
}
}

View file

@ -40,20 +40,28 @@ impl HTMLCanvasElement {
}
}
impl HTMLCanvasElement {
pub fn Width(&self) -> u32 {
pub trait HTMLCanvasElementMethods {
fn Width(&self) -> u32;
fn SetWidth(&mut self, _width: u32) -> ErrorResult;
fn Height(&self) -> u32;
fn SetHeight(&mut self, _height: u32) -> ErrorResult;
}
impl<'a> HTMLCanvasElementMethods for JSRef<'a, HTMLCanvasElement> {
fn Width(&self) -> u32 {
0
}
pub fn SetWidth(&mut self, _width: u32) -> ErrorResult {
fn SetWidth(&mut self, _width: u32) -> ErrorResult {
Ok(())
}
pub fn Height(&self) -> u32 {
fn Height(&self) -> u32 {
0
}
pub fn SetHeight(&mut self, _height: u32) -> ErrorResult {
fn SetHeight(&mut self, _height: u32) -> ErrorResult {
Ok(())
}
}

View file

@ -118,9 +118,17 @@ impl HTMLCollection {
}
}
impl HTMLCollection {
pub trait HTMLCollectionMethods {
fn Length(&self) -> u32;
fn Item(&self, index: u32) -> Option<Unrooted<Element>>;
fn NamedItem(&self, key: DOMString) -> Option<Unrooted<Element>>;
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Unrooted<Element>>;
fn NamedGetter(&self, maybe_name: Option<DOMString>, found: &mut bool) -> Option<Unrooted<Element>>;
}
impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> {
// http://dom.spec.whatwg.org/#dom-htmlcollection-length
pub fn Length(&self) -> u32 {
fn Length(&self) -> u32 {
let roots = RootCollection::new();
match self.collection {
Static(ref elems) => elems.len() as u32,
@ -136,7 +144,7 @@ impl HTMLCollection {
}
// http://dom.spec.whatwg.org/#dom-htmlcollection-item
pub fn Item(&self, index: u32) -> Option<Unrooted<Element>> {
fn Item(&self, index: u32) -> Option<Unrooted<Element>> {
let roots = RootCollection::new();
match self.collection {
Static(ref elems) => elems
@ -159,7 +167,7 @@ impl HTMLCollection {
}
// http://dom.spec.whatwg.org/#dom-htmlcollection-nameditem
pub fn NamedItem(&self, key: DOMString) -> Option<Unrooted<Element>> {
fn NamedItem(&self, key: DOMString) -> Option<Unrooted<Element>> {
let roots = RootCollection::new();
// Step 1.
@ -190,16 +198,14 @@ impl HTMLCollection {
}
}
}
}
impl HTMLCollection {
pub fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Unrooted<Element>> {
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Unrooted<Element>> {
let maybe_elem = self.Item(index);
*found = maybe_elem.is_some();
maybe_elem
}
pub fn NamedGetter(&self, maybe_name: Option<DOMString>, found: &mut bool) -> Option<Unrooted<Element>> {
fn NamedGetter(&self, maybe_name: Option<DOMString>, found: &mut bool) -> Option<Unrooted<Element>> {
match maybe_name {
Some(name) => {
let maybe_elem = self.NamedItem(name);

View file

@ -40,12 +40,18 @@ impl HTMLDataElement {
}
}
impl HTMLDataElement {
pub fn Value(&self) -> DOMString {
pub trait HTMLDataElementMethods {
fn Value(&self) -> DOMString;
fn SetValue(&mut self, _value: DOMString) -> ErrorResult;
}
impl<'a> HTMLDataElementMethods for JSRef<'a, HTMLDataElement> {
fn Value(&self) -> DOMString {
~""
}
pub fn SetValue(&mut self, _value: DOMString) -> ErrorResult {
fn SetValue(&mut self, _value: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -40,8 +40,12 @@ impl HTMLDataListElement {
}
}
impl HTMLDataListElement {
pub fn Options(&self, abstract_self: &JSRef<HTMLDataListElement>) -> Unrooted<HTMLCollection> {
pub trait HTMLDataListElementMethods {
fn Options(&self, abstract_self: &JSRef<HTMLDataListElement>) -> Unrooted<HTMLCollection>;
}
impl<'a> HTMLDataListElementMethods for JSRef<'a, HTMLDataListElement> {
fn Options(&self, abstract_self: &JSRef<HTMLDataListElement>) -> Unrooted<HTMLCollection> {
struct HTMLDataListOptionsFilter;
impl CollectionFilter for HTMLDataListOptionsFilter {
fn filter(&self, elem: &JSRef<Element>, _root: &JSRef<Node>) -> bool {
@ -55,3 +59,4 @@ impl HTMLDataListElement {
HTMLCollection::create(&*window, node, filter)
}
}

View file

@ -40,12 +40,18 @@ impl HTMLDirectoryElement {
}
}
impl HTMLDirectoryElement {
pub fn Compact(&self) -> bool {
pub trait HTMLDirectoryElementMethods {
fn Compact(&self) -> bool;
fn SetCompact(&mut self, _compact: bool) -> ErrorResult;
}
impl<'a> HTMLDirectoryElementMethods for JSRef<'a, HTMLDirectoryElement> {
fn Compact(&self) -> bool {
false
}
pub fn SetCompact(&mut self, _compact: bool) -> ErrorResult {
fn SetCompact(&mut self, _compact: bool) -> ErrorResult {
Ok(())
}
}

View file

@ -40,12 +40,18 @@ impl HTMLDivElement {
}
}
impl HTMLDivElement {
pub fn Align(&self) -> DOMString {
pub trait HTMLDivElementMethods {
fn Align(&self) -> DOMString;
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult;
}
impl<'a> HTMLDivElementMethods for JSRef<'a, HTMLDivElement> {
fn Align(&self) -> DOMString {
~""
}
pub fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -40,20 +40,28 @@ impl HTMLDListElement {
}
}
impl HTMLDListElement {
pub fn Compact(&self) -> bool {
pub trait HTMLDListElementMethods {
fn Compact(&self) -> bool;
fn SetCompact(&mut self, _compact: bool) -> ErrorResult;
fn Type(&self) -> DOMString;
fn SetType(&mut self, _type: DOMString) -> ErrorResult;
}
impl<'a> HTMLDListElementMethods for JSRef<'a, HTMLDListElement> {
fn Compact(&self) -> bool {
false
}
pub fn SetCompact(&mut self, _compact: bool) -> ErrorResult {
fn SetCompact(&mut self, _compact: bool) -> ErrorResult {
Ok(())
}
pub fn Type(&self) -> DOMString {
fn Type(&self) -> DOMString {
~""
}
pub fn SetType(&mut self, _type: DOMString) -> ErrorResult {
fn SetType(&mut self, _type: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -45,121 +45,154 @@ impl HTMLElement {
}
}
impl HTMLElement {
pub fn Title(&self) -> DOMString {
pub trait HTMLElementMethods {
fn Title(&self) -> DOMString;
fn SetTitle(&mut self, _title: DOMString);
fn Lang(&self) -> DOMString;
fn SetLang(&mut self, _lang: DOMString);
fn Dir(&self) -> DOMString;
fn SetDir(&mut self, _dir: DOMString) -> ErrorResult;
fn GetItemValue(&self, _cx: *JSContext) -> Fallible<JSVal>;
fn SetItemValue(&mut self, _cx: *JSContext, _val: JSVal) -> ErrorResult;
fn Hidden(&self) -> bool;
fn SetHidden(&mut self, _hidden: bool) -> ErrorResult;
fn Click(&self);
fn TabIndex(&self) -> i32;
fn SetTabIndex(&mut self, _index: i32) -> ErrorResult;
fn Focus(&self) -> ErrorResult;
fn Blur(&self) -> ErrorResult;
fn AccessKey(&self) -> DOMString;
fn SetAccessKey(&self, _key: DOMString) -> ErrorResult;
fn AccessKeyLabel(&self) -> DOMString;
fn Draggable(&self) -> bool;
fn SetDraggable(&mut self, _draggable: bool) -> ErrorResult;
fn ContentEditable(&self) -> DOMString;
fn SetContentEditable(&mut self, _val: DOMString) -> ErrorResult;
fn IsContentEditable(&self) -> bool;
fn Spellcheck(&self) -> bool;
fn SetSpellcheck(&self, _val: bool) -> ErrorResult;
fn GetOffsetParent(&self) -> Option<Unrooted<Element>>;
fn OffsetTop(&self) -> i32;
fn OffsetLeft(&self) -> i32;
fn OffsetWidth(&self) -> i32;
fn OffsetHeight(&self) -> i32;
}
impl<'a> HTMLElementMethods for JSRef<'a, HTMLElement> {
fn Title(&self) -> DOMString {
~""
}
pub fn SetTitle(&mut self, _title: DOMString) {
fn SetTitle(&mut self, _title: DOMString) {
}
pub fn Lang(&self) -> DOMString {
fn Lang(&self) -> DOMString {
~""
}
pub fn SetLang(&mut self, _lang: DOMString) {
fn SetLang(&mut self, _lang: DOMString) {
}
pub fn Dir(&self) -> DOMString {
fn Dir(&self) -> DOMString {
~""
}
pub fn SetDir(&mut self, _dir: DOMString) -> ErrorResult {
fn SetDir(&mut self, _dir: DOMString) -> ErrorResult {
Ok(())
}
pub fn GetItemValue(&self, _cx: *JSContext) -> Fallible<JSVal> {
fn GetItemValue(&self, _cx: *JSContext) -> Fallible<JSVal> {
Ok(NullValue())
}
pub fn SetItemValue(&mut self, _cx: *JSContext, _val: JSVal) -> ErrorResult {
fn SetItemValue(&mut self, _cx: *JSContext, _val: JSVal) -> ErrorResult {
Ok(())
}
pub fn Hidden(&self) -> bool {
fn Hidden(&self) -> bool {
false
}
pub fn SetHidden(&mut self, _hidden: bool) -> ErrorResult {
fn SetHidden(&mut self, _hidden: bool) -> ErrorResult {
Ok(())
}
pub fn Click(&self) {
fn Click(&self) {
}
pub fn TabIndex(&self) -> i32 {
fn TabIndex(&self) -> i32 {
0
}
pub fn SetTabIndex(&mut self, _index: i32) -> ErrorResult {
fn SetTabIndex(&mut self, _index: i32) -> ErrorResult {
Ok(())
}
pub fn Focus(&self) -> ErrorResult {
fn Focus(&self) -> ErrorResult {
Ok(())
}
pub fn Blur(&self) -> ErrorResult {
fn Blur(&self) -> ErrorResult {
Ok(())
}
pub fn AccessKey(&self) -> DOMString {
fn AccessKey(&self) -> DOMString {
~""
}
pub fn SetAccessKey(&self, _key: DOMString) -> ErrorResult {
fn SetAccessKey(&self, _key: DOMString) -> ErrorResult {
Ok(())
}
pub fn AccessKeyLabel(&self) -> DOMString {
fn AccessKeyLabel(&self) -> DOMString {
~""
}
pub fn Draggable(&self) -> bool {
fn Draggable(&self) -> bool {
false
}
pub fn SetDraggable(&mut self, _draggable: bool) -> ErrorResult {
fn SetDraggable(&mut self, _draggable: bool) -> ErrorResult {
Ok(())
}
pub fn ContentEditable(&self) -> DOMString {
fn ContentEditable(&self) -> DOMString {
~""
}
pub fn SetContentEditable(&mut self, _val: DOMString) -> ErrorResult {
fn SetContentEditable(&mut self, _val: DOMString) -> ErrorResult {
Ok(())
}
pub fn IsContentEditable(&self) -> bool {
fn IsContentEditable(&self) -> bool {
false
}
pub fn Spellcheck(&self) -> bool {
fn Spellcheck(&self) -> bool {
false
}
pub fn SetSpellcheck(&self, _val: bool) -> ErrorResult {
fn SetSpellcheck(&self, _val: bool) -> ErrorResult {
Ok(())
}
pub fn GetOffsetParent(&self) -> Option<Unrooted<Element>> {
fn GetOffsetParent(&self) -> Option<Unrooted<Element>> {
None
}
pub fn OffsetTop(&self) -> i32 {
fn OffsetTop(&self) -> i32 {
0
}
pub fn OffsetLeft(&self) -> i32 {
fn OffsetLeft(&self) -> i32 {
0
}
pub fn OffsetWidth(&self) -> i32 {
fn OffsetWidth(&self) -> i32 {
0
}
pub fn OffsetHeight(&self) -> i32 {
fn OffsetHeight(&self) -> i32 {
0
}
}

View file

@ -40,56 +40,73 @@ impl HTMLEmbedElement {
}
}
impl HTMLEmbedElement {
pub fn Src(&self) -> DOMString {
pub trait HTMLEmbedElementMethods {
fn Src(&self) -> DOMString;
fn SetSrc(&mut self, _src: DOMString) -> ErrorResult;
fn Type(&self) -> DOMString;
fn SetType(&mut self, _type: DOMString) -> ErrorResult;
fn Width(&self) -> DOMString;
fn SetWidth(&mut self, _width: DOMString) -> ErrorResult;
fn Height(&self) -> DOMString;
fn SetHeight(&mut self, _height: DOMString) -> ErrorResult;
fn Align(&self) -> DOMString;
fn SetAlign(&mut self, _type: DOMString) -> ErrorResult;
fn Name(&self) -> DOMString;
fn SetName(&mut self, _type: DOMString) -> ErrorResult;
fn GetSVGDocument(&self) -> Option<Unrooted<Document>>;
}
impl<'a> HTMLEmbedElementMethods for JSRef<'a, HTMLEmbedElement> {
fn Src(&self) -> DOMString {
~""
}
pub fn SetSrc(&mut self, _src: DOMString) -> ErrorResult {
fn SetSrc(&mut self, _src: DOMString) -> ErrorResult {
Ok(())
}
pub fn Type(&self) -> DOMString {
fn Type(&self) -> DOMString {
~""
}
pub fn SetType(&mut self, _type: DOMString) -> ErrorResult {
fn SetType(&mut self, _type: DOMString) -> ErrorResult {
Ok(())
}
pub fn Width(&self) -> DOMString {
fn Width(&self) -> DOMString {
~""
}
pub fn SetWidth(&mut self, _width: DOMString) -> ErrorResult {
fn SetWidth(&mut self, _width: DOMString) -> ErrorResult {
Ok(())
}
pub fn Height(&self) -> DOMString {
fn Height(&self) -> DOMString {
~""
}
pub fn SetHeight(&mut self, _height: DOMString) -> ErrorResult {
fn SetHeight(&mut self, _height: DOMString) -> ErrorResult {
Ok(())
}
pub fn Align(&self) -> DOMString {
fn Align(&self) -> DOMString {
~""
}
pub fn SetAlign(&mut self, _type: DOMString) -> ErrorResult {
fn SetAlign(&mut self, _type: DOMString) -> ErrorResult {
Ok(())
}
pub fn Name(&self) -> DOMString {
fn Name(&self) -> DOMString {
~""
}
pub fn SetName(&mut self, _type: DOMString) -> ErrorResult {
fn SetName(&mut self, _type: DOMString) -> ErrorResult {
Ok(())
}
pub fn GetSVGDocument(&self) -> Option<Unrooted<Document>> {
fn GetSVGDocument(&self) -> Option<Unrooted<Document>> {
None
}
}

View file

@ -43,33 +43,48 @@ impl HTMLFieldSetElement {
}
}
impl HTMLFieldSetElement {
pub fn Disabled(&self) -> bool {
pub trait HTMLFieldSetElementMethods {
fn Disabled(&self) -> bool;
fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult;
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>>;
fn Name(&self) -> DOMString;
fn SetName(&mut self, _name: DOMString) -> ErrorResult;
fn Type(&self) -> DOMString;
fn Elements(&self, abstract_self: &JSRef<HTMLFieldSetElement>) -> Unrooted<HTMLCollection>;
fn WillValidate(&self) -> bool;
fn Validity(&self) -> Unrooted<ValidityState>;
fn ValidationMessage(&self) -> DOMString;
fn CheckValidity(&self) -> bool;
fn SetCustomValidity(&mut self, _error: DOMString);
}
impl<'a> HTMLFieldSetElementMethods for JSRef<'a, HTMLFieldSetElement> {
fn Disabled(&self) -> bool {
false
}
pub fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult {
fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult {
Ok(())
}
pub fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>> {
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>> {
None
}
pub fn Name(&self) -> DOMString {
fn Name(&self) -> DOMString {
~""
}
pub fn SetName(&mut self, _name: DOMString) -> ErrorResult {
fn SetName(&mut self, _name: DOMString) -> ErrorResult {
Ok(())
}
pub fn Type(&self) -> DOMString {
fn Type(&self) -> DOMString {
~""
}
// http://www.whatwg.org/html/#dom-fieldset-elements
pub fn Elements(&self, abstract_self: &JSRef<HTMLFieldSetElement>) -> Unrooted<HTMLCollection> {
fn Elements(&self, abstract_self: &JSRef<HTMLFieldSetElement>) -> Unrooted<HTMLCollection> {
struct ElementsFilter;
impl CollectionFilter for ElementsFilter {
fn filter(&self, elem: &JSRef<Element>, root: &JSRef<Node>) -> bool {
@ -86,25 +101,26 @@ impl HTMLFieldSetElement {
HTMLCollection::create(&*window, node, filter)
}
pub fn WillValidate(&self) -> bool {
fn WillValidate(&self) -> bool {
false
}
pub fn Validity(&self) -> Unrooted<ValidityState> {
fn Validity(&self) -> Unrooted<ValidityState> {
let roots = RootCollection::new();
let doc = self.htmlelement.element.node.owner_doc().root(&roots);
let window = doc.deref().window.root(&roots);
ValidityState::new(&*window)
}
pub fn ValidationMessage(&self) -> DOMString {
fn ValidationMessage(&self) -> DOMString {
~""
}
pub fn CheckValidity(&self) -> bool {
fn CheckValidity(&self) -> bool {
false
}
pub fn SetCustomValidity(&mut self, _error: DOMString) {
fn SetCustomValidity(&mut self, _error: DOMString) {
}
}

View file

@ -40,28 +40,38 @@ impl HTMLFontElement {
}
}
impl HTMLFontElement {
pub fn Color(&self) -> DOMString {
pub trait HTMLFontElementMethods {
fn Color(&self) -> DOMString;
fn SetColor(&mut self, _color: DOMString) -> ErrorResult;
fn Face(&self) -> DOMString;
fn SetFace(&mut self, _face: DOMString) -> ErrorResult;
fn Size(&self) -> DOMString;
fn SetSize(&mut self, _size: DOMString) -> ErrorResult;
}
impl<'a> HTMLFontElementMethods for JSRef<'a, HTMLFontElement> {
fn Color(&self) -> DOMString {
~""
}
pub fn SetColor(&mut self, _color: DOMString) -> ErrorResult {
fn SetColor(&mut self, _color: DOMString) -> ErrorResult {
Ok(())
}
pub fn Face(&self) -> DOMString {
fn Face(&self) -> DOMString {
~""
}
pub fn SetFace(&mut self, _face: DOMString) -> ErrorResult {
fn SetFace(&mut self, _face: DOMString) -> ErrorResult {
Ok(())
}
pub fn Size(&self) -> DOMString {
fn Size(&self) -> DOMString {
~""
}
pub fn SetSize(&mut self, _size: DOMString) -> ErrorResult {
fn SetSize(&mut self, _size: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -41,80 +41,107 @@ impl HTMLFormElement {
}
}
impl HTMLFormElement {
pub fn AcceptCharset(&self) -> DOMString {
pub trait HTMLFormElementMethods {
fn AcceptCharset(&self) -> DOMString;
fn SetAcceptCharset(&mut self, _accept_charset: DOMString) -> ErrorResult;
fn Action(&self) -> DOMString;
fn SetAction(&mut self, _action: DOMString) -> ErrorResult;
fn Autocomplete(&self) -> DOMString;
fn SetAutocomplete(&mut self, _autocomplete: DOMString) -> ErrorResult;
fn Enctype(&self) -> DOMString;
fn SetEnctype(&mut self, _enctype: DOMString) -> ErrorResult;
fn Encoding(&self) -> DOMString;
fn SetEncoding(&mut self, _encoding: DOMString) -> ErrorResult;
fn Method(&self) -> DOMString;
fn SetMethod(&mut self, _method: DOMString) -> ErrorResult;
fn Name(&self) -> DOMString;
fn SetName(&mut self, _name: DOMString) -> ErrorResult;
fn NoValidate(&self) -> bool;
fn SetNoValidate(&mut self, _no_validate: bool) -> ErrorResult;
fn Target(&self) -> DOMString;
fn SetTarget(&mut self, _target: DOMString) -> ErrorResult;
fn Elements(&self) -> Unrooted<HTMLCollection>;
fn Length(&self) -> i32;
fn Submit(&self) -> ErrorResult;
fn Reset(&self);
fn CheckValidity(&self) -> bool;
fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> Unrooted<Element>;
}
impl<'a> HTMLFormElementMethods for JSRef<'a, HTMLFormElement> {
fn AcceptCharset(&self) -> DOMString {
~""
}
pub fn SetAcceptCharset(&mut self, _accept_charset: DOMString) -> ErrorResult {
fn SetAcceptCharset(&mut self, _accept_charset: DOMString) -> ErrorResult {
Ok(())
}
pub fn Action(&self) -> DOMString {
fn Action(&self) -> DOMString {
~""
}
pub fn SetAction(&mut self, _action: DOMString) -> ErrorResult {
fn SetAction(&mut self, _action: DOMString) -> ErrorResult {
Ok(())
}
pub fn Autocomplete(&self) -> DOMString {
fn Autocomplete(&self) -> DOMString {
~""
}
pub fn SetAutocomplete(&mut self, _autocomplete: DOMString) -> ErrorResult {
fn SetAutocomplete(&mut self, _autocomplete: DOMString) -> ErrorResult {
Ok(())
}
pub fn Enctype(&self) -> DOMString {
fn Enctype(&self) -> DOMString {
~""
}
pub fn SetEnctype(&mut self, _enctype: DOMString) -> ErrorResult {
fn SetEnctype(&mut self, _enctype: DOMString) -> ErrorResult {
Ok(())
}
pub fn Encoding(&self) -> DOMString {
fn Encoding(&self) -> DOMString {
~""
}
pub fn SetEncoding(&mut self, _encoding: DOMString) -> ErrorResult {
fn SetEncoding(&mut self, _encoding: DOMString) -> ErrorResult {
Ok(())
}
pub fn Method(&self) -> DOMString {
fn Method(&self) -> DOMString {
~""
}
pub fn SetMethod(&mut self, _method: DOMString) -> ErrorResult {
fn SetMethod(&mut self, _method: DOMString) -> ErrorResult {
Ok(())
}
pub fn Name(&self) -> DOMString {
fn Name(&self) -> DOMString {
~""
}
pub fn SetName(&mut self, _name: DOMString) -> ErrorResult {
fn SetName(&mut self, _name: DOMString) -> ErrorResult {
Ok(())
}
pub fn NoValidate(&self) -> bool {
fn NoValidate(&self) -> bool {
false
}
pub fn SetNoValidate(&mut self, _no_validate: bool) -> ErrorResult {
fn SetNoValidate(&mut self, _no_validate: bool) -> ErrorResult {
Ok(())
}
pub fn Target(&self) -> DOMString {
fn Target(&self) -> DOMString {
~""
}
pub fn SetTarget(&mut self, _target: DOMString) -> ErrorResult {
fn SetTarget(&mut self, _target: DOMString) -> ErrorResult {
Ok(())
}
pub fn Elements(&self) -> Unrooted<HTMLCollection> {
fn Elements(&self) -> Unrooted<HTMLCollection> {
// FIXME: https://github.com/mozilla/servo/issues/1844
let roots = RootCollection::new();
let doc = self.htmlelement.element.node.owner_doc().root(&roots);
@ -122,22 +149,23 @@ impl HTMLFormElement {
HTMLCollection::new(&*window, Static(vec!()))
}
pub fn Length(&self) -> i32 {
fn Length(&self) -> i32 {
0
}
pub fn Submit(&self) -> ErrorResult {
fn Submit(&self) -> ErrorResult {
Ok(())
}
pub fn Reset(&self) {
fn Reset(&self) {
}
pub fn CheckValidity(&self) -> bool {
fn CheckValidity(&self) -> bool {
false
}
pub fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> Unrooted<Element> {
fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> Unrooted<Element> {
fail!("Not implemented.")
}
}

View file

@ -41,76 +41,98 @@ impl HTMLFrameElement {
}
}
impl HTMLFrameElement {
pub fn Name(&self) -> DOMString {
pub trait HTMLFrameElementMethods {
fn Name(&self) -> DOMString;
fn SetName(&mut self, _name: DOMString) -> ErrorResult;
fn Scrolling(&self) -> DOMString;
fn SetScrolling(&mut self, _scrolling: DOMString) -> ErrorResult;
fn Src(&self) -> DOMString;
fn SetSrc(&mut self, _src: DOMString) -> ErrorResult;
fn FrameBorder(&self) -> DOMString;
fn SetFrameBorder(&mut self, _frameborder: DOMString) -> ErrorResult;
fn LongDesc(&self) -> DOMString;
fn SetLongDesc(&mut self, _longdesc: DOMString) -> ErrorResult;
fn NoResize(&self) -> bool;
fn SetNoResize(&mut self, _no_resize: bool) -> ErrorResult;
fn GetContentDocument(&self) -> Option<Unrooted<Document>>;
fn GetContentWindow(&self) -> Option<Unrooted<Window>>;
fn MarginHeight(&self) -> DOMString;
fn SetMarginHeight(&mut self, _height: DOMString) -> ErrorResult;
fn MarginWidth(&self) -> DOMString;
fn SetMarginWidth(&mut self, _height: DOMString) -> ErrorResult;
}
impl<'a> HTMLFrameElementMethods for JSRef<'a, HTMLFrameElement> {
fn Name(&self) -> DOMString {
~""
}
pub fn SetName(&mut self, _name: DOMString) -> ErrorResult {
fn SetName(&mut self, _name: DOMString) -> ErrorResult {
Ok(())
}
pub fn Scrolling(&self) -> DOMString {
fn Scrolling(&self) -> DOMString {
~""
}
pub fn SetScrolling(&mut self, _scrolling: DOMString) -> ErrorResult {
fn SetScrolling(&mut self, _scrolling: DOMString) -> ErrorResult {
Ok(())
}
pub fn Src(&self) -> DOMString {
fn Src(&self) -> DOMString {
~""
}
pub fn SetSrc(&mut self, _src: DOMString) -> ErrorResult {
fn SetSrc(&mut self, _src: DOMString) -> ErrorResult {
Ok(())
}
pub fn FrameBorder(&self) -> DOMString {
fn FrameBorder(&self) -> DOMString {
~""
}
pub fn SetFrameBorder(&mut self, _frameborder: DOMString) -> ErrorResult {
fn SetFrameBorder(&mut self, _frameborder: DOMString) -> ErrorResult {
Ok(())
}
pub fn LongDesc(&self) -> DOMString {
fn LongDesc(&self) -> DOMString {
~""
}
pub fn SetLongDesc(&mut self, _longdesc: DOMString) -> ErrorResult {
fn SetLongDesc(&mut self, _longdesc: DOMString) -> ErrorResult {
Ok(())
}
pub fn NoResize(&self) -> bool {
fn NoResize(&self) -> bool {
false
}
pub fn SetNoResize(&mut self, _no_resize: bool) -> ErrorResult {
fn SetNoResize(&mut self, _no_resize: bool) -> ErrorResult {
Ok(())
}
pub fn GetContentDocument(&self) -> Option<Unrooted<Document>> {
fn GetContentDocument(&self) -> Option<Unrooted<Document>> {
None
}
pub fn GetContentWindow(&self) -> Option<Unrooted<Window>> {
fn GetContentWindow(&self) -> Option<Unrooted<Window>> {
None
}
pub fn MarginHeight(&self) -> DOMString {
fn MarginHeight(&self) -> DOMString {
~""
}
pub fn SetMarginHeight(&mut self, _height: DOMString) -> ErrorResult {
fn SetMarginHeight(&mut self, _height: DOMString) -> ErrorResult {
Ok(())
}
pub fn MarginWidth(&self) -> DOMString {
fn MarginWidth(&self) -> DOMString {
~""
}
pub fn SetMarginWidth(&mut self, _height: DOMString) -> ErrorResult {
fn SetMarginWidth(&mut self, _height: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -40,20 +40,28 @@ impl HTMLFrameSetElement {
}
}
impl HTMLFrameSetElement {
pub fn Cols(&self) -> DOMString {
pub trait HTMLFrameSetElementMethods {
fn Cols(&self) -> DOMString;
fn SetCols(&mut self, _cols: DOMString) -> ErrorResult;
fn Rows(&self) -> DOMString;
fn SetRows(&mut self, _rows: DOMString) -> ErrorResult;
}
impl<'a> HTMLFrameSetElementMethods for JSRef<'a, HTMLFrameSetElement> {
fn Cols(&self) -> DOMString {
~""
}
pub fn SetCols(&mut self, _cols: DOMString) -> ErrorResult {
fn SetCols(&mut self, _cols: DOMString) -> ErrorResult {
Ok(())
}
pub fn Rows(&self) -> DOMString {
fn Rows(&self) -> DOMString {
~""
}
pub fn SetRows(&mut self, _rows: DOMString) -> ErrorResult {
fn SetRows(&mut self, _rows: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -38,3 +38,6 @@ impl HTMLHeadElement {
Node::reflect_node(~element, document, HTMLHeadElementBinding::Wrap)
}
}
pub trait HTMLHeadElementMethods {
}

View file

@ -51,11 +51,17 @@ impl HTMLHeadingElement {
}
}
impl HTMLHeadingElement {
pub fn Align(&self) -> DOMString {
pub trait HTMLHeadingElementMethods {
fn Align(&self) -> DOMString;
fn SetAlign(&mut self, _align: DOMString);
}
impl<'a> HTMLHeadingElementMethods for JSRef<'a, HTMLHeadingElement> {
fn Align(&self) -> DOMString {
~""
}
pub fn SetAlign(&mut self, _align: DOMString) {
fn SetAlign(&mut self, _align: DOMString) {
}
}

View file

@ -40,44 +40,58 @@ impl HTMLHRElement {
}
}
impl HTMLHRElement {
pub fn Align(&self) -> DOMString {
pub trait HTMLHRElementMethods {
fn Align(&self) -> DOMString;
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult;
fn Color(&self) -> DOMString;
fn SetColor(&mut self, _color: DOMString) -> ErrorResult;
fn NoShade(&self) -> bool;
fn SetNoShade(&self, _no_shade: bool) -> ErrorResult;
fn Size(&self) -> DOMString;
fn SetSize(&mut self, _size: DOMString) -> ErrorResult;
fn Width(&self) -> DOMString;
fn SetWidth(&mut self, _width: DOMString) -> ErrorResult;
}
impl<'a> HTMLHRElementMethods for JSRef<'a, HTMLHRElement> {
fn Align(&self) -> DOMString {
~""
}
pub fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
Ok(())
}
pub fn Color(&self) -> DOMString {
fn Color(&self) -> DOMString {
~""
}
pub fn SetColor(&mut self, _color: DOMString) -> ErrorResult {
fn SetColor(&mut self, _color: DOMString) -> ErrorResult {
Ok(())
}
pub fn NoShade(&self) -> bool {
fn NoShade(&self) -> bool {
false
}
pub fn SetNoShade(&self, _no_shade: bool) -> ErrorResult {
fn SetNoShade(&self, _no_shade: bool) -> ErrorResult {
Ok(())
}
pub fn Size(&self) -> DOMString {
fn Size(&self) -> DOMString {
~""
}
pub fn SetSize(&mut self, _size: DOMString) -> ErrorResult {
fn SetSize(&mut self, _size: DOMString) -> ErrorResult {
Ok(())
}
pub fn Width(&self) -> DOMString {
fn Width(&self) -> DOMString {
~""
}
pub fn SetWidth(&mut self, _width: DOMString) -> ErrorResult {
fn SetWidth(&mut self, _width: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -40,12 +40,18 @@ impl HTMLHtmlElement {
}
}
impl HTMLHtmlElement {
pub fn Version(&self) -> DOMString {
pub trait HTMLHtmlElementMethods {
fn Version(&self) -> DOMString;
fn SetVersion(&mut self, _version: DOMString) -> ErrorResult;
}
impl<'a> HTMLHtmlElementMethods for JSRef<'a, HTMLHtmlElement> {
fn Version(&self) -> DOMString {
~""
}
pub fn SetVersion(&mut self, _version: DOMString) -> ErrorResult {
fn SetVersion(&mut self, _version: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -80,122 +80,154 @@ impl HTMLIFrameElement {
}
}
impl HTMLIFrameElement {
pub fn Src(&self) -> DOMString {
pub trait HTMLIFrameElementMethods {
fn Src(&self) -> DOMString;
fn SetSrc(&mut self, _src: DOMString) -> ErrorResult;
fn Srcdoc(&self) -> DOMString;
fn SetSrcdoc(&mut self, _srcdoc: DOMString) -> ErrorResult;
fn Name(&self) -> DOMString;
fn SetName(&mut self, _name: DOMString) -> ErrorResult;
fn Sandbox(&self, abstract_self: &JSRef<HTMLIFrameElement>) -> DOMString;
fn SetSandbox(&mut self, abstract_self: &mut JSRef<HTMLIFrameElement>, sandbox: DOMString);
fn AllowFullscreen(&self) -> bool;
fn SetAllowFullscreen(&mut self, _allow: bool) -> ErrorResult;
fn Width(&self) -> DOMString;
fn SetWidth(&mut self, _width: DOMString) -> ErrorResult;
fn Height(&self) -> DOMString;
fn SetHeight(&mut self, _height: DOMString) -> ErrorResult;
fn GetContentDocument(&self) -> Option<Unrooted<Document>>;
fn GetContentWindow(&self) -> Option<Unrooted<Window>>;
fn Align(&self) -> DOMString;
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult;
fn Scrolling(&self) -> DOMString;
fn SetScrolling(&mut self, _scrolling: DOMString) -> ErrorResult;
fn FrameBorder(&self) -> DOMString;
fn SetFrameBorder(&mut self, _frameborder: DOMString) -> ErrorResult;
fn LongDesc(&self) -> DOMString;
fn SetLongDesc(&mut self, _longdesc: DOMString) -> ErrorResult;
fn MarginHeight(&self) -> DOMString;
fn SetMarginHeight(&mut self, _marginheight: DOMString) -> ErrorResult;
fn MarginWidth(&self) -> DOMString;
fn SetMarginWidth(&mut self, _marginwidth: DOMString) -> ErrorResult;
fn GetSVGDocument(&self) -> Option<Unrooted<Document>>;
}
impl<'a> HTMLIFrameElementMethods for JSRef<'a, HTMLIFrameElement> {
fn Src(&self) -> DOMString {
~""
}
pub fn SetSrc(&mut self, _src: DOMString) -> ErrorResult {
fn SetSrc(&mut self, _src: DOMString) -> ErrorResult {
Ok(())
}
pub fn Srcdoc(&self) -> DOMString {
fn Srcdoc(&self) -> DOMString {
~""
}
pub fn SetSrcdoc(&mut self, _srcdoc: DOMString) -> ErrorResult {
fn SetSrcdoc(&mut self, _srcdoc: DOMString) -> ErrorResult {
Ok(())
}
pub fn Name(&self) -> DOMString {
fn Name(&self) -> DOMString {
~""
}
pub fn SetName(&mut self, _name: DOMString) -> ErrorResult {
fn SetName(&mut self, _name: DOMString) -> ErrorResult {
Ok(())
}
pub fn Sandbox(&self, abstract_self: &JSRef<HTMLIFrameElement>) -> DOMString {
fn Sandbox(&self, abstract_self: &JSRef<HTMLIFrameElement>) -> DOMString {
let element: &JSRef<Element> = ElementCast::from_ref(abstract_self);
element.get_string_attribute("sandbox")
}
pub fn SetSandbox(&mut self, abstract_self: &mut JSRef<HTMLIFrameElement>, sandbox: DOMString) {
fn SetSandbox(&mut self, abstract_self: &mut JSRef<HTMLIFrameElement>, sandbox: DOMString) {
let element: &mut JSRef<Element> = ElementCast::from_mut_ref(abstract_self);
element.set_string_attribute("sandbox", sandbox);
}
pub fn AllowFullscreen(&self) -> bool {
fn AllowFullscreen(&self) -> bool {
false
}
pub fn SetAllowFullscreen(&mut self, _allow: bool) -> ErrorResult {
fn SetAllowFullscreen(&mut self, _allow: bool) -> ErrorResult {
Ok(())
}
pub fn Width(&self) -> DOMString {
fn Width(&self) -> DOMString {
~""
}
pub fn SetWidth(&mut self, _width: DOMString) -> ErrorResult {
fn SetWidth(&mut self, _width: DOMString) -> ErrorResult {
Ok(())
}
pub fn Height(&self) -> DOMString {
fn Height(&self) -> DOMString {
~""
}
pub fn SetHeight(&mut self, _height: DOMString) -> ErrorResult {
fn SetHeight(&mut self, _height: DOMString) -> ErrorResult {
Ok(())
}
pub fn GetContentDocument(&self) -> Option<Unrooted<Document>> {
fn GetContentDocument(&self) -> Option<Unrooted<Document>> {
None
}
pub fn GetContentWindow(&self) -> Option<Unrooted<Window>> {
fn GetContentWindow(&self) -> Option<Unrooted<Window>> {
None
}
pub fn Align(&self) -> DOMString {
fn Align(&self) -> DOMString {
~""
}
pub fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
Ok(())
}
pub fn Scrolling(&self) -> DOMString {
fn Scrolling(&self) -> DOMString {
~""
}
pub fn SetScrolling(&mut self, _scrolling: DOMString) -> ErrorResult {
fn SetScrolling(&mut self, _scrolling: DOMString) -> ErrorResult {
Ok(())
}
pub fn FrameBorder(&self) -> DOMString {
fn FrameBorder(&self) -> DOMString {
~""
}
pub fn SetFrameBorder(&mut self, _frameborder: DOMString) -> ErrorResult {
fn SetFrameBorder(&mut self, _frameborder: DOMString) -> ErrorResult {
Ok(())
}
pub fn LongDesc(&self) -> DOMString {
fn LongDesc(&self) -> DOMString {
~""
}
pub fn SetLongDesc(&mut self, _longdesc: DOMString) -> ErrorResult {
fn SetLongDesc(&mut self, _longdesc: DOMString) -> ErrorResult {
Ok(())
}
pub fn MarginHeight(&self) -> DOMString {
fn MarginHeight(&self) -> DOMString {
~""
}
pub fn SetMarginHeight(&mut self, _marginheight: DOMString) -> ErrorResult {
fn SetMarginHeight(&mut self, _marginheight: DOMString) -> ErrorResult {
Ok(())
}
pub fn MarginWidth(&self) -> DOMString {
fn MarginWidth(&self) -> DOMString {
~""
}
pub fn SetMarginWidth(&mut self, _marginwidth: DOMString) -> ErrorResult {
fn SetMarginWidth(&mut self, _marginwidth: DOMString) -> ErrorResult {
Ok(())
}
pub fn GetSVGDocument(&self) -> Option<Unrooted<Document>> {
fn GetSVGDocument(&self) -> Option<Unrooted<Document>> {
None
}
}

View file

@ -47,9 +47,7 @@ impl HTMLImageElement {
let element = HTMLImageElement::new_inherited(localName, document.unrooted());
Node::reflect_node(~element, document, HTMLImageElementBinding::Wrap)
}
}
impl HTMLImageElement {
pub fn image<'a>(&'a self) -> &'a Option<Url> {
&*self.image
}
@ -79,145 +77,179 @@ impl HTMLImageElement {
}
}
}
}
pub fn Alt(&self, abstract_self: &JSRef<HTMLImageElement>) -> DOMString {
pub trait HTMLImageElementMethods {
fn Alt(&self, abstract_self: &JSRef<HTMLImageElement>) -> DOMString;
fn SetAlt(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, alt: DOMString);
fn Src(&self, abstract_self: &JSRef<HTMLImageElement>) -> DOMString;
fn SetSrc(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, src: DOMString);
fn CrossOrigin(&self) -> DOMString;
fn SetCrossOrigin(&mut self, _cross_origin: DOMString) -> ErrorResult;
fn UseMap(&self, abstract_self: &JSRef<HTMLImageElement>) -> DOMString;
fn SetUseMap(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, use_map: DOMString);
fn IsMap(&self, abstract_self: &JSRef<HTMLImageElement>) -> bool;
fn SetIsMap(&self, abstract_self: &mut JSRef<HTMLImageElement>, is_map: bool);
fn Width(&self, abstract_self: &JSRef<HTMLImageElement>) -> u32;
fn SetWidth(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, width: u32);
fn Height(&self, abstract_self: &JSRef<HTMLImageElement>) -> u32;
fn SetHeight(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, height: u32);
fn NaturalWidth(&self) -> u32;
fn NaturalHeight(&self) -> u32;
fn Complete(&self) -> bool;
fn Name(&self, abstract_self: &JSRef<HTMLImageElement>) -> DOMString;
fn SetName(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, name: DOMString);
fn Align(&self, abstract_self: &JSRef<HTMLImageElement>) -> DOMString;
fn SetAlign(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, align: DOMString);
fn Hspace(&self, abstract_self: &JSRef<HTMLImageElement>) -> u32;
fn SetHspace(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, hspace: u32);
fn Vspace(&self, abstract_self: &JSRef<HTMLImageElement>) -> u32;
fn SetVspace(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, vspace: u32);
fn LongDesc(&self, abstract_self: &JSRef<HTMLImageElement>) -> DOMString;
fn SetLongDesc(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, longdesc: DOMString);
fn Border(&self, abstract_self: &JSRef<HTMLImageElement>) -> DOMString;
fn SetBorder(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, border: DOMString);
}
impl<'a> HTMLImageElementMethods for JSRef<'a, HTMLImageElement> {
fn Alt(&self, abstract_self: &JSRef<HTMLImageElement>) -> DOMString {
let element: &JSRef<Element> = ElementCast::from_ref(abstract_self);
element.get_string_attribute("alt")
}
pub fn SetAlt(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, alt: DOMString) {
fn SetAlt(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, alt: DOMString) {
let element: &mut JSRef<Element> = ElementCast::from_mut_ref(abstract_self);
element.set_string_attribute("alt", alt)
}
pub fn Src(&self, abstract_self: &JSRef<HTMLImageElement>) -> DOMString {
fn Src(&self, abstract_self: &JSRef<HTMLImageElement>) -> DOMString {
let element: &JSRef<Element> = ElementCast::from_ref(abstract_self);
element.get_string_attribute("src")
}
pub fn SetSrc(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, src: DOMString) {
fn SetSrc(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, src: DOMString) {
let element: &mut JSRef<Element> = ElementCast::from_mut_ref(abstract_self);
element.set_url_attribute("src", src)
}
pub fn CrossOrigin(&self) -> DOMString {
fn CrossOrigin(&self) -> DOMString {
~""
}
pub fn SetCrossOrigin(&mut self, _cross_origin: DOMString) -> ErrorResult {
fn SetCrossOrigin(&mut self, _cross_origin: DOMString) -> ErrorResult {
Ok(())
}
pub fn UseMap(&self, abstract_self: &JSRef<HTMLImageElement>) -> DOMString {
fn UseMap(&self, abstract_self: &JSRef<HTMLImageElement>) -> DOMString {
let element: &JSRef<Element> = ElementCast::from_ref(abstract_self);
element.get_string_attribute("useMap")
}
pub fn SetUseMap(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, use_map: DOMString) {
fn SetUseMap(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, use_map: DOMString) {
let element: &mut JSRef<Element> = ElementCast::from_mut_ref(abstract_self);
element.set_string_attribute("useMap", use_map)
}
pub fn IsMap(&self, abstract_self: &JSRef<HTMLImageElement>) -> bool {
fn IsMap(&self, abstract_self: &JSRef<HTMLImageElement>) -> bool {
let element: &JSRef<Element> = ElementCast::from_ref(abstract_self);
from_str::<bool>(element.get_string_attribute("hspace")).unwrap()
}
pub fn SetIsMap(&self, abstract_self: &mut JSRef<HTMLImageElement>, is_map: bool) {
fn SetIsMap(&self, abstract_self: &mut JSRef<HTMLImageElement>, is_map: bool) {
let element: &mut JSRef<Element> = ElementCast::from_mut_ref(abstract_self);
element.set_string_attribute("isMap", is_map.to_str())
}
pub fn Width(&self, abstract_self: &JSRef<HTMLImageElement>) -> u32 {
fn Width(&self, abstract_self: &JSRef<HTMLImageElement>) -> u32 {
let node: &JSRef<Node> = NodeCast::from_ref(abstract_self);
let rect = node.get_bounding_content_box();
to_px(rect.size.width) as u32
}
pub fn SetWidth(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, width: u32) {
fn SetWidth(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, width: u32) {
let elem: &mut JSRef<Element> = ElementCast::from_mut_ref(abstract_self);
elem.set_uint_attribute("width", width)
}
pub fn Height(&self, abstract_self: &JSRef<HTMLImageElement>) -> u32 {
fn Height(&self, abstract_self: &JSRef<HTMLImageElement>) -> u32 {
let node: &JSRef<Node> = NodeCast::from_ref(abstract_self);
let rect = node.get_bounding_content_box();
to_px(rect.size.height) as u32
}
pub fn SetHeight(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, height: u32) {
fn SetHeight(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, height: u32) {
let elem: &mut JSRef<Element> = ElementCast::from_mut_ref(abstract_self);
elem.set_uint_attribute("height", height)
}
pub fn NaturalWidth(&self) -> u32 {
fn NaturalWidth(&self) -> u32 {
0
}
pub fn NaturalHeight(&self) -> u32 {
fn NaturalHeight(&self) -> u32 {
0
}
pub fn Complete(&self) -> bool {
fn Complete(&self) -> bool {
false
}
pub fn Name(&self, abstract_self: &JSRef<HTMLImageElement>) -> DOMString {
fn Name(&self, abstract_self: &JSRef<HTMLImageElement>) -> DOMString {
let element: &JSRef<Element> = ElementCast::from_ref(abstract_self);
element.get_string_attribute("name")
}
pub fn SetName(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, name: DOMString) {
fn SetName(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, name: DOMString) {
let element: &mut JSRef<Element> = ElementCast::from_mut_ref(abstract_self);
element.set_string_attribute("name", name)
}
pub fn Align(&self, abstract_self: &JSRef<HTMLImageElement>) -> DOMString {
fn Align(&self, abstract_self: &JSRef<HTMLImageElement>) -> DOMString {
let element: &JSRef<Element> = ElementCast::from_ref(abstract_self);
element.get_string_attribute("longdesc")
}
pub fn SetAlign(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, align: DOMString) {
fn SetAlign(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, align: DOMString) {
let element: &mut JSRef<Element> = ElementCast::from_mut_ref(abstract_self);
element.set_string_attribute("align", align)
}
pub fn Hspace(&self, abstract_self: &JSRef<HTMLImageElement>) -> u32 {
fn Hspace(&self, abstract_self: &JSRef<HTMLImageElement>) -> u32 {
let element: &JSRef<Element> = ElementCast::from_ref(abstract_self);
from_str::<u32>(element.get_string_attribute("hspace")).unwrap()
}
pub fn SetHspace(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, hspace: u32) {
fn SetHspace(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, hspace: u32) {
let element: &mut JSRef<Element> = ElementCast::from_mut_ref(abstract_self);
element.set_uint_attribute("hspace", hspace)
}
pub fn Vspace(&self, abstract_self: &JSRef<HTMLImageElement>) -> u32 {
fn Vspace(&self, abstract_self: &JSRef<HTMLImageElement>) -> u32 {
let element: &JSRef<Element> = ElementCast::from_ref(abstract_self);
from_str::<u32>(element.get_string_attribute("vspace")).unwrap()
}
pub fn SetVspace(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, vspace: u32) {
fn SetVspace(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, vspace: u32) {
let element: &mut JSRef<Element> = ElementCast::from_mut_ref(abstract_self);
element.set_uint_attribute("vspace", vspace)
}
pub fn LongDesc(&self, abstract_self: &JSRef<HTMLImageElement>) -> DOMString {
fn LongDesc(&self, abstract_self: &JSRef<HTMLImageElement>) -> DOMString {
let element: &JSRef<Element> = ElementCast::from_ref(abstract_self);
element.get_string_attribute("longdesc")
}
pub fn SetLongDesc(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, longdesc: DOMString) {
fn SetLongDesc(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, longdesc: DOMString) {
let element: &mut JSRef<Element> = ElementCast::from_mut_ref(abstract_self);
element.set_string_attribute("longdesc", longdesc)
}
pub fn Border(&self, abstract_self: &JSRef<HTMLImageElement>) -> DOMString {
fn Border(&self, abstract_self: &JSRef<HTMLImageElement>) -> DOMString {
let element: &JSRef<Element> = ElementCast::from_ref(abstract_self);
element.get_string_attribute("border")
}
pub fn SetBorder(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, border: DOMString) {
fn SetBorder(&mut self, abstract_self: &mut JSRef<HTMLImageElement>, border: DOMString) {
let element: &mut JSRef<Element> = ElementCast::from_mut_ref(abstract_self);
element.set_string_attribute("border", border)
}

View file

@ -40,310 +40,392 @@ impl HTMLInputElement {
}
}
impl HTMLInputElement {
pub fn Accept(&self) -> DOMString {
pub trait HTMLInputElementMethods {
fn Accept(&self) -> DOMString;
fn SetAccept(&mut self, _accept: DOMString) -> ErrorResult;
fn Alt(&self) -> DOMString;
fn SetAlt(&mut self, _alt: DOMString) -> ErrorResult;
fn Autocomplete(&self) -> DOMString;
fn SetAutocomplete(&mut self, _autocomple: DOMString) -> ErrorResult;
fn Autofocus(&self) -> bool;
fn SetAutofocus(&mut self, _autofocus: bool) -> ErrorResult;
fn DefaultChecked(&self) -> bool;
fn SetDefaultChecked(&mut self, _default_checked: bool) -> ErrorResult;
fn Checked(&self) -> bool;
fn SetChecked(&mut self, _checked: bool);
fn Disabled(&self) -> bool;
fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult;
fn FormAction(&self) -> DOMString;
fn SetFormAction(&mut self, _form_action: DOMString) -> ErrorResult;
fn FormEnctype(&self) -> DOMString;
fn SetFormEnctype(&mut self, _form_enctype: DOMString) -> ErrorResult;
fn FormMethod(&self) -> DOMString;
fn SetFormMethod(&mut self, _form_method: DOMString) -> ErrorResult;
fn FormNoValidate(&self) -> bool;
fn SetFormNoValidate(&mut self, _form_no_validate: bool) -> ErrorResult;
fn FormTarget(&self) -> DOMString;
fn SetFormTarget(&mut self, _form_target: DOMString) -> ErrorResult;
fn Height(&self) -> u32;
fn SetHeight(&mut self, _height: u32) -> ErrorResult;
fn Indeterminate(&self) -> bool;
fn SetIndeterminate(&mut self, _indeterminate: bool);
fn InputMode(&self) -> DOMString;
fn SetInputMode(&mut self, _input_mode: DOMString) -> ErrorResult;
fn Max(&self) -> DOMString;
fn SetMax(&mut self, _max: DOMString) -> ErrorResult;
fn MaxLength(&self) -> i32;
fn SetMaxLength(&mut self, _max_length: i32) -> ErrorResult;
fn Min(&self) -> DOMString;
fn SetMin(&mut self, _min: DOMString) -> ErrorResult;
fn Multiple(&self) -> bool;
fn SetMultiple(&mut self, _multiple: bool) -> ErrorResult;
fn Name(&self) -> DOMString;
fn SetName(&mut self, _name: DOMString) -> ErrorResult;
fn Pattern(&self) -> DOMString;
fn SetPattern(&mut self, _pattern: DOMString) -> ErrorResult;
fn Placeholder(&self) -> DOMString;
fn SetPlaceholder(&mut self, _placeholder: DOMString) -> ErrorResult;
fn ReadOnly(&self) -> bool;
fn SetReadOnly(&mut self, _read_only: bool) -> ErrorResult;
fn Required(&self) -> bool;
fn SetRequired(&mut self, _required: bool) -> ErrorResult;
fn Size(&self) -> u32;
fn SetSize(&mut self, _size: u32) -> ErrorResult;
fn Src(&self) -> DOMString;
fn SetSrc(&mut self, _src: DOMString) -> ErrorResult;
fn Step(&self) -> DOMString;
fn SetStep(&mut self, _step: DOMString) -> ErrorResult;
fn Type(&self) -> DOMString;
fn SetType(&mut self, _type: DOMString) -> ErrorResult;
fn DefaultValue(&self) -> DOMString;
fn SetDefaultValue(&mut self, _default_value: DOMString) -> ErrorResult;
fn Value(&self) -> DOMString;
fn SetValue(&mut self, _value: DOMString) -> ErrorResult;
fn Width(&self) -> u32;
fn SetWidth(&mut self, _width: u32);
fn WillValidate(&self) -> bool;
fn SetWillValidate(&self, _will_validate: bool);
fn GetValidationMessage(&self) -> Fallible<DOMString>;
fn CheckValidity(&self) -> bool;
fn SetCustomValidity(&self, _error: DOMString);
fn Select(&self);
fn GetSelectionStart(&self) -> Fallible<i32>;
fn SetSelectionStart(&mut self, _selection_start: i32) -> ErrorResult;
fn GetSelectionEnd(&self) -> Fallible<i32>;
fn SetSelectionEnd(&mut self, _selection_end: i32) -> ErrorResult;
fn GetSelectionDirection(&self) -> Fallible<DOMString>;
fn SetSelectionDirection(&mut self, _selection_direction: DOMString) -> ErrorResult;
fn Align(&self) -> DOMString;
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult;
fn UseMap(&self) -> DOMString;
fn SetUseMap(&mut self, _align: DOMString) -> ErrorResult;
}
impl<'a> HTMLInputElementMethods for JSRef<'a, HTMLInputElement> {
fn Accept(&self) -> DOMString {
~""
}
pub fn SetAccept(&mut self, _accept: DOMString) -> ErrorResult {
fn SetAccept(&mut self, _accept: DOMString) -> ErrorResult {
Ok(())
}
pub fn Alt(&self) -> DOMString {
fn Alt(&self) -> DOMString {
~""
}
pub fn SetAlt(&mut self, _alt: DOMString) -> ErrorResult {
fn SetAlt(&mut self, _alt: DOMString) -> ErrorResult {
Ok(())
}
pub fn Autocomplete(&self) -> DOMString {
fn Autocomplete(&self) -> DOMString {
~""
}
pub fn SetAutocomplete(&mut self, _autocomple: DOMString) -> ErrorResult {
fn SetAutocomplete(&mut self, _autocomple: DOMString) -> ErrorResult {
Ok(())
}
pub fn Autofocus(&self) -> bool {
fn Autofocus(&self) -> bool {
false
}
pub fn SetAutofocus(&mut self, _autofocus: bool) -> ErrorResult {
fn SetAutofocus(&mut self, _autofocus: bool) -> ErrorResult {
Ok(())
}
pub fn DefaultChecked(&self) -> bool {
fn DefaultChecked(&self) -> bool {
false
}
pub fn SetDefaultChecked(&mut self, _default_checked: bool) -> ErrorResult {
fn SetDefaultChecked(&mut self, _default_checked: bool) -> ErrorResult {
Ok(())
}
pub fn Checked(&self) -> bool {
fn Checked(&self) -> bool {
false
}
pub fn SetChecked(&mut self, _checked: bool) {
fn SetChecked(&mut self, _checked: bool) {
}
pub fn Disabled(&self) -> bool {
fn Disabled(&self) -> bool {
false
}
pub fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult {
fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult {
Ok(())
}
pub fn FormAction(&self) -> DOMString {
fn FormAction(&self) -> DOMString {
~""
}
pub fn SetFormAction(&mut self, _form_action: DOMString) -> ErrorResult {
fn SetFormAction(&mut self, _form_action: DOMString) -> ErrorResult {
Ok(())
}
pub fn FormEnctype(&self) -> DOMString {
fn FormEnctype(&self) -> DOMString {
~""
}
pub fn SetFormEnctype(&mut self, _form_enctype: DOMString) -> ErrorResult {
fn SetFormEnctype(&mut self, _form_enctype: DOMString) -> ErrorResult {
Ok(())
}
pub fn FormMethod(&self) -> DOMString {
fn FormMethod(&self) -> DOMString {
~""
}
pub fn SetFormMethod(&mut self, _form_method: DOMString) -> ErrorResult {
fn SetFormMethod(&mut self, _form_method: DOMString) -> ErrorResult {
Ok(())
}
pub fn FormNoValidate(&self) -> bool {
fn FormNoValidate(&self) -> bool {
false
}
pub fn SetFormNoValidate(&mut self, _form_no_validate: bool) -> ErrorResult {
fn SetFormNoValidate(&mut self, _form_no_validate: bool) -> ErrorResult {
Ok(())
}
pub fn FormTarget(&self) -> DOMString {
fn FormTarget(&self) -> DOMString {
~""
}
pub fn SetFormTarget(&mut self, _form_target: DOMString) -> ErrorResult {
fn SetFormTarget(&mut self, _form_target: DOMString) -> ErrorResult {
Ok(())
}
pub fn Height(&self) -> u32 {
fn Height(&self) -> u32 {
0
}
pub fn SetHeight(&mut self, _height: u32) -> ErrorResult {
fn SetHeight(&mut self, _height: u32) -> ErrorResult {
Ok(())
}
pub fn Indeterminate(&self) -> bool {
fn Indeterminate(&self) -> bool {
false
}
pub fn SetIndeterminate(&mut self, _indeterminate: bool) {
fn SetIndeterminate(&mut self, _indeterminate: bool) {
}
pub fn InputMode(&self) -> DOMString {
fn InputMode(&self) -> DOMString {
~""
}
pub fn SetInputMode(&mut self, _input_mode: DOMString) -> ErrorResult {
fn SetInputMode(&mut self, _input_mode: DOMString) -> ErrorResult {
Ok(())
}
pub fn Max(&self) -> DOMString {
fn Max(&self) -> DOMString {
~""
}
pub fn SetMax(&mut self, _max: DOMString) -> ErrorResult {
fn SetMax(&mut self, _max: DOMString) -> ErrorResult {
Ok(())
}
pub fn MaxLength(&self) -> i32 {
fn MaxLength(&self) -> i32 {
0
}
pub fn SetMaxLength(&mut self, _max_length: i32) -> ErrorResult {
fn SetMaxLength(&mut self, _max_length: i32) -> ErrorResult {
Ok(())
}
pub fn Min(&self) -> DOMString {
fn Min(&self) -> DOMString {
~""
}
pub fn SetMin(&mut self, _min: DOMString) -> ErrorResult {
fn SetMin(&mut self, _min: DOMString) -> ErrorResult {
Ok(())
}
pub fn Multiple(&self) -> bool {
fn Multiple(&self) -> bool {
false
}
pub fn SetMultiple(&mut self, _multiple: bool) -> ErrorResult {
fn SetMultiple(&mut self, _multiple: bool) -> ErrorResult {
Ok(())
}
pub fn Name(&self) -> DOMString {
fn Name(&self) -> DOMString {
~""
}
pub fn SetName(&mut self, _name: DOMString) -> ErrorResult {
fn SetName(&mut self, _name: DOMString) -> ErrorResult {
Ok(())
}
pub fn Pattern(&self) -> DOMString {
fn Pattern(&self) -> DOMString {
~""
}
pub fn SetPattern(&mut self, _pattern: DOMString) -> ErrorResult {
fn SetPattern(&mut self, _pattern: DOMString) -> ErrorResult {
Ok(())
}
pub fn Placeholder(&self) -> DOMString {
fn Placeholder(&self) -> DOMString {
~""
}
pub fn SetPlaceholder(&mut self, _placeholder: DOMString) -> ErrorResult {
fn SetPlaceholder(&mut self, _placeholder: DOMString) -> ErrorResult {
Ok(())
}
pub fn ReadOnly(&self) -> bool {
fn ReadOnly(&self) -> bool {
false
}
pub fn SetReadOnly(&mut self, _read_only: bool) -> ErrorResult {
fn SetReadOnly(&mut self, _read_only: bool) -> ErrorResult {
Ok(())
}
pub fn Required(&self) -> bool {
fn Required(&self) -> bool {
false
}
pub fn SetRequired(&mut self, _required: bool) -> ErrorResult {
fn SetRequired(&mut self, _required: bool) -> ErrorResult {
Ok(())
}
pub fn Size(&self) -> u32 {
fn Size(&self) -> u32 {
0
}
pub fn SetSize(&mut self, _size: u32) -> ErrorResult {
fn SetSize(&mut self, _size: u32) -> ErrorResult {
Ok(())
}
pub fn Src(&self) -> DOMString {
fn Src(&self) -> DOMString {
~""
}
pub fn SetSrc(&mut self, _src: DOMString) -> ErrorResult {
fn SetSrc(&mut self, _src: DOMString) -> ErrorResult {
Ok(())
}
pub fn Step(&self) -> DOMString {
fn Step(&self) -> DOMString {
~""
}
pub fn SetStep(&mut self, _step: DOMString) -> ErrorResult {
fn SetStep(&mut self, _step: DOMString) -> ErrorResult {
Ok(())
}
pub fn Type(&self) -> DOMString {
fn Type(&self) -> DOMString {
~""
}
pub fn SetType(&mut self, _type: DOMString) -> ErrorResult {
fn SetType(&mut self, _type: DOMString) -> ErrorResult {
Ok(())
}
pub fn DefaultValue(&self) -> DOMString {
fn DefaultValue(&self) -> DOMString {
~""
}
pub fn SetDefaultValue(&mut self, _default_value: DOMString) -> ErrorResult {
fn SetDefaultValue(&mut self, _default_value: DOMString) -> ErrorResult {
Ok(())
}
pub fn Value(&self) -> DOMString {
fn Value(&self) -> DOMString {
~""
}
pub fn SetValue(&mut self, _value: DOMString) -> ErrorResult {
fn SetValue(&mut self, _value: DOMString) -> ErrorResult {
Ok(())
}
pub fn Width(&self) -> u32 {
fn Width(&self) -> u32 {
0
}
pub fn SetWidth(&mut self, _width: u32) {
fn SetWidth(&mut self, _width: u32) {
}
pub fn WillValidate(&self) -> bool {
fn WillValidate(&self) -> bool {
false
}
pub fn SetWillValidate(&self, _will_validate: bool) {
fn SetWillValidate(&self, _will_validate: bool) {
}
pub fn GetValidationMessage(&self) -> Fallible<DOMString> {
fn GetValidationMessage(&self) -> Fallible<DOMString> {
Ok(~"")
}
pub fn CheckValidity(&self) -> bool {
fn CheckValidity(&self) -> bool {
false
}
pub fn SetCustomValidity(&self, _error: DOMString) {
fn SetCustomValidity(&self, _error: DOMString) {
}
pub fn Select(&self) {
fn Select(&self) {
}
pub fn GetSelectionStart(&self) -> Fallible<i32> {
fn GetSelectionStart(&self) -> Fallible<i32> {
Ok(0)
}
pub fn SetSelectionStart(&mut self, _selection_start: i32) -> ErrorResult {
fn SetSelectionStart(&mut self, _selection_start: i32) -> ErrorResult {
Ok(())
}
pub fn GetSelectionEnd(&self) -> Fallible<i32> {
fn GetSelectionEnd(&self) -> Fallible<i32> {
Ok(0)
}
pub fn SetSelectionEnd(&mut self, _selection_end: i32) -> ErrorResult {
fn SetSelectionEnd(&mut self, _selection_end: i32) -> ErrorResult {
Ok(())
}
pub fn GetSelectionDirection(&self) -> Fallible<DOMString> {
fn GetSelectionDirection(&self) -> Fallible<DOMString> {
Ok(~"")
}
pub fn SetSelectionDirection(&mut self, _selection_direction: DOMString) -> ErrorResult {
fn SetSelectionDirection(&mut self, _selection_direction: DOMString) -> ErrorResult {
Ok(())
}
pub fn Align(&self) -> DOMString {
fn Align(&self) -> DOMString {
~""
}
pub fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
Ok(())
}
pub fn UseMap(&self) -> DOMString {
fn UseMap(&self) -> DOMString {
~""
}
pub fn SetUseMap(&mut self, _align: DOMString) -> ErrorResult {
fn SetUseMap(&mut self, _align: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -39,11 +39,17 @@ impl HTMLLabelElement {
}
}
impl HTMLLabelElement {
pub fn HtmlFor(&self) -> DOMString {
pub trait HTMLLabelElementMethods {
fn HtmlFor(&self) -> DOMString;
fn SetHtmlFor(&mut self, _html_for: DOMString);
}
impl<'a> HTMLLabelElementMethods for JSRef<'a, HTMLLabelElement> {
fn HtmlFor(&self) -> DOMString {
~""
}
pub fn SetHtmlFor(&mut self, _html_for: DOMString) {
fn SetHtmlFor(&mut self, _html_for: DOMString) {
}
}

View file

@ -40,12 +40,18 @@ impl HTMLLegendElement {
}
}
impl HTMLLegendElement {
pub fn Align(&self) -> DOMString {
pub trait HTMLLegendElementMethods {
fn Align(&self) -> DOMString;
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult;
}
impl<'a> HTMLLegendElementMethods for JSRef<'a, HTMLLegendElement> {
fn Align(&self) -> DOMString {
~""
}
pub fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -40,20 +40,28 @@ impl HTMLLIElement {
}
}
impl HTMLLIElement {
pub fn Value(&self) -> i32 {
pub trait HTMLLIElementMethods {
fn Value(&self) -> i32;
fn SetValue(&mut self, _value: i32) -> ErrorResult;
fn Type(&self) -> DOMString;
fn SetType(&mut self, _type: DOMString) -> ErrorResult;
}
impl<'a> HTMLLIElementMethods for JSRef<'a, HTMLLIElement> {
fn Value(&self) -> i32 {
0
}
pub fn SetValue(&mut self, _value: i32) -> ErrorResult {
fn SetValue(&mut self, _value: i32) -> ErrorResult {
Ok(())
}
pub fn Type(&self) -> DOMString {
fn Type(&self) -> DOMString {
~""
}
pub fn SetType(&mut self, _type: DOMString) -> ErrorResult {
fn SetType(&mut self, _type: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -40,83 +40,107 @@ impl HTMLLinkElement {
}
}
impl HTMLLinkElement {
pub fn Disabled(&self) -> bool {
pub trait HTMLLinkElementMethods {
fn Disabled(&self) -> bool;
fn SetDisabled(&mut self, _disable: bool);
fn Href(&self) -> DOMString;
fn SetHref(&mut self, _href: DOMString) -> ErrorResult;
fn CrossOrigin(&self) -> DOMString;
fn SetCrossOrigin(&mut self, _cross_origin: DOMString) -> ErrorResult;
fn Rel(&self) -> DOMString;
fn SetRel(&mut self, _rel: DOMString) -> ErrorResult;
fn Media(&self) -> DOMString;
fn SetMedia(&mut self, _media: DOMString) -> ErrorResult;
fn Hreflang(&self) -> DOMString;
fn SetHreflang(&mut self, _href: DOMString) -> ErrorResult;
fn Type(&self) -> DOMString;
fn SetType(&mut self, _type: DOMString) -> ErrorResult;
fn Charset(&self) -> DOMString;
fn SetCharset(&mut self, _charset: DOMString) -> ErrorResult;
fn Rev(&self) -> DOMString;
fn SetRev(&mut self, _rev: DOMString) -> ErrorResult;
fn Target(&self) -> DOMString;
fn SetTarget(&mut self, _target: DOMString) -> ErrorResult;
}
impl<'a> HTMLLinkElementMethods for JSRef<'a, HTMLLinkElement> {
fn Disabled(&self) -> bool {
false
}
pub fn SetDisabled(&mut self, _disable: bool) {
fn SetDisabled(&mut self, _disable: bool) {
}
pub fn Href(&self) -> DOMString {
fn Href(&self) -> DOMString {
~""
}
pub fn SetHref(&mut self, _href: DOMString) -> ErrorResult {
fn SetHref(&mut self, _href: DOMString) -> ErrorResult {
Ok(())
}
pub fn CrossOrigin(&self) -> DOMString {
fn CrossOrigin(&self) -> DOMString {
~""
}
pub fn SetCrossOrigin(&mut self, _cross_origin: DOMString) -> ErrorResult {
fn SetCrossOrigin(&mut self, _cross_origin: DOMString) -> ErrorResult {
Ok(())
}
pub fn Rel(&self) -> DOMString {
fn Rel(&self) -> DOMString {
~""
}
pub fn SetRel(&mut self, _rel: DOMString) -> ErrorResult {
fn SetRel(&mut self, _rel: DOMString) -> ErrorResult {
Ok(())
}
pub fn Media(&self) -> DOMString {
fn Media(&self) -> DOMString {
~""
}
pub fn SetMedia(&mut self, _media: DOMString) -> ErrorResult {
fn SetMedia(&mut self, _media: DOMString) -> ErrorResult {
Ok(())
}
pub fn Hreflang(&self) -> DOMString {
fn Hreflang(&self) -> DOMString {
~""
}
pub fn SetHreflang(&mut self, _href: DOMString) -> ErrorResult {
fn SetHreflang(&mut self, _href: DOMString) -> ErrorResult {
Ok(())
}
pub fn Type(&self) -> DOMString {
fn Type(&self) -> DOMString {
~""
}
pub fn SetType(&mut self, _type: DOMString) -> ErrorResult {
fn SetType(&mut self, _type: DOMString) -> ErrorResult {
Ok(())
}
pub fn Charset(&self) -> DOMString {
fn Charset(&self) -> DOMString {
~""
}
pub fn SetCharset(&mut self, _charset: DOMString) -> ErrorResult {
fn SetCharset(&mut self, _charset: DOMString) -> ErrorResult {
Ok(())
}
pub fn Rev(&self) -> DOMString {
fn Rev(&self) -> DOMString {
~""
}
pub fn SetRev(&mut self, _rev: DOMString) -> ErrorResult {
fn SetRev(&mut self, _rev: DOMString) -> ErrorResult {
Ok(())
}
pub fn Target(&self) -> DOMString {
fn Target(&self) -> DOMString {
~""
}
pub fn SetTarget(&mut self, _target: DOMString) -> ErrorResult {
fn SetTarget(&mut self, _target: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -38,3 +38,6 @@ impl HTMLMainElement {
Node::reflect_node(~element, document, HTMLMainElementBinding::Wrap)
}
}
pub trait HTMLMainElementMethods {
}

View file

@ -41,16 +41,22 @@ impl HTMLMapElement {
}
}
impl HTMLMapElement {
pub fn Name(&self) -> DOMString {
pub trait HTMLMapElementMethods {
fn Name(&self) -> DOMString;
fn SetName(&mut self, _name: DOMString) -> ErrorResult;
fn Areas(&self) -> Unrooted<HTMLCollection>;
}
impl<'a> HTMLMapElementMethods for JSRef<'a, HTMLMapElement> {
fn Name(&self) -> DOMString {
~""
}
pub fn SetName(&mut self, _name: DOMString) -> ErrorResult {
fn SetName(&mut self, _name: DOMString) -> ErrorResult {
Ok(())
}
pub fn Areas(&self) -> Unrooted<HTMLCollection> {
fn Areas(&self) -> Unrooted<HTMLCollection> {
let roots = RootCollection::new();
// FIXME: https://github.com/mozilla/servo/issues/1845
let doc = self.htmlelement.element.node.owner_doc().root(&roots);
@ -58,3 +64,4 @@ impl HTMLMapElement {
HTMLCollection::new(&*window, Static(vec!()))
}
}

View file

@ -2,7 +2,7 @@
* 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::js::JS;
use dom::bindings::js::{JS, JSRef};
use dom::bindings::codegen::InheritTypes::HTMLMediaElementDerived;
use dom::bindings::error::ErrorResult;
use dom::document::Document;
@ -35,139 +35,177 @@ impl HTMLMediaElement {
}
}
impl HTMLMediaElement {
pub fn Src(&self) -> DOMString {
pub trait HTMLMediaElementMethods {
fn Src(&self) -> DOMString;
fn SetSrc(&mut self, _src: DOMString) -> ErrorResult;
fn CurrentSrc(&self) -> DOMString;
fn CrossOrigin(&self) -> DOMString;
fn SetCrossOrigin(&mut self, _cross_origin: DOMString) -> ErrorResult;
fn Preload(&self) -> DOMString;
fn SetPreload(&mut self, _preload: DOMString) -> ErrorResult;
fn Load(&self);
fn CanPlayType(&self, _type: DOMString) -> DOMString;
fn ReadyState(&self) -> u16;
fn Seeking(&self) -> bool;
fn CurrentTime(&self) -> f64;
fn SetCurrentTime(&mut self, _current_time: f64) -> ErrorResult;
fn GetDuration(&self) -> f64;
fn Paused(&self) -> bool;
fn DefaultPlaybackRate(&self) -> f64;
fn SetDefaultPlaybackRate(&mut self, _default_playback_rate: f64) -> ErrorResult;
fn PlaybackRate(&self) -> f64;
fn SetPlaybackRate(&mut self, _playback_rate: f64) -> ErrorResult;
fn Ended(&self) -> bool;
fn Autoplay(&self) -> bool;
fn SetAutoplay(&mut self, _autoplay: bool) -> ErrorResult;
fn Loop(&self) -> bool;
fn SetLoop(&mut self, _loop: bool) -> ErrorResult;
fn Play(&self) -> ErrorResult;
fn Pause(&self) -> ErrorResult;
fn Controls(&self) -> bool;
fn SetControls(&mut self, _controls: bool) -> ErrorResult;
fn Volume(&self) -> f64;
fn SetVolume(&mut self, _volume: f64) -> ErrorResult;
fn Muted(&self) -> bool;
fn SetMuted(&mut self, _muted: bool);
fn DefaultMuted(&self) -> bool;
fn SetDefaultMuted(&mut self, _default_muted: bool) -> ErrorResult;
}
impl<'a> HTMLMediaElementMethods for JSRef<'a, HTMLMediaElement> {
fn Src(&self) -> DOMString {
~""
}
pub fn SetSrc(&mut self, _src: DOMString) -> ErrorResult {
fn SetSrc(&mut self, _src: DOMString) -> ErrorResult {
Ok(())
}
pub fn CurrentSrc(&self) -> DOMString {
fn CurrentSrc(&self) -> DOMString {
~""
}
pub fn CrossOrigin(&self) -> DOMString {
fn CrossOrigin(&self) -> DOMString {
~""
}
pub fn SetCrossOrigin(&mut self, _cross_origin: DOMString) -> ErrorResult {
fn SetCrossOrigin(&mut self, _cross_origin: DOMString) -> ErrorResult {
Ok(())
}
pub fn Preload(&self) -> DOMString {
fn Preload(&self) -> DOMString {
~""
}
pub fn SetPreload(&mut self, _preload: DOMString) -> ErrorResult {
fn SetPreload(&mut self, _preload: DOMString) -> ErrorResult {
Ok(())
}
pub fn Load(&self) {
fn Load(&self) {
}
pub fn CanPlayType(&self, _type: DOMString) -> DOMString {
fn CanPlayType(&self, _type: DOMString) -> DOMString {
~""
}
pub fn ReadyState(&self) -> u16 {
fn ReadyState(&self) -> u16 {
0
}
pub fn Seeking(&self) -> bool {
fn Seeking(&self) -> bool {
false
}
pub fn CurrentTime(&self) -> f64 {
fn CurrentTime(&self) -> f64 {
0f64
}
pub fn SetCurrentTime(&mut self, _current_time: f64) -> ErrorResult {
fn SetCurrentTime(&mut self, _current_time: f64) -> ErrorResult {
Ok(())
}
pub fn GetDuration(&self) -> f64 {
fn GetDuration(&self) -> f64 {
0f64
}
pub fn Paused(&self) -> bool {
fn Paused(&self) -> bool {
false
}
pub fn DefaultPlaybackRate(&self) -> f64 {
fn DefaultPlaybackRate(&self) -> f64 {
0f64
}
pub fn SetDefaultPlaybackRate(&mut self, _default_playback_rate: f64) -> ErrorResult {
fn SetDefaultPlaybackRate(&mut self, _default_playback_rate: f64) -> ErrorResult {
Ok(())
}
pub fn PlaybackRate(&self) -> f64 {
fn PlaybackRate(&self) -> f64 {
0f64
}
pub fn SetPlaybackRate(&mut self, _playback_rate: f64) -> ErrorResult {
fn SetPlaybackRate(&mut self, _playback_rate: f64) -> ErrorResult {
Ok(())
}
pub fn Ended(&self) -> bool {
fn Ended(&self) -> bool {
false
}
pub fn Autoplay(&self) -> bool {
fn Autoplay(&self) -> bool {
false
}
pub fn SetAutoplay(&mut self, _autoplay: bool) -> ErrorResult {
fn SetAutoplay(&mut self, _autoplay: bool) -> ErrorResult {
Ok(())
}
pub fn Loop(&self) -> bool {
fn Loop(&self) -> bool {
false
}
pub fn SetLoop(&mut self, _loop: bool) -> ErrorResult {
fn SetLoop(&mut self, _loop: bool) -> ErrorResult {
Ok(())
}
pub fn Play(&self) -> ErrorResult {
fn Play(&self) -> ErrorResult {
Ok(())
}
pub fn Pause(&self) -> ErrorResult {
fn Pause(&self) -> ErrorResult {
Ok(())
}
pub fn Controls(&self) -> bool {
fn Controls(&self) -> bool {
false
}
pub fn SetControls(&mut self, _controls: bool) -> ErrorResult {
fn SetControls(&mut self, _controls: bool) -> ErrorResult {
Ok(())
}
pub fn Volume(&self) -> f64 {
fn Volume(&self) -> f64 {
0f64
}
pub fn SetVolume(&mut self, _volume: f64) -> ErrorResult {
fn SetVolume(&mut self, _volume: f64) -> ErrorResult {
Ok(())
}
pub fn Muted(&self) -> bool {
fn Muted(&self) -> bool {
false
}
pub fn SetMuted(&mut self, _muted: bool) {
fn SetMuted(&mut self, _muted: bool) {
}
pub fn DefaultMuted(&self) -> bool {
fn DefaultMuted(&self) -> bool {
false
}
pub fn SetDefaultMuted(&mut self, _default_muted: bool) -> ErrorResult {
fn SetDefaultMuted(&mut self, _default_muted: bool) -> ErrorResult {
Ok(())
}
}

View file

@ -40,36 +40,48 @@ impl HTMLMetaElement {
}
}
impl HTMLMetaElement {
pub fn Name(&self) -> DOMString {
pub trait HTMLMetaElementMethods {
fn Name(&self) -> DOMString;
fn SetName(&mut self, _name: DOMString) -> ErrorResult;
fn HttpEquiv(&self) -> DOMString;
fn SetHttpEquiv(&mut self, _http_equiv: DOMString) -> ErrorResult;
fn Content(&self) -> DOMString;
fn SetContent(&mut self, _content: DOMString) -> ErrorResult;
fn Scheme(&self) -> DOMString;
fn SetScheme(&mut self, _scheme: DOMString) -> ErrorResult;
}
impl<'a> HTMLMetaElementMethods for JSRef<'a, HTMLMetaElement> {
fn Name(&self) -> DOMString {
~""
}
pub fn SetName(&mut self, _name: DOMString) -> ErrorResult {
fn SetName(&mut self, _name: DOMString) -> ErrorResult {
Ok(())
}
pub fn HttpEquiv(&self) -> DOMString {
fn HttpEquiv(&self) -> DOMString {
~""
}
pub fn SetHttpEquiv(&mut self, _http_equiv: DOMString) -> ErrorResult {
fn SetHttpEquiv(&mut self, _http_equiv: DOMString) -> ErrorResult {
Ok(())
}
pub fn Content(&self) -> DOMString {
fn Content(&self) -> DOMString {
~""
}
pub fn SetContent(&mut self, _content: DOMString) -> ErrorResult {
fn SetContent(&mut self, _content: DOMString) -> ErrorResult {
Ok(())
}
pub fn Scheme(&self) -> DOMString {
fn Scheme(&self) -> DOMString {
~""
}
pub fn SetScheme(&mut self, _scheme: DOMString) -> ErrorResult {
fn SetScheme(&mut self, _scheme: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -40,52 +40,68 @@ impl HTMLMeterElement {
}
}
impl HTMLMeterElement {
pub fn Value(&self) -> f64 {
pub trait HTMLMeterElementMethods {
fn Value(&self) -> f64;
fn SetValue(&mut self, _value: f64) -> ErrorResult;
fn Min(&self) -> f64;
fn SetMin(&mut self, _min: f64) -> ErrorResult;
fn Max(&self) -> f64;
fn SetMax(&mut self, _max: f64) -> ErrorResult;
fn Low(&self) -> f64;
fn SetLow(&mut self, _low: f64) -> ErrorResult;
fn High(&self) -> f64;
fn SetHigh(&mut self, _high: f64) -> ErrorResult;
fn Optimum(&self) -> f64;
fn SetOptimum(&mut self, _optimum: f64) -> ErrorResult;
}
impl<'a> HTMLMeterElementMethods for JSRef<'a, HTMLMeterElement> {
fn Value(&self) -> f64 {
0.0
}
pub fn SetValue(&mut self, _value: f64) -> ErrorResult {
fn SetValue(&mut self, _value: f64) -> ErrorResult {
Ok(())
}
pub fn Min(&self) -> f64 {
fn Min(&self) -> f64 {
0.0
}
pub fn SetMin(&mut self, _min: f64) -> ErrorResult {
fn SetMin(&mut self, _min: f64) -> ErrorResult {
Ok(())
}
pub fn Max(&self) -> f64 {
fn Max(&self) -> f64 {
0.0
}
pub fn SetMax(&mut self, _max: f64) -> ErrorResult {
fn SetMax(&mut self, _max: f64) -> ErrorResult {
Ok(())
}
pub fn Low(&self) -> f64 {
fn Low(&self) -> f64 {
0.0
}
pub fn SetLow(&mut self, _low: f64) -> ErrorResult {
fn SetLow(&mut self, _low: f64) -> ErrorResult {
Ok(())
}
pub fn High(&self) -> f64 {
fn High(&self) -> f64 {
0.0
}
pub fn SetHigh(&mut self, _high: f64) -> ErrorResult {
fn SetHigh(&mut self, _high: f64) -> ErrorResult {
Ok(())
}
pub fn Optimum(&self) -> f64 {
fn Optimum(&self) -> f64 {
0.0
}
pub fn SetOptimum(&mut self, _optimum: f64) -> ErrorResult {
fn SetOptimum(&mut self, _optimum: f64) -> ErrorResult {
Ok(())
}
}

View file

@ -40,20 +40,28 @@ impl HTMLModElement {
}
}
impl HTMLModElement {
pub fn Cite(&self) -> DOMString {
pub trait HTMLModElementMethods {
fn Cite(&self) -> DOMString;
fn SetCite(&mut self, _cite: DOMString) -> ErrorResult;
fn DateTime(&self) -> DOMString;
fn SetDateTime(&mut self, _datetime: DOMString) -> ErrorResult;
}
impl<'a> HTMLModElementMethods for JSRef<'a, HTMLModElement> {
fn Cite(&self) -> DOMString {
~""
}
pub fn SetCite(&mut self, _cite: DOMString) -> ErrorResult {
fn SetCite(&mut self, _cite: DOMString) -> ErrorResult {
Ok(())
}
pub fn DateTime(&self) -> DOMString {
fn DateTime(&self) -> DOMString {
~""
}
pub fn SetDateTime(&mut self, _datetime: DOMString) -> ErrorResult {
fn SetDateTime(&mut self, _datetime: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -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 http://mozilla.org/MPL/2.0/. */
use dom::attr::AttrMethods;
use dom::bindings::codegen::BindingDeclarations::HTMLObjectElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLObjectElementDerived;
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast};
@ -79,170 +80,214 @@ impl<'a> ProcessDataURL for JSRef<'a, HTMLObjectElement> {
}
}
impl HTMLObjectElement {
pub fn Data(&self) -> DOMString {
pub trait HTMLObjectElementMethods {
fn Data(&self) -> DOMString;
fn SetData(&mut self, _data: DOMString) -> ErrorResult;
fn Type(&self) -> DOMString;
fn SetType(&mut self, _type: DOMString) -> ErrorResult;
fn Name(&self) -> DOMString;
fn SetName(&mut self, _name: DOMString) -> ErrorResult;
fn UseMap(&self) -> DOMString;
fn SetUseMap(&mut self, _use_map: DOMString) -> ErrorResult;
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>>;
fn Width(&self) -> DOMString;
fn SetWidth(&mut self, _width: DOMString) -> ErrorResult;
fn Height(&self) -> DOMString;
fn SetHeight(&mut self, _height: DOMString) -> ErrorResult;
fn GetContentDocument(&self) -> Option<Unrooted<Document>>;
fn GetContentWindow(&self) -> Option<Unrooted<Window>>;
fn WillValidate(&self) -> bool;
fn Validity(&self) -> Unrooted<ValidityState>;
fn ValidationMessage(&self) -> DOMString;
fn CheckValidity(&self) -> bool;
fn SetCustomValidity(&mut self, _error: DOMString);
fn Align(&self) -> DOMString;
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult;
fn Archive(&self) -> DOMString;
fn SetArchive(&mut self, _archive: DOMString) -> ErrorResult;
fn Code(&self) -> DOMString;
fn SetCode(&mut self, _code: DOMString) -> ErrorResult;
fn Declare(&self) -> bool;
fn SetDeclare(&mut self, _declare: bool) -> ErrorResult;
fn Hspace(&self) -> u32;
fn SetHspace(&mut self, _hspace: u32) -> ErrorResult;
fn Standby(&self) -> DOMString;
fn SetStandby(&mut self, _standby: DOMString) -> ErrorResult;
fn Vspace(&self) -> u32;
fn SetVspace(&mut self, _vspace: u32) -> ErrorResult;
fn CodeBase(&self) -> DOMString;
fn SetCodeBase(&mut self, _codebase: DOMString) -> ErrorResult;
fn CodeType(&self) -> DOMString;
fn SetCodeType(&mut self, _codetype: DOMString) -> ErrorResult;
fn Border(&self) -> DOMString;
fn SetBorder(&mut self, _border: DOMString) -> ErrorResult;
fn GetSVGDocument(&self) -> Option<Unrooted<Document>>;
}
impl<'a> HTMLObjectElementMethods for JSRef<'a, HTMLObjectElement> {
fn Data(&self) -> DOMString {
~""
}
pub fn SetData(&mut self, _data: DOMString) -> ErrorResult {
fn SetData(&mut self, _data: DOMString) -> ErrorResult {
Ok(())
}
pub fn Type(&self) -> DOMString {
fn Type(&self) -> DOMString {
~""
}
pub fn SetType(&mut self, _type: DOMString) -> ErrorResult {
fn SetType(&mut self, _type: DOMString) -> ErrorResult {
Ok(())
}
pub fn Name(&self) -> DOMString {
fn Name(&self) -> DOMString {
~""
}
pub fn SetName(&mut self, _name: DOMString) -> ErrorResult {
fn SetName(&mut self, _name: DOMString) -> ErrorResult {
Ok(())
}
pub fn UseMap(&self) -> DOMString {
fn UseMap(&self) -> DOMString {
~""
}
pub fn SetUseMap(&mut self, _use_map: DOMString) -> ErrorResult {
fn SetUseMap(&mut self, _use_map: DOMString) -> ErrorResult {
Ok(())
}
pub fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>> {
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>> {
None
}
pub fn Width(&self) -> DOMString {
fn Width(&self) -> DOMString {
~""
}
pub fn SetWidth(&mut self, _width: DOMString) -> ErrorResult {
fn SetWidth(&mut self, _width: DOMString) -> ErrorResult {
Ok(())
}
pub fn Height(&self) -> DOMString {
fn Height(&self) -> DOMString {
~""
}
pub fn SetHeight(&mut self, _height: DOMString) -> ErrorResult {
fn SetHeight(&mut self, _height: DOMString) -> ErrorResult {
Ok(())
}
pub fn GetContentDocument(&self) -> Option<Unrooted<Document>> {
fn GetContentDocument(&self) -> Option<Unrooted<Document>> {
None
}
pub fn GetContentWindow(&self) -> Option<Unrooted<Window>> {
fn GetContentWindow(&self) -> Option<Unrooted<Window>> {
None
}
pub fn WillValidate(&self) -> bool {
fn WillValidate(&self) -> bool {
false
}
pub fn Validity(&self) -> Unrooted<ValidityState> {
fn Validity(&self) -> Unrooted<ValidityState> {
let roots = RootCollection::new();
let doc = self.htmlelement.element.node.owner_doc().root(&roots);
let window = doc.deref().window.root(&roots);
ValidityState::new(&window.root_ref())
}
pub fn ValidationMessage(&self) -> DOMString {
fn ValidationMessage(&self) -> DOMString {
~""
}
pub fn CheckValidity(&self) -> bool {
fn CheckValidity(&self) -> bool {
false
}
pub fn SetCustomValidity(&mut self, _error: DOMString) {
fn SetCustomValidity(&mut self, _error: DOMString) {
}
pub fn Align(&self) -> DOMString {
fn Align(&self) -> DOMString {
~""
}
pub fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
Ok(())
}
pub fn Archive(&self) -> DOMString {
fn Archive(&self) -> DOMString {
~""
}
pub fn SetArchive(&mut self, _archive: DOMString) -> ErrorResult {
fn SetArchive(&mut self, _archive: DOMString) -> ErrorResult {
Ok(())
}
pub fn Code(&self) -> DOMString {
fn Code(&self) -> DOMString {
~""
}
pub fn SetCode(&mut self, _code: DOMString) -> ErrorResult {
fn SetCode(&mut self, _code: DOMString) -> ErrorResult {
Ok(())
}
pub fn Declare(&self) -> bool {
fn Declare(&self) -> bool {
false
}
pub fn SetDeclare(&mut self, _declare: bool) -> ErrorResult {
fn SetDeclare(&mut self, _declare: bool) -> ErrorResult {
Ok(())
}
pub fn Hspace(&self) -> u32 {
fn Hspace(&self) -> u32 {
0
}
pub fn SetHspace(&mut self, _hspace: u32) -> ErrorResult {
fn SetHspace(&mut self, _hspace: u32) -> ErrorResult {
Ok(())
}
pub fn Standby(&self) -> DOMString {
fn Standby(&self) -> DOMString {
~""
}
pub fn SetStandby(&mut self, _standby: DOMString) -> ErrorResult {
fn SetStandby(&mut self, _standby: DOMString) -> ErrorResult {
Ok(())
}
pub fn Vspace(&self) -> u32 {
fn Vspace(&self) -> u32 {
0
}
pub fn SetVspace(&mut self, _vspace: u32) -> ErrorResult {
fn SetVspace(&mut self, _vspace: u32) -> ErrorResult {
Ok(())
}
pub fn CodeBase(&self) -> DOMString {
fn CodeBase(&self) -> DOMString {
~""
}
pub fn SetCodeBase(&mut self, _codebase: DOMString) -> ErrorResult {
fn SetCodeBase(&mut self, _codebase: DOMString) -> ErrorResult {
Ok(())
}
pub fn CodeType(&self) -> DOMString {
fn CodeType(&self) -> DOMString {
~""
}
pub fn SetCodeType(&mut self, _codetype: DOMString) -> ErrorResult {
fn SetCodeType(&mut self, _codetype: DOMString) -> ErrorResult {
Ok(())
}
pub fn Border(&self) -> DOMString {
fn Border(&self) -> DOMString {
~""
}
pub fn SetBorder(&mut self, _border: DOMString) -> ErrorResult {
fn SetBorder(&mut self, _border: DOMString) -> ErrorResult {
Ok(())
}
pub fn GetSVGDocument(&self) -> Option<Unrooted<Document>> {
fn GetSVGDocument(&self) -> Option<Unrooted<Document>> {
None
}
}

View file

@ -40,36 +40,48 @@ impl HTMLOListElement {
}
}
impl HTMLOListElement {
pub fn Reversed(&self) -> bool {
pub trait HTMLOListElementMethods {
fn Reversed(&self) -> bool;
fn SetReversed(&self, _reversed: bool) -> ErrorResult;
fn Start(&self) -> i32;
fn SetStart(&mut self, _start: i32) -> ErrorResult;
fn Type(&self) -> DOMString;
fn SetType(&mut self, _type: DOMString) -> ErrorResult;
fn Compact(&self) -> bool;
fn SetCompact(&self, _compact: bool) -> ErrorResult;
}
impl<'a> HTMLOListElementMethods for JSRef<'a, HTMLOListElement> {
fn Reversed(&self) -> bool {
false
}
pub fn SetReversed(&self, _reversed: bool) -> ErrorResult {
fn SetReversed(&self, _reversed: bool) -> ErrorResult {
Ok(())
}
pub fn Start(&self) -> i32 {
fn Start(&self) -> i32 {
0
}
pub fn SetStart(&mut self, _start: i32) -> ErrorResult {
fn SetStart(&mut self, _start: i32) -> ErrorResult {
Ok(())
}
pub fn Type(&self) -> DOMString {
fn Type(&self) -> DOMString {
~""
}
pub fn SetType(&mut self, _type: DOMString) -> ErrorResult {
fn SetType(&mut self, _type: DOMString) -> ErrorResult {
Ok(())
}
pub fn Compact(&self) -> bool {
fn Compact(&self) -> bool {
false
}
pub fn SetCompact(&self, _compact: bool) -> ErrorResult {
fn SetCompact(&self, _compact: bool) -> ErrorResult {
Ok(())
}
}

View file

@ -40,20 +40,28 @@ impl HTMLOptGroupElement {
}
}
impl HTMLOptGroupElement {
pub fn Disabled(&self) -> bool {
pub trait HTMLOptGroupElementMethods {
fn Disabled(&self) -> bool;
fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult;
fn Label(&self) -> DOMString;
fn SetLabel(&mut self, _label: DOMString) -> ErrorResult;
}
impl<'a> HTMLOptGroupElementMethods for JSRef<'a, HTMLOptGroupElement> {
fn Disabled(&self) -> bool {
false
}
pub fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult {
fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult {
Ok(())
}
pub fn Label(&self) -> DOMString {
fn Label(&self) -> DOMString {
~""
}
pub fn SetLabel(&mut self, _label: DOMString) -> ErrorResult {
fn SetLabel(&mut self, _label: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -41,60 +41,78 @@ impl HTMLOptionElement {
}
}
impl HTMLOptionElement {
pub fn Disabled(&self) -> bool {
pub trait HTMLOptionElementMethods {
fn Disabled(&self) -> bool;
fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult;
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>>;
fn Label(&self) -> DOMString;
fn SetLabel(&mut self, _label: DOMString) -> ErrorResult;
fn DefaultSelected(&self) -> bool;
fn SetDefaultSelected(&mut self, _default_selected: bool) -> ErrorResult;
fn Selected(&self) -> bool;
fn SetSelected(&mut self, _selected: bool) -> ErrorResult;
fn Value(&self) -> DOMString;
fn SetValue(&mut self, _value: DOMString) -> ErrorResult;
fn Text(&self) -> DOMString;
fn SetText(&mut self, _text: DOMString) -> ErrorResult;
fn Index(&self) -> i32;
}
impl<'a> HTMLOptionElementMethods for JSRef<'a, HTMLOptionElement> {
fn Disabled(&self) -> bool {
false
}
pub fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult {
fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult {
Ok(())
}
pub fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>> {
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>> {
None
}
pub fn Label(&self) -> DOMString {
fn Label(&self) -> DOMString {
~""
}
pub fn SetLabel(&mut self, _label: DOMString) -> ErrorResult {
fn SetLabel(&mut self, _label: DOMString) -> ErrorResult {
Ok(())
}
pub fn DefaultSelected(&self) -> bool {
fn DefaultSelected(&self) -> bool {
false
}
pub fn SetDefaultSelected(&mut self, _default_selected: bool) -> ErrorResult {
fn SetDefaultSelected(&mut self, _default_selected: bool) -> ErrorResult {
Ok(())
}
pub fn Selected(&self) -> bool {
fn Selected(&self) -> bool {
false
}
pub fn SetSelected(&mut self, _selected: bool) -> ErrorResult {
fn SetSelected(&mut self, _selected: bool) -> ErrorResult {
Ok(())
}
pub fn Value(&self) -> DOMString {
fn Value(&self) -> DOMString {
~""
}
pub fn SetValue(&mut self, _value: DOMString) -> ErrorResult {
fn SetValue(&mut self, _value: DOMString) -> ErrorResult {
Ok(())
}
pub fn Text(&self) -> DOMString {
fn Text(&self) -> DOMString {
~""
}
pub fn SetText(&mut self, _text: DOMString) -> ErrorResult {
fn SetText(&mut self, _text: DOMString) -> ErrorResult {
Ok(())
}
pub fn Index(&self) -> i32 {
fn Index(&self) -> i32 {
0
}
}

View file

@ -42,68 +42,88 @@ impl HTMLOutputElement {
}
}
impl HTMLOutputElement {
pub fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>> {
pub trait HTMLOutputElementMethods {
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>>;
fn Name(&self) -> DOMString;
fn SetName(&mut self, _name: DOMString) -> ErrorResult;
fn Type(&self) -> DOMString;
fn DefaultValue(&self) -> DOMString;
fn SetDefaultValue(&mut self, _value: DOMString) -> ErrorResult;
fn Value(&self) -> DOMString;
fn SetValue(&mut self, _value: DOMString) -> ErrorResult;
fn WillValidate(&self) -> bool;
fn SetWillValidate(&mut self, _will_validate: bool);
fn Validity(&self) -> Unrooted<ValidityState>;
fn SetValidity(&mut self, _validity: JS<ValidityState>);
fn ValidationMessage(&self) -> DOMString;
fn SetValidationMessage(&mut self, _message: DOMString) -> ErrorResult;
fn CheckValidity(&self) -> bool;
fn SetCustomValidity(&mut self, _error: DOMString);
}
impl<'a> HTMLOutputElementMethods for JSRef<'a, HTMLOutputElement> {
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>> {
None
}
pub fn Name(&self) -> DOMString {
fn Name(&self) -> DOMString {
~""
}
pub fn SetName(&mut self, _name: DOMString) -> ErrorResult {
fn SetName(&mut self, _name: DOMString) -> ErrorResult {
Ok(())
}
pub fn Type(&self) -> DOMString {
fn Type(&self) -> DOMString {
~""
}
pub fn DefaultValue(&self) -> DOMString {
fn DefaultValue(&self) -> DOMString {
~""
}
pub fn SetDefaultValue(&mut self, _value: DOMString) -> ErrorResult {
fn SetDefaultValue(&mut self, _value: DOMString) -> ErrorResult {
Ok(())
}
pub fn Value(&self) -> DOMString {
fn Value(&self) -> DOMString {
~""
}
pub fn SetValue(&mut self, _value: DOMString) -> ErrorResult {
fn SetValue(&mut self, _value: DOMString) -> ErrorResult {
Ok(())
}
pub fn WillValidate(&self) -> bool {
fn WillValidate(&self) -> bool {
false
}
pub fn SetWillValidate(&mut self, _will_validate: bool) {
fn SetWillValidate(&mut self, _will_validate: bool) {
}
pub fn Validity(&self) -> Unrooted<ValidityState> {
fn Validity(&self) -> Unrooted<ValidityState> {
let roots = RootCollection::new();
let doc = self.htmlelement.element.node.owner_doc().root(&roots);
let window = doc.deref().window.root(&roots);
ValidityState::new(&*window)
}
pub fn SetValidity(&mut self, _validity: JS<ValidityState>) {
fn SetValidity(&mut self, _validity: JS<ValidityState>) {
}
pub fn ValidationMessage(&self) -> DOMString {
fn ValidationMessage(&self) -> DOMString {
~""
}
pub fn SetValidationMessage(&mut self, _message: DOMString) -> ErrorResult {
fn SetValidationMessage(&mut self, _message: DOMString) -> ErrorResult {
Ok(())
}
pub fn CheckValidity(&self) -> bool {
fn CheckValidity(&self) -> bool {
true
}
pub fn SetCustomValidity(&mut self, _error: DOMString) {
fn SetCustomValidity(&mut self, _error: DOMString) {
}
}

View file

@ -40,12 +40,18 @@ impl HTMLParagraphElement {
}
}
impl HTMLParagraphElement {
pub fn Align(&self) -> DOMString {
pub trait HTMLParagraphElementMethods {
fn Align(&self) -> DOMString;
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult;
}
impl<'a> HTMLParagraphElementMethods for JSRef<'a, HTMLParagraphElement> {
fn Align(&self) -> DOMString {
~""
}
pub fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -40,36 +40,48 @@ impl HTMLParamElement {
}
}
impl HTMLParamElement {
pub fn Name(&self) -> DOMString {
pub trait HTMLParamElementMethods {
fn Name(&self) -> DOMString;
fn SetName(&mut self, _name: DOMString) -> ErrorResult;
fn Value(&self) -> DOMString;
fn SetValue(&mut self, _value: DOMString) -> ErrorResult;
fn Type(&self) -> DOMString;
fn SetType(&mut self, _type: DOMString) -> ErrorResult;
fn ValueType(&self) -> DOMString;
fn SetValueType(&mut self, _value_type: DOMString) -> ErrorResult;
}
impl<'a> HTMLParamElementMethods for JSRef<'a, HTMLParamElement> {
fn Name(&self) -> DOMString {
~""
}
pub fn SetName(&mut self, _name: DOMString) -> ErrorResult {
fn SetName(&mut self, _name: DOMString) -> ErrorResult {
Ok(())
}
pub fn Value(&self) -> DOMString {
fn Value(&self) -> DOMString {
~""
}
pub fn SetValue(&mut self, _value: DOMString) -> ErrorResult {
fn SetValue(&mut self, _value: DOMString) -> ErrorResult {
Ok(())
}
pub fn Type(&self) -> DOMString {
fn Type(&self) -> DOMString {
~""
}
pub fn SetType(&mut self, _type: DOMString) -> ErrorResult {
fn SetType(&mut self, _type: DOMString) -> ErrorResult {
Ok(())
}
pub fn ValueType(&self) -> DOMString {
fn ValueType(&self) -> DOMString {
~""
}
pub fn SetValueType(&mut self, _value_type: DOMString) -> ErrorResult {
fn SetValueType(&mut self, _value_type: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -40,12 +40,18 @@ impl HTMLPreElement {
}
}
impl HTMLPreElement {
pub fn Width(&self) -> i32 {
pub trait HTMLPreElementMethods {
fn Width(&self) -> i32;
fn SetWidth(&mut self, _width: i32) -> ErrorResult;
}
impl<'a> HTMLPreElementMethods for JSRef<'a, HTMLPreElement> {
fn Width(&self) -> i32 {
0
}
pub fn SetWidth(&mut self, _width: i32) -> ErrorResult {
fn SetWidth(&mut self, _width: i32) -> ErrorResult {
Ok(())
}
}

View file

@ -40,28 +40,38 @@ impl HTMLProgressElement {
}
}
impl HTMLProgressElement {
pub fn Value(&self) -> f64 {
pub trait HTMLProgressElementMethods {
fn Value(&self) -> f64;
fn SetValue(&mut self, _value: f64) -> ErrorResult;
fn Max(&self) -> f64;
fn SetMax(&mut self, _max: f64) -> ErrorResult;
fn Position(&self) -> f64;
fn GetPositiom(&self) -> Fallible<f64>;
}
impl<'a> HTMLProgressElementMethods for JSRef<'a, HTMLProgressElement> {
fn Value(&self) -> f64 {
0f64
}
pub fn SetValue(&mut self, _value: f64) -> ErrorResult {
fn SetValue(&mut self, _value: f64) -> ErrorResult {
Ok(())
}
pub fn Max(&self) -> f64 {
fn Max(&self) -> f64 {
0f64
}
pub fn SetMax(&mut self, _max: f64) -> ErrorResult {
fn SetMax(&mut self, _max: f64) -> ErrorResult {
Ok(())
}
pub fn Position(&self) -> f64 {
fn Position(&self) -> f64 {
0f64
}
pub fn GetPositiom(&self) -> Fallible<f64> {
fn GetPositiom(&self) -> Fallible<f64> {
Ok(0f64)
}
}

View file

@ -40,12 +40,18 @@ impl HTMLQuoteElement {
}
}
impl HTMLQuoteElement {
pub fn Cite(&self) -> DOMString {
pub trait HTMLQuoteElementMethods {
fn Cite(&self) -> DOMString;
fn SetCite(&self, _cite: DOMString) -> ErrorResult;
}
impl<'a> HTMLQuoteElementMethods for JSRef<'a, HTMLQuoteElement> {
fn Cite(&self) -> DOMString {
~""
}
pub fn SetCite(&self, _cite: DOMString) -> ErrorResult {
fn SetCite(&self, _cite: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -41,77 +41,99 @@ impl HTMLScriptElement {
}
}
impl HTMLScriptElement {
pub fn Src(&self, abstract_self: &JSRef<HTMLScriptElement>) -> DOMString {
pub trait HTMLScriptElementMethods {
fn Src(&self, abstract_self: &JSRef<HTMLScriptElement>) -> DOMString;
fn SetSrc(&mut self, _abstract_self: &JSRef<HTMLScriptElement>, _src: DOMString) -> ErrorResult;
fn Type(&self) -> DOMString;
fn SetType(&mut self, _type: DOMString) -> ErrorResult;
fn Charset(&self) -> DOMString;
fn SetCharset(&mut self, _charset: DOMString) -> ErrorResult;
fn Async(&self) -> bool;
fn SetAsync(&self, _async: bool) -> ErrorResult;
fn Defer(&self) -> bool;
fn SetDefer(&self, _defer: bool) -> ErrorResult;
fn CrossOrigin(&self) -> DOMString;
fn SetCrossOrigin(&mut self, _cross_origin: DOMString) -> ErrorResult;
fn Text(&self) -> DOMString;
fn SetText(&mut self, _text: DOMString) -> ErrorResult;
fn Event(&self) -> DOMString;
fn SetEvent(&mut self, _event: DOMString) -> ErrorResult;
fn HtmlFor(&self) -> DOMString;
fn SetHtmlFor(&mut self, _html_for: DOMString) -> ErrorResult;
}
impl<'a> HTMLScriptElementMethods for JSRef<'a, HTMLScriptElement> {
fn Src(&self, abstract_self: &JSRef<HTMLScriptElement>) -> DOMString {
let element: &JSRef<Element> = ElementCast::from_ref(abstract_self);
element.get_url_attribute("src")
}
pub fn SetSrc(&mut self, _abstract_self: &JSRef<HTMLScriptElement>, _src: DOMString) -> ErrorResult {
fn SetSrc(&mut self, _abstract_self: &JSRef<HTMLScriptElement>, _src: DOMString) -> ErrorResult {
Ok(())
}
pub fn Type(&self) -> DOMString {
fn Type(&self) -> DOMString {
~""
}
pub fn SetType(&mut self, _type: DOMString) -> ErrorResult {
fn SetType(&mut self, _type: DOMString) -> ErrorResult {
Ok(())
}
pub fn Charset(&self) -> DOMString {
fn Charset(&self) -> DOMString {
~""
}
pub fn SetCharset(&mut self, _charset: DOMString) -> ErrorResult {
fn SetCharset(&mut self, _charset: DOMString) -> ErrorResult {
Ok(())
}
pub fn Async(&self) -> bool {
fn Async(&self) -> bool {
false
}
pub fn SetAsync(&self, _async: bool) -> ErrorResult {
fn SetAsync(&self, _async: bool) -> ErrorResult {
Ok(())
}
pub fn Defer(&self) -> bool {
fn Defer(&self) -> bool {
false
}
pub fn SetDefer(&self, _defer: bool) -> ErrorResult {
fn SetDefer(&self, _defer: bool) -> ErrorResult {
Ok(())
}
pub fn CrossOrigin(&self) -> DOMString {
fn CrossOrigin(&self) -> DOMString {
~""
}
pub fn SetCrossOrigin(&mut self, _cross_origin: DOMString) -> ErrorResult {
fn SetCrossOrigin(&mut self, _cross_origin: DOMString) -> ErrorResult {
Ok(())
}
pub fn Text(&self) -> DOMString {
fn Text(&self) -> DOMString {
~""
}
pub fn SetText(&mut self, _text: DOMString) -> ErrorResult {
fn SetText(&mut self, _text: DOMString) -> ErrorResult {
Ok(())
}
pub fn Event(&self) -> DOMString {
fn Event(&self) -> DOMString {
~""
}
pub fn SetEvent(&mut self, _event: DOMString) -> ErrorResult {
fn SetEvent(&mut self, _event: DOMString) -> ErrorResult {
Ok(())
}
pub fn HtmlFor(&self) -> DOMString {
fn HtmlFor(&self) -> DOMString {
~""
}
pub fn SetHtmlFor(&mut self, _html_for: DOMString) -> ErrorResult {
fn SetHtmlFor(&mut self, _html_for: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -44,141 +44,180 @@ impl HTMLSelectElement {
}
}
impl HTMLSelectElement {
pub fn Autofocus(&self) -> bool {
pub trait HTMLSelectElementMethods {
fn Autofocus(&self) -> bool;
fn SetAutofocus(&mut self, _autofocus: bool) -> ErrorResult;
fn Disabled(&self) -> bool;
fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult;
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>>;
fn Multiple(&self) -> bool;
fn SetMultiple(&mut self, _multiple: bool) -> ErrorResult;
fn Name(&self) -> DOMString;
fn SetName(&mut self, _name: DOMString) -> ErrorResult;
fn Required(&self) -> bool;
fn SetRequired(&mut self, _multiple: bool) -> ErrorResult;
fn Size(&self) -> u32;
fn SetSize(&mut self, _size: u32) -> ErrorResult;
fn Type(&self) -> DOMString;
fn Length(&self) -> u32;
fn SetLength(&mut self, _length: u32) -> ErrorResult;
fn Item(&self, _index: u32) -> Option<Unrooted<Element>>;
fn NamedItem(&self, _name: DOMString) -> Option<Unrooted<HTMLOptionElement>>;
fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> Option<Unrooted<Element>>;
fn IndexedSetter(&mut self, _index: u32, _option: Option<JSRef<HTMLOptionElement>>) -> ErrorResult;
fn Remove_(&self);
fn Remove(&self, _index: i32);
fn SelectedIndex(&self) -> i32;
fn SetSelectedIndex(&mut self, _index: i32) -> ErrorResult;
fn Value(&self) -> DOMString;
fn SetValue(&mut self, _value: DOMString);
fn WillValidate(&self) -> bool;
fn SetWillValidate(&mut self, _will_validate: bool);
fn Validity(&self) -> Unrooted<ValidityState>;
fn SetValidity(&mut self, _validity: JS<ValidityState>);
fn ValidationMessage(&self) -> DOMString;
fn SetValidationMessage(&mut self, _message: DOMString) -> ErrorResult;
fn CheckValidity(&self) -> bool;
fn SetCustomValidity(&mut self, _error: DOMString);
fn Add(&self, _element: HTMLOptionElementOrHTMLOptGroupElement, _before: Option<HTMLElementOrLong>) -> ErrorResult;
}
impl<'a> HTMLSelectElementMethods for JSRef<'a, HTMLSelectElement> {
fn Autofocus(&self) -> bool {
false
}
pub fn SetAutofocus(&mut self, _autofocus: bool) -> ErrorResult {
fn SetAutofocus(&mut self, _autofocus: bool) -> ErrorResult {
Ok(())
}
pub fn Disabled(&self) -> bool {
fn Disabled(&self) -> bool {
false
}
pub fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult {
fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult {
Ok(())
}
pub fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>> {
fn GetForm(&self) -> Option<Unrooted<HTMLFormElement>> {
None
}
pub fn Multiple(&self) -> bool {
fn Multiple(&self) -> bool {
false
}
pub fn SetMultiple(&mut self, _multiple: bool) -> ErrorResult {
fn SetMultiple(&mut self, _multiple: bool) -> ErrorResult {
Ok(())
}
pub fn Name(&self) -> DOMString {
fn Name(&self) -> DOMString {
~""
}
pub fn SetName(&mut self, _name: DOMString) -> ErrorResult {
fn SetName(&mut self, _name: DOMString) -> ErrorResult {
Ok(())
}
pub fn Required(&self) -> bool {
fn Required(&self) -> bool {
false
}
pub fn SetRequired(&mut self, _multiple: bool) -> ErrorResult {
fn SetRequired(&mut self, _multiple: bool) -> ErrorResult {
Ok(())
}
pub fn Size(&self) -> u32 {
fn Size(&self) -> u32 {
0
}
pub fn SetSize(&mut self, _size: u32) -> ErrorResult {
fn SetSize(&mut self, _size: u32) -> ErrorResult {
Ok(())
}
pub fn Type(&self) -> DOMString {
fn Type(&self) -> DOMString {
~""
}
pub fn Length(&self) -> u32 {
fn Length(&self) -> u32 {
0
}
pub fn SetLength(&mut self, _length: u32) -> ErrorResult {
fn SetLength(&mut self, _length: u32) -> ErrorResult {
Ok(())
}
pub fn Item(&self, _index: u32) -> Option<Unrooted<Element>> {
fn Item(&self, _index: u32) -> Option<Unrooted<Element>> {
None
}
pub fn NamedItem(&self, _name: DOMString) -> Option<Unrooted<HTMLOptionElement>> {
fn NamedItem(&self, _name: DOMString) -> Option<Unrooted<HTMLOptionElement>> {
None
}
pub fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> Option<Unrooted<Element>> {
fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> Option<Unrooted<Element>> {
None
}
pub fn IndexedSetter(&mut self, _index: u32, _option: Option<JSRef<HTMLOptionElement>>) -> ErrorResult {
fn IndexedSetter(&mut self, _index: u32, _option: Option<JSRef<HTMLOptionElement>>) -> ErrorResult {
Ok(())
}
pub fn Remove_(&self) {
fn Remove_(&self) {
}
pub fn Remove(&self, _index: i32) {
fn Remove(&self, _index: i32) {
}
pub fn SelectedIndex(&self) -> i32 {
fn SelectedIndex(&self) -> i32 {
0
}
pub fn SetSelectedIndex(&mut self, _index: i32) -> ErrorResult {
fn SetSelectedIndex(&mut self, _index: i32) -> ErrorResult {
Ok(())
}
pub fn Value(&self) -> DOMString {
fn Value(&self) -> DOMString {
~""
}
pub fn SetValue(&mut self, _value: DOMString) {
fn SetValue(&mut self, _value: DOMString) {
}
pub fn WillValidate(&self) -> bool {
fn WillValidate(&self) -> bool {
false
}
pub fn SetWillValidate(&mut self, _will_validate: bool) {
fn SetWillValidate(&mut self, _will_validate: bool) {
}
pub fn Validity(&self) -> Unrooted<ValidityState> {
fn Validity(&self) -> Unrooted<ValidityState> {
let roots = RootCollection::new();
let doc = self.htmlelement.element.node.owner_doc().root(&roots);
let window = doc.deref().window.root(&roots);
ValidityState::new(&*window)
}
pub fn SetValidity(&mut self, _validity: JS<ValidityState>) {
fn SetValidity(&mut self, _validity: JS<ValidityState>) {
}
pub fn ValidationMessage(&self) -> DOMString {
fn ValidationMessage(&self) -> DOMString {
~""
}
pub fn SetValidationMessage(&mut self, _message: DOMString) -> ErrorResult {
fn SetValidationMessage(&mut self, _message: DOMString) -> ErrorResult {
Ok(())
}
pub fn CheckValidity(&self) -> bool {
fn CheckValidity(&self) -> bool {
true
}
pub fn SetCustomValidity(&mut self, _error: DOMString) {
fn SetCustomValidity(&mut self, _error: DOMString) {
}
pub fn Add(&self, _element: HTMLOptionElementOrHTMLOptGroupElement, _before: Option<HTMLElementOrLong>) -> ErrorResult {
fn Add(&self, _element: HTMLOptionElementOrHTMLOptGroupElement, _before: Option<HTMLElementOrLong>) -> ErrorResult {
Ok(())
}
}

View file

@ -40,28 +40,38 @@ impl HTMLSourceElement {
}
}
impl HTMLSourceElement {
pub fn Src(&self) -> DOMString {
pub trait HTMLSourceElementMethods {
fn Src(&self) -> DOMString;
fn SetSrc(&mut self, _src: DOMString) -> ErrorResult;
fn Type(&self) -> DOMString;
fn SetType(&mut self, _type: DOMString) -> ErrorResult;
fn Media(&self) -> DOMString;
fn SetMedia(&mut self, _media: DOMString) -> ErrorResult;
}
impl<'a> HTMLSourceElementMethods for JSRef<'a, HTMLSourceElement> {
fn Src(&self) -> DOMString {
~""
}
pub fn SetSrc(&mut self, _src: DOMString) -> ErrorResult {
fn SetSrc(&mut self, _src: DOMString) -> ErrorResult {
Ok(())
}
pub fn Type(&self) -> DOMString {
fn Type(&self) -> DOMString {
~""
}
pub fn SetType(&mut self, _type: DOMString) -> ErrorResult {
fn SetType(&mut self, _type: DOMString) -> ErrorResult {
Ok(())
}
pub fn Media(&self) -> DOMString {
fn Media(&self) -> DOMString {
~""
}
pub fn SetMedia(&mut self, _media: DOMString) -> ErrorResult {
fn SetMedia(&mut self, _media: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -38,3 +38,6 @@ impl HTMLSpanElement {
Node::reflect_node(~element, document, HTMLSpanElementBinding::Wrap)
}
}
pub trait HTMLSpanElementMethods {
}

View file

@ -10,7 +10,7 @@ use dom::document::Document;
use dom::element::HTMLStyleElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
use dom::htmlelement::HTMLElement;
use dom::node::{Node, ElementNodeTypeId, window_from_node};
use dom::node::{Node, NodeMethods, ElementNodeTypeId, window_from_node};
use dom::virtualmethods::VirtualMethods;
use html::cssparse::parse_inline_css;
use layout_interface::{AddStylesheetMsg, LayoutChan};
@ -43,35 +43,46 @@ impl HTMLStyleElement {
}
}
impl HTMLStyleElement {
pub fn Disabled(&self) -> bool {
pub trait HTMLStyleElementMethods {
fn Disabled(&self) -> bool;
fn SetDisabled(&self, _disabled: bool);
fn Media(&self) -> DOMString;
fn SetMedia(&mut self, _media: DOMString) -> ErrorResult;
fn Type(&self) -> DOMString;
fn SetType(&mut self, _type: DOMString) -> ErrorResult;
fn Scoped(&self) -> bool;
fn SetScoped(&self, _scoped: bool) -> ErrorResult;
}
impl<'a> HTMLStyleElementMethods for JSRef<'a, HTMLStyleElement> {
fn Disabled(&self) -> bool {
false
}
pub fn SetDisabled(&self, _disabled: bool) {
fn SetDisabled(&self, _disabled: bool) {
}
pub fn Media(&self) -> DOMString {
fn Media(&self) -> DOMString {
~""
}
pub fn SetMedia(&mut self, _media: DOMString) -> ErrorResult {
fn SetMedia(&mut self, _media: DOMString) -> ErrorResult {
Ok(())
}
pub fn Type(&self) -> DOMString {
fn Type(&self) -> DOMString {
~""
}
pub fn SetType(&mut self, _type: DOMString) -> ErrorResult {
fn SetType(&mut self, _type: DOMString) -> ErrorResult {
Ok(())
}
pub fn Scoped(&self) -> bool {
fn Scoped(&self) -> bool {
false
}
pub fn SetScoped(&self, _scoped: bool) -> ErrorResult {
fn SetScoped(&self, _scoped: bool) -> ErrorResult {
Ok(())
}
}
@ -87,7 +98,7 @@ impl<'a> StyleElementHelpers for JSRef<'a, HTMLStyleElement> {
let win = window_from_node(node).root(&roots);
let url = win.get().page().get_url();
let data = node.get().GetTextContent(node).expect("Element.textContent must be a string");
let data = node.GetTextContent(node).expect("Element.textContent must be a string");
let sheet = parse_inline_css(url, data);
let LayoutChan(ref layout_chan) = *win.get().page().layout_chan;
layout_chan.send(AddStylesheetMsg(sheet));

View file

@ -40,12 +40,18 @@ impl HTMLTableCaptionElement {
}
}
impl HTMLTableCaptionElement {
pub fn Align(&self) -> DOMString {
pub trait HTMLTableCaptionElementMethods {
fn Align(&self) -> DOMString;
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult;
}
impl<'a> HTMLTableCaptionElementMethods for JSRef<'a, HTMLTableCaptionElement> {
fn Align(&self) -> DOMString {
~""
}
pub fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::InheritTypes::HTMLTableCellElementDerived;
use dom::bindings::js::JS;
use dom::bindings::js::{JS, JSRef};
use dom::bindings::error::ErrorResult;
use dom::document::Document;
use dom::element::{ElementTypeId, HTMLTableDataCellElementTypeId, HTMLTableHeaderCellElementTypeId};
@ -35,125 +35,159 @@ impl HTMLTableCellElement {
}
}
impl HTMLTableCellElement {
pub fn ColSpan(&self) -> u32 {
pub trait HTMLTableCellElementMethods {
fn ColSpan(&self) -> u32;
fn SetColSpan(&self, _col_span: u32) -> ErrorResult;
fn RowSpan(&self) -> u32;
fn SetRowSpan(&self, _col_span: u32) -> ErrorResult;
fn Headers(&self) -> DOMString;
fn SetHeaders(&self, _headers: DOMString) -> ErrorResult;
fn CellIndex(&self) -> i32;
fn GetCellIndex(&self, _cell_index: i32) -> ErrorResult;
fn Abbr(&self) -> DOMString;
fn SetAbbr(&self, _abbr: DOMString) -> ErrorResult;
fn Scope(&self) -> DOMString;
fn SetScope(&self, _abbr: DOMString) -> ErrorResult;
fn Align(&self) -> DOMString;
fn SetAlign(&self, _align: DOMString) -> ErrorResult;
fn Axis(&self) -> DOMString;
fn SetAxis(&self, _axis: DOMString) -> ErrorResult;
fn Height(&self) -> DOMString;
fn SetHeight(&self, _height: DOMString) -> ErrorResult;
fn Width(&self) -> DOMString;
fn SetWidth(&self, _width: DOMString) -> ErrorResult;
fn Ch(&self) -> DOMString;
fn SetCh(&self, _ch: DOMString) -> ErrorResult;
fn ChOff(&self) -> DOMString;
fn SetChOff(&self, _ch_off: DOMString) -> ErrorResult;
fn NoWrap(&self) -> bool;
fn SetNoWrap(&self, _no_wrap: bool) -> ErrorResult;
fn VAlign(&self) -> DOMString;
fn SetVAlign(&self, _valign: DOMString) -> ErrorResult;
fn BgColor(&self) -> DOMString;
fn SetBgColor(&self, _bg_color: DOMString) -> ErrorResult;
}
impl<'a> HTMLTableCellElementMethods for JSRef<'a, HTMLTableCellElement> {
fn ColSpan(&self) -> u32 {
0
}
pub fn SetColSpan(&self, _col_span: u32) -> ErrorResult {
fn SetColSpan(&self, _col_span: u32) -> ErrorResult {
Ok(())
}
pub fn RowSpan(&self) -> u32 {
fn RowSpan(&self) -> u32 {
0
}
pub fn SetRowSpan(&self, _col_span: u32) -> ErrorResult {
fn SetRowSpan(&self, _col_span: u32) -> ErrorResult {
Ok(())
}
pub fn Headers(&self) -> DOMString {
fn Headers(&self) -> DOMString {
~""
}
pub fn SetHeaders(&self, _headers: DOMString) -> ErrorResult {
fn SetHeaders(&self, _headers: DOMString) -> ErrorResult {
Ok(())
}
pub fn CellIndex(&self) -> i32 {
fn CellIndex(&self) -> i32 {
0
}
pub fn GetCellIndex(&self, _cell_index: i32) -> ErrorResult {
fn GetCellIndex(&self, _cell_index: i32) -> ErrorResult {
Ok(())
}
pub fn Abbr(&self) -> DOMString {
fn Abbr(&self) -> DOMString {
~""
}
pub fn SetAbbr(&self, _abbr: DOMString) -> ErrorResult {
fn SetAbbr(&self, _abbr: DOMString) -> ErrorResult {
Ok(())
}
pub fn Scope(&self) -> DOMString {
fn Scope(&self) -> DOMString {
~""
}
pub fn SetScope(&self, _abbr: DOMString) -> ErrorResult {
fn SetScope(&self, _abbr: DOMString) -> ErrorResult {
Ok(())
}
pub fn Align(&self) -> DOMString {
fn Align(&self) -> DOMString {
~""
}
pub fn SetAlign(&self, _align: DOMString) -> ErrorResult {
fn SetAlign(&self, _align: DOMString) -> ErrorResult {
Ok(())
}
pub fn Axis(&self) -> DOMString {
fn Axis(&self) -> DOMString {
~""
}
pub fn SetAxis(&self, _axis: DOMString) -> ErrorResult {
fn SetAxis(&self, _axis: DOMString) -> ErrorResult {
Ok(())
}
pub fn Height(&self) -> DOMString {
fn Height(&self) -> DOMString {
~""
}
pub fn SetHeight(&self, _height: DOMString) -> ErrorResult {
fn SetHeight(&self, _height: DOMString) -> ErrorResult {
Ok(())
}
pub fn Width(&self) -> DOMString {
fn Width(&self) -> DOMString {
~""
}
pub fn SetWidth(&self, _width: DOMString) -> ErrorResult {
fn SetWidth(&self, _width: DOMString) -> ErrorResult {
Ok(())
}
pub fn Ch(&self) -> DOMString {
fn Ch(&self) -> DOMString {
~""
}
pub fn SetCh(&self, _ch: DOMString) -> ErrorResult {
fn SetCh(&self, _ch: DOMString) -> ErrorResult {
Ok(())
}
pub fn ChOff(&self) -> DOMString {
fn ChOff(&self) -> DOMString {
~""
}
pub fn SetChOff(&self, _ch_off: DOMString) -> ErrorResult {
fn SetChOff(&self, _ch_off: DOMString) -> ErrorResult {
Ok(())
}
pub fn NoWrap(&self) -> bool {
fn NoWrap(&self) -> bool {
false
}
pub fn SetNoWrap(&self, _no_wrap: bool) -> ErrorResult {
fn SetNoWrap(&self, _no_wrap: bool) -> ErrorResult {
Ok(())
}
pub fn VAlign(&self) -> DOMString {
fn VAlign(&self) -> DOMString {
~""
}
pub fn SetVAlign(&self, _valign: DOMString) -> ErrorResult {
fn SetVAlign(&self, _valign: DOMString) -> ErrorResult {
Ok(())
}
pub fn BgColor(&self) -> DOMString {
fn BgColor(&self) -> DOMString {
~""
}
pub fn SetBgColor(&self, _bg_color: DOMString) -> ErrorResult {
fn SetBgColor(&self, _bg_color: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -40,52 +40,68 @@ impl HTMLTableColElement {
}
}
impl HTMLTableColElement {
pub fn Span(&self) -> u32 {
pub trait HTMLTableColElementMethods {
fn Span(&self) -> u32;
fn SetSpan(&mut self, _span: u32) -> ErrorResult;
fn Align(&self) -> DOMString;
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult;
fn Ch(&self) -> DOMString;
fn SetCh(&mut self, _ch: DOMString) -> ErrorResult;
fn ChOff(&self) -> DOMString;
fn SetChOff(&mut self, _ch_off: DOMString) -> ErrorResult;
fn VAlign(&self) -> DOMString;
fn SetVAlign(&mut self, _v_align: DOMString) -> ErrorResult;
fn Width(&self) -> DOMString;
fn SetWidth(&mut self, _width: DOMString) -> ErrorResult;
}
impl<'a> HTMLTableColElementMethods for JSRef<'a, HTMLTableColElement> {
fn Span(&self) -> u32 {
0
}
pub fn SetSpan(&mut self, _span: u32) -> ErrorResult {
fn SetSpan(&mut self, _span: u32) -> ErrorResult {
Ok(())
}
pub fn Align(&self) -> DOMString {
fn Align(&self) -> DOMString {
~""
}
pub fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
Ok(())
}
pub fn Ch(&self) -> DOMString {
fn Ch(&self) -> DOMString {
~""
}
pub fn SetCh(&mut self, _ch: DOMString) -> ErrorResult {
fn SetCh(&mut self, _ch: DOMString) -> ErrorResult {
Ok(())
}
pub fn ChOff(&self) -> DOMString {
fn ChOff(&self) -> DOMString {
~""
}
pub fn SetChOff(&mut self, _ch_off: DOMString) -> ErrorResult {
fn SetChOff(&mut self, _ch_off: DOMString) -> ErrorResult {
Ok(())
}
pub fn VAlign(&self) -> DOMString {
fn VAlign(&self) -> DOMString {
~""
}
pub fn SetVAlign(&mut self, _v_align: DOMString) -> ErrorResult {
fn SetVAlign(&mut self, _v_align: DOMString) -> ErrorResult {
Ok(())
}
pub fn Width(&self) -> DOMString {
fn Width(&self) -> DOMString {
~""
}
pub fn SetWidth(&mut self, _width: DOMString) -> ErrorResult {
fn SetWidth(&mut self, _width: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -38,3 +38,6 @@ impl HTMLTableDataCellElement {
Node::reflect_node(~element, document, HTMLTableDataCellElementBinding::Wrap)
}
}
pub trait HTMLTableDataCellElementMethods {
}

View file

@ -40,99 +40,128 @@ impl HTMLTableElement {
}
}
impl HTMLTableElement {
pub fn DeleteCaption(&self) {
pub trait HTMLTableElementMethods {
fn DeleteCaption(&self);
fn DeleteTHead(&self);
fn DeleteTFoot(&self);
fn DeleteRow(&mut self, _index: i32) -> ErrorResult;
fn Sortable(&self) -> bool;
fn SetSortable(&self, _sortable: bool);
fn StopSorting(&self);
fn Align(&self) -> DOMString;
fn SetAlign(&self, _align: DOMString) -> ErrorResult;
fn Border(&self) -> DOMString;
fn SetBorder(&self, _border: DOMString) -> ErrorResult;
fn Frame(&self) -> DOMString;
fn SetFrame(&self, _frame: DOMString) -> ErrorResult;
fn Rules(&self) -> DOMString;
fn SetRules(&self, _rules: DOMString) -> ErrorResult;
fn Summary(&self) -> DOMString;
fn SetSummary(&self, _summary: DOMString) -> ErrorResult;
fn Width(&self) -> DOMString;
fn SetWidth(&self, _width: DOMString) -> ErrorResult;
fn BgColor(&self) -> DOMString;
fn SetBgColor(&self, _bg_color: DOMString) -> ErrorResult;
fn CellPadding(&self) -> DOMString;
fn SetCellPadding(&self, _cell_padding: DOMString) -> ErrorResult;
fn CellSpacing(&self) -> DOMString;
fn SetCellSpacing(&self, _cell_spacing: DOMString) -> ErrorResult;
}
impl<'a> HTMLTableElementMethods for JSRef<'a, HTMLTableElement> {
fn DeleteCaption(&self) {
}
pub fn DeleteTHead(&self) {
fn DeleteTHead(&self) {
}
pub fn DeleteTFoot(&self) {
fn DeleteTFoot(&self) {
}
pub fn DeleteRow(&mut self, _index: i32) -> ErrorResult {
fn DeleteRow(&mut self, _index: i32) -> ErrorResult {
Ok(())
}
pub fn Sortable(&self) -> bool {
fn Sortable(&self) -> bool {
false
}
pub fn SetSortable(&self, _sortable: bool) {
fn SetSortable(&self, _sortable: bool) {
}
pub fn StopSorting(&self) {
fn StopSorting(&self) {
}
pub fn Align(&self) -> DOMString {
fn Align(&self) -> DOMString {
~""
}
pub fn SetAlign(&self, _align: DOMString) -> ErrorResult {
fn SetAlign(&self, _align: DOMString) -> ErrorResult {
Ok(())
}
pub fn Border(&self) -> DOMString {
fn Border(&self) -> DOMString {
~""
}
pub fn SetBorder(&self, _border: DOMString) -> ErrorResult {
fn SetBorder(&self, _border: DOMString) -> ErrorResult {
Ok(())
}
pub fn Frame(&self) -> DOMString {
fn Frame(&self) -> DOMString {
~""
}
pub fn SetFrame(&self, _frame: DOMString) -> ErrorResult {
fn SetFrame(&self, _frame: DOMString) -> ErrorResult {
Ok(())
}
pub fn Rules(&self) -> DOMString {
fn Rules(&self) -> DOMString {
~""
}
pub fn SetRules(&self, _rules: DOMString) -> ErrorResult {
fn SetRules(&self, _rules: DOMString) -> ErrorResult {
Ok(())
}
pub fn Summary(&self) -> DOMString {
fn Summary(&self) -> DOMString {
~""
}
pub fn SetSummary(&self, _summary: DOMString) -> ErrorResult {
fn SetSummary(&self, _summary: DOMString) -> ErrorResult {
Ok(())
}
pub fn Width(&self) -> DOMString {
fn Width(&self) -> DOMString {
~""
}
pub fn SetWidth(&self, _width: DOMString) -> ErrorResult {
fn SetWidth(&self, _width: DOMString) -> ErrorResult {
Ok(())
}
pub fn BgColor(&self) -> DOMString {
fn BgColor(&self) -> DOMString {
~""
}
pub fn SetBgColor(&self, _bg_color: DOMString) -> ErrorResult {
fn SetBgColor(&self, _bg_color: DOMString) -> ErrorResult {
Ok(())
}
pub fn CellPadding(&self) -> DOMString {
fn CellPadding(&self) -> DOMString {
~""
}
pub fn SetCellPadding(&self, _cell_padding: DOMString) -> ErrorResult {
fn SetCellPadding(&self, _cell_padding: DOMString) -> ErrorResult {
Ok(())
}
pub fn CellSpacing(&self) -> DOMString {
fn CellSpacing(&self) -> DOMString {
~""
}
pub fn SetCellSpacing(&self, _cell_spacing: DOMString) -> ErrorResult {
fn SetCellSpacing(&self, _cell_spacing: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -38,3 +38,6 @@ impl HTMLTableHeaderCellElement {
Node::reflect_node(~element, document, HTMLTableHeaderCellElementBinding::Wrap)
}
}
pub trait HTMLTableHeaderCellElementMethods {
}

View file

@ -40,64 +40,83 @@ impl HTMLTableRowElement {
}
}
impl HTMLTableRowElement {
pub fn RowIndex(&self) -> i32 {
pub trait HTMLTableRowElementMethods {
fn RowIndex(&self) -> i32;
fn GetRowIndex(&self) -> i32;
fn SectionRowIndex(&self) -> i32;
fn GetSectionRowIndex(&self) -> i32;
fn DeleteCell(&mut self, _index: i32) -> ErrorResult;
fn Align(&self) -> DOMString;
fn SetAlign(&self, _align: DOMString) -> ErrorResult;
fn Ch(&self) -> DOMString;
fn SetCh(&self, _ch: DOMString) -> ErrorResult;
fn ChOff(&self) -> DOMString;
fn SetChOff(&self, _ch_off: DOMString) -> ErrorResult;
fn VAlign(&self) -> DOMString;
fn SetVAlign(&self, _v_align: DOMString) -> ErrorResult;
fn BgColor(&self) -> DOMString;
fn SetBgColor(&self, _bg_color: DOMString) -> ErrorResult;
}
impl<'a> HTMLTableRowElementMethods for JSRef<'a, HTMLTableRowElement> {
fn RowIndex(&self) -> i32 {
0
}
pub fn GetRowIndex(&self) -> i32 {
fn GetRowIndex(&self) -> i32 {
0
}
pub fn SectionRowIndex(&self) -> i32 {
fn SectionRowIndex(&self) -> i32 {
0
}
pub fn GetSectionRowIndex(&self) -> i32 {
fn GetSectionRowIndex(&self) -> i32 {
0
}
pub fn DeleteCell(&mut self, _index: i32) -> ErrorResult {
fn DeleteCell(&mut self, _index: i32) -> ErrorResult {
Ok(())
}
pub fn Align(&self) -> DOMString {
fn Align(&self) -> DOMString {
~""
}
pub fn SetAlign(&self, _align: DOMString) -> ErrorResult {
fn SetAlign(&self, _align: DOMString) -> ErrorResult {
Ok(())
}
pub fn Ch(&self) -> DOMString {
fn Ch(&self) -> DOMString {
~""
}
pub fn SetCh(&self, _ch: DOMString) -> ErrorResult {
fn SetCh(&self, _ch: DOMString) -> ErrorResult {
Ok(())
}
pub fn ChOff(&self) -> DOMString {
fn ChOff(&self) -> DOMString {
~""
}
pub fn SetChOff(&self, _ch_off: DOMString) -> ErrorResult {
fn SetChOff(&self, _ch_off: DOMString) -> ErrorResult {
Ok(())
}
pub fn VAlign(&self) -> DOMString {
fn VAlign(&self) -> DOMString {
~""
}
pub fn SetVAlign(&self, _v_align: DOMString) -> ErrorResult {
fn SetVAlign(&self, _v_align: DOMString) -> ErrorResult {
Ok(())
}
pub fn BgColor(&self) -> DOMString {
fn BgColor(&self) -> DOMString {
~""
}
pub fn SetBgColor(&self, _bg_color: DOMString) -> ErrorResult {
fn SetBgColor(&self, _bg_color: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -40,40 +40,53 @@ impl HTMLTableSectionElement {
}
}
impl HTMLTableSectionElement {
pub fn DeleteRow(&mut self, _index: i32) -> ErrorResult {
pub trait HTMLTableSectionElementMethods {
fn DeleteRow(&mut self, _index: i32) -> ErrorResult;
fn Align(&self) -> DOMString;
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult;
fn Ch(&self) -> DOMString;
fn SetCh(&mut self, _ch: DOMString) -> ErrorResult;
fn ChOff(&self) -> DOMString;
fn SetChOff(&mut self, _ch_off: DOMString) -> ErrorResult;
fn VAlign(&self) -> DOMString;
fn SetVAlign(&mut self, _v_align: DOMString) -> ErrorResult;
}
impl<'a> HTMLTableSectionElementMethods for JSRef<'a, HTMLTableSectionElement> {
fn DeleteRow(&mut self, _index: i32) -> ErrorResult {
Ok(())
}
pub fn Align(&self) -> DOMString {
fn Align(&self) -> DOMString {
~""
}
pub fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
Ok(())
}
pub fn Ch(&self) -> DOMString {
fn Ch(&self) -> DOMString {
~""
}
pub fn SetCh(&mut self, _ch: DOMString) -> ErrorResult {
fn SetCh(&mut self, _ch: DOMString) -> ErrorResult {
Ok(())
}
pub fn ChOff(&self) -> DOMString {
fn ChOff(&self) -> DOMString {
~""
}
pub fn SetChOff(&mut self, _ch_off: DOMString) -> ErrorResult {
fn SetChOff(&mut self, _ch_off: DOMString) -> ErrorResult {
Ok(())
}
pub fn VAlign(&self) -> DOMString {
fn VAlign(&self) -> DOMString {
~""
}
pub fn SetVAlign(&mut self, _v_align: DOMString) -> ErrorResult {
fn SetVAlign(&mut self, _v_align: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -38,3 +38,6 @@ impl HTMLTemplateElement {
Node::reflect_node(~element, document, HTMLTemplateElementBinding::Wrap)
}
}
pub trait HTMLTemplateElementMethods {
}

View file

@ -40,163 +40,208 @@ impl HTMLTextAreaElement {
}
}
impl HTMLTextAreaElement {
pub fn Autofocus(&self) -> bool {
pub trait HTMLTextAreaElementMethods {
fn Autofocus(&self) -> bool;
fn SetAutofocus(&mut self, _autofocus: bool) -> ErrorResult;
fn Cols(&self) -> u32;
fn SetCols(&self, _cols: u32) -> ErrorResult;
fn Disabled(&self) -> bool;
fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult;
fn MaxLength(&self) -> i32;
fn SetMaxLength(&self, _max_length: i32) -> ErrorResult;
fn Name(&self) -> DOMString;
fn SetName(&mut self, _name: DOMString) -> ErrorResult;
fn Placeholder(&self) -> DOMString;
fn SetPlaceholder(&mut self, _placeholder: DOMString) -> ErrorResult;
fn ReadOnly(&self) -> bool;
fn SetReadOnly(&mut self, _read_only: bool) -> ErrorResult;
fn Required(&self) -> bool;
fn SetRequired(&mut self, _required: bool) -> ErrorResult;
fn Rows(&self) -> u32;
fn SetRows(&self, _rows: u32) -> ErrorResult;
fn Wrap(&self) -> DOMString;
fn SetWrap(&mut self, _wrap: DOMString) -> ErrorResult;
fn Type(&self) -> DOMString;
fn SetType(&mut self, _type: DOMString);
fn DefaultValue(&self) -> DOMString;
fn SetDefaultValue(&mut self, _default_value: DOMString) -> ErrorResult;
fn Value(&self) -> DOMString;
fn SetValue(&mut self, _value: DOMString);
fn TextLength(&self) -> u32;
fn SetTextLength(&self, _text_length: u32) -> ErrorResult;
fn WillValidate(&self) -> bool;
fn SetWillValidate(&mut self, _will_validate: bool) -> ErrorResult;
fn ValidationMessage(&self) -> DOMString;
fn CheckValidity(&self) -> bool;
fn SetCustomValidity(&self, _error: DOMString);
fn Select(&self);
fn GetSelectionStart(&self) -> Fallible<u32>;
fn SetSelectionStart(&self, _selection_start: u32) -> ErrorResult;
fn GetSelectionEnd(&self) -> Fallible<u32>;
fn SetSelectionEnd(&self, _selection_end: u32) -> ErrorResult;
fn GetSelectionDirection(&self) -> Fallible<DOMString>;
fn SetSelectionDirection(&self, _selection_direction: DOMString) -> ErrorResult;
fn SetRangeText(&self, _replacement: DOMString);
}
impl<'a> HTMLTextAreaElementMethods for JSRef<'a, HTMLTextAreaElement> {
fn Autofocus(&self) -> bool {
false
}
pub fn SetAutofocus(&mut self, _autofocus: bool) -> ErrorResult {
fn SetAutofocus(&mut self, _autofocus: bool) -> ErrorResult {
Ok(())
}
pub fn Cols(&self) -> u32 {
fn Cols(&self) -> u32 {
0
}
pub fn SetCols(&self, _cols: u32) -> ErrorResult {
fn SetCols(&self, _cols: u32) -> ErrorResult {
Ok(())
}
pub fn Disabled(&self) -> bool {
fn Disabled(&self) -> bool {
false
}
pub fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult {
fn SetDisabled(&mut self, _disabled: bool) -> ErrorResult {
Ok(())
}
pub fn MaxLength(&self) -> i32 {
fn MaxLength(&self) -> i32 {
0
}
pub fn SetMaxLength(&self, _max_length: i32) -> ErrorResult {
fn SetMaxLength(&self, _max_length: i32) -> ErrorResult {
Ok(())
}
pub fn Name(&self) -> DOMString {
fn Name(&self) -> DOMString {
~""
}
pub fn SetName(&mut self, _name: DOMString) -> ErrorResult {
fn SetName(&mut self, _name: DOMString) -> ErrorResult {
Ok(())
}
pub fn Placeholder(&self) -> DOMString {
fn Placeholder(&self) -> DOMString {
~""
}
pub fn SetPlaceholder(&mut self, _placeholder: DOMString) -> ErrorResult {
fn SetPlaceholder(&mut self, _placeholder: DOMString) -> ErrorResult {
Ok(())
}
pub fn ReadOnly(&self) -> bool {
fn ReadOnly(&self) -> bool {
false
}
pub fn SetReadOnly(&mut self, _read_only: bool) -> ErrorResult {
fn SetReadOnly(&mut self, _read_only: bool) -> ErrorResult {
Ok(())
}
pub fn Required(&self) -> bool {
fn Required(&self) -> bool {
false
}
pub fn SetRequired(&mut self, _required: bool) -> ErrorResult {
fn SetRequired(&mut self, _required: bool) -> ErrorResult {
Ok(())
}
pub fn Rows(&self) -> u32 {
fn Rows(&self) -> u32 {
0
}
pub fn SetRows(&self, _rows: u32) -> ErrorResult {
fn SetRows(&self, _rows: u32) -> ErrorResult {
Ok(())
}
pub fn Wrap(&self) -> DOMString {
fn Wrap(&self) -> DOMString {
~""
}
pub fn SetWrap(&mut self, _wrap: DOMString) -> ErrorResult {
fn SetWrap(&mut self, _wrap: DOMString) -> ErrorResult {
Ok(())
}
pub fn Type(&self) -> DOMString {
fn Type(&self) -> DOMString {
~""
}
pub fn SetType(&mut self, _type: DOMString) {
fn SetType(&mut self, _type: DOMString) {
}
pub fn DefaultValue(&self) -> DOMString {
fn DefaultValue(&self) -> DOMString {
~""
}
pub fn SetDefaultValue(&mut self, _default_value: DOMString) -> ErrorResult {
fn SetDefaultValue(&mut self, _default_value: DOMString) -> ErrorResult {
Ok(())
}
pub fn Value(&self) -> DOMString {
fn Value(&self) -> DOMString {
~""
}
pub fn SetValue(&mut self, _value: DOMString) {
fn SetValue(&mut self, _value: DOMString) {
}
pub fn TextLength(&self) -> u32 {
fn TextLength(&self) -> u32 {
0
}
pub fn SetTextLength(&self, _text_length: u32) -> ErrorResult {
fn SetTextLength(&self, _text_length: u32) -> ErrorResult {
Ok(())
}
pub fn WillValidate(&self) -> bool {
fn WillValidate(&self) -> bool {
false
}
pub fn SetWillValidate(&mut self, _will_validate: bool) -> ErrorResult {
fn SetWillValidate(&mut self, _will_validate: bool) -> ErrorResult {
Ok(())
}
pub fn ValidationMessage(&self) -> DOMString {
fn ValidationMessage(&self) -> DOMString {
~""
}
pub fn CheckValidity(&self) -> bool {
fn CheckValidity(&self) -> bool {
false
}
pub fn SetCustomValidity(&self, _error: DOMString) {
fn SetCustomValidity(&self, _error: DOMString) {
}
pub fn Select(&self) {
fn Select(&self) {
}
pub fn GetSelectionStart(&self) -> Fallible<u32> {
fn GetSelectionStart(&self) -> Fallible<u32> {
Ok(0)
}
pub fn SetSelectionStart(&self, _selection_start: u32) -> ErrorResult {
fn SetSelectionStart(&self, _selection_start: u32) -> ErrorResult {
Ok(())
}
pub fn GetSelectionEnd(&self) -> Fallible<u32> {
fn GetSelectionEnd(&self) -> Fallible<u32> {
Ok(0)
}
pub fn SetSelectionEnd(&self, _selection_end: u32) -> ErrorResult {
fn SetSelectionEnd(&self, _selection_end: u32) -> ErrorResult {
Ok(())
}
pub fn GetSelectionDirection(&self) -> Fallible<DOMString> {
fn GetSelectionDirection(&self) -> Fallible<DOMString> {
Ok(~"")
}
pub fn SetSelectionDirection(&self, _selection_direction: DOMString) -> ErrorResult {
fn SetSelectionDirection(&self, _selection_direction: DOMString) -> ErrorResult {
Ok(())
}
pub fn SetRangeText(&self, _replacement: DOMString) {
fn SetRangeText(&self, _replacement: DOMString) {
}
}

View file

@ -40,12 +40,18 @@ impl HTMLTimeElement {
}
}
impl HTMLTimeElement {
pub fn DateTime(&self) -> DOMString {
pub trait HTMLTimeElementMethods {
fn DateTime(&self) -> DOMString;
fn SetDateTime(&mut self, _dateTime: DOMString) -> ErrorResult;
}
impl<'a> HTMLTimeElementMethods for JSRef<'a, HTMLTimeElement> {
fn DateTime(&self) -> DOMString {
~""
}
pub fn SetDateTime(&mut self, _dateTime: DOMString) -> ErrorResult {
fn SetDateTime(&mut self, _dateTime: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -40,12 +40,18 @@ impl HTMLTitleElement {
}
}
impl HTMLTitleElement {
pub fn Text(&self) -> DOMString {
pub trait HTMLTitleElementMethods {
fn Text(&self) -> DOMString;
fn SetText(&mut self, _text: DOMString) -> ErrorResult;
}
impl<'a> HTMLTitleElementMethods for JSRef<'a, HTMLTitleElement> {
fn Text(&self) -> DOMString {
~""
}
pub fn SetText(&mut self, _text: DOMString) -> ErrorResult {
fn SetText(&mut self, _text: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -40,48 +40,63 @@ impl HTMLTrackElement {
}
}
impl HTMLTrackElement {
pub fn Kind(&self) -> DOMString {
pub trait HTMLTrackElementMethods {
fn Kind(&self) -> DOMString;
fn SetKind(&mut self, _kind: DOMString) -> ErrorResult;
fn Src(&self) -> DOMString;
fn SetSrc(&mut self, _src: DOMString) -> ErrorResult;
fn Srclang(&self) -> DOMString;
fn SetSrclang(&mut self, _srclang: DOMString) -> ErrorResult;
fn Label(&self) -> DOMString;
fn SetLabel(&mut self, _label: DOMString) -> ErrorResult;
fn Default(&self) -> bool;
fn SetDefault(&mut self, _default: bool) -> ErrorResult;
fn ReadyState(&self) -> u16;
}
impl<'a> HTMLTrackElementMethods for JSRef<'a, HTMLTrackElement> {
fn Kind(&self) -> DOMString {
~""
}
pub fn SetKind(&mut self, _kind: DOMString) -> ErrorResult {
fn SetKind(&mut self, _kind: DOMString) -> ErrorResult {
Ok(())
}
pub fn Src(&self) -> DOMString {
fn Src(&self) -> DOMString {
~""
}
pub fn SetSrc(&mut self, _src: DOMString) -> ErrorResult {
fn SetSrc(&mut self, _src: DOMString) -> ErrorResult {
Ok(())
}
pub fn Srclang(&self) -> DOMString {
fn Srclang(&self) -> DOMString {
~""
}
pub fn SetSrclang(&mut self, _srclang: DOMString) -> ErrorResult {
fn SetSrclang(&mut self, _srclang: DOMString) -> ErrorResult {
Ok(())
}
pub fn Label(&self) -> DOMString {
fn Label(&self) -> DOMString {
~""
}
pub fn SetLabel(&mut self, _label: DOMString) -> ErrorResult {
fn SetLabel(&mut self, _label: DOMString) -> ErrorResult {
Ok(())
}
pub fn Default(&self) -> bool {
fn Default(&self) -> bool {
false
}
pub fn SetDefault(&mut self, _default: bool) -> ErrorResult {
fn SetDefault(&mut self, _default: bool) -> ErrorResult {
Ok(())
}
pub fn ReadyState(&self) -> u16 {
fn ReadyState(&self) -> u16 {
0
}
}

View file

@ -40,20 +40,28 @@ impl HTMLUListElement {
}
}
impl HTMLUListElement {
pub fn Compact(&self) -> bool {
pub trait HTMLUListElementMethods {
fn Compact(&self) -> bool;
fn SetCompact(&mut self, _compact: bool) -> ErrorResult;
fn Type(&self) -> DOMString;
fn SetType(&mut self, _type: DOMString) -> ErrorResult;
}
impl<'a> HTMLUListElementMethods for JSRef<'a, HTMLUListElement> {
fn Compact(&self) -> bool {
false
}
pub fn SetCompact(&mut self, _compact: bool) -> ErrorResult {
fn SetCompact(&mut self, _compact: bool) -> ErrorResult {
Ok(())
}
pub fn Type(&self) -> DOMString {
fn Type(&self) -> DOMString {
~""
}
pub fn SetType(&mut self, _type: DOMString) -> ErrorResult {
fn SetType(&mut self, _type: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -38,3 +38,6 @@ impl HTMLUnknownElement {
Node::reflect_node(~element, document, HTMLUnknownElementBinding::Wrap)
}
}
pub trait HTMLUnknownElementMethods {
}

View file

@ -40,36 +40,48 @@ impl HTMLVideoElement {
}
}
impl HTMLVideoElement {
pub fn Width(&self) -> u32 {
pub trait HTMLVideoElementMethods {
fn Width(&self) -> u32;
fn SetWidth(&mut self, _width: u32) -> ErrorResult;
fn Height(&self) -> u32;
fn SetHeight(&mut self, _height: u32) -> ErrorResult;
fn VideoWidth(&self) -> u32;
fn VideoHeight(&self) -> u32;
fn Poster(&self) -> DOMString;
fn SetPoster(&mut self, _poster: DOMString) -> ErrorResult;
}
impl<'a> HTMLVideoElementMethods for JSRef<'a, HTMLVideoElement> {
fn Width(&self) -> u32 {
0
}
pub fn SetWidth(&mut self, _width: u32) -> ErrorResult {
fn SetWidth(&mut self, _width: u32) -> ErrorResult {
Ok(())
}
pub fn Height(&self) -> u32 {
fn Height(&self) -> u32 {
0
}
pub fn SetHeight(&mut self, _height: u32) -> ErrorResult {
fn SetHeight(&mut self, _height: u32) -> ErrorResult {
Ok(())
}
pub fn VideoWidth(&self) -> u32 {
fn VideoWidth(&self) -> u32 {
0
}
pub fn VideoHeight(&self) -> u32 {
fn VideoHeight(&self) -> u32 {
0
}
pub fn Poster(&self) -> DOMString {
fn Poster(&self) -> DOMString {
~""
}
pub fn SetPoster(&mut self, _poster: DOMString) -> ErrorResult {
fn SetPoster(&mut self, _poster: DOMString) -> ErrorResult {
Ok(())
}
}

View file

@ -34,104 +34,134 @@ impl Location {
window,
LocationBinding::Wrap)
}
}
pub fn Assign(&self, _url: DOMString) {
pub trait LocationMethods {
fn Assign(&self, _url: DOMString);
fn Replace(&self, _url: DOMString);
fn Reload(&self);
fn Href(&self) -> DOMString;
fn SetHref(&self, _href: DOMString) -> Fallible<()>;
fn Origin(&self) -> DOMString;
fn Protocol(&self) -> DOMString;
fn SetProtocol(&self, _protocol: DOMString);
fn Username(&self) -> DOMString;
fn SetUsername(&self, _username: DOMString);
fn Password(&self) -> DOMString;
fn SetPassword(&self, _password: DOMString);
fn Host(&self) -> DOMString;
fn SetHost(&self, _host: DOMString);
fn Hostname(&self) -> DOMString;
fn SetHostname(&self, _hostname: DOMString);
fn Port(&self) -> DOMString;
fn SetPort(&self, _port: DOMString);
fn Pathname(&self) -> DOMString;
fn SetPathname(&self, _pathname: DOMString);
fn Search(&self) -> DOMString;
fn SetSearch(&self, _search: DOMString);
fn Hash(&self) -> DOMString;
fn SetHash(&self, _hash: DOMString);
}
impl<'a> LocationMethods for JSRef<'a, Location> {
fn Assign(&self, _url: DOMString) {
}
pub fn Replace(&self, _url: DOMString) {
fn Replace(&self, _url: DOMString) {
}
pub fn Reload(&self) {
fn Reload(&self) {
}
pub fn Href(&self) -> DOMString {
fn Href(&self) -> DOMString {
self.page.get_url().to_str()
}
pub fn SetHref(&self, _href: DOMString) -> Fallible<()> {
fn SetHref(&self, _href: DOMString) -> Fallible<()> {
Ok(())
}
pub fn Origin(&self) -> DOMString {
fn Origin(&self) -> DOMString {
~""
}
pub fn Protocol(&self) -> DOMString {
fn Protocol(&self) -> DOMString {
~""
}
pub fn SetProtocol(&self, _protocol: DOMString) {
fn SetProtocol(&self, _protocol: DOMString) {
}
pub fn Username(&self) -> DOMString {
fn Username(&self) -> DOMString {
~""
}
pub fn SetUsername(&self, _username: DOMString) {
fn SetUsername(&self, _username: DOMString) {
}
pub fn Password(&self) -> DOMString {
fn Password(&self) -> DOMString {
~""
}
pub fn SetPassword(&self, _password: DOMString) {
fn SetPassword(&self, _password: DOMString) {
}
pub fn Host(&self) -> DOMString {
fn Host(&self) -> DOMString {
~""
}
pub fn SetHost(&self, _host: DOMString) {
fn SetHost(&self, _host: DOMString) {
}
pub fn Hostname(&self) -> DOMString {
fn Hostname(&self) -> DOMString {
~""
}
pub fn SetHostname(&self, _hostname: DOMString) {
fn SetHostname(&self, _hostname: DOMString) {
}
pub fn Port(&self) -> DOMString {
fn Port(&self) -> DOMString {
~""
}
pub fn SetPort(&self, _port: DOMString) {
fn SetPort(&self, _port: DOMString) {
}
pub fn Pathname(&self) -> DOMString {
fn Pathname(&self) -> DOMString {
~""
}
pub fn SetPathname(&self, _pathname: DOMString) {
fn SetPathname(&self, _pathname: DOMString) {
}
pub fn Search(&self) -> DOMString {
fn Search(&self) -> DOMString {
~""
}
pub fn SetSearch(&self, _search: DOMString) {
fn SetSearch(&self, _search: DOMString) {
}
pub fn Hash(&self) -> DOMString {
fn Hash(&self) -> DOMString {
~""
}
pub fn SetHash(&self, _hash: DOMString) {
fn SetHash(&self, _hash: DOMString) {
}
}
impl Reflectable for Location {
fn reflector<'a>(&'a self) -> &'a Reflector {
&self.reflector_

View file

@ -3,13 +3,13 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::BindingDeclarations::MouseEventBinding;
use dom::bindings::codegen::InheritTypes::MouseEventDerived;
use dom::bindings::codegen::InheritTypes::{UIEventCast, MouseEventDerived};
use dom::bindings::js::{JS, JSRef, RootCollection, RootedReference, Unrooted};
use dom::bindings::error::Fallible;
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::event::{Event, MouseEventTypeId};
use dom::eventtarget::EventTarget;
use dom::uievent::UIEvent;
use dom::uievent::{UIEvent, UIEventMethods};
use dom::window::Window;
use servo_util::str::DOMString;
@ -64,65 +64,98 @@ impl MouseEvent {
let mut ev = MouseEvent::new(owner).root(&roots);
let view = init.view.as_ref().map(|view| view.root(&roots));
let related_target = init.relatedTarget.as_ref().map(|relatedTarget| relatedTarget.root(&roots));
ev.get_mut().InitMouseEvent(type_, init.bubbles, init.cancelable, view.root_ref(),
ev.InitMouseEvent(type_, init.bubbles, init.cancelable, view.root_ref(),
init.detail, init.screenX, init.screenY,
init.clientX, init.clientY, init.ctrlKey,
init.altKey, init.shiftKey, init.metaKey,
init.button, related_target.root_ref());
Ok(Unrooted::new_rooted(&*ev))
}
}
pub fn ScreenX(&self) -> i32 {
pub trait MouseEventMethods {
fn ScreenX(&self) -> i32;
fn ScreenY(&self) -> i32;
fn ClientX(&self) -> i32;
fn ClientY(&self) -> i32;
fn CtrlKey(&self) -> bool;
fn ShiftKey(&self) -> bool;
fn AltKey(&self) -> bool;
fn MetaKey(&self) -> bool;
fn Button(&self) -> u16;
fn Buttons(&self)-> u16;
fn GetRelatedTarget(&self) -> Option<Unrooted<EventTarget>>;
fn GetModifierState(&self, _keyArg: DOMString) -> bool;
fn InitMouseEvent(&mut self,
typeArg: DOMString,
canBubbleArg: bool,
cancelableArg: bool,
viewArg: Option<JSRef<Window>>,
detailArg: i32,
screenXArg: i32,
screenYArg: i32,
clientXArg: i32,
clientYArg: i32,
ctrlKeyArg: bool,
altKeyArg: bool,
shiftKeyArg: bool,
metaKeyArg: bool,
buttonArg: u16,
relatedTargetArg: Option<JSRef<EventTarget>>);
}
impl<'a> MouseEventMethods for JSRef<'a, MouseEvent> {
fn ScreenX(&self) -> i32 {
self.screen_x
}
pub fn ScreenY(&self) -> i32 {
fn ScreenY(&self) -> i32 {
self.screen_y
}
pub fn ClientX(&self) -> i32 {
fn ClientX(&self) -> i32 {
self.client_x
}
pub fn ClientY(&self) -> i32 {
fn ClientY(&self) -> i32 {
self.client_y
}
pub fn CtrlKey(&self) -> bool {
fn CtrlKey(&self) -> bool {
self.ctrl_key
}
pub fn ShiftKey(&self) -> bool {
fn ShiftKey(&self) -> bool {
self.shift_key
}
pub fn AltKey(&self) -> bool {
fn AltKey(&self) -> bool {
self.alt_key
}
pub fn MetaKey(&self) -> bool {
fn MetaKey(&self) -> bool {
self.meta_key
}
pub fn Button(&self) -> u16 {
fn Button(&self) -> u16 {
self.button
}
pub fn Buttons(&self)-> u16 {
fn Buttons(&self)-> u16 {
//TODO
0
}
pub fn GetRelatedTarget(&self) -> Option<Unrooted<EventTarget>> {
fn GetRelatedTarget(&self) -> Option<Unrooted<EventTarget>> {
self.related_target.clone().map(|target| Unrooted::new(target))
}
pub fn GetModifierState(&self, _keyArg: DOMString) -> bool {
fn GetModifierState(&self, _keyArg: DOMString) -> bool {
//TODO
false
}
pub fn InitMouseEvent(&mut self,
fn InitMouseEvent(&mut self,
typeArg: DOMString,
canBubbleArg: bool,
cancelableArg: bool,
@ -138,7 +171,10 @@ impl MouseEvent {
metaKeyArg: bool,
buttonArg: u16,
relatedTargetArg: Option<JSRef<EventTarget>>) {
self.mouseevent.InitUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg);
{
let uievent: &mut JSRef<UIEvent> = UIEventCast::from_mut_ref(self);
uievent.InitUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg);
}
self.screen_x = screenXArg;
self.screen_y = screenYArg;
self.client_x = clientXArg;
@ -152,6 +188,7 @@ impl MouseEvent {
}
}
impl Reflectable for MouseEvent {
fn reflector<'a>(&'a self) -> &'a Reflector {
self.mouseevent.reflector()

View file

@ -26,72 +26,94 @@ impl Navigator {
window,
NavigatorBinding::Wrap)
}
}
pub fn DoNotTrack(&self) -> DOMString {
pub trait NavigatorMethods {
fn DoNotTrack(&self) -> DOMString;
fn Vendor(&self) -> DOMString;
fn VendorSub(&self) -> DOMString;
fn Product(&self) -> DOMString;
fn ProductSub(&self) -> DOMString;
fn CookieEnabled(&self) -> bool;
fn GetBuildID(&self) -> Fallible<DOMString>;
fn JavaEnabled(&self) -> Fallible<bool>;
fn TaintEnabled(&self) -> bool;
fn AppName(&self) -> DOMString;
fn GetAppCodeName(&self) -> Fallible<DOMString>;
fn GetAppVersion(&self) -> Fallible<DOMString>;
fn GetPlatform(&self) -> Fallible<DOMString>;
fn GetUserAgent(&self) -> Fallible<DOMString>;
fn GetLanguage(&self) -> Option<DOMString>;
fn OnLine(&self) -> bool;
}
impl<'a> NavigatorMethods for JSRef<'a, Navigator> {
fn DoNotTrack(&self) -> DOMString {
~"unspecified"
}
pub fn Vendor(&self) -> DOMString {
fn Vendor(&self) -> DOMString {
~"" // Like Gecko
}
pub fn VendorSub(&self) -> DOMString {
fn VendorSub(&self) -> DOMString {
~"" // Like Gecko
}
pub fn Product(&self) -> DOMString {
fn Product(&self) -> DOMString {
~"Gecko"
}
pub fn ProductSub(&self) -> DOMString {
fn ProductSub(&self) -> DOMString {
~""
}
pub fn CookieEnabled(&self) -> bool {
fn CookieEnabled(&self) -> bool {
false
}
pub fn GetBuildID(&self) -> Fallible<DOMString> {
fn GetBuildID(&self) -> Fallible<DOMString> {
Ok(~"")
}
pub fn JavaEnabled(&self) -> Fallible<bool> {
fn JavaEnabled(&self) -> Fallible<bool> {
Ok(false)
}
pub fn TaintEnabled(&self) -> bool {
fn TaintEnabled(&self) -> bool {
false
}
pub fn AppName(&self) -> DOMString {
fn AppName(&self) -> DOMString {
~"Netscape" // Like Gecko/Webkit
}
pub fn GetAppCodeName(&self) -> Fallible<DOMString> {
fn GetAppCodeName(&self) -> Fallible<DOMString> {
Ok(~"Mozilla") // Like Gecko/Webkit
}
pub fn GetAppVersion(&self) -> Fallible<DOMString> {
fn GetAppVersion(&self) -> Fallible<DOMString> {
Ok(~"")
}
pub fn GetPlatform(&self) -> Fallible<DOMString> {
fn GetPlatform(&self) -> Fallible<DOMString> {
Ok(~"")
}
pub fn GetUserAgent(&self) -> Fallible<DOMString> {
fn GetUserAgent(&self) -> Fallible<DOMString> {
Ok(~"")
}
pub fn GetLanguage(&self) -> Option<DOMString> {
fn GetLanguage(&self) -> Option<DOMString> {
None
}
pub fn OnLine(&self) -> bool {
fn OnLine(&self) -> bool {
true
}
}
impl Reflectable for Navigator {
fn reflector<'a>(&'a self) -> &'a Reflector {
&self.reflector_

View file

@ -16,15 +16,15 @@ use dom::bindings::js::{ResultRootable, OptionalRootable};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::error::{ErrorResult, Fallible, NotFound, HierarchyRequest};
use dom::bindings::utils;
use dom::characterdata::CharacterData;
use dom::characterdata::{CharacterData, CharacterDataMethods};
use dom::comment::Comment;
use dom::document::{Document, HTMLDocument, NonHTMLDocument};
use dom::document::{Document, DocumentMethods, HTMLDocument, NonHTMLDocument};
use dom::documentfragment::DocumentFragment;
use dom::documenttype::DocumentType;
use dom::element::{Element, ElementTypeId, HTMLAnchorElementTypeId};
use dom::element::{Element, ElementMethods, ElementTypeId, HTMLAnchorElementTypeId};
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
use dom::nodelist::{NodeList};
use dom::processinginstruction::ProcessingInstruction;
use dom::processinginstruction::{ProcessingInstruction, ProcessingInstructionMethods};
use dom::text::Text;
use dom::virtualmethods::{VirtualMethods, vtable_for};
use dom::window::Window;
@ -226,17 +226,17 @@ pub enum NodeTypeId {
pub fn AppendChild<'a>(self_: &mut JSRef<'a, Node>, node: &mut JSRef<Node>) -> Fallible<Unrooted<Node>> {
let mut self_alias = self_.clone();
self_.get_mut().AppendChild(&mut self_alias, node)
self_.AppendChild(&mut self_alias, node)
}
pub fn ReplaceChild<'a>(self_: &mut JSRef<'a, Node>, node: &mut JSRef<Node>, child: &mut JSRef<Node>) -> Fallible<Unrooted<Node>> {
let mut self_alias = self_.clone();
self_.get_mut().ReplaceChild(&mut self_alias, node, child)
self_.ReplaceChild(&mut self_alias, node, child)
}
pub fn RemoveChild<'a>(self_: &mut JSRef<'a, Node>, node: &mut JSRef<Node>) -> Fallible<Unrooted<Node>> {
let mut self_alias = self_.clone();
self_.get_mut().RemoveChild(&mut self_alias, node)
self_.RemoveChild(&mut self_alias, node)
}
pub trait NodeHelpers {
@ -839,6 +839,12 @@ impl Node {
})
}
pub fn wait_until_safe_to_modify_dom(&self) {
let roots = RootCollection::new();
let document = self.owner_doc().root(&roots);
document.get().wait_until_safe_to_modify_dom();
}
pub fn reflect_node<N: Reflectable+NodeBase>
(node: ~N,
document: &JSRef<Document>,
@ -897,211 +903,6 @@ impl Node {
}
}
// http://dom.spec.whatwg.org/#dom-node-nodetype
pub fn NodeType(&self) -> u16 {
match self.type_id {
ElementNodeTypeId(_) => NodeConstants::ELEMENT_NODE,
TextNodeTypeId => NodeConstants::TEXT_NODE,
ProcessingInstructionNodeTypeId => NodeConstants::PROCESSING_INSTRUCTION_NODE,
CommentNodeTypeId => NodeConstants::COMMENT_NODE,
DocumentNodeTypeId => NodeConstants::DOCUMENT_NODE,
DoctypeNodeTypeId => NodeConstants::DOCUMENT_TYPE_NODE,
DocumentFragmentNodeTypeId => NodeConstants::DOCUMENT_FRAGMENT_NODE,
}
}
// http://dom.spec.whatwg.org/#dom-node-nodename
pub fn NodeName(&self, abstract_self: &JSRef<Node>) -> DOMString {
match self.type_id {
ElementNodeTypeId(..) => {
let elem: &JSRef<Element> = ElementCast::to_ref(abstract_self).unwrap();
elem.get().TagName()
}
TextNodeTypeId => ~"#text",
ProcessingInstructionNodeTypeId => {
let processing_instruction: &JSRef<ProcessingInstruction> =
ProcessingInstructionCast::to_ref(abstract_self).unwrap();
processing_instruction.get().Target()
}
CommentNodeTypeId => ~"#comment",
DoctypeNodeTypeId => {
let doctype: &JSRef<DocumentType> = DocumentTypeCast::to_ref(abstract_self).unwrap();
doctype.get().name.clone()
},
DocumentFragmentNodeTypeId => ~"#document-fragment",
DocumentNodeTypeId => ~"#document"
}
}
// http://dom.spec.whatwg.org/#dom-node-baseuri
pub fn GetBaseURI(&self) -> Option<DOMString> {
// FIXME (#1824) implement.
None
}
// http://dom.spec.whatwg.org/#dom-node-ownerdocument
pub fn GetOwnerDocument(&self) -> Option<Unrooted<Document>> {
match self.type_id {
ElementNodeTypeId(..) |
CommentNodeTypeId |
TextNodeTypeId |
ProcessingInstructionNodeTypeId |
DoctypeNodeTypeId |
DocumentFragmentNodeTypeId => Some(self.owner_doc()),
DocumentNodeTypeId => None
}
}
// http://dom.spec.whatwg.org/#dom-node-parentnode
pub fn GetParentNode(&self) -> Option<Unrooted<Node>> {
self.parent_node.clone().map(|node| Unrooted::new(node))
}
// http://dom.spec.whatwg.org/#dom-node-parentelement
pub fn GetParentElement(&self) -> Option<Unrooted<Element>> {
let roots = RootCollection::new();
self.parent_node.clone()
.and_then(|parent| {
let parent = parent.root(&roots);
ElementCast::to_ref(&*parent).map(|elem| {
Unrooted::new_rooted(elem)
})
})
}
// http://dom.spec.whatwg.org/#dom-node-haschildnodes
pub fn HasChildNodes(&self) -> bool {
self.first_child.is_some()
}
// http://dom.spec.whatwg.org/#dom-node-childnodes
pub fn ChildNodes(&mut self, abstract_self: &JSRef<Node>) -> Unrooted<NodeList> {
let roots = RootCollection::new();
match self.child_list {
None => {
let doc = self.owner_doc().root(&roots);
let window = doc.deref().window.root(&roots);
self.child_list.assign(Some(NodeList::new_child_list(&*window, abstract_self)));
Unrooted::new(self.child_list.get_ref().clone())
}
Some(ref list) => Unrooted::new(list.clone())
}
}
// http://dom.spec.whatwg.org/#dom-node-firstchild
pub fn GetFirstChild(&self) -> Option<Unrooted<Node>> {
self.first_child.clone().map(|node| Unrooted::new(node))
}
// http://dom.spec.whatwg.org/#dom-node-lastchild
pub fn GetLastChild(&self) -> Option<Unrooted<Node>> {
self.last_child.clone().map(|node| Unrooted::new(node))
}
// http://dom.spec.whatwg.org/#dom-node-previoussibling
pub fn GetPreviousSibling(&self) -> Option<Unrooted<Node>> {
self.prev_sibling.clone().map(|node| Unrooted::new(node))
}
// http://dom.spec.whatwg.org/#dom-node-nextsibling
pub fn GetNextSibling(&self) -> Option<Unrooted<Node>> {
self.next_sibling.clone().map(|node| Unrooted::new(node))
}
// http://dom.spec.whatwg.org/#dom-node-nodevalue
pub fn GetNodeValue(&self, abstract_self: &JSRef<Node>) -> Option<DOMString> {
match self.type_id {
CommentNodeTypeId |
TextNodeTypeId |
ProcessingInstructionNodeTypeId => {
let chardata: &JSRef<CharacterData> = CharacterDataCast::to_ref(abstract_self).unwrap();
Some(chardata.get().Data())
}
_ => {
None
}
}
}
// http://dom.spec.whatwg.org/#dom-node-nodevalue
pub fn SetNodeValue(&mut self, abstract_self: &mut JSRef<Node>, val: Option<DOMString>)
-> ErrorResult {
match self.type_id {
CommentNodeTypeId |
TextNodeTypeId |
ProcessingInstructionNodeTypeId => {
self.SetTextContent(abstract_self, val)
}
_ => Ok(())
}
}
// http://dom.spec.whatwg.org/#dom-node-textcontent
pub fn GetTextContent(&self, abstract_self: &JSRef<Node>) -> Option<DOMString> {
let roots = RootCollection::new();
match self.type_id {
DocumentFragmentNodeTypeId |
ElementNodeTypeId(..) => {
let mut content = ~"";
for node in abstract_self.traverse_preorder(&roots) {
if node.is_text() {
let text: &JSRef<Text> = TextCast::to_ref(&node).unwrap();
content.push_str(text.get().characterdata.data.as_slice());
}
}
Some(content)
}
CommentNodeTypeId |
TextNodeTypeId |
ProcessingInstructionNodeTypeId => {
let characterdata: &JSRef<CharacterData> = CharacterDataCast::to_ref(abstract_self).unwrap();
Some(characterdata.get().Data())
}
DoctypeNodeTypeId |
DocumentNodeTypeId => {
None
}
}
}
// http://dom.spec.whatwg.org/#dom-node-textcontent
pub fn SetTextContent(&mut self, abstract_self: &mut JSRef<Node>, value: Option<DOMString>)
-> ErrorResult {
let roots = RootCollection::new();
let value = null_str_as_empty(&value);
match self.type_id {
DocumentFragmentNodeTypeId |
ElementNodeTypeId(..) => {
// Step 1-2.
let node = if value.len() == 0 {
None
} else {
let document = self.owner_doc();
let document = document.root(&roots);
Some(NodeCast::from_unrooted(document.deref().CreateTextNode(&*document, value)))
}.root(&roots);
// Step 3.
Node::replace_all(node.root_ref(), abstract_self);
}
CommentNodeTypeId |
TextNodeTypeId |
ProcessingInstructionNodeTypeId => {
self.wait_until_safe_to_modify_dom();
let characterdata: &mut JSRef<CharacterData> = CharacterDataCast::to_mut_ref(abstract_self).unwrap();
characterdata.get_mut().data = value.clone();
// Notify the document that the content of this node is different
let document = self.owner_doc().root(&roots);
document.get().content_changed();
}
DoctypeNodeTypeId |
DocumentNodeTypeId => {}
}
Ok(())
}
// http://dom.spec.whatwg.org/#concept-node-adopt
pub fn adopt(node: &mut JSRef<Node>, document: &JSRef<Document>) {
let roots = RootCollection::new();
@ -1505,26 +1306,334 @@ impl Node {
Unrooted::new_rooted(&*copy)
}
//
// Low-level pointer stitching
//
pub fn set_parent_node(&mut self, new_parent_node: Option<JSRef<Node>>) {
let roots = RootCollection::new();
let doc = self.owner_doc().root(&roots);
doc.get().wait_until_safe_to_modify_dom();
self.parent_node.assign(new_parent_node);
}
pub fn set_first_child(&mut self, new_first_child: Option<JSRef<Node>>) {
let roots = RootCollection::new();
let doc = self.owner_doc().root(&roots);
doc.get().wait_until_safe_to_modify_dom();
self.first_child.assign(new_first_child);
}
pub fn set_last_child(&mut self, new_last_child: Option<JSRef<Node>>) {
let roots = RootCollection::new();
let doc = self.owner_doc().root(&roots);
doc.get().wait_until_safe_to_modify_dom();
self.last_child.assign(new_last_child);
}
pub fn set_prev_sibling(&mut self, new_prev_sibling: Option<JSRef<Node>>) {
let roots = RootCollection::new();
let doc = self.owner_doc().root(&roots);
doc.get().wait_until_safe_to_modify_dom();
self.prev_sibling.assign(new_prev_sibling);
}
pub fn set_next_sibling(&mut self, new_next_sibling: Option<JSRef<Node>>) {
let roots = RootCollection::new();
let doc = self.owner_doc().root(&roots);
doc.get().wait_until_safe_to_modify_dom();
self.next_sibling.assign(new_next_sibling);
}
pub fn get_hover_state(&self) -> bool {
self.flags.get_in_hover_state()
}
pub fn set_hover_state(&mut self, state: bool) {
self.flags.set_is_in_hover_state(state);
}
#[inline]
pub fn parent_node_ref<'a>(&'a self) -> Option<&'a JS<Node>> {
self.parent_node.as_ref()
}
#[inline]
pub fn first_child_ref<'a>(&'a self) -> Option<&'a JS<Node>> {
self.first_child.as_ref()
}
#[inline]
pub fn last_child_ref<'a>(&'a self) -> Option<&'a JS<Node>> {
self.last_child.as_ref()
}
#[inline]
pub fn prev_sibling_ref<'a>(&'a self) -> Option<&'a JS<Node>> {
self.prev_sibling.as_ref()
}
#[inline]
pub fn next_sibling_ref<'a>(&'a self) -> Option<&'a JS<Node>> {
self.next_sibling.as_ref()
}
pub unsafe fn get_hover_state_for_layout(&self) -> bool {
let unsafe_this: *Node = cast::transmute::<&Node,*Node>(self);
(*unsafe_this).flags.get_in_hover_state()
}
}
pub trait NodeMethods {
fn NodeType(&self) -> u16;
fn NodeName(&self, abstract_self: &JSRef<Node>) -> DOMString;
fn GetBaseURI(&self) -> Option<DOMString>;
fn GetOwnerDocument(&self) -> Option<Unrooted<Document>>;
fn GetParentNode(&self) -> Option<Unrooted<Node>>;
fn GetParentElement(&self) -> Option<Unrooted<Element>>;
fn HasChildNodes(&self) -> bool;
fn ChildNodes(&mut self, abstract_self: &JSRef<Node>) -> Unrooted<NodeList>;
fn GetFirstChild(&self) -> Option<Unrooted<Node>>;
fn GetLastChild(&self) -> Option<Unrooted<Node>>;
fn GetPreviousSibling(&self) -> Option<Unrooted<Node>>;
fn GetNextSibling(&self) -> Option<Unrooted<Node>>;
fn GetNodeValue(&self, abstract_self: &JSRef<Node>) -> Option<DOMString>;
fn SetNodeValue(&mut self, abstract_self: &mut JSRef<Node>, val: Option<DOMString>) -> ErrorResult;
fn GetTextContent(&self, abstract_self: &JSRef<Node>) -> Option<DOMString>;
fn SetTextContent(&mut self, abstract_self: &mut JSRef<Node>, value: Option<DOMString>) -> ErrorResult;
fn InsertBefore(&self, abstract_self: &mut JSRef<Node>, node: &mut JSRef<Node>, child: Option<JSRef<Node>>) -> Fallible<Unrooted<Node>>;
fn AppendChild(&self, abstract_self: &mut JSRef<Node>, node: &mut JSRef<Node>) -> Fallible<Unrooted<Node>>;
fn ReplaceChild(&self, parent: &mut JSRef<Node>, node: &mut JSRef<Node>, child: &mut JSRef<Node>) -> Fallible<Unrooted<Node>>;
fn RemoveChild(&self, abstract_self: &mut JSRef<Node>, node: &mut JSRef<Node>) -> Fallible<Unrooted<Node>>;
fn Normalize(&mut self, abstract_self: &mut JSRef<Node>);
fn CloneNode(&self, abstract_self: &mut JSRef<Node>, deep: bool) -> Unrooted<Node>;
fn IsEqualNode(&self, abstract_self: &JSRef<Node>, maybe_node: Option<JSRef<Node>>) -> bool;
fn CompareDocumentPosition(&self, abstract_self: &JSRef<Node>, other: &JSRef<Node>) -> u16;
fn Contains(&self, abstract_self: &JSRef<Node>, maybe_other: Option<JSRef<Node>>) -> bool;
fn LookupPrefix(&self, _prefix: Option<DOMString>) -> Option<DOMString>;
fn LookupNamespaceURI(&self, _namespace: Option<DOMString>) -> Option<DOMString>;
fn IsDefaultNamespace(&self, _namespace: Option<DOMString>) -> bool;
}
impl<'a> NodeMethods for JSRef<'a, Node> {
// http://dom.spec.whatwg.org/#dom-node-nodetype
fn NodeType(&self) -> u16 {
match self.type_id {
ElementNodeTypeId(_) => NodeConstants::ELEMENT_NODE,
TextNodeTypeId => NodeConstants::TEXT_NODE,
ProcessingInstructionNodeTypeId => NodeConstants::PROCESSING_INSTRUCTION_NODE,
CommentNodeTypeId => NodeConstants::COMMENT_NODE,
DocumentNodeTypeId => NodeConstants::DOCUMENT_NODE,
DoctypeNodeTypeId => NodeConstants::DOCUMENT_TYPE_NODE,
DocumentFragmentNodeTypeId => NodeConstants::DOCUMENT_FRAGMENT_NODE,
}
}
// http://dom.spec.whatwg.org/#dom-node-nodename
fn NodeName(&self, abstract_self: &JSRef<Node>) -> DOMString {
match self.type_id {
ElementNodeTypeId(..) => {
let elem: &JSRef<Element> = ElementCast::to_ref(abstract_self).unwrap();
elem.TagName()
}
TextNodeTypeId => ~"#text",
ProcessingInstructionNodeTypeId => {
let processing_instruction: &JSRef<ProcessingInstruction> =
ProcessingInstructionCast::to_ref(abstract_self).unwrap();
processing_instruction.Target()
}
CommentNodeTypeId => ~"#comment",
DoctypeNodeTypeId => {
let doctype: &JSRef<DocumentType> = DocumentTypeCast::to_ref(abstract_self).unwrap();
doctype.get().name.clone()
},
DocumentFragmentNodeTypeId => ~"#document-fragment",
DocumentNodeTypeId => ~"#document"
}
}
// http://dom.spec.whatwg.org/#dom-node-baseuri
fn GetBaseURI(&self) -> Option<DOMString> {
// FIXME (#1824) implement.
None
}
// http://dom.spec.whatwg.org/#dom-node-ownerdocument
fn GetOwnerDocument(&self) -> Option<Unrooted<Document>> {
match self.type_id {
ElementNodeTypeId(..) |
CommentNodeTypeId |
TextNodeTypeId |
ProcessingInstructionNodeTypeId |
DoctypeNodeTypeId |
DocumentFragmentNodeTypeId => Some(self.owner_doc()),
DocumentNodeTypeId => None
}
}
// http://dom.spec.whatwg.org/#dom-node-parentnode
fn GetParentNode(&self) -> Option<Unrooted<Node>> {
self.parent_node.clone().map(|node| Unrooted::new(node))
}
// http://dom.spec.whatwg.org/#dom-node-parentelement
fn GetParentElement(&self) -> Option<Unrooted<Element>> {
let roots = RootCollection::new();
self.parent_node.clone()
.and_then(|parent| {
let parent = parent.root(&roots);
ElementCast::to_ref(&*parent).map(|elem| {
Unrooted::new_rooted(elem)
})
})
}
// http://dom.spec.whatwg.org/#dom-node-haschildnodes
fn HasChildNodes(&self) -> bool {
self.first_child.is_some()
}
// http://dom.spec.whatwg.org/#dom-node-childnodes
fn ChildNodes(&mut self, abstract_self: &JSRef<Node>) -> Unrooted<NodeList> {
let roots = RootCollection::new();
match self.child_list {
None => (),
Some(ref list) => return Unrooted::new(list.clone()),
}
let doc = self.deref().owner_doc().root(&roots);
let window = doc.deref().window.root(&roots);
self.child_list.assign(Some(NodeList::new_child_list(&*window, abstract_self)));
Unrooted::new(self.child_list.get_ref().clone())
}
// http://dom.spec.whatwg.org/#dom-node-firstchild
fn GetFirstChild(&self) -> Option<Unrooted<Node>> {
self.first_child.clone().map(|node| Unrooted::new(node))
}
// http://dom.spec.whatwg.org/#dom-node-lastchild
fn GetLastChild(&self) -> Option<Unrooted<Node>> {
self.last_child.clone().map(|node| Unrooted::new(node))
}
// http://dom.spec.whatwg.org/#dom-node-previoussibling
fn GetPreviousSibling(&self) -> Option<Unrooted<Node>> {
self.prev_sibling.clone().map(|node| Unrooted::new(node))
}
// http://dom.spec.whatwg.org/#dom-node-nextsibling
fn GetNextSibling(&self) -> Option<Unrooted<Node>> {
self.next_sibling.clone().map(|node| Unrooted::new(node))
}
// http://dom.spec.whatwg.org/#dom-node-nodevalue
fn GetNodeValue(&self, abstract_self: &JSRef<Node>) -> Option<DOMString> {
match self.type_id {
CommentNodeTypeId |
TextNodeTypeId |
ProcessingInstructionNodeTypeId => {
let chardata: &JSRef<CharacterData> = CharacterDataCast::to_ref(abstract_self).unwrap();
Some(chardata.Data())
}
_ => {
None
}
}
}
// http://dom.spec.whatwg.org/#dom-node-nodevalue
fn SetNodeValue(&mut self, abstract_self: &mut JSRef<Node>, val: Option<DOMString>)
-> ErrorResult {
match self.type_id {
CommentNodeTypeId |
TextNodeTypeId |
ProcessingInstructionNodeTypeId => {
self.SetTextContent(abstract_self, val)
}
_ => Ok(())
}
}
// http://dom.spec.whatwg.org/#dom-node-textcontent
fn GetTextContent(&self, abstract_self: &JSRef<Node>) -> Option<DOMString> {
let roots = RootCollection::new();
match self.type_id {
DocumentFragmentNodeTypeId |
ElementNodeTypeId(..) => {
let mut content = ~"";
for node in abstract_self.traverse_preorder(&roots) {
if node.is_text() {
let text: &JSRef<Text> = TextCast::to_ref(&node).unwrap();
content.push_str(text.get().characterdata.data.as_slice());
}
}
Some(content)
}
CommentNodeTypeId |
TextNodeTypeId |
ProcessingInstructionNodeTypeId => {
let characterdata: &JSRef<CharacterData> = CharacterDataCast::to_ref(abstract_self).unwrap();
Some(characterdata.Data())
}
DoctypeNodeTypeId |
DocumentNodeTypeId => {
None
}
}
}
// http://dom.spec.whatwg.org/#dom-node-textcontent
fn SetTextContent(&mut self, abstract_self: &mut JSRef<Node>, value: Option<DOMString>)
-> ErrorResult {
let roots = RootCollection::new();
let value = null_str_as_empty(&value);
match self.type_id {
DocumentFragmentNodeTypeId |
ElementNodeTypeId(..) => {
// Step 1-2.
let node = if value.len() == 0 {
None
} else {
let document = self.owner_doc().root(&roots);
Some(NodeCast::from_unrooted(document.deref().CreateTextNode(&*document, value)))
}.root(&roots);
// Step 3.
Node::replace_all(node.root_ref(), abstract_self);
}
CommentNodeTypeId |
TextNodeTypeId |
ProcessingInstructionNodeTypeId => {
self.wait_until_safe_to_modify_dom();
let characterdata: &mut JSRef<CharacterData> = CharacterDataCast::to_mut_ref(abstract_self).unwrap();
characterdata.get_mut().data = value.clone();
// Notify the document that the content of this node is different
let document = self.owner_doc().root(&roots);
document.get().content_changed();
}
DoctypeNodeTypeId |
DocumentNodeTypeId => {}
}
Ok(())
}
// http://dom.spec.whatwg.org/#dom-node-insertbefore
pub fn InsertBefore(&self, abstract_self: &mut JSRef<Node>, node: &mut JSRef<Node>, child: Option<JSRef<Node>>)
fn InsertBefore(&self, abstract_self: &mut JSRef<Node>, node: &mut JSRef<Node>, child: Option<JSRef<Node>>)
-> Fallible<Unrooted<Node>> {
Node::pre_insert(node, abstract_self, child)
}
pub fn wait_until_safe_to_modify_dom(&self) {
let roots = RootCollection::new();
let document = self.owner_doc().root(&roots);
document.get().wait_until_safe_to_modify_dom();
}
// http://dom.spec.whatwg.org/#dom-node-appendchild
pub fn AppendChild(&self, abstract_self: &mut JSRef<Node>, node: &mut JSRef<Node>)
fn AppendChild(&self, abstract_self: &mut JSRef<Node>, node: &mut JSRef<Node>)
-> Fallible<Unrooted<Node>> {
Node::pre_insert(node, abstract_self, None)
}
// http://dom.spec.whatwg.org/#concept-node-replace
pub fn ReplaceChild(&self, parent: &mut JSRef<Node>, node: &mut JSRef<Node>, child: &mut JSRef<Node>)
fn ReplaceChild(&self, parent: &mut JSRef<Node>, node: &mut JSRef<Node>, child: &mut JSRef<Node>)
-> Fallible<Unrooted<Node>> {
let roots = RootCollection::new();
@ -1655,26 +1764,26 @@ impl Node {
}
// http://dom.spec.whatwg.org/#dom-node-removechild
pub fn RemoveChild(&self, abstract_self: &mut JSRef<Node>, node: &mut JSRef<Node>)
fn RemoveChild(&self, abstract_self: &mut JSRef<Node>, node: &mut JSRef<Node>)
-> Fallible<Unrooted<Node>> {
Node::pre_remove(node, abstract_self)
}
// http://dom.spec.whatwg.org/#dom-node-normalize
pub fn Normalize(&mut self, abstract_self: &mut JSRef<Node>) {
fn Normalize(&mut self, abstract_self: &mut JSRef<Node>) {
let roots = RootCollection::new();
let mut prev_text = None;
for mut child in self.children() {
if child.is_text() {
let mut child_alias = child.clone();
let characterdata: &JSRef<CharacterData> = CharacterDataCast::to_ref(&child).unwrap();
if characterdata.get().Length() == 0 {
if characterdata.Length() == 0 {
abstract_self.remove_child(&mut child_alias);
} else {
match prev_text {
Some(ref mut text_node) => {
let prev_characterdata: &mut JSRef<CharacterData> = CharacterDataCast::to_mut_ref(text_node).unwrap();
let _ = prev_characterdata.get_mut().AppendData(characterdata.get().Data());
let _ = prev_characterdata.AppendData(characterdata.Data());
abstract_self.remove_child(&mut child_alias);
},
None => prev_text = Some(child_alias)
@ -1682,7 +1791,7 @@ impl Node {
}
} else {
let mut c = child.clone();
child.get_mut().Normalize(&mut c);
child.Normalize(&mut c);
prev_text = None;
}
@ -1690,7 +1799,7 @@ impl Node {
}
// http://dom.spec.whatwg.org/#dom-node-clonenode
pub fn CloneNode(&self, abstract_self: &mut JSRef<Node>, deep: bool) -> Unrooted<Node> {
fn CloneNode(&self, abstract_self: &mut JSRef<Node>, deep: bool) -> Unrooted<Node> {
match deep {
true => Node::clone(abstract_self, None, CloneChildren),
false => Node::clone(abstract_self, None, DoNotCloneChildren)
@ -1698,7 +1807,7 @@ impl Node {
}
// http://dom.spec.whatwg.org/#dom-node-isequalnode
pub fn IsEqualNode(&self, abstract_self: &JSRef<Node>, maybe_node: Option<JSRef<Node>>) -> bool {
fn IsEqualNode(&self, abstract_self: &JSRef<Node>, maybe_node: Option<JSRef<Node>>) -> bool {
fn is_equal_doctype(node: &JSRef<Node>, other: &JSRef<Node>) -> bool {
let doctype: &JSRef<DocumentType> = DocumentTypeCast::to_ref(node).unwrap();
let other_doctype: &JSRef<DocumentType> = DocumentTypeCast::to_ref(other).unwrap();
@ -1775,7 +1884,7 @@ impl Node {
}
// http://dom.spec.whatwg.org/#dom-node-comparedocumentposition
pub fn CompareDocumentPosition(&self, abstract_self: &JSRef<Node>, other: &JSRef<Node>) -> u16 {
fn CompareDocumentPosition(&self, abstract_self: &JSRef<Node>, other: &JSRef<Node>) -> u16 {
let roots = RootCollection::new();
if abstract_self == other {
// step 2.
@ -1830,7 +1939,7 @@ impl Node {
}
// http://dom.spec.whatwg.org/#dom-node-contains
pub fn Contains(&self, abstract_self: &JSRef<Node>, maybe_other: Option<JSRef<Node>>) -> bool {
fn Contains(&self, abstract_self: &JSRef<Node>, maybe_other: Option<JSRef<Node>>) -> bool {
match maybe_other {
None => false,
Some(ref other) => abstract_self.is_inclusive_ancestor_of(other)
@ -1838,100 +1947,25 @@ impl Node {
}
// http://dom.spec.whatwg.org/#dom-node-lookupprefix
pub fn LookupPrefix(&self, _prefix: Option<DOMString>) -> Option<DOMString> {
fn LookupPrefix(&self, _prefix: Option<DOMString>) -> Option<DOMString> {
// FIXME (#1826) implement.
None
}
// http://dom.spec.whatwg.org/#dom-node-lookupnamespaceuri
pub fn LookupNamespaceURI(&self, _namespace: Option<DOMString>) -> Option<DOMString> {
fn LookupNamespaceURI(&self, _namespace: Option<DOMString>) -> Option<DOMString> {
// FIXME (#1826) implement.
None
}
// http://dom.spec.whatwg.org/#dom-node-isdefaultnamespace
pub fn IsDefaultNamespace(&self, _namespace: Option<DOMString>) -> bool {
fn IsDefaultNamespace(&self, _namespace: Option<DOMString>) -> bool {
// FIXME (#1826) implement.
false
}
//
// Low-level pointer stitching
//
pub fn set_parent_node(&mut self, new_parent_node: Option<JSRef<Node>>) {
let roots = RootCollection::new();
let doc = self.owner_doc().root(&roots);
doc.get().wait_until_safe_to_modify_dom();
self.parent_node.assign(new_parent_node);
}
pub fn set_first_child(&mut self, new_first_child: Option<JSRef<Node>>) {
let roots = RootCollection::new();
let doc = self.owner_doc().root(&roots);
doc.get().wait_until_safe_to_modify_dom();
self.first_child.assign(new_first_child);
}
pub fn set_last_child(&mut self, new_last_child: Option<JSRef<Node>>) {
let roots = RootCollection::new();
let doc = self.owner_doc().root(&roots);
doc.get().wait_until_safe_to_modify_dom();
self.last_child.assign(new_last_child);
}
pub fn set_prev_sibling(&mut self, new_prev_sibling: Option<JSRef<Node>>) {
let roots = RootCollection::new();
let doc = self.owner_doc().root(&roots);
doc.get().wait_until_safe_to_modify_dom();
self.prev_sibling.assign(new_prev_sibling);
}
pub fn set_next_sibling(&mut self, new_next_sibling: Option<JSRef<Node>>) {
let roots = RootCollection::new();
let doc = self.owner_doc().root(&roots);
doc.get().wait_until_safe_to_modify_dom();
self.next_sibling.assign(new_next_sibling);
}
pub fn get_hover_state(&self) -> bool {
self.flags.get_in_hover_state()
}
pub fn set_hover_state(&mut self, state: bool) {
self.flags.set_is_in_hover_state(state);
}
#[inline]
pub fn parent_node_ref<'a>(&'a self) -> Option<&'a JS<Node>> {
self.parent_node.as_ref()
}
#[inline]
pub fn first_child_ref<'a>(&'a self) -> Option<&'a JS<Node>> {
self.first_child.as_ref()
}
#[inline]
pub fn last_child_ref<'a>(&'a self) -> Option<&'a JS<Node>> {
self.last_child.as_ref()
}
#[inline]
pub fn prev_sibling_ref<'a>(&'a self) -> Option<&'a JS<Node>> {
self.prev_sibling.as_ref()
}
#[inline]
pub fn next_sibling_ref<'a>(&'a self) -> Option<&'a JS<Node>> {
self.next_sibling.as_ref()
}
pub unsafe fn get_hover_state_for_layout(&self) -> bool {
self.flags.get_in_hover_state()
}
}
impl Reflectable for Node {
fn reflector<'a>(&'a self) -> &'a Reflector {
self.eventtarget.reflector()

View file

@ -44,8 +44,16 @@ impl NodeList {
pub fn new_child_list(window: &JSRef<Window>, node: &JSRef<Node>) -> Unrooted<NodeList> {
NodeList::new(window, Children(node.unrooted()))
}
}
pub fn Length(&self) -> u32 {
pub trait NodeListMethods {
fn Length(&self) -> u32;
fn Item(&self, index: u32) -> Option<Unrooted<Node>>;
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Unrooted<Node>>;
}
impl<'a> NodeListMethods for JSRef<'a, NodeList> {
fn Length(&self) -> u32 {
let roots = RootCollection::new();
match self.list_type {
Simple(ref elems) => elems.len() as u32,
@ -56,7 +64,7 @@ impl NodeList {
}
}
pub fn Item(&self, index: u32) -> Option<Unrooted<Node>> {
fn Item(&self, index: u32) -> Option<Unrooted<Node>> {
let roots = RootCollection::new();
match self.list_type {
_ if index >= self.Length() => None,
@ -69,7 +77,7 @@ impl NodeList {
}
}
pub fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Unrooted<Node>> {
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Unrooted<Node>> {
let item = self.Item(index);
*found = item.is_some();
item

View file

@ -41,8 +41,13 @@ impl ProcessingInstruction {
}
}
impl ProcessingInstruction {
pub fn Target(&self) -> DOMString {
pub trait ProcessingInstructionMethods {
fn Target(&self) -> DOMString;
}
impl<'a> ProcessingInstructionMethods for JSRef<'a, ProcessingInstruction> {
fn Target(&self) -> DOMString {
self.target.clone()
}
}

View file

@ -22,192 +22,372 @@ pub struct TestBinding {
pub window: JS<Window>,
}
impl TestBinding {
pub fn BooleanAttribute(&self) -> bool { false }
pub fn SetBooleanAttribute(&self, _: bool) {}
pub fn ByteAttribute(&self) -> i8 { 0 }
pub fn SetByteAttribute(&self, _: i8) {}
pub fn OctetAttribute(&self) -> u8 { 0 }
pub fn SetOctetAttribute(&self, _: u8) {}
pub fn ShortAttribute(&self) -> i16 { 0 }
pub fn SetShortAttribute(&self, _: i16) {}
pub fn UnsignedShortAttribute(&self) -> u16 { 0 }
pub fn SetUnsignedShortAttribute(&self, _: u16) {}
pub fn LongAttribute(&self) -> i32 { 0 }
pub fn SetLongAttribute(&self, _: i32) {}
pub fn UnsignedLongAttribute(&self) -> u32 { 0 }
pub fn SetUnsignedLongAttribute(&self, _: u32) {}
pub fn LongLongAttribute(&self) -> i64 { 0 }
pub fn SetLongLongAttribute(&self, _: i64) {}
pub fn UnsignedLongLongAttribute(&self) -> u64 { 0 }
pub fn SetUnsignedLongLongAttribute(&self, _: u64) {}
pub fn FloatAttribute(&self) -> f32 { 0. }
pub fn SetFloatAttribute(&self, _: f32) {}
pub fn DoubleAttribute(&self) -> f64 { 0. }
pub fn SetDoubleAttribute(&self, _: f64) {}
pub fn StringAttribute(&self) -> DOMString { ~"" }
pub fn SetStringAttribute(&self, _: DOMString) {}
pub fn ByteStringAttribute(&self) -> ByteString { ByteString::new(vec!()) }
pub fn SetByteStringAttribute(&self, _: ByteString) {}
pub fn EnumAttribute(&self) -> TestEnum { _empty }
pub fn SetEnumAttribute(&self, _: TestEnum) {}
pub fn InterfaceAttribute(&self) -> Unrooted<Blob> {
pub trait TestBindingMethods {
fn BooleanAttribute(&self) -> bool;
fn SetBooleanAttribute(&self, _: bool);
fn ByteAttribute(&self) -> i8;
fn SetByteAttribute(&self, _: i8);
fn OctetAttribute(&self) -> u8;
fn SetOctetAttribute(&self, _: u8);
fn ShortAttribute(&self) -> i16;
fn SetShortAttribute(&self, _: i16);
fn UnsignedShortAttribute(&self) -> u16;
fn SetUnsignedShortAttribute(&self, _: u16);
fn LongAttribute(&self) -> i32;
fn SetLongAttribute(&self, _: i32);
fn UnsignedLongAttribute(&self) -> u32;
fn SetUnsignedLongAttribute(&self, _: u32);
fn LongLongAttribute(&self) -> i64;
fn SetLongLongAttribute(&self, _: i64);
fn UnsignedLongLongAttribute(&self) -> u64;
fn SetUnsignedLongLongAttribute(&self, _: u64);
fn FloatAttribute(&self) -> f32;
fn SetFloatAttribute(&self, _: f32);
fn DoubleAttribute(&self) -> f64;
fn SetDoubleAttribute(&self, _: f64);
fn StringAttribute(&self) -> DOMString;
fn SetStringAttribute(&self, _: DOMString);
fn ByteStringAttribute(&self) -> ByteString;
fn SetByteStringAttribute(&self, _: ByteString);
fn EnumAttribute(&self) -> TestEnum;
fn SetEnumAttribute(&self, _: TestEnum);
fn InterfaceAttribute(&self) -> Unrooted<Blob>;
fn SetInterfaceAttribute(&self, _: &JSRef<Blob>);
fn AnyAttribute(&self, _: *JSContext) -> JSVal;
fn SetAnyAttribute(&self, _: *JSContext, _: JSVal);
fn GetBooleanAttributeNullable(&self) -> Option<bool>;
fn SetBooleanAttributeNullable(&self, _: Option<bool>);
fn GetByteAttributeNullable(&self) -> Option<i8>;
fn SetByteAttributeNullable(&self, _: Option<i8>);
fn GetOctetAttributeNullable(&self) -> Option<u8>;
fn SetOctetAttributeNullable(&self, _: Option<u8>);
fn GetShortAttributeNullable(&self) -> Option<i16>;
fn SetShortAttributeNullable(&self, _: Option<i16>);
fn GetUnsignedShortAttributeNullable(&self) -> Option<u16>;
fn SetUnsignedShortAttributeNullable(&self, _: Option<u16>);
fn GetLongAttributeNullable(&self) -> Option<i32>;
fn SetLongAttributeNullable(&self, _: Option<i32>);
fn GetUnsignedLongAttributeNullable(&self) -> Option<u32>;
fn SetUnsignedLongAttributeNullable(&self, _: Option<u32>);
fn GetLongLongAttributeNullable(&self) -> Option<i64>;
fn SetLongLongAttributeNullable(&self, _: Option<i64>);
fn GetUnsignedLongLongAttributeNullable(&self) -> Option<u64>;
fn SetUnsignedLongLongAttributeNullable(&self, _: Option<u64>);
fn GetFloatAttributeNullable(&self) -> Option<f32>;
fn SetFloatAttributeNullable(&self, _: Option<f32>);
fn GetDoubleAttributeNullable(&self) -> Option<f64>;
fn SetDoubleAttributeNullable(&self, _: Option<f64>);
fn GetByteStringAttributeNullable(&self) -> Option<ByteString>;
fn SetByteStringAttributeNullable(&self, _: Option<ByteString>);
fn GetStringAttributeNullable(&self) -> Option<DOMString>;
fn SetStringAttributeNullable(&self, _: Option<DOMString>);
fn GetEnumAttributeNullable(&self) -> Option<TestEnum>;
fn GetInterfaceAttributeNullable(&self) -> Option<Unrooted<Blob>>;
fn SetInterfaceAttributeNullable(&self, _: Option<JSRef<Blob>>);
fn PassBoolean(&self, _: bool);
fn PassByte(&self, _: i8);
fn PassOctet(&self, _: u8);
fn PassShort(&self, _: i16);
fn PassUnsignedShort(&self, _: u16);
fn PassLong(&self, _: i32);
fn PassUnsignedLong(&self, _: u32);
fn PassLongLong(&self, _: i64);
fn PassUnsignedLongLong(&self, _: u64);
fn PassFloat(&self, _: f32);
fn PassDouble(&self, _: f64);
fn PassString(&self, _: DOMString);
fn PassByteString(&self, _: ByteString);
fn PassEnum(&self, _: TestEnum);
fn PassInterface(&self, _: &JSRef<Blob>);
fn PassUnion(&self, _: HTMLElementOrLong);
fn PassAny(&self, _: *JSContext, _: JSVal);
fn PassNullableBoolean(&self, _: Option<bool>);
fn PassNullableByte(&self, _: Option<i8>);
fn PassNullableOctet(&self, _: Option<u8>);
fn PassNullableShort(&self, _: Option<i16>);
fn PassNullableUnsignedShort(&self, _: Option<u16>);
fn PassNullableLong(&self, _: Option<i32>);
fn PassNullableUnsignedLong(&self, _: Option<u32>);
fn PassNullableLongLong(&self, _: Option<i64>);
fn PassNullableUnsignedLongLong(&self, _: Option<u64>);
fn PassNullableFloat(&self, _: Option<f32>);
fn PassNullableDouble(&self, _: Option<f64>);
fn PassNullableString(&self, _: Option<DOMString>);
fn PassNullableByteString(&self, _: Option<ByteString>) {}
// fn PassNullableEnum(&self, _: Option<TestEnum>);
fn PassNullableInterface(&self, _: Option<JSRef<Blob>>);
fn PassNullableUnion(&self, _: Option<HTMLElementOrLong>);
fn PassNullableAny(&self, _: *JSContext, _: Option<JSVal>);
fn PassOptionalBoolean(&self, _: Option<bool>);
fn PassOptionalByte(&self, _: Option<i8>);
fn PassOptionalOctet(&self, _: Option<u8>);
fn PassOptionalShort(&self, _: Option<i16>);
fn PassOptionalUnsignedShort(&self, _: Option<u16>);
fn PassOptionalLong(&self, _: Option<i32>);
fn PassOptionalUnsignedLong(&self, _: Option<u32>);
fn PassOptionalLongLong(&self, _: Option<i64>);
fn PassOptionalUnsignedLongLong(&self, _: Option<u64>);
fn PassOptionalFloat(&self, _: Option<f32>);
fn PassOptionalDouble(&self, _: Option<f64>);
fn PassOptionalString(&self, _: Option<DOMString>);
fn PassOptionalByteString(&self, _: Option<ByteString>) {}
fn PassOptionalEnum(&self, _: Option<TestEnum>);
fn PassOptionalInterface(&self, _: Option<JSRef<Blob>>);
fn PassOptionalUnion(&self, _: Option<HTMLElementOrLong>);
fn PassOptionalAny(&self, _: *JSContext, _: Option<JSVal>);
fn PassOptionalNullableBoolean(&self, _: Option<Option<bool>>);
fn PassOptionalNullableByte(&self, _: Option<Option<i8>>);
fn PassOptionalNullableOctet(&self, _: Option<Option<u8>>);
fn PassOptionalNullableShort(&self, _: Option<Option<i16>>);
fn PassOptionalNullableUnsignedShort(&self, _: Option<Option<u16>>);
fn PassOptionalNullableLong(&self, _: Option<Option<i32>>);
fn PassOptionalNullableUnsignedLong(&self, _: Option<Option<u32>>);
fn PassOptionalNullableLongLong(&self, _: Option<Option<i64>>);
fn PassOptionalNullableUnsignedLongLong(&self, _: Option<Option<u64>>);
fn PassOptionalNullableFloat(&self, _: Option<Option<f32>>);
fn PassOptionalNullableDouble(&self, _: Option<Option<f64>>);
fn PassOptionalNullableString(&self, _: Option<Option<DOMString>>);
fn PassOptionalNullableByteString(&self, _: Option<Option<ByteString>>) {}
// fn PassOptionalNullableEnum(&self, _: Option<Option<TestEnum>>);
fn PassOptionalNullableInterface(&self, _: Option<Option<JS<Blob>>>);
fn PassOptionalNullableUnion(&self, _: Option<Option<HTMLElementOrLong>>);
fn PassOptionalBooleanWithDefault(&self, _: bool);
fn PassOptionalByteWithDefault(&self, _: i8);
fn PassOptionalOctetWithDefault(&self, _: u8);
fn PassOptionalShortWithDefault(&self, _: i16);
fn PassOptionalUnsignedShortWithDefault(&self, _: u16);
fn PassOptionalLongWithDefault(&self, _: i32);
fn PassOptionalUnsignedLongWithDefault(&self, _: u32);
fn PassOptionalLongLongWithDefault(&self, _: i64);
fn PassOptionalUnsignedLongLongWithDefault(&self, _: u64);
fn PassOptionalStringWithDefault(&self, _: DOMString);
fn PassOptionalEnumWithDefault(&self, _: TestEnum);
fn PassOptionalNullableBooleanWithDefault(&self, _: Option<bool>);
fn PassOptionalNullableByteWithDefault(&self, _: Option<i8>);
fn PassOptionalNullableOctetWithDefault(&self, _: Option<u8>);
fn PassOptionalNullableShortWithDefault(&self, _: Option<i16>);
fn PassOptionalNullableUnsignedShortWithDefault(&self, _: Option<u16>);
fn PassOptionalNullableLongWithDefault(&self, _: Option<i32>);
fn PassOptionalNullableUnsignedLongWithDefault(&self, _: Option<u32>);
fn PassOptionalNullableLongLongWithDefault(&self, _: Option<i64>);
fn PassOptionalNullableUnsignedLongLongWithDefault(&self, _: Option<u64>);
fn PassOptionalNullableFloatWithDefault(&self, _: Option<f32>);
fn PassOptionalNullableDoubleWithDefault(&self, _: Option<f64>);
fn PassOptionalNullableStringWithDefault(&self, _: Option<DOMString>);
fn PassOptionalNullableByteStringWithDefault(&self, _: Option<ByteString>) {}
// fn PassOptionalNullableEnumWithDefault(&self, _: Option<TestEnum>);
fn PassOptionalNullableInterfaceWithDefault(&self, _: Option<JSRef<Blob>>);
fn PassOptionalNullableUnionWithDefault(&self, _: Option<HTMLElementOrLong>);
fn PassOptionalAnyWithDefault(&self, _: *JSContext, _: JSVal);
fn PassOptionalNullableBooleanWithNonNullDefault(&self, _: Option<bool>);
fn PassOptionalNullableByteWithNonNullDefault(&self, _: Option<i8>);
fn PassOptionalNullableOctetWithNonNullDefault(&self, _: Option<u8>);
fn PassOptionalNullableShortWithNonNullDefault(&self, _: Option<i16>);
fn PassOptionalNullableUnsignedShortWithNonNullDefault(&self, _: Option<u16>);
fn PassOptionalNullableLongWithNonNullDefault(&self, _: Option<i32>);
fn PassOptionalNullableUnsignedLongWithNonNullDefault(&self, _: Option<u32>);
fn PassOptionalNullableLongLongWithNonNullDefault(&self, _: Option<i64>);
fn PassOptionalNullableUnsignedLongLongWithNonNullDefault(&self, _: Option<u64>);
// fn PassOptionalNullableFloatWithNonNullDefault(&self, _: Option<f32>);
// fn PassOptionalNullableDoubleWithNonNullDefault(&self, _: Option<f64>);
fn PassOptionalNullableStringWithNonNullDefault(&self, _: Option<DOMString>);
// fn PassOptionalNullableEnumWithNonNullDefault(&self, _: Option<TestEnum>);
}
impl<'a> TestBindingMethods for JSRef<'a, TestBinding> {
fn BooleanAttribute(&self) -> bool { false }
fn SetBooleanAttribute(&self, _: bool) {}
fn ByteAttribute(&self) -> i8 { 0 }
fn SetByteAttribute(&self, _: i8) {}
fn OctetAttribute(&self) -> u8 { 0 }
fn SetOctetAttribute(&self, _: u8) {}
fn ShortAttribute(&self) -> i16 { 0 }
fn SetShortAttribute(&self, _: i16) {}
fn UnsignedShortAttribute(&self) -> u16 { 0 }
fn SetUnsignedShortAttribute(&self, _: u16) {}
fn LongAttribute(&self) -> i32 { 0 }
fn SetLongAttribute(&self, _: i32) {}
fn UnsignedLongAttribute(&self) -> u32 { 0 }
fn SetUnsignedLongAttribute(&self, _: u32) {}
fn LongLongAttribute(&self) -> i64 { 0 }
fn SetLongLongAttribute(&self, _: i64) {}
fn UnsignedLongLongAttribute(&self) -> u64 { 0 }
fn SetUnsignedLongLongAttribute(&self, _: u64) {}
fn FloatAttribute(&self) -> f32 { 0. }
fn SetFloatAttribute(&self, _: f32) {}
fn DoubleAttribute(&self) -> f64 { 0. }
fn SetDoubleAttribute(&self, _: f64) {}
fn StringAttribute(&self) -> DOMString { ~"" }
fn SetStringAttribute(&self, _: DOMString) {}
fn ByteStringAttribute(&self) -> ByteString { ByteString::new(vec!()) }
fn SetByteStringAttribute(&self, _: ByteString) {}
fn EnumAttribute(&self) -> TestEnum { _empty }
fn SetEnumAttribute(&self, _: TestEnum) {}
fn InterfaceAttribute(&self) -> Unrooted<Blob> {
let roots = RootCollection::new();
let window = self.window.root(&roots);
Blob::new(&*window)
}
pub fn SetInterfaceAttribute(&self, _: &JSRef<Blob>) {}
pub fn AnyAttribute(&self, _: *JSContext) -> JSVal { NullValue() }
pub fn SetAnyAttribute(&self, _: *JSContext, _: JSVal) {}
fn SetInterfaceAttribute(&self, _: &JSRef<Blob>) {}
fn AnyAttribute(&self, _: *JSContext) -> JSVal { NullValue() }
fn SetAnyAttribute(&self, _: *JSContext, _: JSVal) {}
pub fn GetBooleanAttributeNullable(&self) -> Option<bool> { Some(false) }
pub fn SetBooleanAttributeNullable(&self, _: Option<bool>) {}
pub fn GetByteAttributeNullable(&self) -> Option<i8> { Some(0) }
pub fn SetByteAttributeNullable(&self, _: Option<i8>) {}
pub fn GetOctetAttributeNullable(&self) -> Option<u8> { Some(0) }
pub fn SetOctetAttributeNullable(&self, _: Option<u8>) {}
pub fn GetShortAttributeNullable(&self) -> Option<i16> { Some(0) }
pub fn SetShortAttributeNullable(&self, _: Option<i16>) {}
pub fn GetUnsignedShortAttributeNullable(&self) -> Option<u16> { Some(0) }
pub fn SetUnsignedShortAttributeNullable(&self, _: Option<u16>) {}
pub fn GetLongAttributeNullable(&self) -> Option<i32> { Some(0) }
pub fn SetLongAttributeNullable(&self, _: Option<i32>) {}
pub fn GetUnsignedLongAttributeNullable(&self) -> Option<u32> { Some(0) }
pub fn SetUnsignedLongAttributeNullable(&self, _: Option<u32>) {}
pub fn GetLongLongAttributeNullable(&self) -> Option<i64> { Some(0) }
pub fn SetLongLongAttributeNullable(&self, _: Option<i64>) {}
pub fn GetUnsignedLongLongAttributeNullable(&self) -> Option<u64> { Some(0) }
pub fn SetUnsignedLongLongAttributeNullable(&self, _: Option<u64>) {}
pub fn GetFloatAttributeNullable(&self) -> Option<f32> { Some(0.) }
pub fn SetFloatAttributeNullable(&self, _: Option<f32>) {}
pub fn GetDoubleAttributeNullable(&self) -> Option<f64> { Some(0.) }
pub fn SetDoubleAttributeNullable(&self, _: Option<f64>) {}
pub fn GetByteStringAttributeNullable(&self) -> Option<ByteString> { Some(ByteString::new(vec!())) }
pub fn SetByteStringAttributeNullable(&self, _: Option<ByteString>) {}
pub fn GetStringAttributeNullable(&self) -> Option<DOMString> { Some(~"") }
pub fn SetStringAttributeNullable(&self, _: Option<DOMString>) {}
pub fn GetEnumAttributeNullable(&self) -> Option<TestEnum> { Some(_empty) }
pub fn GetInterfaceAttributeNullable(&self) -> Option<Unrooted<Blob>> {
fn GetBooleanAttributeNullable(&self) -> Option<bool> { Some(false) }
fn SetBooleanAttributeNullable(&self, _: Option<bool>) {}
fn GetByteAttributeNullable(&self) -> Option<i8> { Some(0) }
fn SetByteAttributeNullable(&self, _: Option<i8>) {}
fn GetOctetAttributeNullable(&self) -> Option<u8> { Some(0) }
fn SetOctetAttributeNullable(&self, _: Option<u8>) {}
fn GetShortAttributeNullable(&self) -> Option<i16> { Some(0) }
fn SetShortAttributeNullable(&self, _: Option<i16>) {}
fn GetUnsignedShortAttributeNullable(&self) -> Option<u16> { Some(0) }
fn SetUnsignedShortAttributeNullable(&self, _: Option<u16>) {}
fn GetLongAttributeNullable(&self) -> Option<i32> { Some(0) }
fn SetLongAttributeNullable(&self, _: Option<i32>) {}
fn GetUnsignedLongAttributeNullable(&self) -> Option<u32> { Some(0) }
fn SetUnsignedLongAttributeNullable(&self, _: Option<u32>) {}
fn GetLongLongAttributeNullable(&self) -> Option<i64> { Some(0) }
fn SetLongLongAttributeNullable(&self, _: Option<i64>) {}
fn GetUnsignedLongLongAttributeNullable(&self) -> Option<u64> { Some(0) }
fn SetUnsignedLongLongAttributeNullable(&self, _: Option<u64>) {}
fn GetFloatAttributeNullable(&self) -> Option<f32> { Some(0.) }
fn SetFloatAttributeNullable(&self, _: Option<f32>) {}
fn GetDoubleAttributeNullable(&self) -> Option<f64> { Some(0.) }
fn SetDoubleAttributeNullable(&self, _: Option<f64>) {}
fn GetByteStringAttributeNullable(&self) -> Option<ByteString> { Some(ByteString::new(vec!())) }
fn SetByteStringAttributeNullable(&self, _: Option<ByteString>) {}
fn GetStringAttributeNullable(&self) -> Option<DOMString> { Some(~"") }
fn SetStringAttributeNullable(&self, _: Option<DOMString>) {}
fn GetEnumAttributeNullable(&self) -> Option<TestEnum> { Some(_empty) }
fn GetInterfaceAttributeNullable(&self) -> Option<Unrooted<Blob>> {
let roots = RootCollection::new();
let window = self.window.root(&roots);
Some(Blob::new(&(*window)))
}
pub fn SetInterfaceAttributeNullable(&self, _: Option<JSRef<Blob>>) {}
fn SetInterfaceAttributeNullable(&self, _: Option<JSRef<Blob>>) {}
pub fn PassBoolean(&self, _: bool) {}
pub fn PassByte(&self, _: i8) {}
pub fn PassOctet(&self, _: u8) {}
pub fn PassShort(&self, _: i16) {}
pub fn PassUnsignedShort(&self, _: u16) {}
pub fn PassLong(&self, _: i32) {}
pub fn PassUnsignedLong(&self, _: u32) {}
pub fn PassLongLong(&self, _: i64) {}
pub fn PassUnsignedLongLong(&self, _: u64) {}
pub fn PassFloat(&self, _: f32) {}
pub fn PassDouble(&self, _: f64) {}
pub fn PassString(&self, _: DOMString) {}
pub fn PassByteString(&self, _: ByteString) {}
pub fn PassEnum(&self, _: TestEnum) {}
pub fn PassInterface(&self, _: &JSRef<Blob>) {}
pub fn PassUnion(&self, _: HTMLElementOrLong) {}
pub fn PassAny(&self, _: *JSContext, _: JSVal) {}
fn PassBoolean(&self, _: bool) {}
fn PassByte(&self, _: i8) {}
fn PassOctet(&self, _: u8) {}
fn PassShort(&self, _: i16) {}
fn PassUnsignedShort(&self, _: u16) {}
fn PassLong(&self, _: i32) {}
fn PassUnsignedLong(&self, _: u32) {}
fn PassLongLong(&self, _: i64) {}
fn PassUnsignedLongLong(&self, _: u64) {}
fn PassFloat(&self, _: f32) {}
fn PassDouble(&self, _: f64) {}
fn PassString(&self, _: DOMString) {}
fn PassByteString(&self, _: ByteString) {}
fn PassEnum(&self, _: TestEnum) {}
fn PassInterface(&self, _: &JSRef<Blob>) {}
fn PassUnion(&self, _: HTMLElementOrLong) {}
fn PassAny(&self, _: *JSContext, _: JSVal) {}
pub fn PassNullableBoolean(&self, _: Option<bool>) {}
pub fn PassNullableByte(&self, _: Option<i8>) {}
pub fn PassNullableOctet(&self, _: Option<u8>) {}
pub fn PassNullableShort(&self, _: Option<i16>) {}
pub fn PassNullableUnsignedShort(&self, _: Option<u16>) {}
pub fn PassNullableLong(&self, _: Option<i32>) {}
pub fn PassNullableUnsignedLong(&self, _: Option<u32>) {}
pub fn PassNullableLongLong(&self, _: Option<i64>) {}
pub fn PassNullableUnsignedLongLong(&self, _: Option<u64>) {}
pub fn PassNullableFloat(&self, _: Option<f32>) {}
pub fn PassNullableDouble(&self, _: Option<f64>) {}
pub fn PassNullableString(&self, _: Option<DOMString>) {}
pub fn PassNullableByteString(&self, _: Option<ByteString>) {}
// pub fn PassNullableEnum(&self, _: Option<TestEnum>) {}
pub fn PassNullableInterface(&self, _: Option<JSRef<Blob>>) {}
pub fn PassNullableUnion(&self, _: Option<HTMLElementOrLong>) {}
pub fn PassNullableAny(&self, _: *JSContext, _: Option<JSVal>) {}
fn PassNullableBoolean(&self, _: Option<bool>) {}
fn PassNullableByte(&self, _: Option<i8>) {}
fn PassNullableOctet(&self, _: Option<u8>) {}
fn PassNullableShort(&self, _: Option<i16>) {}
fn PassNullableUnsignedShort(&self, _: Option<u16>) {}
fn PassNullableLong(&self, _: Option<i32>) {}
fn PassNullableUnsignedLong(&self, _: Option<u32>) {}
fn PassNullableLongLong(&self, _: Option<i64>) {}
fn PassNullableUnsignedLongLong(&self, _: Option<u64>) {}
fn PassNullableFloat(&self, _: Option<f32>) {}
fn PassNullableDouble(&self, _: Option<f64>) {}
fn PassNullableString(&self, _: Option<DOMString>) {}
fn PassNullableByteString(&self, _: Option<ByteString>) {}
// fn PassNullableEnum(&self, _: Option<TestEnum>) {}
fn PassNullableInterface(&self, _: Option<JSRef<Blob>>) {}
fn PassNullableUnion(&self, _: Option<HTMLElementOrLong>) {}
fn PassNullableAny(&self, _: *JSContext, _: Option<JSVal>) {}
pub fn PassOptionalBoolean(&self, _: Option<bool>) {}
pub fn PassOptionalByte(&self, _: Option<i8>) {}
pub fn PassOptionalOctet(&self, _: Option<u8>) {}
pub fn PassOptionalShort(&self, _: Option<i16>) {}
pub fn PassOptionalUnsignedShort(&self, _: Option<u16>) {}
pub fn PassOptionalLong(&self, _: Option<i32>) {}
pub fn PassOptionalUnsignedLong(&self, _: Option<u32>) {}
pub fn PassOptionalLongLong(&self, _: Option<i64>) {}
pub fn PassOptionalUnsignedLongLong(&self, _: Option<u64>) {}
pub fn PassOptionalFloat(&self, _: Option<f32>) {}
pub fn PassOptionalDouble(&self, _: Option<f64>) {}
pub fn PassOptionalString(&self, _: Option<DOMString>) {}
pub fn PassOptionalByteString(&self, _: Option<ByteString>) {}
pub fn PassOptionalEnum(&self, _: Option<TestEnum>) {}
pub fn PassOptionalInterface(&self, _: Option<JSRef<Blob>>) {}
pub fn PassOptionalUnion(&self, _: Option<HTMLElementOrLong>) {}
pub fn PassOptionalAny(&self, _: *JSContext, _: Option<JSVal>) {}
fn PassOptionalBoolean(&self, _: Option<bool>) {}
fn PassOptionalByte(&self, _: Option<i8>) {}
fn PassOptionalOctet(&self, _: Option<u8>) {}
fn PassOptionalShort(&self, _: Option<i16>) {}
fn PassOptionalUnsignedShort(&self, _: Option<u16>) {}
fn PassOptionalLong(&self, _: Option<i32>) {}
fn PassOptionalUnsignedLong(&self, _: Option<u32>) {}
fn PassOptionalLongLong(&self, _: Option<i64>) {}
fn PassOptionalUnsignedLongLong(&self, _: Option<u64>) {}
fn PassOptionalFloat(&self, _: Option<f32>) {}
fn PassOptionalDouble(&self, _: Option<f64>) {}
fn PassOptionalString(&self, _: Option<DOMString>) {}
fn PassOptionalByteString(&self, _: Option<ByteString>) {}
fn PassOptionalEnum(&self, _: Option<TestEnum>) {}
fn PassOptionalInterface(&self, _: Option<JSRef<Blob>>) {}
fn PassOptionalUnion(&self, _: Option<HTMLElementOrLong>) {}
fn PassOptionalAny(&self, _: *JSContext, _: Option<JSVal>) {}
pub fn PassOptionalNullableBoolean(&self, _: Option<Option<bool>>) {}
pub fn PassOptionalNullableByte(&self, _: Option<Option<i8>>) {}
pub fn PassOptionalNullableOctet(&self, _: Option<Option<u8>>) {}
pub fn PassOptionalNullableShort(&self, _: Option<Option<i16>>) {}
pub fn PassOptionalNullableUnsignedShort(&self, _: Option<Option<u16>>) {}
pub fn PassOptionalNullableLong(&self, _: Option<Option<i32>>) {}
pub fn PassOptionalNullableUnsignedLong(&self, _: Option<Option<u32>>) {}
pub fn PassOptionalNullableLongLong(&self, _: Option<Option<i64>>) {}
pub fn PassOptionalNullableUnsignedLongLong(&self, _: Option<Option<u64>>) {}
pub fn PassOptionalNullableFloat(&self, _: Option<Option<f32>>) {}
pub fn PassOptionalNullableDouble(&self, _: Option<Option<f64>>) {}
pub fn PassOptionalNullableString(&self, _: Option<Option<DOMString>>) {}
pub fn PassOptionalNullableByteString(&self, _: Option<Option<ByteString>>) {}
// pub fn PassOptionalNullableEnum(&self, _: Option<Option<TestEnum>>) {}
pub fn PassOptionalNullableInterface(&self, _: Option<Option<JS<Blob>>>) {}
pub fn PassOptionalNullableUnion(&self, _: Option<Option<HTMLElementOrLong>>) {}
fn PassOptionalNullableBoolean(&self, _: Option<Option<bool>>) {}
fn PassOptionalNullableByte(&self, _: Option<Option<i8>>) {}
fn PassOptionalNullableOctet(&self, _: Option<Option<u8>>) {}
fn PassOptionalNullableShort(&self, _: Option<Option<i16>>) {}
fn PassOptionalNullableUnsignedShort(&self, _: Option<Option<u16>>) {}
fn PassOptionalNullableLong(&self, _: Option<Option<i32>>) {}
fn PassOptionalNullableUnsignedLong(&self, _: Option<Option<u32>>) {}
fn PassOptionalNullableLongLong(&self, _: Option<Option<i64>>) {}
fn PassOptionalNullableUnsignedLongLong(&self, _: Option<Option<u64>>) {}
fn PassOptionalNullableFloat(&self, _: Option<Option<f32>>) {}
fn PassOptionalNullableDouble(&self, _: Option<Option<f64>>) {}
fn PassOptionalNullableString(&self, _: Option<Option<DOMString>>) {}
fn PassOptionalNullableByteString(&self, _: Option<Option<ByteString>>) {}
// fn PassOptionalNullableEnum(&self, _: Option<Option<TestEnum>>) {}
fn PassOptionalNullableInterface(&self, _: Option<Option<JS<Blob>>>) {}
fn PassOptionalNullableUnion(&self, _: Option<Option<HTMLElementOrLong>>) {}
pub fn PassOptionalBooleanWithDefault(&self, _: bool) {}
pub fn PassOptionalByteWithDefault(&self, _: i8) {}
pub fn PassOptionalOctetWithDefault(&self, _: u8) {}
pub fn PassOptionalShortWithDefault(&self, _: i16) {}
pub fn PassOptionalUnsignedShortWithDefault(&self, _: u16) {}
pub fn PassOptionalLongWithDefault(&self, _: i32) {}
pub fn PassOptionalUnsignedLongWithDefault(&self, _: u32) {}
pub fn PassOptionalLongLongWithDefault(&self, _: i64) {}
pub fn PassOptionalUnsignedLongLongWithDefault(&self, _: u64) {}
pub fn PassOptionalStringWithDefault(&self, _: DOMString) {}
pub fn PassOptionalEnumWithDefault(&self, _: TestEnum) {}
fn PassOptionalBooleanWithDefault(&self, _: bool) {}
fn PassOptionalByteWithDefault(&self, _: i8) {}
fn PassOptionalOctetWithDefault(&self, _: u8) {}
fn PassOptionalShortWithDefault(&self, _: i16) {}
fn PassOptionalUnsignedShortWithDefault(&self, _: u16) {}
fn PassOptionalLongWithDefault(&self, _: i32) {}
fn PassOptionalUnsignedLongWithDefault(&self, _: u32) {}
fn PassOptionalLongLongWithDefault(&self, _: i64) {}
fn PassOptionalUnsignedLongLongWithDefault(&self, _: u64) {}
fn PassOptionalStringWithDefault(&self, _: DOMString) {}
fn PassOptionalEnumWithDefault(&self, _: TestEnum) {}
pub fn PassOptionalNullableBooleanWithDefault(&self, _: Option<bool>) {}
pub fn PassOptionalNullableByteWithDefault(&self, _: Option<i8>) {}
pub fn PassOptionalNullableOctetWithDefault(&self, _: Option<u8>) {}
pub fn PassOptionalNullableShortWithDefault(&self, _: Option<i16>) {}
pub fn PassOptionalNullableUnsignedShortWithDefault(&self, _: Option<u16>) {}
pub fn PassOptionalNullableLongWithDefault(&self, _: Option<i32>) {}
pub fn PassOptionalNullableUnsignedLongWithDefault(&self, _: Option<u32>) {}
pub fn PassOptionalNullableLongLongWithDefault(&self, _: Option<i64>) {}
pub fn PassOptionalNullableUnsignedLongLongWithDefault(&self, _: Option<u64>) {}
pub fn PassOptionalNullableFloatWithDefault(&self, _: Option<f32>) {}
pub fn PassOptionalNullableDoubleWithDefault(&self, _: Option<f64>) {}
pub fn PassOptionalNullableStringWithDefault(&self, _: Option<DOMString>) {}
pub fn PassOptionalNullableByteStringWithDefault(&self, _: Option<ByteString>) {}
// pub fn PassOptionalNullableEnumWithDefault(&self, _: Option<TestEnum>) {}
pub fn PassOptionalNullableInterfaceWithDefault(&self, _: Option<JSRef<Blob>>) {}
pub fn PassOptionalNullableUnionWithDefault(&self, _: Option<HTMLElementOrLong>) {}
pub fn PassOptionalAnyWithDefault(&self, _: *JSContext, _: JSVal) {}
fn PassOptionalNullableBooleanWithDefault(&self, _: Option<bool>) {}
fn PassOptionalNullableByteWithDefault(&self, _: Option<i8>) {}
fn PassOptionalNullableOctetWithDefault(&self, _: Option<u8>) {}
fn PassOptionalNullableShortWithDefault(&self, _: Option<i16>) {}
fn PassOptionalNullableUnsignedShortWithDefault(&self, _: Option<u16>) {}
fn PassOptionalNullableLongWithDefault(&self, _: Option<i32>) {}
fn PassOptionalNullableUnsignedLongWithDefault(&self, _: Option<u32>) {}
fn PassOptionalNullableLongLongWithDefault(&self, _: Option<i64>) {}
fn PassOptionalNullableUnsignedLongLongWithDefault(&self, _: Option<u64>) {}
fn PassOptionalNullableFloatWithDefault(&self, _: Option<f32>) {}
fn PassOptionalNullableDoubleWithDefault(&self, _: Option<f64>) {}
fn PassOptionalNullableStringWithDefault(&self, _: Option<DOMString>) {}
fn PassOptionalNullableByteStringWithDefault(&self, _: Option<ByteString>) {}
// fn PassOptionalNullableEnumWithDefault(&self, _: Option<TestEnum>) {}
fn PassOptionalNullableInterfaceWithDefault(&self, _: Option<JSRef<Blob>>) {}
fn PassOptionalNullableUnionWithDefault(&self, _: Option<HTMLElementOrLong>) {}
fn PassOptionalAnyWithDefault(&self, _: *JSContext, _: JSVal) {}
pub fn PassOptionalNullableBooleanWithNonNullDefault(&self, _: Option<bool>) {}
pub fn PassOptionalNullableByteWithNonNullDefault(&self, _: Option<i8>) {}
pub fn PassOptionalNullableOctetWithNonNullDefault(&self, _: Option<u8>) {}
pub fn PassOptionalNullableShortWithNonNullDefault(&self, _: Option<i16>) {}
pub fn PassOptionalNullableUnsignedShortWithNonNullDefault(&self, _: Option<u16>) {}
pub fn PassOptionalNullableLongWithNonNullDefault(&self, _: Option<i32>) {}
pub fn PassOptionalNullableUnsignedLongWithNonNullDefault(&self, _: Option<u32>) {}
pub fn PassOptionalNullableLongLongWithNonNullDefault(&self, _: Option<i64>) {}
pub fn PassOptionalNullableUnsignedLongLongWithNonNullDefault(&self, _: Option<u64>) {}
// pub fn PassOptionalNullableFloatWithNonNullDefault(&self, _: Option<f32>) {}
// pub fn PassOptionalNullableDoubleWithNonNullDefault(&self, _: Option<f64>) {}
pub fn PassOptionalNullableStringWithNonNullDefault(&self, _: Option<DOMString>) {}
// pub fn PassOptionalNullableEnumWithNonNullDefault(&self, _: Option<TestEnum>) {}
fn PassOptionalNullableBooleanWithNonNullDefault(&self, _: Option<bool>) {}
fn PassOptionalNullableByteWithNonNullDefault(&self, _: Option<i8>) {}
fn PassOptionalNullableOctetWithNonNullDefault(&self, _: Option<u8>) {}
fn PassOptionalNullableShortWithNonNullDefault(&self, _: Option<i16>) {}
fn PassOptionalNullableUnsignedShortWithNonNullDefault(&self, _: Option<u16>) {}
fn PassOptionalNullableLongWithNonNullDefault(&self, _: Option<i32>) {}
fn PassOptionalNullableUnsignedLongWithNonNullDefault(&self, _: Option<u32>) {}
fn PassOptionalNullableLongLongWithNonNullDefault(&self, _: Option<i64>) {}
fn PassOptionalNullableUnsignedLongLongWithNonNullDefault(&self, _: Option<u64>) {}
// fn PassOptionalNullableFloatWithNonNullDefault(&self, _: Option<f32>) {}
// fn PassOptionalNullableDoubleWithNonNullDefault(&self, _: Option<f64>) {}
fn PassOptionalNullableStringWithNonNullDefault(&self, _: Option<DOMString>) {}
// fn PassOptionalNullableEnumWithNonNullDefault(&self, _: Option<TestEnum>) {}
}
impl Reflectable for TestBinding {

View file

@ -10,7 +10,7 @@ use dom::characterdata::CharacterData;
use dom::document::Document;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
use dom::node::{Node, TextNodeTypeId};
use dom::window::Window;
use dom::window::{Window, WindowMethods};
use servo_util::str::DOMString;
/// An HTML text node.
@ -42,16 +42,23 @@ impl Text {
pub fn Constructor(owner: &JSRef<Window>, text: DOMString) -> Fallible<Unrooted<Text>> {
let roots = RootCollection::new();
let document = owner.get().Document();
let document = document.root(&roots);
Ok(Text::new(text.clone(), &document.root_ref()))
let document = owner.Document().root(&roots);
Ok(Text::new(text.clone(), &*document))
}
}
pub fn SplitText(&self, _offset: u32) -> Fallible<Unrooted<Text>> {
pub trait TextMethods {
fn SplitText(&self, _offset: u32) -> Fallible<Unrooted<Text>>;
fn GetWholeText(&self) -> Fallible<DOMString>;
}
impl<'a> TextMethods for JSRef<'a, Text> {
fn SplitText(&self, _offset: u32) -> Fallible<Unrooted<Text>> {
fail!("unimplemented")
}
pub fn GetWholeText(&self) -> Fallible<DOMString> {
fn GetWholeText(&self) -> Fallible<DOMString> {
Ok(~"")
}
}

View file

@ -3,11 +3,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::BindingDeclarations::UIEventBinding;
use dom::bindings::codegen::InheritTypes::UIEventDerived;
use dom::bindings::codegen::InheritTypes::{EventCast, UIEventDerived};
use dom::bindings::js::{JS, JSRef, RootCollection, RootedReference, Unrooted};
use dom::bindings::error::Fallible;
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::event::{Event, EventTypeId, UIEventTypeId};
use dom::event::{Event, EventMethods, EventTypeId, UIEventTypeId};
use dom::node::Node;
use dom::window::Window;
use servo_util::str::DOMString;
@ -48,80 +48,107 @@ impl UIEvent {
let roots = RootCollection::new();
let mut ev = UIEvent::new(owner).root(&roots);
let view = init.view.as_ref().map(|view| view.root(&roots));
ev.get_mut().InitUIEvent(type_, init.parent.bubbles, init.parent.cancelable,
ev.InitUIEvent(type_, init.parent.bubbles, init.parent.cancelable,
view.root_ref(), init.detail);
Ok(Unrooted::new_rooted(&*ev))
}
}
pub fn GetView(&self) -> Option<Unrooted<Window>> {
pub trait UIEventMethods {
fn GetView(&self) -> Option<Unrooted<Window>>;
fn Detail(&self) -> i32;
fn LayerX(&self) -> i32;
fn LayerY(&self) -> i32;
fn PageX(&self) -> i32;
fn PageY(&self) -> i32;
fn Which(&self) -> u32;
fn GetRangeParent(&self) -> Option<Unrooted<Node>>;
fn RangeOffset(&self) -> i32;
fn CancelBubble(&self) -> bool;
fn SetCancelBubble(&mut self, _val: bool);
fn IsChar(&self) -> bool;
fn InitUIEvent(&mut self,
type_: DOMString,
can_bubble: bool,
cancelable: bool,
view: Option<JSRef<Window>>,
detail: i32);
}
impl<'a> UIEventMethods for JSRef<'a, UIEvent> {
fn GetView(&self) -> Option<Unrooted<Window>> {
self.view.clone().map(|view| Unrooted::new(view))
}
pub fn Detail(&self) -> i32 {
fn Detail(&self) -> i32 {
self.detail
}
pub fn InitUIEvent(&mut self,
fn InitUIEvent(&mut self,
type_: DOMString,
can_bubble: bool,
cancelable: bool,
view: Option<JSRef<Window>>,
detail: i32) {
self.event.InitEvent(type_, can_bubble, cancelable);
{
let event: &mut JSRef<Event> = EventCast::from_mut_ref(self);
event.InitEvent(type_, can_bubble, cancelable);
}
self.view = view.map(|view| view.unrooted());
self.detail = detail;
}
pub fn LayerX(&self) -> i32 {
fn LayerX(&self) -> i32 {
//TODO
0
}
pub fn LayerY(&self) -> i32 {
fn LayerY(&self) -> i32 {
//TODO
0
}
pub fn PageX(&self) -> i32 {
fn PageX(&self) -> i32 {
//TODO
0
}
pub fn PageY(&self) -> i32 {
fn PageY(&self) -> i32 {
//TODO
0
}
pub fn Which(&self) -> u32 {
fn Which(&self) -> u32 {
//TODO
0
}
pub fn GetRangeParent(&self) -> Option<Unrooted<Node>> {
fn GetRangeParent(&self) -> Option<Unrooted<Node>> {
//TODO
None
}
pub fn RangeOffset(&self) -> i32 {
fn RangeOffset(&self) -> i32 {
//TODO
0
}
pub fn CancelBubble(&self) -> bool {
fn CancelBubble(&self) -> bool {
//TODO
false
}
pub fn SetCancelBubble(&mut self, _val: bool) {
fn SetCancelBubble(&mut self, _val: bool) {
//TODO
}
pub fn IsChar(&self) -> bool {
fn IsChar(&self) -> bool {
//TODO
false
}
}
impl Reflectable for UIEvent {
fn reflector<'a>(&'a self) -> &'a Reflector {
self.event.reflector()

View file

@ -30,44 +30,57 @@ impl ValidityState {
}
}
impl ValidityState {
pub fn ValueMissing(&self) -> bool {
pub trait ValidityStateMethods {
fn ValueMissing(&self) -> bool;
fn TypeMismatch(&self) -> bool;
fn PatternMismatch(&self) -> bool;
fn TooLong(&self) -> bool;
fn RangeUnderflow(&self) -> bool;
fn RangeOverflow(&self) -> bool;
fn StepMismatch(&self) -> bool;
fn CustomError(&self) -> bool;
fn Valid(&self) -> bool;
}
impl<'a> ValidityStateMethods for JSRef<'a, ValidityState> {
fn ValueMissing(&self) -> bool {
false
}
pub fn TypeMismatch(&self) -> bool {
fn TypeMismatch(&self) -> bool {
false
}
pub fn PatternMismatch(&self) -> bool {
fn PatternMismatch(&self) -> bool {
false
}
pub fn TooLong(&self) -> bool {
fn TooLong(&self) -> bool {
false
}
pub fn RangeUnderflow(&self) -> bool {
fn RangeUnderflow(&self) -> bool {
false
}
pub fn RangeOverflow(&self) -> bool {
fn RangeOverflow(&self) -> bool {
false
}
pub fn StepMismatch(&self) -> bool {
fn StepMismatch(&self) -> bool {
false
}
pub fn CustomError(&self) -> bool {
fn CustomError(&self) -> bool {
false
}
pub fn Valid(&self) -> bool {
fn Valid(&self) -> bool {
true
}
}
impl Reflectable for ValidityState {
fn reflector<'a>(&'a self) -> &'a Reflector {
&self.reflector_

Some files were not shown because too many files have changed in this diff Show more