auto merge of #679 : jdm/servo/morenodes, r=pcwalton

Nothing too exciting here.
This commit is contained in:
bors-servo 2013-08-06 18:57:35 -07:00
commit ff9e72a013
13 changed files with 343 additions and 139 deletions

View file

@ -169,7 +169,8 @@ DOMInterfaces = {
'Element': {
'nativeType': 'AbstractNode<ScriptView>',
'pointerType': ''
'pointerType': '',
'needsAbstract': ['getClientRects', 'getBoundingClientRect']
},
'Event': {
@ -545,9 +546,11 @@ def addHTMLElement(element):
}
addHTMLElement('HTMLAnchorElement')
addHTMLElement('HTMLDivElement')
addHTMLElement('HTMLElement')
addHTMLElement('HTMLHeadElement')
addHTMLElement('HTMLHtmlElement')
addHTMLElement('HTMLImageElement')
# If you add one of these, you need to make sure nsDOMQS.h has the relevant
# macros added for it
@ -557,7 +560,6 @@ def addExternalHTMLElement(element):
headerFile=nativeElement + '.h')
addExternalHTMLElement('HTMLCanvasElement')
addExternalHTMLElement('HTMLImageElement')
addExternalHTMLElement('HTMLOptionElement')
addExternalHTMLElement('HTMLOptGroupElement')
addExternalHTMLElement('HTMLVideoElement')

View file

