Generate bindings for Node, CharacterData, Text, Element, and HTMLElement. Hook up text nodes to use the new bindings.

This commit is contained in:
Josh Matthews 2013-07-28 11:43:24 -04:00
parent c9bc2046f6
commit fd4efad70c
20 changed files with 1069 additions and 62 deletions

View file

@ -0,0 +1,146 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::utils::{DOMString, null_string, ErrorResult};
use dom::bindings::utils::{CacheableWrapper, BindingObject, WrapperCache};
use dom::element::Element;
use dom::node::{AbstractNode, ScriptView};
use js::jsapi::{JSObject, JSContext, JSVal};
use js::JSVAL_NULL;
pub struct HTMLElement {
parent: Element
}
impl HTMLElement {
pub fn Title(&self) -> DOMString {
null_string
}
pub fn SetTitle(&mut self, _title: &DOMString) {
}
pub fn Lang(&self) -> DOMString {
null_string
}
pub fn SetLang(&mut self, _lang: &DOMString) {
}
pub fn Dir(&self) -> DOMString {
null_string
}
pub fn SetDir(&mut self, _dir: &DOMString, _rv: &mut ErrorResult) {
}
pub fn GetItemValue(&self, _cx: *JSContext, _rv: &mut ErrorResult) -> JSVal {
JSVAL_NULL
}
pub fn SetItemValue(&mut self, _cx: *JSContext, _val: JSVal, _rv: &mut ErrorResult) {
}
pub fn Hidden(&self) -> bool {
false
}
pub fn SetHidden(&mut self, _hidden: bool, _rv: &mut ErrorResult) {
}
pub fn Click(&self) {
}
pub fn TabIndex(&self) -> i32 {
0
}
pub fn SetTabIndex(&mut self, _index: i32, _rv: &mut ErrorResult) {
}
pub fn Focus(&self, _rv: &mut ErrorResult) {
}
pub fn Blur(&self, _rv: &mut ErrorResult) {
}
pub fn AccessKey(&self) -> DOMString {
null_string
}
pub fn SetAccessKey(&self, _key: &DOMString, _rv: &mut ErrorResult) {
}
pub fn AccessKeyLabel(&self) -> DOMString {
null_string
}
pub fn Draggable(&self) -> bool {
false
}
pub fn SetDraggable(&mut self, _draggable: bool, _rv: &mut ErrorResult) {
}
pub fn ContentEditable(&self) -> DOMString {
null_string
}
pub fn SetContentEditable(&mut self, _val: &DOMString, _rv: &mut ErrorResult) {
}
pub fn IsContentEditable(&self) -> bool {
false
}
pub fn Spellcheck(&self) -> bool {
false
}
pub fn SetSpellcheck(&self, _val: bool, _rv: &mut ErrorResult) {
}
pub fn ClassName(&self) -> DOMString {
null_string
}
pub fn SetClassName(&self, _class: &DOMString) {
}
pub fn GetOffsetParent(&self) -> Option<AbstractNode<ScriptView>> {
None
}
pub fn OffsetTop(&self) -> i32 {
0
}
pub fn OffsetLeft(&self) -> i32 {
0
}
pub fn OffsetWidth(&self) -> i32 {
0
}
pub fn OffsetHeight(&self) -> i32 {
0
}
}
impl CacheableWrapper for HTMLElement {
fn get_wrappercache(&mut self) -> &mut WrapperCache {
self.parent.get_wrappercache()
}
fn wrap_object_shared(@mut self, _cx: *JSContext, _scope: *JSObject) -> *JSObject {
fail!(~"need to implement wrapping");
}
}
impl BindingObject for HTMLElement {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> {
self.parent.GetParentObject(cx)
}
}