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

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