@ -3177,7 +3177,7 @@ class CGGenericMethod(CGAbstractBindingMethod):
def generate_code(self):
return CGIndenter(CGGeneric(
"let _info: *JSJitInfo = RUST_FUNCTION_VALUE_TO_JITINFO(JS_CALLEE(cx, vp));\n"
"return CallJitMethodOp(_info, cx, obj, ptr::to_unsafe_ptr(&(*this).payload) as *libc::c_void, argc, vp);"))
"return CallJitMethodOp(_info, cx, obj, this as *libc::c_void, argc, vp);"))
class CGAbstractStaticMethod(CGAbstractMethod):
"""
@ -3200,16 +3200,24 @@ class CGSpecializedMethod(CGAbstractExternMethod):
self.method = method
name = method.identifier.name
args = [Argument('*JSContext', 'cx'), Argument('JSHandleObject', 'obj'),
Argument('*mut %s' % descriptor.concreteType, 'this'),
Argument('*mut rust_box<%s>' % descriptor.concreteType, 'this'),
Argument('libc::c_uint', 'argc'), Argument('*mut JSVal', 'vp')]
CGAbstractExternMethod.__init__(self, descriptor, name, 'JSBool', args)
def definition_body(self):
name = self.method.identifier.name
nativeName = MakeNativeName(self.descriptor.binaryNames.get(name, name))
return CGWrapper(CGMethodCall([], nativeName, self.method.isStatic(),
extraPre = ''
argsPre = []
if name in self.descriptor.needsAbstract:
abstractName = re.sub(r'<\w+>', '', self.descriptor.nativeType)
extraPre = ' let abstract_this = %s::from_box(this);\n' % abstractName
argsPre = ['abstract_this']
return CGWrapper(CGMethodCall(argsPre, nativeName, self.method.isStatic(),
self.descriptor, self.method),
pre=" let obj = (*obj.unnamed);\n").define()
pre=extraPre +
" let obj = (*obj.unnamed);\n" +
" let this = &mut (*this).payload;\n").define()
class CGGenericGetter(CGAbstractBindingMethod):
"""
@ -3233,7 +3241,7 @@ class CGGenericGetter(CGAbstractBindingMethod):
def generate_code(self):
return CGIndenter(CGGeneric(
"let info: *JSJitInfo = RUST_FUNCTION_VALUE_TO_JITINFO(JS_CALLEE(cx, vp));\n"
"return CallJitPropertyOp(info, cx, obj, ptr::to_unsafe_ptr(&(*this).payload) as *libc::c_void, vp);"))
"return CallJitPropertyOp(info, cx, obj, this as *libc::c_void, vp);"))
class CGSpecializedGetter(CGAbstractExternMethod):
"""
@ -3245,7 +3253,7 @@ class CGSpecializedGetter(CGAbstractExternMethod):
name = 'get_' + attr.identifier.name
args = [ Argument('*JSContext', 'cx'),
Argument('JSHandleObject', 'obj'),
Argument('*%s' % descriptor.concreteType, 'this'),
Argument('*mut rust_box<%s>' % descriptor.concreteType, 'this'),
Argument('*mut JSVal', 'vp') ]
CGAbstractExternMethod.__init__(self, descriptor, name, "JSBool", args)
@ -3263,7 +3271,8 @@ class CGSpecializedGetter(CGAbstractExternMethod):
nativeName = "Get" + nativeName
return CGWrapper(CGIndenter(CGGetterCall(self.attr.type, nativeName,
self.descriptor, self.attr)),
pre=" let obj = (*obj.unnamed);\n").define()
pre=" let obj = (*obj.unnamed);\n" +
" let this = &mut (*this).payload;\n").define()
class CGGenericSetter(CGAbstractBindingMethod):
"""
@ -3288,7 +3297,7 @@ class CGGenericSetter(CGAbstractBindingMethod):
"let undef = JSVAL_VOID;\n"
"let argv: *JSVal = if argc != 0 { JS_ARGV(cx, cast::transmute(vp)) } else { &undef as *JSVal };\n"
"let info: *JSJitInfo = RUST_FUNCTION_VALUE_TO_JITINFO(JS_CALLEE(cx, cast::transmute(vp)));\n"
"if CallJitPropertyOp(info, cx, obj, ptr::to_unsafe_ptr(&(*this).payload) as *libc::c_void, argv) == 0 {"
"if CallJitPropertyOp(info, cx, obj, this as *libc::c_void, argv) == 0 {"
" return 0;\n"
"}\n"
"*vp = JSVAL_VOID;\n"
@ -3304,7 +3313,7 @@ class CGSpecializedSetter(CGAbstractExternMethod):
name = 'set_' + attr.identifier.name
args = [ Argument('*JSContext', 'cx'),
Argument('JSHandleObject', 'obj'),
Argument('*mut %s' % descriptor.concreteType, 'this'),
Argument('*mut rust_box<%s>' % descriptor.concreteType, 'this'),
Argument('*mut JSVal', 'argv')]
CGAbstractExternMethod.__init__(self, descriptor, name, "JSBool", args)
@ -3313,7 +3322,8 @@ class CGSpecializedSetter(CGAbstractExternMethod):
nativeName = "Set" + MakeNativeName(self.descriptor.binaryNames.get(name, name))
return CGWrapper(CGIndenter(CGSetterCall(self.attr.type, nativeName,
self.descriptor, self.attr)),
pre=" let obj = (*obj.unnamed);\n").define()
pre=" let obj = (*obj.unnamed);\n" +
" let this = &mut (*this).payload;\n").define()
def infallibleForMember(member, type, descriptorProvider):
"""
@ -4606,9 +4616,11 @@ class CGBindingRoot(CGThing):
'dom::node::{AbstractNode, Node, Text}', #XXXjdm
'dom::document::{Document, AbstractDocument}', #XXXjdm
'dom::element::{Element, HTMLHeadElement, HTMLHtmlElement}', #XXXjdm
'dom::element::{HTMLDivElement}', #XXXjdm
'dom::htmlanchorelement::HTMLAnchorElement', #XXXjdm
'dom::htmlelement::HTMLElement', #XXXjdm
'dom::htmldocument::HTMLDocument', #XXXjdm
'dom::htmlimageelement::HTMLImageElement', #XXXjdm
'dom::bindings::utils::*',
'dom::bindings::conversions::*',
'dom::blob::*', #XXXjdm

View file

@ -141,6 +141,7 @@ class Descriptor(DescriptorProvider):
self.nativeType = desc.get('nativeType', nativeTypeDefault)
self.pointerType = desc.get('pointerType', '@mut ')
self.concreteType = desc.get('concreteType', ifaceName)
self.needsAbstract = desc.get('needsAbstract', [])
self.hasInstanceInterface = desc.get('hasInstanceInterface', None)
# Do something sane for JSObject

View file

@ -0,0 +1,19 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* http://www.whatwg.org/specs/web-apps/current-work/
*
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
* Opera Software ASA. You are granted a license to use, reproduce
* and create derivative works of this document.
*/
interface HTMLDivElement : HTMLElement {};
partial interface HTMLDivElement {
[SetterThrows]
attribute DOMString align;
};

View file

@ -0,0 +1,50 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* http://www.whatwg.org/specs/web-apps/current-work/#htmlimageelement
* http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
* Opera Software ASA. You are granted a license to use, reproduce
* and create derivative works of this document.
*/
[NamedConstructor=Image(optional unsigned long width, optional unsigned long height)]
interface HTMLImageElement : HTMLElement {
[SetterThrows]
attribute DOMString alt;
[SetterThrows]
attribute DOMString src;
// attribute DOMString srcset;
[SetterThrows]
attribute DOMString crossOrigin;
[SetterThrows]
attribute DOMString useMap;
[SetterThrows]
attribute boolean isMap;
[SetterThrows]
attribute unsigned long width;
[SetterThrows]
attribute unsigned long height;
readonly attribute unsigned long naturalWidth;
readonly attribute unsigned long naturalHeight;
readonly attribute boolean complete;
};
// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
partial interface HTMLImageElement {
[SetterThrows]
attribute DOMString name;
[SetterThrows]
attribute DOMString align;
[SetterThrows]
attribute unsigned long hspace;
[SetterThrows]
attribute unsigned long vspace;
[SetterThrows]
attribute DOMString longDesc;
[TreatNullAs=EmptyString,SetterThrows] attribute DOMString border;
};

View file

@ -29,8 +29,8 @@ use js::jsapi::{JSContext, JSVal, JSObject, JSBool, JSFreeOp, JSPropertySpec};
use js::jsapi::{JSNativeWrapper, JSTracer, JSTRACE_OBJECT};
use js::jsapi::{JSPropertyOpWrapper, JSStrictPropertyOpWrapper, JSFunctionSpec};
use js::rust::{Compartment, jsobj};
use js::{JS_ARGV, JSPROP_ENUMERATE, JSPROP_SHARED, JSVAL_NULL};
use js::{JS_THIS_OBJECT, JS_SET_RVAL, JSPROP_NATIVE_ACCESSORS};
use js::{JS_ARGV, JSPROP_ENUMERATE, JSPROP_SHARED};
use js::{JS_THIS_OBJECT, JSPROP_NATIVE_ACCESSORS};
extern fn finalize(_fop: *JSFreeOp, obj: *JSObject) {
debug!("element finalize: %x!", obj as uint);
@ -151,17 +151,13 @@ extern fn getClientRects(cx: *JSContext, _argc: c_uint, vp: *JSVal) -> JSBool {
let obj = JS_THIS_OBJECT(cx, vp);
let mut node = unwrap(obj);
let rval = do node.with_imm_element |elem| {
elem.getClientRects()
elem.GetClientRects(node)
};
if rval.is_none() {
JS_SET_RVAL(cx, vp, JSVAL_NULL);
} else {
let cache = node.get_wrappercache();
let rval = rval.get() as @mut CacheableWrapper;
assert!(WrapNewBindingObject(cx, cache.get_wrapper(),
rval,
cast::transmute(vp)));
}
let cache = node.get_wrappercache();
let rval = rval as @mut CacheableWrapper;
assert!(WrapNewBindingObject(cx, cache.get_wrapper(),
rval,
cast::transmute(vp)));
return 1;
}
}
@ -171,17 +167,13 @@ extern fn getBoundingClientRect(cx: *JSContext, _argc: c_uint, vp: *JSVal) -> JS
let obj = JS_THIS_OBJECT(cx, vp);
let mut node = unwrap(obj);
let rval = do node.with_imm_element |elem| {
elem.getBoundingClientRect()
elem.GetBoundingClientRect(node)
};
if rval.is_none() {
JS_SET_RVAL(cx, vp, JSVAL_NULL);
} else {
let cache = node.get_wrappercache();
let rval = rval.get() as @mut CacheableWrapper;
assert!(WrapNewBindingObject(cx, cache.get_wrapper(),
rval,
cast::transmute(vp)));
}
let cache = node.get_wrappercache();
let rval = rval as @mut CacheableWrapper;
assert!(WrapNewBindingObject(cx, cache.get_wrapper(),
rval,
cast::transmute(vp)));
return 1;
}
}

View file

@ -7,8 +7,10 @@ use dom::bindings::text;
use dom::bindings::utils;
use dom::bindings::utils::{CacheableWrapper, WrapperCache, DerivedWrapper};
use dom::element::{HTMLHeadElementTypeId, HTMLHtmlElementTypeId, HTMLAnchorElementTypeId};
use dom::element::{HTMLHeadElement, HTMLHtmlElement};
use dom::element::{HTMLDivElementTypeId, HTMLImageElementTypeId};
use dom::element::{HTMLHeadElement, HTMLHtmlElement, HTMLDivElement};
use dom::htmlanchorelement::HTMLAnchorElement;
use dom::htmlimageelement::HTMLImageElement;
use dom::node::{AbstractNode, Node, ElementNodeTypeId, TextNodeTypeId, CommentNodeTypeId};
use dom::node::{DoctypeNodeTypeId, ScriptView, Text};
@ -75,8 +77,10 @@ macro_rules! generate_element(
pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject {
match node.type_id() {
ElementNodeTypeId(HTMLAnchorElementTypeId) => generate_element!(HTMLAnchorElement),
ElementNodeTypeId(HTMLDivElementTypeId) => generate_element!(HTMLDivElement),
ElementNodeTypeId(HTMLHeadElementTypeId) => generate_element!(HTMLHeadElement),
ElementNodeTypeId(HTMLHtmlElementTypeId) => generate_element!(HTMLHtmlElement),
ElementNodeTypeId(HTMLImageElementTypeId) => generate_element!(HTMLImageElement),
ElementNodeTypeId(_) => element::create(cx, node).ptr,
CommentNodeTypeId |
DoctypeNodeTypeId => text::create(cx, node).ptr,

View file

@ -617,7 +617,8 @@ pub extern fn ThrowingConstructor(_cx: *JSContext, _argc: uint, _vp: *JSVal) ->
}
pub fn initialize_global(global: *JSObject) {
let protoArray = @mut ([0 as *JSObject, ..33]); //XXXjdm PrototyepList::id::_ID_Count
let protoArray = @mut ([0 as *JSObject, ..35]);
assert!(protoArray.len() == PrototypeList::id::_ID_Count as uint);
unsafe {
//XXXjdm we should be storing the box pointer instead of the inner
let box = squirrel_away(protoArray);

View file

@ -5,7 +5,8 @@
//! Element nodes.
use dom::bindings::codegen::{HTMLHeadElementBinding, HTMLHtmlElementBinding};
use dom::bindings::codegen::{HTMLAnchorElementBinding};
use dom::bindings::codegen::{HTMLAnchorElementBinding, HTMLDivElementBinding};
use dom::bindings::codegen::{HTMLImageElementBinding};
use dom::bindings::utils::{DOMString, null_string, ErrorResult};
use dom::bindings::utils::{CacheableWrapper, BindingObject, WrapperCache};
use dom::clientrect::ClientRect;
@ -13,6 +14,7 @@ use dom::clientrectlist::ClientRectList;
use dom::htmlanchorelement::HTMLAnchorElement;
use dom::htmlcollection::HTMLCollection;
use dom::htmlelement::HTMLElement;
use dom::htmlimageelement::HTMLImageElement;
use dom::node::{ElementNodeTypeId, Node, ScriptView, AbstractNode};
use layout_interface::{ContentBoxQuery, ContentBoxResponse, ContentBoxesQuery};
use layout_interface::{ContentBoxesResponse};
@ -134,6 +136,15 @@ impl HTMLHtmlElement {
}
}
impl HTMLDivElement {
pub fn Align(&self) -> DOMString {
null_string
}
pub fn SetAlign(&mut self, _align: &DOMString, _rv: &mut ErrorResult) {
}
}
pub macro_rules! generate_cacheable_wrapper(
($name: ident, $wrap: path) => (
impl CacheableWrapper for $name {
@ -165,6 +176,10 @@ generate_cacheable_wrapper!(HTMLHtmlElement, HTMLHtmlElementBinding::Wrap)
generate_binding_object!(HTMLHtmlElement)
generate_cacheable_wrapper!(HTMLAnchorElement, HTMLAnchorElementBinding::Wrap)
generate_binding_object!(HTMLAnchorElement)
generate_cacheable_wrapper!(HTMLDivElement, HTMLDivElementBinding::Wrap)
generate_binding_object!(HTMLDivElement)
generate_cacheable_wrapper!(HTMLImageElement, HTMLImageElementBinding::Wrap)
generate_binding_object!(HTMLImageElement)
//
// Fancier elements
@ -182,11 +197,6 @@ pub struct HTMLIframeElement {
size_future_chan: Option<ChanOne<Size2D<uint>>>,
}
pub struct HTMLImageElement {
parent: HTMLElement,
image: Option<Url>,
}
//
// Element methods
//
@ -233,95 +243,6 @@ impl<'self> Element {
}
}
pub fn getClientRects(&self) -> Option<@mut ClientRectList> {
let (rects, cx, scope) = match self.parent.owner_doc {
Some(doc) => {
match doc.with_base(|doc| doc.window) {
Some(win) => {
let node = self.parent.abstract.get();
assert!(node.is_element());
let page = win.page;
let (port, chan) = comm::stream();
// TODO(tkuehn): currently just queries top-level page layout. Needs to query
// subframe layout if this element is in a subframe. Probably need an ID field.
match unsafe {(*page).query_layout(ContentBoxesQuery(node, chan), port)} {
Ok(ContentBoxesResponse(rects)) => {
let cx = unsafe {(*page).js_info.get_ref().js_compartment.cx.ptr};
let cache = win.get_wrappercache();
let scope = cache.get_wrapper();
let rects = do rects.map |r| {
ClientRect::new(
r.origin.y.to_f32(),
(r.origin.y + r.size.height).to_f32(),
r.origin.x.to_f32(),
(r.origin.x + r.size.width).to_f32(),
cx,
scope)
};
Some((rects, cx, scope))
},
Err(()) => {
debug!("layout query error");
None
}
}
}
None => {
debug!("no window");
None
}
}
}
None => {
debug!("no document");
None
}
}.get();
Some(ClientRectList::new(rects, cx, scope))
}
pub fn getBoundingClientRect(&self) -> Option<@mut ClientRect> {
match self.parent.owner_doc {
Some(doc) => {
match doc.with_base(|doc| doc.window) {
Some(win) => {
let page = win.page;
let node = self.parent.abstract.get();
assert!(node.is_element());
let (port, chan) = comm::stream();
match unsafe{(*page).query_layout(ContentBoxQuery(node, chan), port)} {
Ok(ContentBoxResponse(rect)) => {
let cx = unsafe {(*page).js_info.get_ref().js_compartment.cx.ptr};
let cache = win.get_wrappercache();
let scope = cache.get_wrapper();
Some(ClientRect::new(
rect.origin.y.to_f32(),
(rect.origin.y + rect.size.height).to_f32(),
rect.origin.x.to_f32(),
(rect.origin.x + rect.size.width).to_f32(),
cx,
scope))
},
Err(()) => {
debug!("error querying layout");
None
}
}
}
None => {
debug!("no window");
None
}
}
}
None => {
debug!("no document");
None
}
}
}
fn get_scope_and_cx(&self) -> (*JSObject, *JSContext) {
let doc = self.parent.owner_doc.get();
let win = doc.with_base(|doc| doc.window.get());
@ -405,13 +326,84 @@ impl Element {
pub fn MozRequestPointerLock(&self) {
}
pub fn GetClientRects(&self) -> @mut ClientRectList {
let (scope, cx) = self.get_scope_and_cx();
ClientRectList::new(~[], cx, scope)
pub fn GetClientRects(&self, abstract_self: AbstractNode<ScriptView>) -> @mut ClientRectList {
let (rects, cx, scope) = match self.parent.owner_doc {
Some(doc) => {
match doc.with_base(|doc| doc.window) {
Some(win) => {
let node = abstract_self;
assert!(node.is_element());
let page = win.page;
let (port, chan) = comm::stream();
// TODO(tkuehn): currently just queries top-level page layout. Needs to query
// subframe layout if this element is in a subframe. Probably need an ID field.
match unsafe {(*page).query_layout(ContentBoxesQuery(node, chan), port)} {
Ok(ContentBoxesResponse(rects)) => {
let cx = unsafe {(*page).js_info.get_ref().js_compartment.cx.ptr};
let cache = win.get_wrappercache();
let scope = cache.get_wrapper();
let rects = do rects.map |r| {
ClientRect::new(
r.origin.y.to_f32(),
(r.origin.y + r.size.height).to_f32(),
r.origin.x.to_f32(),
(r.origin.x + r.size.width).to_f32(),
cx,
scope)
};
Some((rects, cx, scope))
},
Err(()) => {
debug!("layout query error");
None
}
}
}
None => {
debug!("no window");
None
}
}
}
None => {
debug!("no document");
None
}
}.get();
ClientRectList::new(rects, cx, scope)
}
pub fn GetBoundingClientRect(&self) -> @mut ClientRect {
fail!("stub")
pub fn GetBoundingClientRect(&self, abstract_self: AbstractNode<ScriptView>) -> @mut ClientRect {
match self.parent.owner_doc {
Some(doc) => {
match doc.with_base(|doc| doc.window) {
Some(win) => {
let page = win.page;
let node = abstract_self;
assert!(node.is_element());
let (port, chan) = comm::stream();
match unsafe{(*page).query_layout(ContentBoxQuery(node, chan), port)} {
Ok(ContentBoxResponse(rect)) => {
let cx = unsafe {(*page).js_info.get_ref().js_compartment.cx.ptr};
let cache = win.get_wrappercache();
let scope = cache.get_wrapper();
ClientRect::new(
rect.origin.y.to_f32(),
(rect.origin.y + rect.size.height).to_f32(),
rect.origin.x.to_f32(),
(rect.origin.x + rect.size.width).to_f32(),
cx,
scope)
},
Err(()) => fail!("error querying layout")
}
}
None => fail!("no window")
}
}
None => fail!("no document")
}
}
pub fn ScrollIntoView(&self, _top: bool) {

View file

@ -0,0 +1,117 @@
/* 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::htmlelement::HTMLElement;
use extra::net::url::Url;
pub struct HTMLImageElement {
parent: HTMLElement,
image: Option<Url>,
}
impl HTMLImageElement {
pub fn Alt(&self) -> DOMString {
null_string
}
pub fn SetAlt(&mut self, _alt: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Src(&self) -> DOMString {
null_string
}
pub fn SetSrc(&mut self, _src: &DOMString, _rv: &mut ErrorResult) {
}
pub fn CrossOrigin(&self) -> DOMString {
null_string
}
pub fn SetCrossOrigin(&mut self, _cross_origin: &DOMString, _rv: &mut ErrorResult) {
}
pub fn UseMap(&self) -> DOMString {
null_string
}
pub fn SetUseMap(&mut self, _use_map: &DOMString, _rv: &mut ErrorResult) {
}
pub fn IsMap(&self) -> bool {
false
}
pub fn SetIsMap(&self, _is_map: bool, _rv: &mut ErrorResult) {
}
pub fn Width(&self) -> u32 {
0
}
pub fn SetWidth(&mut self, _width: u32, _rv: &mut ErrorResult) {
}
pub fn Height(&self) -> u32 {
0
}
pub fn SetHeight(&mut self, _height: u32, _rv: &mut ErrorResult) {
}
pub fn NaturalWidth(&self) -> u32 {
0
}
pub fn NaturalHeight(&self) -> u32 {
0
}
pub fn Complete(&self) -> bool {
false
}
pub fn Name(&self) -> DOMString {
null_string
}
pub fn SetName(&mut self, _name: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Align(&self) -> DOMString {
null_string
}
pub fn SetAlign(&mut self, _align: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Hspace(&self) -> u32 {
0
}
pub fn SetHspace(&mut self, _hspace: u32, _rv: &mut ErrorResult) {
}
pub fn Vspace(&self) -> u32 {
0
}
pub fn SetVspace(&mut self, _vspace: u32, _rv: &mut ErrorResult) {
}
pub fn LongDesc(&self) -> DOMString {
null_string
}
pub fn SetLongDesc(&mut self, _longdesc: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Border(&self) -> DOMString {
null_string
}
pub fn SetBorder(&mut self, _border: &DOMString, _rv: &mut ErrorResult) {
}
}

View file

@ -7,12 +7,13 @@
use dom::bindings::codegen::TextBinding;
use dom::bindings::node;
use dom::bindings::utils::{WrapperCache, DOMString, null_string, ErrorResult};
use dom::bindings::utils::{BindingObject, CacheableWrapper};
use dom::bindings::utils::{BindingObject, CacheableWrapper, rust_box};
use dom::bindings;
use dom::characterdata::CharacterData;
use dom::document::AbstractDocument;
use dom::element::{Element, ElementTypeId, HTMLImageElement, HTMLImageElementTypeId, HTMLIframeElementTypeId, HTMLIframeElement};
use dom::element::{Element, ElementTypeId, HTMLImageElementTypeId, HTMLIframeElementTypeId, HTMLIframeElement};
use dom::element::{HTMLStyleElementTypeId};
use dom::htmlimageelement::HTMLImageElement;
use dom::window::Window;
use std::cast;
@ -235,6 +236,15 @@ impl<'self, View> AbstractNode<View> {
}
}
/// Allow consumers to recreate an AbstractNode from the raw boxed type.
/// Must only be used in situations where the boxed type is in the inheritance
/// chain for nodes.
pub fn from_box<T>(ptr: *mut rust_box<T>) -> AbstractNode<View> {
AbstractNode {
obj: ptr as *mut Node<View>
}
}
/// Returns the layout data, unsafely cast to whatever type layout wishes. Only layout is
/// allowed to call this. This is wildly unsafe and is therefore marked as such.
pub unsafe fn unsafe_layout_data<T>(self) -> @mut T {

View file

@ -18,7 +18,7 @@ use dom::element::{HTMLAnchorElementTypeId, HTMLAsideElementTypeId, HTMLBRElemen
use dom::element::{HTMLAsideElement, HTMLBRElement, HTMLBodyElement,
HTMLBoldElement, HTMLDivElement, HTMLFontElement, HTMLFormElement,
HTMLHRElement, HTMLHeadElement, HTMLHeadingElement, HTMLHtmlElement,
HTMLInputElement, HTMLImageElement, HTMLIframeElement,
HTMLInputElement, HTMLIframeElement,
HTMLItalicElement, HTMLLinkElement, HTMLListItemElement, HTMLMetaElement,
HTMLOListElement, HTMLOptionElement, HTMLParagraphElement,
HTMLScriptElement, HTMLSectionElement, HTMLSelectElement, HTMLSmallElement,
@ -28,6 +28,7 @@ use dom::element::{HTMLAsideElement, HTMLBRElement, HTMLBodyElement,
use dom::element::{HTMLHeadingElementTypeId, Heading1, Heading2, Heading3, Heading4, Heading5,
Heading6};
use dom::htmlanchorelement::HTMLAnchorElement;
use dom::htmlimageelement::HTMLImageElement;
use dom::element::{Element, Attr};
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Comment, Doctype, ElementNodeTypeId, Node, ScriptView};

View file

@ -44,10 +44,12 @@ pub mod dom {
pub mod FormDataBinding;
pub mod HTMLAnchorElementBinding;
pub mod HTMLCollectionBinding;
pub mod HTMLDivElementBinding;
pub mod HTMLDocumentBinding;
pub mod HTMLElementBinding;
pub mod HTMLHeadElementBinding;
pub mod HTMLHtmlElementBinding;
pub mod HTMLImageElementBinding;
pub mod MouseEventBinding;
pub mod NodeBinding;
pub mod PrototypeList;
@ -72,6 +74,7 @@ pub mod dom {
pub mod htmlcollection;
pub mod htmldocument;
pub mod htmlelement;
pub mod htmlimageelement;
pub mod mouseevent;
pub mod node;
pub mod uievent;