mirror of
https://github.com/servo/servo.git
synced 2025-06-08 00:23:30 +00:00
More progress in the &JSRef -> JSRef conversion
Change all of the <Class>Methods traits to take `self` instead of `&self`.
This commit is contained in:
parent
2adc594e5d
commit
2c8d51a37c
66 changed files with 812 additions and 815 deletions
|
@ -116,33 +116,32 @@ impl Attr {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> AttrMethods for JSRef<'a, Attr> {
|
impl<'a> AttrMethods for JSRef<'a, Attr> {
|
||||||
fn LocalName(&self) -> DOMString {
|
fn LocalName(self) -> DOMString {
|
||||||
self.local_name().as_slice().to_string()
|
self.local_name().as_slice().to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Value(&self) -> DOMString {
|
fn Value(self) -> DOMString {
|
||||||
self.value().as_slice().to_string()
|
self.value().as_slice().to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetValue(&self, value: DOMString) {
|
fn SetValue(self, value: DOMString) {
|
||||||
let owner = self.owner.root();
|
let owner = self.owner.root();
|
||||||
let value = owner.deref().parse_attribute(
|
let value = owner.deref().parse_attribute(&self.namespace, self.local_name(), value);
|
||||||
&self.namespace, self.local_name(), value);
|
|
||||||
self.set_value(ReplacedAttr, value);
|
self.set_value(ReplacedAttr, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Name(&self) -> DOMString {
|
fn Name(self) -> DOMString {
|
||||||
self.name.as_slice().to_string()
|
self.name.as_slice().to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetNamespaceURI(&self) -> Option<DOMString> {
|
fn GetNamespaceURI(self) -> Option<DOMString> {
|
||||||
match self.namespace.to_str() {
|
match self.namespace.to_str() {
|
||||||
"" => None,
|
"" => None,
|
||||||
url => Some(url.to_string()),
|
url => Some(url.to_string()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetPrefix(&self) -> Option<DOMString> {
|
fn GetPrefix(self) -> Option<DOMString> {
|
||||||
self.prefix.clone()
|
self.prefix.clone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2186,7 +2186,7 @@ class CGCallGenerator(CGThing):
|
||||||
if static:
|
if static:
|
||||||
call = CGWrapper(call, pre="%s::" % descriptorProvider.interface.identifier.name)
|
call = CGWrapper(call, pre="%s::" % descriptorProvider.interface.identifier.name)
|
||||||
else:
|
else:
|
||||||
call = CGWrapper(call, pre="(*%s)." % object)
|
call = CGWrapper(call, pre="%s." % object)
|
||||||
call = CGList([call, CGWrapper(args, pre="(", post=")")])
|
call = CGList([call, CGWrapper(args, pre="(", post=")")])
|
||||||
|
|
||||||
self.cgRoot.append(CGList([
|
self.cgRoot.append(CGList([
|
||||||
|
@ -4064,7 +4064,7 @@ class CGInterfaceTrait(CGThing):
|
||||||
return "".join(", %s: %s" % argument for argument in arguments)
|
return "".join(", %s: %s" % argument for argument in arguments)
|
||||||
|
|
||||||
methods = CGList([
|
methods = CGList([
|
||||||
CGGeneric("fn %s(&self%s) -> %s;\n" % (name, fmt(arguments), rettype))
|
CGGeneric("fn %s(self%s) -> %s;\n" % (name, fmt(arguments), rettype))
|
||||||
for name, arguments, rettype in members()
|
for name, arguments, rettype in members()
|
||||||
], "")
|
], "")
|
||||||
self.cgRoot = CGWrapper(CGIndenter(methods),
|
self.cgRoot = CGWrapper(CGIndenter(methods),
|
||||||
|
|
|
@ -46,21 +46,21 @@ impl CanvasRenderingContext2D {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> {
|
impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> {
|
||||||
fn Canvas(&self) -> Temporary<HTMLCanvasElement> {
|
fn Canvas(self) -> Temporary<HTMLCanvasElement> {
|
||||||
Temporary::new(self.canvas)
|
Temporary::new(self.canvas)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn FillRect(&self, x: f64, y: f64, width: f64, height: f64) {
|
fn FillRect(self, x: f64, y: f64, width: f64, height: f64) {
|
||||||
let rect = Rect(Point2D(x as f32, y as f32), Size2D(width as f32, height as f32));
|
let rect = Rect(Point2D(x as f32, y as f32), Size2D(width as f32, height as f32));
|
||||||
self.renderer.deref().send(FillRect(rect));
|
self.renderer.deref().send(FillRect(rect));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ClearRect(&self, x: f64, y: f64, width: f64, height: f64) {
|
fn ClearRect(self, x: f64, y: f64, width: f64, height: f64) {
|
||||||
let rect = Rect(Point2D(x as f32, y as f32), Size2D(width as f32, height as f32));
|
let rect = Rect(Point2D(x as f32, y as f32), Size2D(width as f32, height as f32));
|
||||||
self.renderer.deref().send(ClearRect(rect));
|
self.renderer.deref().send(ClearRect(rect));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn StrokeRect(&self, x: f64, y: f64, width: f64, height: f64) {
|
fn StrokeRect(self, x: f64, y: f64, width: f64, height: f64) {
|
||||||
let rect = Rect(Point2D(x as f32, y as f32), Size2D(width as f32, height as f32));
|
let rect = Rect(Point2D(x as f32, y as f32), Size2D(width as f32, height as f32));
|
||||||
self.renderer.deref().send(StrokeRect(rect));
|
self.renderer.deref().send(StrokeRect(rect));
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,37 +45,37 @@ impl CharacterData {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
|
impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
|
||||||
fn Data(&self) -> DOMString {
|
fn Data(self) -> DOMString {
|
||||||
self.data.deref().borrow().clone()
|
self.data.deref().borrow().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetData(&self, arg: DOMString) -> ErrorResult {
|
fn SetData(self, arg: DOMString) -> ErrorResult {
|
||||||
*self.data.deref().borrow_mut() = arg;
|
*self.data.deref().borrow_mut() = arg;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Length(&self) -> u32 {
|
fn Length(self) -> u32 {
|
||||||
self.data.deref().borrow().len() as u32
|
self.data.deref().borrow().len() as u32
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SubstringData(&self, offset: u32, count: u32) -> Fallible<DOMString> {
|
fn SubstringData(self, offset: u32, count: u32) -> Fallible<DOMString> {
|
||||||
Ok(self.data.deref().borrow().as_slice().slice(offset as uint, count as uint).to_string())
|
Ok(self.data.deref().borrow().as_slice().slice(offset as uint, count as uint).to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn AppendData(&self, arg: DOMString) -> ErrorResult {
|
fn AppendData(self, arg: DOMString) -> ErrorResult {
|
||||||
self.data.deref().borrow_mut().push_str(arg.as_slice());
|
self.data.deref().borrow_mut().push_str(arg.as_slice());
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn InsertData(&self, offset: u32, arg: DOMString) -> ErrorResult {
|
fn InsertData(self, offset: u32, arg: DOMString) -> ErrorResult {
|
||||||
self.ReplaceData(offset, 0, arg)
|
self.ReplaceData(offset, 0, arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn DeleteData(&self, offset: u32, count: u32) -> ErrorResult {
|
fn DeleteData(self, offset: u32, count: u32) -> ErrorResult {
|
||||||
self.ReplaceData(offset, count, "".to_string())
|
self.ReplaceData(offset, count, "".to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ReplaceData(&self, offset: u32, count: u32, arg: DOMString) -> ErrorResult {
|
fn ReplaceData(self, offset: u32, count: u32, arg: DOMString) -> ErrorResult {
|
||||||
let length = self.data.deref().borrow().len() as u32;
|
let length = self.data.deref().borrow().len() as u32;
|
||||||
if offset > length {
|
if offset > length {
|
||||||
return Err(IndexSize);
|
return Err(IndexSize);
|
||||||
|
@ -94,8 +94,8 @@ impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-childnode-remove
|
// http://dom.spec.whatwg.org/#dom-childnode-remove
|
||||||
fn Remove(&self) {
|
fn Remove(self) {
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
node.remove_self();
|
node.remove_self();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,27 +28,27 @@ impl Console {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ConsoleMethods for JSRef<'a, Console> {
|
impl<'a> ConsoleMethods for JSRef<'a, Console> {
|
||||||
fn Log(&self, message: DOMString) {
|
fn Log(self, message: DOMString) {
|
||||||
println!("{:s}", message);
|
println!("{:s}", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Debug(&self, message: DOMString) {
|
fn Debug(self, message: DOMString) {
|
||||||
println!("{:s}", message);
|
println!("{:s}", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Info(&self, message: DOMString) {
|
fn Info(self, message: DOMString) {
|
||||||
println!("{:s}", message);
|
println!("{:s}", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Warn(&self, message: DOMString) {
|
fn Warn(self, message: DOMString) {
|
||||||
println!("{:s}", message);
|
println!("{:s}", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Error(&self, message: DOMString) {
|
fn Error(self, message: DOMString) {
|
||||||
println!("{:s}", message);
|
println!("{:s}", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Assert(&self, condition: bool, message: Option<DOMString>) {
|
fn Assert(self, condition: bool, message: Option<DOMString>) {
|
||||||
if !condition {
|
if !condition {
|
||||||
let message = match message {
|
let message = match message {
|
||||||
Some(ref message) => message.as_slice(),
|
Some(ref message) => message.as_slice(),
|
||||||
|
|
|
@ -57,18 +57,18 @@ impl CustomEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CustomEventMethods for JSRef<'a, CustomEvent> {
|
impl<'a> CustomEventMethods for JSRef<'a, CustomEvent> {
|
||||||
fn Detail(&self, _cx: *mut JSContext) -> JSVal {
|
fn Detail(self, _cx: *mut JSContext) -> JSVal {
|
||||||
*self.detail.deref().get()
|
*self.detail.deref().get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn InitCustomEvent(&self,
|
fn InitCustomEvent(self,
|
||||||
_cx: *mut JSContext,
|
_cx: *mut JSContext,
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
can_bubble: bool,
|
can_bubble: bool,
|
||||||
cancelable: bool,
|
cancelable: bool,
|
||||||
detail: JSVal) {
|
detail: JSVal) {
|
||||||
self.detail.deref().set(Traceable::new(detail));
|
self.detail.deref().set(Traceable::new(detail));
|
||||||
let event: JSRef<Event> = EventCast::from_ref(*self);
|
let event: JSRef<Event> = EventCast::from_ref(self);
|
||||||
event.InitEvent(type_, can_bubble, cancelable);
|
event.InitEvent(type_, can_bubble, cancelable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ impl DedicatedWorkerGlobalScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DedicatedWorkerGlobalScopeMethods for JSRef<'a, DedicatedWorkerGlobalScope> {
|
impl<'a> DedicatedWorkerGlobalScopeMethods for JSRef<'a, DedicatedWorkerGlobalScope> {
|
||||||
fn PostMessage(&self, cx: *mut JSContext, message: JSVal) {
|
fn PostMessage(self, cx: *mut JSContext, message: JSVal) {
|
||||||
let mut data = ptr::mut_null();
|
let mut data = ptr::mut_null();
|
||||||
let mut nbytes = 0;
|
let mut nbytes = 0;
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -163,13 +163,13 @@ impl<'a> DedicatedWorkerGlobalScopeMethods for JSRef<'a, DedicatedWorkerGlobalSc
|
||||||
sender.send(WorkerPostMessage(*self.worker, data, nbytes));
|
sender.send(WorkerPostMessage(*self.worker, data, nbytes));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetOnmessage(&self) -> Option<EventHandlerNonNull> {
|
fn GetOnmessage(self) -> Option<EventHandlerNonNull> {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.get_event_handler_common("message")
|
eventtarget.get_event_handler_common("message")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetOnmessage(&self, listener: Option<EventHandlerNonNull>) {
|
fn SetOnmessage(self, listener: Option<EventHandlerNonNull>) {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.set_event_handler_common("message", listener)
|
eventtarget.set_event_handler_common("message", listener)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -367,25 +367,25 @@ impl<'a> PrivateDocumentHelpers for JSRef<'a, Document> {
|
||||||
|
|
||||||
impl<'a> DocumentMethods for JSRef<'a, Document> {
|
impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
// http://dom.spec.whatwg.org/#dom-document-implementation
|
// http://dom.spec.whatwg.org/#dom-document-implementation
|
||||||
fn Implementation(&self) -> Temporary<DOMImplementation> {
|
fn Implementation(self) -> Temporary<DOMImplementation> {
|
||||||
if self.implementation.get().is_none() {
|
if self.implementation.get().is_none() {
|
||||||
self.implementation.assign(Some(DOMImplementation::new(*self)));
|
self.implementation.assign(Some(DOMImplementation::new(self)));
|
||||||
}
|
}
|
||||||
Temporary::new(self.implementation.get().get_ref().clone())
|
Temporary::new(self.implementation.get().get_ref().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-url
|
// http://dom.spec.whatwg.org/#dom-document-url
|
||||||
fn URL(&self) -> DOMString {
|
fn URL(self) -> DOMString {
|
||||||
self.url().serialize()
|
self.url().serialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-documenturi
|
// http://dom.spec.whatwg.org/#dom-document-documenturi
|
||||||
fn DocumentURI(&self) -> DOMString {
|
fn DocumentURI(self) -> DOMString {
|
||||||
self.URL()
|
self.URL()
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-compatmode
|
// http://dom.spec.whatwg.org/#dom-document-compatmode
|
||||||
fn CompatMode(&self) -> DOMString {
|
fn CompatMode(self) -> DOMString {
|
||||||
match self.quirks_mode.deref().get() {
|
match self.quirks_mode.deref().get() {
|
||||||
LimitedQuirks | NoQuirks => "CSS1Compat".to_string(),
|
LimitedQuirks | NoQuirks => "CSS1Compat".to_string(),
|
||||||
FullQuirks => "BackCompat".to_string()
|
FullQuirks => "BackCompat".to_string()
|
||||||
|
@ -393,18 +393,18 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-characterset
|
// http://dom.spec.whatwg.org/#dom-document-characterset
|
||||||
fn CharacterSet(&self) -> DOMString {
|
fn CharacterSet(self) -> DOMString {
|
||||||
self.encoding_name.deref().borrow().as_slice().to_ascii_lower()
|
self.encoding_name.deref().borrow().as_slice().to_ascii_lower()
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-content_type
|
// http://dom.spec.whatwg.org/#dom-document-content_type
|
||||||
fn ContentType(&self) -> DOMString {
|
fn ContentType(self) -> DOMString {
|
||||||
self.content_type.clone()
|
self.content_type.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-doctype
|
// http://dom.spec.whatwg.org/#dom-document-doctype
|
||||||
fn GetDoctype(&self) -> Option<Temporary<DocumentType>> {
|
fn GetDoctype(self) -> Option<Temporary<DocumentType>> {
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
node.children().find(|child| {
|
node.children().find(|child| {
|
||||||
child.is_doctype()
|
child.is_doctype()
|
||||||
}).map(|node| {
|
}).map(|node| {
|
||||||
|
@ -414,32 +414,32 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-documentelement
|
// http://dom.spec.whatwg.org/#dom-document-documentelement
|
||||||
fn GetDocumentElement(&self) -> Option<Temporary<Element>> {
|
fn GetDocumentElement(self) -> Option<Temporary<Element>> {
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
node.child_elements().next().map(|elem| Temporary::from_rooted(elem))
|
node.child_elements().next().map(|elem| Temporary::from_rooted(elem))
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-getelementsbytagname
|
// http://dom.spec.whatwg.org/#dom-document-getelementsbytagname
|
||||||
fn GetElementsByTagName(&self, tag_name: DOMString) -> Temporary<HTMLCollection> {
|
fn GetElementsByTagName(self, tag_name: DOMString) -> Temporary<HTMLCollection> {
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
HTMLCollection::by_tag_name(*window, NodeCast::from_ref(*self), tag_name)
|
HTMLCollection::by_tag_name(*window, NodeCast::from_ref(self), tag_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-getelementsbytagnamens
|
// http://dom.spec.whatwg.org/#dom-document-getelementsbytagnamens
|
||||||
fn GetElementsByTagNameNS(&self, maybe_ns: Option<DOMString>, tag_name: DOMString) -> Temporary<HTMLCollection> {
|
fn GetElementsByTagNameNS(self, maybe_ns: Option<DOMString>, tag_name: DOMString) -> Temporary<HTMLCollection> {
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
HTMLCollection::by_tag_name_ns(*window, NodeCast::from_ref(*self), tag_name, maybe_ns)
|
HTMLCollection::by_tag_name_ns(*window, NodeCast::from_ref(self), tag_name, maybe_ns)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-getelementsbyclassname
|
// http://dom.spec.whatwg.org/#dom-document-getelementsbyclassname
|
||||||
fn GetElementsByClassName(&self, classes: DOMString) -> Temporary<HTMLCollection> {
|
fn GetElementsByClassName(self, classes: DOMString) -> Temporary<HTMLCollection> {
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
|
|
||||||
HTMLCollection::by_class_name(*window, NodeCast::from_ref(*self), classes)
|
HTMLCollection::by_class_name(*window, NodeCast::from_ref(self), classes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid
|
// http://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid
|
||||||
fn GetElementById(&self, id: DOMString) -> Option<Temporary<Element>> {
|
fn GetElementById(self, id: DOMString) -> Option<Temporary<Element>> {
|
||||||
match self.idmap.deref().borrow().find_equiv(&id) {
|
match self.idmap.deref().borrow().find_equiv(&id) {
|
||||||
None => None,
|
None => None,
|
||||||
Some(ref elements) => Some(Temporary::new((*elements)[0].clone())),
|
Some(ref elements) => Some(Temporary::new((*elements)[0].clone())),
|
||||||
|
@ -447,17 +447,17 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-createelement
|
// http://dom.spec.whatwg.org/#dom-document-createelement
|
||||||
fn CreateElement(&self, local_name: DOMString) -> Fallible<Temporary<Element>> {
|
fn CreateElement(self, local_name: DOMString) -> Fallible<Temporary<Element>> {
|
||||||
if xml_name_type(local_name.as_slice()) == InvalidXMLName {
|
if xml_name_type(local_name.as_slice()) == InvalidXMLName {
|
||||||
debug!("Not a valid element name");
|
debug!("Not a valid element name");
|
||||||
return Err(InvalidCharacter);
|
return Err(InvalidCharacter);
|
||||||
}
|
}
|
||||||
let local_name = local_name.as_slice().to_ascii_lower();
|
let local_name = local_name.as_slice().to_ascii_lower();
|
||||||
Ok(build_element_from_tag(local_name, namespace::HTML, *self))
|
Ok(build_element_from_tag(local_name, namespace::HTML, self))
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-createelementns
|
// http://dom.spec.whatwg.org/#dom-document-createelementns
|
||||||
fn CreateElementNS(&self,
|
fn CreateElementNS(self,
|
||||||
namespace: Option<DOMString>,
|
namespace: Option<DOMString>,
|
||||||
qualified_name: DOMString) -> Fallible<Temporary<Element>> {
|
qualified_name: DOMString) -> Fallible<Temporary<Element>> {
|
||||||
let ns = Namespace::from_str(null_str_as_empty_ref(&namespace));
|
let ns = Namespace::from_str(null_str_as_empty_ref(&namespace));
|
||||||
|
@ -497,31 +497,31 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ns == namespace::HTML {
|
if ns == namespace::HTML {
|
||||||
Ok(build_element_from_tag(local_name_from_qname.to_string(), ns, *self))
|
Ok(build_element_from_tag(local_name_from_qname.to_string(), ns, self))
|
||||||
} else {
|
} else {
|
||||||
Ok(Element::new(local_name_from_qname.to_string(), ns,
|
Ok(Element::new(local_name_from_qname.to_string(), ns,
|
||||||
prefix_from_qname.map(|s| s.to_string()), *self))
|
prefix_from_qname.map(|s| s.to_string()), self))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-createdocumentfragment
|
// http://dom.spec.whatwg.org/#dom-document-createdocumentfragment
|
||||||
fn CreateDocumentFragment(&self) -> Temporary<DocumentFragment> {
|
fn CreateDocumentFragment(self) -> Temporary<DocumentFragment> {
|
||||||
DocumentFragment::new(*self)
|
DocumentFragment::new(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-createtextnode
|
// http://dom.spec.whatwg.org/#dom-document-createtextnode
|
||||||
fn CreateTextNode(&self, data: DOMString)
|
fn CreateTextNode(self, data: DOMString)
|
||||||
-> Temporary<Text> {
|
-> Temporary<Text> {
|
||||||
Text::new(data, *self)
|
Text::new(data, self)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-createcomment
|
// http://dom.spec.whatwg.org/#dom-document-createcomment
|
||||||
fn CreateComment(&self, data: DOMString) -> Temporary<Comment> {
|
fn CreateComment(self, data: DOMString) -> Temporary<Comment> {
|
||||||
Comment::new(data, *self)
|
Comment::new(data, self)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-createprocessinginstruction
|
// http://dom.spec.whatwg.org/#dom-document-createprocessinginstruction
|
||||||
fn CreateProcessingInstruction(&self, target: DOMString,
|
fn CreateProcessingInstruction(self, target: DOMString,
|
||||||
data: DOMString) -> Fallible<Temporary<ProcessingInstruction>> {
|
data: DOMString) -> Fallible<Temporary<ProcessingInstruction>> {
|
||||||
// Step 1.
|
// Step 1.
|
||||||
if xml_name_type(target.as_slice()) == InvalidXMLName {
|
if xml_name_type(target.as_slice()) == InvalidXMLName {
|
||||||
|
@ -534,11 +534,11 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 3.
|
// Step 3.
|
||||||
Ok(ProcessingInstruction::new(target, data, *self))
|
Ok(ProcessingInstruction::new(target, data, self))
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-importnode
|
// http://dom.spec.whatwg.org/#dom-document-importnode
|
||||||
fn ImportNode(&self, node: JSRef<Node>, deep: bool) -> Fallible<Temporary<Node>> {
|
fn ImportNode(self, node: JSRef<Node>, deep: bool) -> Fallible<Temporary<Node>> {
|
||||||
// Step 1.
|
// Step 1.
|
||||||
if node.is_document() {
|
if node.is_document() {
|
||||||
return Err(NotSupported);
|
return Err(NotSupported);
|
||||||
|
@ -550,25 +550,25 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
false => DoNotCloneChildren
|
false => DoNotCloneChildren
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(Node::clone(node, Some(*self), clone_children))
|
Ok(Node::clone(node, Some(self), clone_children))
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-adoptnode
|
// http://dom.spec.whatwg.org/#dom-document-adoptnode
|
||||||
fn AdoptNode(&self, node: JSRef<Node>) -> Fallible<Temporary<Node>> {
|
fn AdoptNode(self, node: JSRef<Node>) -> Fallible<Temporary<Node>> {
|
||||||
// Step 1.
|
// Step 1.
|
||||||
if node.is_document() {
|
if node.is_document() {
|
||||||
return Err(NotSupported);
|
return Err(NotSupported);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 2.
|
// Step 2.
|
||||||
Node::adopt(node, *self);
|
Node::adopt(node, self);
|
||||||
|
|
||||||
// Step 3.
|
// Step 3.
|
||||||
Ok(Temporary::from_rooted(node))
|
Ok(Temporary::from_rooted(node))
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-createevent
|
// http://dom.spec.whatwg.org/#dom-document-createevent
|
||||||
fn CreateEvent(&self, interface: DOMString) -> Fallible<Temporary<Event>> {
|
fn CreateEvent(self, interface: DOMString) -> Fallible<Temporary<Event>> {
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
|
|
||||||
match interface.as_slice().to_ascii_lower().as_slice() {
|
match interface.as_slice().to_ascii_lower().as_slice() {
|
||||||
|
@ -581,7 +581,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://www.whatwg.org/html/#dom-document-lastmodified
|
// http://www.whatwg.org/html/#dom-document-lastmodified
|
||||||
fn LastModified(&self) -> DOMString {
|
fn LastModified(self) -> DOMString {
|
||||||
match *self.last_modified.borrow() {
|
match *self.last_modified.borrow() {
|
||||||
Some(ref t) => t.clone(),
|
Some(ref t) => t.clone(),
|
||||||
None => time::now().strftime("%m/%d/%Y %H:%M:%S"),
|
None => time::now().strftime("%m/%d/%Y %H:%M:%S"),
|
||||||
|
@ -589,18 +589,18 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-createrange
|
// http://dom.spec.whatwg.org/#dom-document-createrange
|
||||||
fn CreateRange(&self) -> Temporary<Range> {
|
fn CreateRange(self) -> Temporary<Range> {
|
||||||
Range::new(*self)
|
Range::new(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-createtreewalker
|
// http://dom.spec.whatwg.org/#dom-document-createtreewalker
|
||||||
fn CreateTreeWalker(&self, root: JSRef<Node>, whatToShow: u32, filter: Option<NodeFilter>)
|
fn CreateTreeWalker(self, root: JSRef<Node>, whatToShow: u32, filter: Option<NodeFilter>)
|
||||||
-> Temporary<TreeWalker> {
|
-> Temporary<TreeWalker> {
|
||||||
TreeWalker::new(*self, root, whatToShow, filter)
|
TreeWalker::new(self, root, whatToShow, filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://www.whatwg.org/specs/web-apps/current-work/#document.title
|
// http://www.whatwg.org/specs/web-apps/current-work/#document.title
|
||||||
fn Title(&self) -> DOMString {
|
fn Title(self) -> DOMString {
|
||||||
let mut title = String::new();
|
let mut title = String::new();
|
||||||
self.GetDocumentElement().root().map(|root| {
|
self.GetDocumentElement().root().map(|root| {
|
||||||
let root: JSRef<Node> = NodeCast::from_ref(*root);
|
let root: JSRef<Node> = NodeCast::from_ref(*root);
|
||||||
|
@ -620,7 +620,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://www.whatwg.org/specs/web-apps/current-work/#document.title
|
// http://www.whatwg.org/specs/web-apps/current-work/#document.title
|
||||||
fn SetTitle(&self, title: DOMString) -> ErrorResult {
|
fn SetTitle(self, title: DOMString) -> ErrorResult {
|
||||||
self.GetDocumentElement().root().map(|root| {
|
self.GetDocumentElement().root().map(|root| {
|
||||||
let root: JSRef<Node> = NodeCast::from_ref(*root);
|
let root: JSRef<Node> = NodeCast::from_ref(*root);
|
||||||
let head_node = root.traverse_preorder().find(|child| {
|
let head_node = root.traverse_preorder().find(|child| {
|
||||||
|
@ -642,7 +642,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
let new_title = HTMLTitleElement::new("title".to_string(), *self).root();
|
let new_title = HTMLTitleElement::new("title".to_string(), self).root();
|
||||||
let new_title: JSRef<Node> = NodeCast::from_ref(*new_title);
|
let new_title: JSRef<Node> = NodeCast::from_ref(*new_title);
|
||||||
|
|
||||||
if !title.is_empty() {
|
if !title.is_empty() {
|
||||||
|
@ -658,7 +658,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-head
|
// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-head
|
||||||
fn GetHead(&self) -> Option<Temporary<HTMLHeadElement>> {
|
fn GetHead(self) -> Option<Temporary<HTMLHeadElement>> {
|
||||||
self.get_html_element().and_then(|root| {
|
self.get_html_element().and_then(|root| {
|
||||||
let root = root.root();
|
let root = root.root();
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*root);
|
let node: JSRef<Node> = NodeCast::from_ref(*root);
|
||||||
|
@ -671,7 +671,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-body
|
// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-body
|
||||||
fn GetBody(&self) -> Option<Temporary<HTMLElement>> {
|
fn GetBody(self) -> Option<Temporary<HTMLElement>> {
|
||||||
self.get_html_element().and_then(|root| {
|
self.get_html_element().and_then(|root| {
|
||||||
let root = root.root();
|
let root = root.root();
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*root);
|
let node: JSRef<Node> = NodeCast::from_ref(*root);
|
||||||
|
@ -688,7 +688,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-body
|
// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-body
|
||||||
fn SetBody(&self, new_body: Option<JSRef<HTMLElement>>) -> ErrorResult {
|
fn SetBody(self, new_body: Option<JSRef<HTMLElement>>) -> ErrorResult {
|
||||||
// Step 1.
|
// Step 1.
|
||||||
match new_body {
|
match new_body {
|
||||||
Some(ref htmlelem) => {
|
Some(ref htmlelem) => {
|
||||||
|
@ -731,7 +731,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-getelementsbyname
|
// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-getelementsbyname
|
||||||
fn GetElementsByName(&self, name: DOMString) -> Temporary<NodeList> {
|
fn GetElementsByName(self, name: DOMString) -> Temporary<NodeList> {
|
||||||
self.createNodeList(|node| {
|
self.createNodeList(|node| {
|
||||||
if !node.is_element() {
|
if !node.is_element() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -744,121 +744,121 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Images(&self) -> Temporary<HTMLCollection> {
|
fn Images(self) -> Temporary<HTMLCollection> {
|
||||||
if self.images.get().is_none() {
|
if self.images.get().is_none() {
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
let root = NodeCast::from_ref(*self);
|
let root = NodeCast::from_ref(self);
|
||||||
let filter = box ImagesFilter;
|
let filter = box ImagesFilter;
|
||||||
self.images.assign(Some(HTMLCollection::create(*window, root, filter)));
|
self.images.assign(Some(HTMLCollection::create(*window, root, filter)));
|
||||||
}
|
}
|
||||||
Temporary::new(self.images.get().get_ref().clone())
|
Temporary::new(self.images.get().get_ref().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Embeds(&self) -> Temporary<HTMLCollection> {
|
fn Embeds(self) -> Temporary<HTMLCollection> {
|
||||||
if self.embeds.get().is_none() {
|
if self.embeds.get().is_none() {
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
let root = NodeCast::from_ref(*self);
|
let root = NodeCast::from_ref(self);
|
||||||
let filter = box EmbedsFilter;
|
let filter = box EmbedsFilter;
|
||||||
self.embeds.assign(Some(HTMLCollection::create(*window, root, filter)));
|
self.embeds.assign(Some(HTMLCollection::create(*window, root, filter)));
|
||||||
}
|
}
|
||||||
Temporary::new(self.embeds.get().get_ref().clone())
|
Temporary::new(self.embeds.get().get_ref().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Plugins(&self) -> Temporary<HTMLCollection> {
|
fn Plugins(self) -> Temporary<HTMLCollection> {
|
||||||
self.Embeds()
|
self.Embeds()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Links(&self) -> Temporary<HTMLCollection> {
|
fn Links(self) -> Temporary<HTMLCollection> {
|
||||||
if self.links.get().is_none() {
|
if self.links.get().is_none() {
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
let root = NodeCast::from_ref(*self);
|
let root = NodeCast::from_ref(self);
|
||||||
let filter = box LinksFilter;
|
let filter = box LinksFilter;
|
||||||
self.links.assign(Some(HTMLCollection::create(*window, root, filter)));
|
self.links.assign(Some(HTMLCollection::create(*window, root, filter)));
|
||||||
}
|
}
|
||||||
Temporary::new(self.links.get().get_ref().clone())
|
Temporary::new(self.links.get().get_ref().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Forms(&self) -> Temporary<HTMLCollection> {
|
fn Forms(self) -> Temporary<HTMLCollection> {
|
||||||
if self.forms.get().is_none() {
|
if self.forms.get().is_none() {
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
let root = NodeCast::from_ref(*self);
|
let root = NodeCast::from_ref(self);
|
||||||
let filter = box FormsFilter;
|
let filter = box FormsFilter;
|
||||||
self.forms.assign(Some(HTMLCollection::create(*window, root, filter)));
|
self.forms.assign(Some(HTMLCollection::create(*window, root, filter)));
|
||||||
}
|
}
|
||||||
Temporary::new(self.forms.get().get_ref().clone())
|
Temporary::new(self.forms.get().get_ref().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Scripts(&self) -> Temporary<HTMLCollection> {
|
fn Scripts(self) -> Temporary<HTMLCollection> {
|
||||||
if self.scripts.get().is_none() {
|
if self.scripts.get().is_none() {
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
let root = NodeCast::from_ref(*self);
|
let root = NodeCast::from_ref(self);
|
||||||
let filter = box ScriptsFilter;
|
let filter = box ScriptsFilter;
|
||||||
self.scripts.assign(Some(HTMLCollection::create(*window, root, filter)));
|
self.scripts.assign(Some(HTMLCollection::create(*window, root, filter)));
|
||||||
}
|
}
|
||||||
Temporary::new(self.scripts.get().get_ref().clone())
|
Temporary::new(self.scripts.get().get_ref().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Anchors(&self) -> Temporary<HTMLCollection> {
|
fn Anchors(self) -> Temporary<HTMLCollection> {
|
||||||
if self.anchors.get().is_none() {
|
if self.anchors.get().is_none() {
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
let root = NodeCast::from_ref(*self);
|
let root = NodeCast::from_ref(self);
|
||||||
let filter = box AnchorsFilter;
|
let filter = box AnchorsFilter;
|
||||||
self.anchors.assign(Some(HTMLCollection::create(*window, root, filter)));
|
self.anchors.assign(Some(HTMLCollection::create(*window, root, filter)));
|
||||||
}
|
}
|
||||||
Temporary::new(self.anchors.get().get_ref().clone())
|
Temporary::new(self.anchors.get().get_ref().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Applets(&self) -> Temporary<HTMLCollection> {
|
fn Applets(self) -> Temporary<HTMLCollection> {
|
||||||
// FIXME: This should be return OBJECT elements containing applets.
|
// FIXME: This should be return OBJECT elements containing applets.
|
||||||
if self.applets.get().is_none() {
|
if self.applets.get().is_none() {
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
let root = NodeCast::from_ref(*self);
|
let root = NodeCast::from_ref(self);
|
||||||
let filter = box AppletsFilter;
|
let filter = box AppletsFilter;
|
||||||
self.applets.assign(Some(HTMLCollection::create(*window, root, filter)));
|
self.applets.assign(Some(HTMLCollection::create(*window, root, filter)));
|
||||||
}
|
}
|
||||||
Temporary::new(self.applets.get().get_ref().clone())
|
Temporary::new(self.applets.get().get_ref().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Location(&self) -> Temporary<Location> {
|
fn Location(self) -> Temporary<Location> {
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
window.Location()
|
window.Location()
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-parentnode-children
|
// http://dom.spec.whatwg.org/#dom-parentnode-children
|
||||||
fn Children(&self) -> Temporary<HTMLCollection> {
|
fn Children(self) -> Temporary<HTMLCollection> {
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
HTMLCollection::children(*window, NodeCast::from_ref(*self))
|
HTMLCollection::children(*window, NodeCast::from_ref(self))
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-parentnode-queryselector
|
// http://dom.spec.whatwg.org/#dom-parentnode-queryselector
|
||||||
fn QuerySelector(&self, selectors: DOMString) -> Fallible<Option<Temporary<Element>>> {
|
fn QuerySelector(self, selectors: DOMString) -> Fallible<Option<Temporary<Element>>> {
|
||||||
let root: JSRef<Node> = NodeCast::from_ref(*self);
|
let root: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
root.query_selector(selectors)
|
root.query_selector(selectors)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-parentnode-queryselectorall
|
// http://dom.spec.whatwg.org/#dom-parentnode-queryselectorall
|
||||||
fn QuerySelectorAll(&self, selectors: DOMString) -> Fallible<Temporary<NodeList>> {
|
fn QuerySelectorAll(self, selectors: DOMString) -> Fallible<Temporary<NodeList>> {
|
||||||
let root: JSRef<Node> = NodeCast::from_ref(*self);
|
let root: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
root.query_selector_all(selectors)
|
root.query_selector_all(selectors)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetOnclick(&self) -> Option<EventHandlerNonNull> {
|
fn GetOnclick(self) -> Option<EventHandlerNonNull> {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.get_event_handler_common("click")
|
eventtarget.get_event_handler_common("click")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetOnclick(&self, listener: Option<EventHandlerNonNull>) {
|
fn SetOnclick(self, listener: Option<EventHandlerNonNull>) {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.set_event_handler_common("click", listener)
|
eventtarget.set_event_handler_common("click", listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetOnload(&self) -> Option<EventHandlerNonNull> {
|
fn GetOnload(self) -> Option<EventHandlerNonNull> {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.get_event_handler_common("load")
|
eventtarget.get_event_handler_common("load")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetOnload(&self, listener: Option<EventHandlerNonNull>) {
|
fn SetOnload(self, listener: Option<EventHandlerNonNull>) {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.set_event_handler_common("load", listener)
|
eventtarget.set_event_handler_common("load", listener)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,23 +53,22 @@ impl DocumentFragment {
|
||||||
|
|
||||||
impl<'a> DocumentFragmentMethods for JSRef<'a, DocumentFragment> {
|
impl<'a> DocumentFragmentMethods for JSRef<'a, DocumentFragment> {
|
||||||
// http://dom.spec.whatwg.org/#dom-parentnode-children
|
// http://dom.spec.whatwg.org/#dom-parentnode-children
|
||||||
fn Children(&self) -> Temporary<HTMLCollection> {
|
fn Children(self) -> Temporary<HTMLCollection> {
|
||||||
let window = window_from_node(*self).root();
|
let window = window_from_node(self).root();
|
||||||
HTMLCollection::children(*window, NodeCast::from_ref(*self))
|
HTMLCollection::children(*window, NodeCast::from_ref(self))
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-parentnode-queryselector
|
// http://dom.spec.whatwg.org/#dom-parentnode-queryselector
|
||||||
fn QuerySelector(&self, selectors: DOMString) -> Fallible<Option<Temporary<Element>>> {
|
fn QuerySelector(self, selectors: DOMString) -> Fallible<Option<Temporary<Element>>> {
|
||||||
let root: JSRef<Node> = NodeCast::from_ref(*self);
|
let root: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
root.query_selector(selectors)
|
root.query_selector(selectors)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-parentnode-queryselectorall
|
// http://dom.spec.whatwg.org/#dom-parentnode-queryselectorall
|
||||||
fn QuerySelectorAll(&self, selectors: DOMString) -> Fallible<Temporary<NodeList>> {
|
fn QuerySelectorAll(self, selectors: DOMString) -> Fallible<Temporary<NodeList>> {
|
||||||
let root: JSRef<Node> = NodeCast::from_ref(*self);
|
let root: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
root.query_selector_all(selectors)
|
root.query_selector_all(selectors)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Reflectable for DocumentFragment {
|
impl Reflectable for DocumentFragment {
|
||||||
|
|
|
@ -56,21 +56,21 @@ impl DocumentType {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DocumentTypeMethods for JSRef<'a, DocumentType> {
|
impl<'a> DocumentTypeMethods for JSRef<'a, DocumentType> {
|
||||||
fn Name(&self) -> DOMString {
|
fn Name(self) -> DOMString {
|
||||||
self.name.clone()
|
self.name.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn PublicId(&self) -> DOMString {
|
fn PublicId(self) -> DOMString {
|
||||||
self.public_id.clone()
|
self.public_id.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SystemId(&self) -> DOMString {
|
fn SystemId(self) -> DOMString {
|
||||||
self.system_id.clone()
|
self.system_id.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-childnode-remove
|
// http://dom.spec.whatwg.org/#dom-childnode-remove
|
||||||
fn Remove(&self) {
|
fn Remove(self) {
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
node.remove_self();
|
node.remove_self();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ impl Reflectable for DOMException {
|
||||||
|
|
||||||
impl<'a> DOMExceptionMethods for JSRef<'a, DOMException> {
|
impl<'a> DOMExceptionMethods for JSRef<'a, DOMException> {
|
||||||
// http://dom.spec.whatwg.org/#dom-domexception-code
|
// http://dom.spec.whatwg.org/#dom-domexception-code
|
||||||
fn Code(&self) -> u16 {
|
fn Code(self) -> u16 {
|
||||||
match self.code {
|
match self.code {
|
||||||
// http://dom.spec.whatwg.org/#concept-throw
|
// http://dom.spec.whatwg.org/#concept-throw
|
||||||
EncodingError => 0,
|
EncodingError => 0,
|
||||||
|
@ -100,12 +100,12 @@ impl<'a> DOMExceptionMethods for JSRef<'a, DOMException> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#error-names-0
|
// http://dom.spec.whatwg.org/#error-names-0
|
||||||
fn Name(&self) -> DOMString {
|
fn Name(self) -> DOMString {
|
||||||
self.code.to_string()
|
self.code.to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#error-names-0
|
// http://dom.spec.whatwg.org/#error-names-0
|
||||||
fn Message(&self) -> DOMString {
|
fn Message(self) -> DOMString {
|
||||||
match self.code {
|
match self.code {
|
||||||
IndexSizeError => "The index is not in the allowed range.".to_string(),
|
IndexSizeError => "The index is not in the allowed range.".to_string(),
|
||||||
HierarchyRequestError => "The operation would yield an incorrect node tree.".to_string(),
|
HierarchyRequestError => "The operation would yield an incorrect node tree.".to_string(),
|
||||||
|
|
|
@ -54,7 +54,7 @@ impl Reflectable for DOMImplementation {
|
||||||
// http://dom.spec.whatwg.org/#domimplementation
|
// http://dom.spec.whatwg.org/#domimplementation
|
||||||
impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> {
|
impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> {
|
||||||
// http://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype
|
// http://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype
|
||||||
fn CreateDocumentType(&self, qname: DOMString, pubid: DOMString, sysid: DOMString) -> Fallible<Temporary<DocumentType>> {
|
fn CreateDocumentType(self, qname: DOMString, pubid: DOMString, sysid: DOMString) -> Fallible<Temporary<DocumentType>> {
|
||||||
match xml_name_type(qname.as_slice()) {
|
match xml_name_type(qname.as_slice()) {
|
||||||
// Step 1.
|
// Step 1.
|
||||||
InvalidXMLName => Err(InvalidCharacter),
|
InvalidXMLName => Err(InvalidCharacter),
|
||||||
|
@ -69,7 +69,7 @@ impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-domimplementation-createdocument
|
// http://dom.spec.whatwg.org/#dom-domimplementation-createdocument
|
||||||
fn CreateDocument(&self, namespace: Option<DOMString>, qname: DOMString,
|
fn CreateDocument(self, namespace: Option<DOMString>, qname: DOMString,
|
||||||
maybe_doctype: Option<JSRef<DocumentType>>) -> Fallible<Temporary<Document>> {
|
maybe_doctype: Option<JSRef<DocumentType>>) -> Fallible<Temporary<Document>> {
|
||||||
let doc = self.document.root();
|
let doc = self.document.root();
|
||||||
let win = doc.window.root();
|
let win = doc.window.root();
|
||||||
|
@ -115,7 +115,7 @@ impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument
|
// http://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument
|
||||||
fn CreateHTMLDocument(&self, title: Option<DOMString>) -> Temporary<Document> {
|
fn CreateHTMLDocument(self, title: Option<DOMString>) -> Temporary<Document> {
|
||||||
let document = self.document.root();
|
let document = self.document.root();
|
||||||
let win = document.window.root();
|
let win = document.window.root();
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ impl DOMParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DOMParserMethods for JSRef<'a, DOMParser> {
|
impl<'a> DOMParserMethods for JSRef<'a, DOMParser> {
|
||||||
fn ParseFromString(&self,
|
fn ParseFromString(self,
|
||||||
_s: DOMString,
|
_s: DOMString,
|
||||||
ty: DOMParserBinding::SupportedType)
|
ty: DOMParserBinding::SupportedType)
|
||||||
-> Fallible<Temporary<Document>> {
|
-> Fallible<Temporary<Document>> {
|
||||||
|
|
|
@ -41,27 +41,27 @@ impl DOMRect {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DOMRectMethods for JSRef<'a, DOMRect> {
|
impl<'a> DOMRectMethods for JSRef<'a, DOMRect> {
|
||||||
fn Top(&self) -> f32 {
|
fn Top(self) -> f32 {
|
||||||
self.top
|
self.top
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Bottom(&self) -> f32 {
|
fn Bottom(self) -> f32 {
|
||||||
self.bottom
|
self.bottom
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Left(&self) -> f32 {
|
fn Left(self) -> f32 {
|
||||||
self.left
|
self.left
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Right(&self) -> f32 {
|
fn Right(self) -> f32 {
|
||||||
self.right
|
self.right
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Width(&self) -> f32 {
|
fn Width(self) -> f32 {
|
||||||
(self.right - self.left).abs()
|
(self.right - self.left).abs()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Height(&self) -> f32 {
|
fn Height(self) -> f32 {
|
||||||
(self.bottom - self.top).abs()
|
(self.bottom - self.top).abs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,11 +37,11 @@ impl DOMRectList {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DOMRectListMethods for JSRef<'a, DOMRectList> {
|
impl<'a> DOMRectListMethods for JSRef<'a, DOMRectList> {
|
||||||
fn Length(&self) -> u32 {
|
fn Length(self) -> u32 {
|
||||||
self.rects.len() as u32
|
self.rects.len() as u32
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Item(&self, index: u32) -> Option<Temporary<DOMRect>> {
|
fn Item(self, index: u32) -> Option<Temporary<DOMRect>> {
|
||||||
let rects = &self.rects;
|
let rects = &self.rects;
|
||||||
if index < rects.len() as u32 {
|
if index < rects.len() as u32 {
|
||||||
Some(Temporary::new(rects[index as uint].clone()))
|
Some(Temporary::new(rects[index as uint].clone()))
|
||||||
|
@ -50,7 +50,7 @@ impl<'a> DOMRectListMethods for JSRef<'a, DOMRectList> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Temporary<DOMRect>> {
|
fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<Temporary<DOMRect>> {
|
||||||
*found = index < self.rects.len() as u32;
|
*found = index < self.rects.len() as u32;
|
||||||
self.Item(index)
|
self.Item(index)
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,27 +71,27 @@ impl<'a> PrivateDOMTokenListHelpers for JSRef<'a, DOMTokenList> {
|
||||||
// http://dom.spec.whatwg.org/#domtokenlist
|
// http://dom.spec.whatwg.org/#domtokenlist
|
||||||
impl<'a> DOMTokenListMethods for JSRef<'a, DOMTokenList> {
|
impl<'a> DOMTokenListMethods for JSRef<'a, DOMTokenList> {
|
||||||
// http://dom.spec.whatwg.org/#dom-domtokenlist-length
|
// http://dom.spec.whatwg.org/#dom-domtokenlist-length
|
||||||
fn Length(&self) -> u32 {
|
fn Length(self) -> u32 {
|
||||||
self.attribute().root().map(|attr| {
|
self.attribute().root().map(|attr| {
|
||||||
attr.value().tokens().map(|tokens| tokens.len()).unwrap_or(0)
|
attr.value().tokens().map(|tokens| tokens.len()).unwrap_or(0)
|
||||||
}).unwrap_or(0) as u32
|
}).unwrap_or(0) as u32
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-domtokenlist-item
|
// http://dom.spec.whatwg.org/#dom-domtokenlist-item
|
||||||
fn Item(&self, index: u32) -> Option<DOMString> {
|
fn Item(self, index: u32) -> Option<DOMString> {
|
||||||
self.attribute().root().and_then(|attr| attr.value().tokens().and_then(|mut tokens| {
|
self.attribute().root().and_then(|attr| attr.value().tokens().and_then(|mut tokens| {
|
||||||
tokens.idx(index as uint).map(|token| token.as_slice().to_string())
|
tokens.idx(index as uint).map(|token| token.as_slice().to_string())
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<DOMString> {
|
fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<DOMString> {
|
||||||
let item = self.Item(index);
|
let item = self.Item(index);
|
||||||
*found = item.is_some();
|
*found = item.is_some();
|
||||||
item
|
item
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-domtokenlist-contains
|
// http://dom.spec.whatwg.org/#dom-domtokenlist-contains
|
||||||
fn Contains(&self, token: DOMString) -> Fallible<bool> {
|
fn Contains(self, token: DOMString) -> Fallible<bool> {
|
||||||
self.check_token_exceptions(token.as_slice()).map(|slice| {
|
self.check_token_exceptions(token.as_slice()).map(|slice| {
|
||||||
self.attribute().root().and_then(|attr| attr.value().tokens().map(|mut tokens| {
|
self.attribute().root().and_then(|attr| attr.value().tokens().map(|mut tokens| {
|
||||||
let atom = Atom::from_slice(slice);
|
let atom = Atom::from_slice(slice);
|
||||||
|
|
|
@ -271,7 +271,7 @@ impl<'a> ElementHelpers for JSRef<'a, Element> {
|
||||||
summarized
|
summarized
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_void(&self) -> bool {
|
fn is_void(self) -> bool {
|
||||||
if self.namespace != namespace::HTML {
|
if self.namespace != namespace::HTML {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -506,24 +506,24 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
|
||||||
|
|
||||||
impl<'a> ElementMethods for JSRef<'a, Element> {
|
impl<'a> ElementMethods for JSRef<'a, Element> {
|
||||||
// http://dom.spec.whatwg.org/#dom-element-namespaceuri
|
// http://dom.spec.whatwg.org/#dom-element-namespaceuri
|
||||||
fn GetNamespaceURI(&self) -> Option<DOMString> {
|
fn GetNamespaceURI(self) -> Option<DOMString> {
|
||||||
match self.namespace {
|
match self.namespace {
|
||||||
Null => None,
|
Null => None,
|
||||||
ref ns => Some(ns.to_str().to_string())
|
ref ns => Some(ns.to_str().to_string())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn LocalName(&self) -> DOMString {
|
fn LocalName(self) -> DOMString {
|
||||||
self.local_name.as_slice().to_string()
|
self.local_name.as_slice().to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-element-prefix
|
// http://dom.spec.whatwg.org/#dom-element-prefix
|
||||||
fn GetPrefix(&self) -> Option<DOMString> {
|
fn GetPrefix(self) -> Option<DOMString> {
|
||||||
self.prefix.clone()
|
self.prefix.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-element-tagname
|
// http://dom.spec.whatwg.org/#dom-element-tagname
|
||||||
fn TagName(&self) -> DOMString {
|
fn TagName(self) -> DOMString {
|
||||||
let qualified_name = match self.prefix {
|
let qualified_name = match self.prefix {
|
||||||
Some(ref prefix) => format!("{}:{}", prefix, self.local_name).into_maybe_owned(),
|
Some(ref prefix) => format!("{}:{}", prefix, self.local_name).into_maybe_owned(),
|
||||||
None => self.local_name.as_slice().into_maybe_owned()
|
None => self.local_name.as_slice().into_maybe_owned()
|
||||||
|
@ -536,31 +536,31 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-element-id
|
// http://dom.spec.whatwg.org/#dom-element-id
|
||||||
fn Id(&self) -> DOMString {
|
fn Id(self) -> DOMString {
|
||||||
self.get_string_attribute("id")
|
self.get_string_attribute("id")
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-element-id
|
// http://dom.spec.whatwg.org/#dom-element-id
|
||||||
fn SetId(&self, id: DOMString) {
|
fn SetId(self, id: DOMString) {
|
||||||
self.set_atomic_attribute("id", id);
|
self.set_atomic_attribute("id", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-element-classname
|
// http://dom.spec.whatwg.org/#dom-element-classname
|
||||||
fn ClassName(&self) -> DOMString {
|
fn ClassName(self) -> DOMString {
|
||||||
self.get_string_attribute("class")
|
self.get_string_attribute("class")
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-element-classname
|
// http://dom.spec.whatwg.org/#dom-element-classname
|
||||||
fn SetClassName(&self, class: DOMString) {
|
fn SetClassName(self, class: DOMString) {
|
||||||
self.set_tokenlist_attribute("class", class);
|
self.set_tokenlist_attribute("class", class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-element-classlist
|
// http://dom.spec.whatwg.org/#dom-element-classlist
|
||||||
fn ClassList(&self) -> Temporary<DOMTokenList> {
|
fn ClassList(self) -> Temporary<DOMTokenList> {
|
||||||
match self.class_list.get() {
|
match self.class_list.get() {
|
||||||
Some(class_list) => Temporary::new(class_list),
|
Some(class_list) => Temporary::new(class_list),
|
||||||
None => {
|
None => {
|
||||||
let class_list = DOMTokenList::new(*self, "class").root();
|
let class_list = DOMTokenList::new(self, "class").root();
|
||||||
self.class_list.assign(Some(class_list.deref().clone()));
|
self.class_list.assign(Some(class_list.deref().clone()));
|
||||||
Temporary::from_rooted(*class_list)
|
Temporary::from_rooted(*class_list)
|
||||||
}
|
}
|
||||||
|
@ -568,24 +568,24 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-element-attributes
|
// http://dom.spec.whatwg.org/#dom-element-attributes
|
||||||
fn Attributes(&self) -> Temporary<NamedNodeMap> {
|
fn Attributes(self) -> Temporary<NamedNodeMap> {
|
||||||
match self.attr_list.get() {
|
match self.attr_list.get() {
|
||||||
None => (),
|
None => (),
|
||||||
Some(ref list) => return Temporary::new(list.clone()),
|
Some(ref list) => return Temporary::new(list.clone()),
|
||||||
}
|
}
|
||||||
|
|
||||||
let doc = {
|
let doc = {
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
node.owner_doc().root()
|
node.owner_doc().root()
|
||||||
};
|
};
|
||||||
let window = doc.deref().window.root();
|
let window = doc.deref().window.root();
|
||||||
let list = NamedNodeMap::new(*window, *self);
|
let list = NamedNodeMap::new(*window, self);
|
||||||
self.attr_list.assign(Some(list));
|
self.attr_list.assign(Some(list));
|
||||||
Temporary::new(self.attr_list.get().get_ref().clone())
|
Temporary::new(self.attr_list.get().get_ref().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-element-getattribute
|
// http://dom.spec.whatwg.org/#dom-element-getattribute
|
||||||
fn GetAttribute(&self, name: DOMString) -> Option<DOMString> {
|
fn GetAttribute(self, name: DOMString) -> Option<DOMString> {
|
||||||
let name = if self.html_element_in_html_document() {
|
let name = if self.html_element_in_html_document() {
|
||||||
name.as_slice().to_ascii_lower()
|
name.as_slice().to_ascii_lower()
|
||||||
} else {
|
} else {
|
||||||
|
@ -596,7 +596,7 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-element-getattributens
|
// http://dom.spec.whatwg.org/#dom-element-getattributens
|
||||||
fn GetAttributeNS(&self,
|
fn GetAttributeNS(self,
|
||||||
namespace: Option<DOMString>,
|
namespace: Option<DOMString>,
|
||||||
local_name: DOMString) -> Option<DOMString> {
|
local_name: DOMString) -> Option<DOMString> {
|
||||||
let namespace = Namespace::from_str(null_str_as_empty_ref(&namespace));
|
let namespace = Namespace::from_str(null_str_as_empty_ref(&namespace));
|
||||||
|
@ -605,11 +605,11 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-element-setattribute
|
// http://dom.spec.whatwg.org/#dom-element-setattribute
|
||||||
fn SetAttribute(&self,
|
fn SetAttribute(self,
|
||||||
name: DOMString,
|
name: DOMString,
|
||||||
value: DOMString) -> ErrorResult {
|
value: DOMString) -> ErrorResult {
|
||||||
{
|
{
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
node.wait_until_safe_to_modify_dom();
|
node.wait_until_safe_to_modify_dom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -636,12 +636,12 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-element-setattributens
|
// http://dom.spec.whatwg.org/#dom-element-setattributens
|
||||||
fn SetAttributeNS(&self,
|
fn SetAttributeNS(self,
|
||||||
namespace_url: Option<DOMString>,
|
namespace_url: Option<DOMString>,
|
||||||
name: DOMString,
|
name: DOMString,
|
||||||
value: DOMString) -> ErrorResult {
|
value: DOMString) -> ErrorResult {
|
||||||
{
|
{
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
node.wait_until_safe_to_modify_dom();
|
node.wait_until_safe_to_modify_dom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -705,7 +705,7 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-element-removeattribute
|
// http://dom.spec.whatwg.org/#dom-element-removeattribute
|
||||||
fn RemoveAttribute(&self, name: DOMString) {
|
fn RemoveAttribute(self, name: DOMString) {
|
||||||
let name = if self.html_element_in_html_document() {
|
let name = if self.html_element_in_html_document() {
|
||||||
name.as_slice().to_ascii_lower()
|
name.as_slice().to_ascii_lower()
|
||||||
} else {
|
} else {
|
||||||
|
@ -715,7 +715,7 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-element-removeattributens
|
// http://dom.spec.whatwg.org/#dom-element-removeattributens
|
||||||
fn RemoveAttributeNS(&self,
|
fn RemoveAttributeNS(self,
|
||||||
namespace: Option<DOMString>,
|
namespace: Option<DOMString>,
|
||||||
localname: DOMString) {
|
localname: DOMString) {
|
||||||
let namespace = Namespace::from_str(null_str_as_empty_ref(&namespace));
|
let namespace = Namespace::from_str(null_str_as_empty_ref(&namespace));
|
||||||
|
@ -723,38 +723,38 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-element-hasattribute
|
// http://dom.spec.whatwg.org/#dom-element-hasattribute
|
||||||
fn HasAttribute(&self,
|
fn HasAttribute(self,
|
||||||
name: DOMString) -> bool {
|
name: DOMString) -> bool {
|
||||||
self.has_attribute(name.as_slice())
|
self.has_attribute(name.as_slice())
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-element-hasattributens
|
// http://dom.spec.whatwg.org/#dom-element-hasattributens
|
||||||
fn HasAttributeNS(&self,
|
fn HasAttributeNS(self,
|
||||||
namespace: Option<DOMString>,
|
namespace: Option<DOMString>,
|
||||||
local_name: DOMString) -> bool {
|
local_name: DOMString) -> bool {
|
||||||
self.GetAttributeNS(namespace, local_name).is_some()
|
self.GetAttributeNS(namespace, local_name).is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetElementsByTagName(&self, localname: DOMString) -> Temporary<HTMLCollection> {
|
fn GetElementsByTagName(self, localname: DOMString) -> Temporary<HTMLCollection> {
|
||||||
let window = window_from_node(*self).root();
|
let window = window_from_node(self).root();
|
||||||
HTMLCollection::by_tag_name(*window, NodeCast::from_ref(*self), localname)
|
HTMLCollection::by_tag_name(*window, NodeCast::from_ref(self), localname)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetElementsByTagNameNS(&self, maybe_ns: Option<DOMString>,
|
fn GetElementsByTagNameNS(self, maybe_ns: Option<DOMString>,
|
||||||
localname: DOMString) -> Temporary<HTMLCollection> {
|
localname: DOMString) -> Temporary<HTMLCollection> {
|
||||||
let window = window_from_node(*self).root();
|
let window = window_from_node(self).root();
|
||||||
HTMLCollection::by_tag_name_ns(*window, NodeCast::from_ref(*self), localname, maybe_ns)
|
HTMLCollection::by_tag_name_ns(*window, NodeCast::from_ref(self), localname, maybe_ns)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetElementsByClassName(&self, classes: DOMString) -> Temporary<HTMLCollection> {
|
fn GetElementsByClassName(self, classes: DOMString) -> Temporary<HTMLCollection> {
|
||||||
let window = window_from_node(*self).root();
|
let window = window_from_node(self).root();
|
||||||
HTMLCollection::by_class_name(*window, NodeCast::from_ref(*self), classes)
|
HTMLCollection::by_class_name(*window, NodeCast::from_ref(self), classes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/csswg/cssom-view/#dom-element-getclientrects
|
// http://dev.w3.org/csswg/cssom-view/#dom-element-getclientrects
|
||||||
fn GetClientRects(&self) -> Temporary<DOMRectList> {
|
fn GetClientRects(self) -> Temporary<DOMRectList> {
|
||||||
let win = window_from_node(*self).root();
|
let win = window_from_node(self).root();
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
let rects = node.get_content_boxes();
|
let rects = node.get_content_boxes();
|
||||||
let rects: Vec<Root<DOMRect>> = rects.iter().map(|r| {
|
let rects: Vec<Root<DOMRect>> = rects.iter().map(|r| {
|
||||||
DOMRect::new(
|
DOMRect::new(
|
||||||
|
@ -769,9 +769,9 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/csswg/cssom-view/#dom-element-getboundingclientrect
|
// http://dev.w3.org/csswg/cssom-view/#dom-element-getboundingclientrect
|
||||||
fn GetBoundingClientRect(&self) -> Temporary<DOMRect> {
|
fn GetBoundingClientRect(self) -> Temporary<DOMRect> {
|
||||||
let win = window_from_node(*self).root();
|
let win = window_from_node(self).root();
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
let rect = node.get_bounding_content_box();
|
let rect = node.get_bounding_content_box();
|
||||||
DOMRect::new(
|
DOMRect::new(
|
||||||
*win,
|
*win,
|
||||||
|
@ -781,45 +781,45 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
|
||||||
rect.origin.x + rect.size.width)
|
rect.origin.x + rect.size.width)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetInnerHTML(&self) -> Fallible<DOMString> {
|
fn GetInnerHTML(self) -> Fallible<DOMString> {
|
||||||
//XXX TODO: XML case
|
//XXX TODO: XML case
|
||||||
Ok(serialize(&mut NodeIterator::new(NodeCast::from_ref(*self), false, false)))
|
Ok(serialize(&mut NodeIterator::new(NodeCast::from_ref(self), false, false)))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetOuterHTML(&self) -> Fallible<DOMString> {
|
fn GetOuterHTML(self) -> Fallible<DOMString> {
|
||||||
Ok(serialize(&mut NodeIterator::new(NodeCast::from_ref(*self), true, false)))
|
Ok(serialize(&mut NodeIterator::new(NodeCast::from_ref(self), true, false)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-parentnode-children
|
// http://dom.spec.whatwg.org/#dom-parentnode-children
|
||||||
fn Children(&self) -> Temporary<HTMLCollection> {
|
fn Children(self) -> Temporary<HTMLCollection> {
|
||||||
let window = window_from_node(*self).root();
|
let window = window_from_node(self).root();
|
||||||
HTMLCollection::children(*window, NodeCast::from_ref(*self))
|
HTMLCollection::children(*window, NodeCast::from_ref(self))
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-parentnode-queryselector
|
// http://dom.spec.whatwg.org/#dom-parentnode-queryselector
|
||||||
fn QuerySelector(&self, selectors: DOMString) -> Fallible<Option<Temporary<Element>>> {
|
fn QuerySelector(self, selectors: DOMString) -> Fallible<Option<Temporary<Element>>> {
|
||||||
let root: JSRef<Node> = NodeCast::from_ref(*self);
|
let root: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
root.query_selector(selectors)
|
root.query_selector(selectors)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-parentnode-queryselectorall
|
// http://dom.spec.whatwg.org/#dom-parentnode-queryselectorall
|
||||||
fn QuerySelectorAll(&self, selectors: DOMString) -> Fallible<Temporary<NodeList>> {
|
fn QuerySelectorAll(self, selectors: DOMString) -> Fallible<Temporary<NodeList>> {
|
||||||
let root: JSRef<Node> = NodeCast::from_ref(*self);
|
let root: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
root.query_selector_all(selectors)
|
root.query_selector_all(selectors)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-childnode-remove
|
// http://dom.spec.whatwg.org/#dom-childnode-remove
|
||||||
fn Remove(&self) {
|
fn Remove(self) {
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
node.remove_self();
|
node.remove_self();
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-element-matches
|
// http://dom.spec.whatwg.org/#dom-element-matches
|
||||||
fn Matches(&self, selectors: DOMString) -> Fallible<bool> {
|
fn Matches(self, selectors: DOMString) -> Fallible<bool> {
|
||||||
match parse_selector_list_from_str(selectors.as_slice()) {
|
match parse_selector_list_from_str(selectors.as_slice()) {
|
||||||
Err(()) => Err(Syntax),
|
Err(()) => Err(Syntax),
|
||||||
Ok(ref selectors) => {
|
Ok(ref selectors) => {
|
||||||
let root: JSRef<Node> = NodeCast::from_ref(*self);
|
let root: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
Ok(matches(selectors, &root, &mut None))
|
Ok(matches(selectors, &root, &mut None))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,54 +98,54 @@ impl Event {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> EventMethods for JSRef<'a, Event> {
|
impl<'a> EventMethods for JSRef<'a, Event> {
|
||||||
fn EventPhase(&self) -> u16 {
|
fn EventPhase(self) -> u16 {
|
||||||
self.phase.deref().get() as u16
|
self.phase.deref().get() as u16
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Type(&self) -> DOMString {
|
fn Type(self) -> DOMString {
|
||||||
self.type_.deref().borrow().clone()
|
self.type_.deref().borrow().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetTarget(&self) -> Option<Temporary<EventTarget>> {
|
fn GetTarget(self) -> Option<Temporary<EventTarget>> {
|
||||||
self.target.get().as_ref().map(|target| Temporary::new(target.clone()))
|
self.target.get().as_ref().map(|target| Temporary::new(target.clone()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetCurrentTarget(&self) -> Option<Temporary<EventTarget>> {
|
fn GetCurrentTarget(self) -> Option<Temporary<EventTarget>> {
|
||||||
self.current_target.get().as_ref().map(|target| Temporary::new(target.clone()))
|
self.current_target.get().as_ref().map(|target| Temporary::new(target.clone()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn DefaultPrevented(&self) -> bool {
|
fn DefaultPrevented(self) -> bool {
|
||||||
self.canceled.deref().get()
|
self.canceled.deref().get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn PreventDefault(&self) {
|
fn PreventDefault(self) {
|
||||||
if self.cancelable.deref().get() {
|
if self.cancelable.deref().get() {
|
||||||
self.canceled.deref().set(true)
|
self.canceled.deref().set(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn StopPropagation(&self) {
|
fn StopPropagation(self) {
|
||||||
self.stop_propagation.deref().set(true);
|
self.stop_propagation.deref().set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn StopImmediatePropagation(&self) {
|
fn StopImmediatePropagation(self) {
|
||||||
self.stop_immediate.deref().set(true);
|
self.stop_immediate.deref().set(true);
|
||||||
self.stop_propagation.deref().set(true);
|
self.stop_propagation.deref().set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Bubbles(&self) -> bool {
|
fn Bubbles(self) -> bool {
|
||||||
self.bubbles.deref().get()
|
self.bubbles.deref().get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Cancelable(&self) -> bool {
|
fn Cancelable(self) -> bool {
|
||||||
self.cancelable.deref().get()
|
self.cancelable.deref().get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn TimeStamp(&self) -> u64 {
|
fn TimeStamp(self) -> u64 {
|
||||||
self.timestamp
|
self.timestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
fn InitEvent(&self,
|
fn InitEvent(self,
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
bubbles: bool,
|
bubbles: bool,
|
||||||
cancelable: bool) {
|
cancelable: bool) {
|
||||||
|
@ -163,7 +163,7 @@ impl<'a> EventMethods for JSRef<'a, Event> {
|
||||||
self.cancelable.deref().set(cancelable);
|
self.cancelable.deref().set(cancelable);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn IsTrusted(&self) -> bool {
|
fn IsTrusted(self) -> bool {
|
||||||
self.trusted.deref().get()
|
self.trusted.deref().get()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,7 +225,7 @@ impl<'a> EventTargetHelpers for JSRef<'a, EventTarget> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> EventTargetMethods for JSRef<'a, EventTarget> {
|
impl<'a> EventTargetMethods for JSRef<'a, EventTarget> {
|
||||||
fn AddEventListener(&self,
|
fn AddEventListener(self,
|
||||||
ty: DOMString,
|
ty: DOMString,
|
||||||
listener: Option<EventListener>,
|
listener: Option<EventListener>,
|
||||||
capture: bool) {
|
capture: bool) {
|
||||||
|
@ -246,7 +246,7 @@ impl<'a> EventTargetMethods for JSRef<'a, EventTarget> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn RemoveEventListener(&self,
|
fn RemoveEventListener(self,
|
||||||
ty: DOMString,
|
ty: DOMString,
|
||||||
listener: Option<EventListener>,
|
listener: Option<EventListener>,
|
||||||
capture: bool) {
|
capture: bool) {
|
||||||
|
@ -270,7 +270,7 @@ impl<'a> EventTargetMethods for JSRef<'a, EventTarget> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn DispatchEvent(&self, event: JSRef<Event>) -> Fallible<bool> {
|
fn DispatchEvent(self, event: JSRef<Event>) -> Fallible<bool> {
|
||||||
self.dispatch_event_with_target(None, event)
|
self.dispatch_event_with_target(None, event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,8 @@ impl File {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FileMethods for File {
|
impl<'a> FileMethods for JSRef<'a, File> {
|
||||||
fn Name(&self) -> DOMString {
|
fn Name(self) -> DOMString {
|
||||||
self.name.clone()
|
self.name.clone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,22 +56,22 @@ impl FormData {
|
||||||
|
|
||||||
impl<'a> FormDataMethods for JSRef<'a, FormData> {
|
impl<'a> FormDataMethods for JSRef<'a, FormData> {
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
fn Append(&self, name: DOMString, value: JSRef<Blob>, filename: Option<DOMString>) {
|
fn Append(self, name: DOMString, value: JSRef<Blob>, filename: Option<DOMString>) {
|
||||||
let file = FileData(JS::from_rooted(self.get_file_from_blob(value, filename)));
|
let file = FileData(JS::from_rooted(self.get_file_from_blob(value, filename)));
|
||||||
self.data.deref().borrow_mut().insert_or_update_with(name.clone(), vec!(file.clone()),
|
self.data.deref().borrow_mut().insert_or_update_with(name.clone(), vec!(file.clone()),
|
||||||
|_k, v| {v.push(file.clone());});
|
|_k, v| {v.push(file.clone());});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Append_(&self, name: DOMString, value: DOMString) {
|
fn Append_(self, name: DOMString, value: DOMString) {
|
||||||
self.data.deref().borrow_mut().insert_or_update_with(name, vec!(StringData(value.clone())),
|
self.data.deref().borrow_mut().insert_or_update_with(name, vec!(StringData(value.clone())),
|
||||||
|_k, v| {v.push(StringData(value.clone()));});
|
|_k, v| {v.push(StringData(value.clone()));});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Delete(&self, name: DOMString) {
|
fn Delete(self, name: DOMString) {
|
||||||
self.data.deref().borrow_mut().remove(&name);
|
self.data.deref().borrow_mut().remove(&name);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Get(&self, name: DOMString) -> Option<FileOrString> {
|
fn Get(self, name: DOMString) -> Option<FileOrString> {
|
||||||
if self.data.deref().borrow().contains_key_equiv(&name) {
|
if self.data.deref().borrow().contains_key_equiv(&name) {
|
||||||
match self.data.deref().borrow().get(&name)[0].clone() {
|
match self.data.deref().borrow().get(&name)[0].clone() {
|
||||||
StringData(ref s) => Some(eString(s.clone())),
|
StringData(ref s) => Some(eString(s.clone())),
|
||||||
|
@ -84,16 +84,16 @@ impl<'a> FormDataMethods for JSRef<'a, FormData> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Has(&self, name: DOMString) -> bool {
|
fn Has(self, name: DOMString) -> bool {
|
||||||
self.data.deref().borrow().contains_key_equiv(&name)
|
self.data.deref().borrow().contains_key_equiv(&name)
|
||||||
}
|
}
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
fn Set(&self, name: DOMString, value: JSRef<Blob>, filename: Option<DOMString>) {
|
fn Set(self, name: DOMString, value: JSRef<Blob>, filename: Option<DOMString>) {
|
||||||
let file = FileData(JS::from_rooted(self.get_file_from_blob(value, filename)));
|
let file = FileData(JS::from_rooted(self.get_file_from_blob(value, filename)));
|
||||||
self.data.deref().borrow_mut().insert(name, vec!(file));
|
self.data.deref().borrow_mut().insert(name, vec!(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Set_(&self, name: DOMString, value: DOMString) {
|
fn Set_(self, name: DOMString, value: DOMString) {
|
||||||
self.data.deref().borrow_mut().insert(name, vec!(StringData(value)));
|
self.data.deref().borrow_mut().insert(name, vec!(StringData(value)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,13 +122,13 @@ impl Reflectable for HTMLAnchorElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLAnchorElementMethods for JSRef<'a, HTMLAnchorElement> {
|
impl<'a> HTMLAnchorElementMethods for JSRef<'a, HTMLAnchorElement> {
|
||||||
fn Text(&self) -> DOMString {
|
fn Text(self) -> DOMString {
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
node.GetTextContent().unwrap()
|
node.GetTextContent().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetText(&self, value: DOMString) {
|
fn SetText(self, value: DOMString) {
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
node.SetTextContent(Some(value))
|
node.SetTextContent(Some(value))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,13 +47,13 @@ impl HTMLBodyElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLBodyElementMethods for JSRef<'a, HTMLBodyElement> {
|
impl<'a> HTMLBodyElementMethods for JSRef<'a, HTMLBodyElement> {
|
||||||
fn GetOnunload(&self) -> Option<EventHandlerNonNull> {
|
fn GetOnunload(self) -> Option<EventHandlerNonNull> {
|
||||||
let win = window_from_node(*self).root();
|
let win = window_from_node(self).root();
|
||||||
win.deref().GetOnunload()
|
win.deref().GetOnunload()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetOnunload(&self, listener: Option<EventHandlerNonNull>) {
|
fn SetOnunload(self, listener: Option<EventHandlerNonNull>) {
|
||||||
let win = window_from_node(*self).root();
|
let win = window_from_node(self).root();
|
||||||
win.deref().SetOnunload(listener)
|
win.deref().SetOnunload(listener)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,8 @@ impl HTMLButtonElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLButtonElementMethods for JSRef<'a, HTMLButtonElement> {
|
impl<'a> HTMLButtonElementMethods for JSRef<'a, HTMLButtonElement> {
|
||||||
fn Validity(&self) -> Temporary<ValidityState> {
|
fn Validity(self) -> Temporary<ValidityState> {
|
||||||
let window = window_from_node(*self).root();
|
let window = window_from_node(self).root();
|
||||||
ValidityState::new(*window)
|
ValidityState::new(*window)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,8 +55,8 @@ impl<'a> HTMLButtonElementMethods for JSRef<'a, HTMLButtonElement> {
|
||||||
make_bool_getter!(Disabled)
|
make_bool_getter!(Disabled)
|
||||||
|
|
||||||
// http://www.whatwg.org/html/#dom-fe-disabled
|
// http://www.whatwg.org/html/#dom-fe-disabled
|
||||||
fn SetDisabled(&self, disabled: bool) {
|
fn SetDisabled(self, disabled: bool) {
|
||||||
let elem: JSRef<Element> = ElementCast::from_ref(*self);
|
let elem: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
elem.set_bool_attribute("disabled", disabled)
|
elem.set_bool_attribute("disabled", disabled)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,33 +61,33 @@ impl HTMLCanvasElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLCanvasElementMethods for JSRef<'a, HTMLCanvasElement> {
|
impl<'a> HTMLCanvasElementMethods for JSRef<'a, HTMLCanvasElement> {
|
||||||
fn Width(&self) -> u32 {
|
fn Width(self) -> u32 {
|
||||||
self.width.get()
|
self.width.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetWidth(&self, width: u32) {
|
fn SetWidth(self, width: u32) {
|
||||||
let elem: JSRef<Element> = ElementCast::from_ref(*self);
|
let elem: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
elem.set_uint_attribute("width", width)
|
elem.set_uint_attribute("width", width)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Height(&self) -> u32 {
|
fn Height(self) -> u32 {
|
||||||
self.height.get()
|
self.height.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetHeight(&self, height: u32) {
|
fn SetHeight(self, height: u32) {
|
||||||
let elem: JSRef<Element> = ElementCast::from_ref(*self);
|
let elem: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
elem.set_uint_attribute("height", height)
|
elem.set_uint_attribute("height", height)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetContext(&self, id: DOMString) -> Option<Temporary<CanvasRenderingContext2D>> {
|
fn GetContext(self, id: DOMString) -> Option<Temporary<CanvasRenderingContext2D>> {
|
||||||
if id.as_slice() != "2d" {
|
if id.as_slice() != "2d" {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.context.get().is_none() {
|
if self.context.get().is_none() {
|
||||||
let window = window_from_node(*self).root();
|
let window = window_from_node(self).root();
|
||||||
let (w, h) = (self.width.get() as i32, self.height.get() as i32);
|
let (w, h) = (self.width.get() as i32, self.height.get() as i32);
|
||||||
let context = CanvasRenderingContext2D::new(&Window(*window), *self, Size2D(w, h));
|
let context = CanvasRenderingContext2D::new(&Window(*window), self, Size2D(w, h));
|
||||||
self.context.assign(Some(context));
|
self.context.assign(Some(context));
|
||||||
}
|
}
|
||||||
self.context.get().map(|context| Temporary::new(context))
|
self.context.get().map(|context| Temporary::new(context))
|
||||||
|
|
|
@ -172,7 +172,7 @@ impl HTMLCollection {
|
||||||
|
|
||||||
impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> {
|
impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> {
|
||||||
// http://dom.spec.whatwg.org/#dom-htmlcollection-length
|
// http://dom.spec.whatwg.org/#dom-htmlcollection-length
|
||||||
fn Length(&self) -> u32 {
|
fn Length(self) -> u32 {
|
||||||
match self.collection {
|
match self.collection {
|
||||||
Static(ref elems) => elems.len() as u32,
|
Static(ref elems) => elems.len() as u32,
|
||||||
Live(ref root, ref filter) => {
|
Live(ref root, ref filter) => {
|
||||||
|
@ -187,7 +187,7 @@ impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-htmlcollection-item
|
// http://dom.spec.whatwg.org/#dom-htmlcollection-item
|
||||||
fn Item(&self, index: u32) -> Option<Temporary<Element>> {
|
fn Item(self, index: u32) -> Option<Temporary<Element>> {
|
||||||
match self.collection {
|
match self.collection {
|
||||||
Static(ref elems) => elems
|
Static(ref elems) => elems
|
||||||
.as_slice()
|
.as_slice()
|
||||||
|
@ -209,7 +209,7 @@ impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-htmlcollection-nameditem
|
// http://dom.spec.whatwg.org/#dom-htmlcollection-nameditem
|
||||||
fn NamedItem(&self, key: DOMString) -> Option<Temporary<Element>> {
|
fn NamedItem(self, key: DOMString) -> Option<Temporary<Element>> {
|
||||||
// Step 1.
|
// Step 1.
|
||||||
if key.is_empty() {
|
if key.is_empty() {
|
||||||
return None;
|
return None;
|
||||||
|
@ -239,13 +239,13 @@ impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Temporary<Element>> {
|
fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<Temporary<Element>> {
|
||||||
let maybe_elem = self.Item(index);
|
let maybe_elem = self.Item(index);
|
||||||
*found = maybe_elem.is_some();
|
*found = maybe_elem.is_some();
|
||||||
maybe_elem
|
maybe_elem
|
||||||
}
|
}
|
||||||
|
|
||||||
fn NamedGetter(&self, name: DOMString, found: &mut bool) -> Option<Temporary<Element>> {
|
fn NamedGetter(self, name: DOMString, found: &mut bool) -> Option<Temporary<Element>> {
|
||||||
let maybe_elem = self.NamedItem(name);
|
let maybe_elem = self.NamedItem(name);
|
||||||
*found = maybe_elem.is_some();
|
*found = maybe_elem.is_some();
|
||||||
maybe_elem
|
maybe_elem
|
||||||
|
|
|
@ -43,14 +43,14 @@ impl HTMLDataListElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLDataListElementMethods for JSRef<'a, HTMLDataListElement> {
|
impl<'a> HTMLDataListElementMethods for JSRef<'a, HTMLDataListElement> {
|
||||||
fn Options(&self) -> Temporary<HTMLCollection> {
|
fn Options(self) -> Temporary<HTMLCollection> {
|
||||||
struct HTMLDataListOptionsFilter;
|
struct HTMLDataListOptionsFilter;
|
||||||
impl CollectionFilter for HTMLDataListOptionsFilter {
|
impl CollectionFilter for HTMLDataListOptionsFilter {
|
||||||
fn filter(&self, elem: JSRef<Element>, _root: JSRef<Node>) -> bool {
|
fn filter(&self, elem: JSRef<Element>, _root: JSRef<Node>) -> bool {
|
||||||
elem.is_htmloptionelement()
|
elem.is_htmloptionelement()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
let filter = box HTMLDataListOptionsFilter;
|
let filter = box HTMLDataListOptionsFilter;
|
||||||
let window = window_from_node(node).root();
|
let window = window_from_node(node).root();
|
||||||
HTMLCollection::create(*window, node, filter)
|
HTMLCollection::create(*window, node, filter)
|
||||||
|
|
|
@ -63,28 +63,28 @@ impl<'a> PrivateHTMLElementHelpers for JSRef<'a, HTMLElement> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLElementMethods for JSRef<'a, HTMLElement> {
|
impl<'a> HTMLElementMethods for JSRef<'a, HTMLElement> {
|
||||||
fn GetOnclick(&self) -> Option<EventHandlerNonNull> {
|
fn GetOnclick(self) -> Option<EventHandlerNonNull> {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.get_event_handler_common("click")
|
eventtarget.get_event_handler_common("click")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetOnclick(&self, listener: Option<EventHandlerNonNull>) {
|
fn SetOnclick(self, listener: Option<EventHandlerNonNull>) {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.set_event_handler_common("click", listener)
|
eventtarget.set_event_handler_common("click", listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetOnload(&self) -> Option<EventHandlerNonNull> {
|
fn GetOnload(self) -> Option<EventHandlerNonNull> {
|
||||||
if self.is_body_or_frameset() {
|
if self.is_body_or_frameset() {
|
||||||
let win = window_from_node(*self).root();
|
let win = window_from_node(self).root();
|
||||||
win.deref().GetOnload()
|
win.deref().GetOnload()
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetOnload(&self, listener: Option<EventHandlerNonNull>) {
|
fn SetOnload(self, listener: Option<EventHandlerNonNull>) {
|
||||||
if self.is_body_or_frameset() {
|
if self.is_body_or_frameset() {
|
||||||
let win = window_from_node(*self).root();
|
let win = window_from_node(self).root();
|
||||||
win.deref().SetOnload(listener)
|
win.deref().SetOnload(listener)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ impl HTMLFieldSetElement {
|
||||||
|
|
||||||
impl<'a> HTMLFieldSetElementMethods for JSRef<'a, HTMLFieldSetElement> {
|
impl<'a> HTMLFieldSetElementMethods for JSRef<'a, HTMLFieldSetElement> {
|
||||||
// http://www.whatwg.org/html/#dom-fieldset-elements
|
// http://www.whatwg.org/html/#dom-fieldset-elements
|
||||||
fn Elements(&self) -> Temporary<HTMLCollection> {
|
fn Elements(self) -> Temporary<HTMLCollection> {
|
||||||
struct ElementsFilter;
|
struct ElementsFilter;
|
||||||
impl CollectionFilter for ElementsFilter {
|
impl CollectionFilter for ElementsFilter {
|
||||||
fn filter(&self, elem: JSRef<Element>, root: JSRef<Node>) -> bool {
|
fn filter(&self, elem: JSRef<Element>, root: JSRef<Node>) -> bool {
|
||||||
|
@ -59,14 +59,14 @@ impl<'a> HTMLFieldSetElementMethods for JSRef<'a, HTMLFieldSetElement> {
|
||||||
elem != root && tag_names.iter().any(|&tag_name| tag_name == elem.deref().local_name.as_slice())
|
elem != root && tag_names.iter().any(|&tag_name| tag_name == elem.deref().local_name.as_slice())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
let filter = box ElementsFilter;
|
let filter = box ElementsFilter;
|
||||||
let window = window_from_node(node).root();
|
let window = window_from_node(node).root();
|
||||||
HTMLCollection::create(*window, node, filter)
|
HTMLCollection::create(*window, node, filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Validity(&self) -> Temporary<ValidityState> {
|
fn Validity(self) -> Temporary<ValidityState> {
|
||||||
let window = window_from_node(*self).root();
|
let window = window_from_node(self).root();
|
||||||
ValidityState::new(*window)
|
ValidityState::new(*window)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,8 +74,8 @@ impl<'a> HTMLFieldSetElementMethods for JSRef<'a, HTMLFieldSetElement> {
|
||||||
make_bool_getter!(Disabled)
|
make_bool_getter!(Disabled)
|
||||||
|
|
||||||
// http://www.whatwg.org/html/#dom-fieldset-disabled
|
// http://www.whatwg.org/html/#dom-fieldset-disabled
|
||||||
fn SetDisabled(&self, disabled: bool) {
|
fn SetDisabled(self, disabled: bool) {
|
||||||
let elem: JSRef<Element> = ElementCast::from_ref(*self);
|
let elem: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
elem.set_bool_attribute("disabled", disabled)
|
elem.set_bool_attribute("disabled", disabled)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,29 +131,29 @@ impl HTMLIFrameElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLIFrameElementMethods for JSRef<'a, HTMLIFrameElement> {
|
impl<'a> HTMLIFrameElementMethods for JSRef<'a, HTMLIFrameElement> {
|
||||||
fn Src(&self) -> DOMString {
|
fn Src(self) -> DOMString {
|
||||||
let element: JSRef<Element> = ElementCast::from_ref(*self);
|
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
element.get_string_attribute("src")
|
element.get_string_attribute("src")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetSrc(&self, src: DOMString) {
|
fn SetSrc(self, src: DOMString) {
|
||||||
let element: JSRef<Element> = ElementCast::from_ref(*self);
|
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
element.set_url_attribute("src", src)
|
element.set_url_attribute("src", src)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Sandbox(&self) -> DOMString {
|
fn Sandbox(self) -> DOMString {
|
||||||
let element: JSRef<Element> = ElementCast::from_ref(*self);
|
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
element.get_string_attribute("sandbox")
|
element.get_string_attribute("sandbox")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetSandbox(&self, sandbox: DOMString) {
|
fn SetSandbox(self, sandbox: DOMString) {
|
||||||
let element: JSRef<Element> = ElementCast::from_ref(*self);
|
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
element.set_string_attribute("sandbox", sandbox);
|
element.set_string_attribute("sandbox", sandbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetContentWindow(&self) -> Option<Temporary<Window>> {
|
fn GetContentWindow(self) -> Option<Temporary<Window>> {
|
||||||
self.size.deref().get().and_then(|size| {
|
self.size.deref().get().and_then(|size| {
|
||||||
let window = window_from_node(*self).root();
|
let window = window_from_node(self).root();
|
||||||
let children = &*window.deref().page.children.deref().borrow();
|
let children = &*window.deref().page.children.deref().borrow();
|
||||||
let child = children.iter().find(|child| {
|
let child = children.iter().find(|child| {
|
||||||
child.subpage_id.unwrap() == size.subpage_id
|
child.subpage_id.unwrap() == size.subpage_id
|
||||||
|
|
|
@ -99,93 +99,93 @@ impl LayoutHTMLImageElementHelpers for JS<HTMLImageElement> {
|
||||||
impl<'a> HTMLImageElementMethods for JSRef<'a, HTMLImageElement> {
|
impl<'a> HTMLImageElementMethods for JSRef<'a, HTMLImageElement> {
|
||||||
make_getter!(Alt)
|
make_getter!(Alt)
|
||||||
|
|
||||||
fn SetAlt(&self, alt: DOMString) {
|
fn SetAlt(self, alt: DOMString) {
|
||||||
let element: JSRef<Element> = ElementCast::from_ref(*self);
|
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
element.set_string_attribute("alt", alt)
|
element.set_string_attribute("alt", alt)
|
||||||
}
|
}
|
||||||
|
|
||||||
make_getter!(Src)
|
make_getter!(Src)
|
||||||
|
|
||||||
fn SetSrc(&self, src: DOMString) {
|
fn SetSrc(self, src: DOMString) {
|
||||||
let element: JSRef<Element> = ElementCast::from_ref(*self);
|
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
element.set_url_attribute("src", src)
|
element.set_url_attribute("src", src)
|
||||||
}
|
}
|
||||||
|
|
||||||
make_getter!(UseMap)
|
make_getter!(UseMap)
|
||||||
|
|
||||||
fn SetUseMap(&self, use_map: DOMString) {
|
fn SetUseMap(self, use_map: DOMString) {
|
||||||
let element: JSRef<Element> = ElementCast::from_ref(*self);
|
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
element.set_string_attribute("usemap", use_map)
|
element.set_string_attribute("usemap", use_map)
|
||||||
}
|
}
|
||||||
|
|
||||||
make_bool_getter!(IsMap)
|
make_bool_getter!(IsMap)
|
||||||
|
|
||||||
fn SetIsMap(&self, is_map: bool) {
|
fn SetIsMap(self, is_map: bool) {
|
||||||
let element: JSRef<Element> = ElementCast::from_ref(*self);
|
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
element.set_string_attribute("ismap", is_map.to_string())
|
element.set_string_attribute("ismap", is_map.to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Width(&self) -> u32 {
|
fn Width(self) -> u32 {
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
let rect = node.get_bounding_content_box();
|
let rect = node.get_bounding_content_box();
|
||||||
to_px(rect.size.width) as u32
|
to_px(rect.size.width) as u32
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetWidth(&self, width: u32) {
|
fn SetWidth(self, width: u32) {
|
||||||
let elem: JSRef<Element> = ElementCast::from_ref(*self);
|
let elem: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
elem.set_uint_attribute("width", width)
|
elem.set_uint_attribute("width", width)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Height(&self) -> u32 {
|
fn Height(self) -> u32 {
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
let rect = node.get_bounding_content_box();
|
let rect = node.get_bounding_content_box();
|
||||||
to_px(rect.size.height) as u32
|
to_px(rect.size.height) as u32
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetHeight(&self, height: u32) {
|
fn SetHeight(self, height: u32) {
|
||||||
let elem: JSRef<Element> = ElementCast::from_ref(*self);
|
let elem: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
elem.set_uint_attribute("height", height)
|
elem.set_uint_attribute("height", height)
|
||||||
}
|
}
|
||||||
|
|
||||||
make_getter!(Name)
|
make_getter!(Name)
|
||||||
|
|
||||||
fn SetName(&self, name: DOMString) {
|
fn SetName(self, name: DOMString) {
|
||||||
let element: JSRef<Element> = ElementCast::from_ref(*self);
|
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
element.set_string_attribute("name", name)
|
element.set_string_attribute("name", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
make_getter!(Align)
|
make_getter!(Align)
|
||||||
|
|
||||||
fn SetAlign(&self, align: DOMString) {
|
fn SetAlign(self, align: DOMString) {
|
||||||
let element: JSRef<Element> = ElementCast::from_ref(*self);
|
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
element.set_string_attribute("align", align)
|
element.set_string_attribute("align", align)
|
||||||
}
|
}
|
||||||
|
|
||||||
make_uint_getter!(Hspace)
|
make_uint_getter!(Hspace)
|
||||||
|
|
||||||
fn SetHspace(&self, hspace: u32) {
|
fn SetHspace(self, hspace: u32) {
|
||||||
let element: JSRef<Element> = ElementCast::from_ref(*self);
|
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
element.set_uint_attribute("hspace", hspace)
|
element.set_uint_attribute("hspace", hspace)
|
||||||
}
|
}
|
||||||
|
|
||||||
make_uint_getter!(Vspace)
|
make_uint_getter!(Vspace)
|
||||||
|
|
||||||
fn SetVspace(&self, vspace: u32) {
|
fn SetVspace(self, vspace: u32) {
|
||||||
let element: JSRef<Element> = ElementCast::from_ref(*self);
|
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
element.set_uint_attribute("vspace", vspace)
|
element.set_uint_attribute("vspace", vspace)
|
||||||
}
|
}
|
||||||
|
|
||||||
make_getter!(LongDesc)
|
make_getter!(LongDesc)
|
||||||
|
|
||||||
fn SetLongDesc(&self, longdesc: DOMString) {
|
fn SetLongDesc(self, longdesc: DOMString) {
|
||||||
let element: JSRef<Element> = ElementCast::from_ref(*self);
|
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
element.set_string_attribute("longdesc", longdesc)
|
element.set_string_attribute("longdesc", longdesc)
|
||||||
}
|
}
|
||||||
|
|
||||||
make_getter!(Border)
|
make_getter!(Border)
|
||||||
|
|
||||||
fn SetBorder(&self, border: DOMString) {
|
fn SetBorder(self, border: DOMString) {
|
||||||
let element: JSRef<Element> = ElementCast::from_ref(*self);
|
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
element.set_string_attribute("border", border)
|
element.set_string_attribute("border", border)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,8 @@ impl<'a> HTMLInputElementMethods for JSRef<'a, HTMLInputElement> {
|
||||||
make_bool_getter!(Disabled)
|
make_bool_getter!(Disabled)
|
||||||
|
|
||||||
// http://www.whatwg.org/html/#dom-fe-disabled
|
// http://www.whatwg.org/html/#dom-fe-disabled
|
||||||
fn SetDisabled(&self, disabled: bool) {
|
fn SetDisabled(self, disabled: bool) {
|
||||||
let elem: JSRef<Element> = ElementCast::from_ref(*self);
|
let elem: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
elem.set_bool_attribute("disabled", disabled)
|
elem.set_bool_attribute("disabled", disabled)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,8 +83,8 @@ pub fn is_image_data(uri: &str) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLObjectElementMethods for JSRef<'a, HTMLObjectElement> {
|
impl<'a> HTMLObjectElementMethods for JSRef<'a, HTMLObjectElement> {
|
||||||
fn Validity(&self) -> Temporary<ValidityState> {
|
fn Validity(self) -> Temporary<ValidityState> {
|
||||||
let window = window_from_node(*self).root();
|
let window = window_from_node(self).root();
|
||||||
ValidityState::new(*window)
|
ValidityState::new(*window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,8 @@ impl<'a> HTMLOptGroupElementMethods for JSRef<'a, HTMLOptGroupElement> {
|
||||||
make_bool_getter!(Disabled)
|
make_bool_getter!(Disabled)
|
||||||
|
|
||||||
// http://www.whatwg.org/html#dom-optgroup-disabled
|
// http://www.whatwg.org/html#dom-optgroup-disabled
|
||||||
fn SetDisabled(&self, disabled: bool) {
|
fn SetDisabled(self, disabled: bool) {
|
||||||
let elem: JSRef<Element> = ElementCast::from_ref(*self);
|
let elem: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
elem.set_bool_attribute("disabled", disabled)
|
elem.set_bool_attribute("disabled", disabled)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,8 @@ impl<'a> HTMLOptionElementMethods for JSRef<'a, HTMLOptionElement> {
|
||||||
make_bool_getter!(Disabled)
|
make_bool_getter!(Disabled)
|
||||||
|
|
||||||
// http://www.whatwg.org/html/#dom-option-disabled
|
// http://www.whatwg.org/html/#dom-option-disabled
|
||||||
fn SetDisabled(&self, disabled: bool) {
|
fn SetDisabled(self, disabled: bool) {
|
||||||
let elem: JSRef<Element> = ElementCast::from_ref(*self);
|
let elem: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
elem.set_bool_attribute("disabled", disabled)
|
elem.set_bool_attribute("disabled", disabled)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,8 @@ impl HTMLOutputElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLOutputElementMethods for JSRef<'a, HTMLOutputElement> {
|
impl<'a> HTMLOutputElementMethods for JSRef<'a, HTMLOutputElement> {
|
||||||
fn Validity(&self) -> Temporary<ValidityState> {
|
fn Validity(self) -> Temporary<ValidityState> {
|
||||||
let window = window_from_node(*self).root();
|
let window = window_from_node(self).root();
|
||||||
ValidityState::new(*window)
|
ValidityState::new(*window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,20 +107,20 @@ impl<'a> HTMLScriptElementHelpers for JSRef<'a, HTMLScriptElement> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLScriptElementMethods for JSRef<'a, HTMLScriptElement> {
|
impl<'a> HTMLScriptElementMethods for JSRef<'a, HTMLScriptElement> {
|
||||||
fn Src(&self) -> DOMString {
|
fn Src(self) -> DOMString {
|
||||||
let element: JSRef<Element> = ElementCast::from_ref(*self);
|
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
element.get_url_attribute("src")
|
element.get_url_attribute("src")
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://www.whatwg.org/html/#dom-script-text
|
// http://www.whatwg.org/html/#dom-script-text
|
||||||
fn Text(&self) -> DOMString {
|
fn Text(self) -> DOMString {
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
Node::collect_text_contents(node.children())
|
Node::collect_text_contents(node.children())
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://www.whatwg.org/html/#dom-script-text
|
// http://www.whatwg.org/html/#dom-script-text
|
||||||
fn SetText(&self, value: DOMString) {
|
fn SetText(self, value: DOMString) {
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
node.SetTextContent(Some(value))
|
node.SetTextContent(Some(value))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,21 +48,21 @@ impl HTMLSelectElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLSelectElementMethods for JSRef<'a, HTMLSelectElement> {
|
impl<'a> HTMLSelectElementMethods for JSRef<'a, HTMLSelectElement> {
|
||||||
fn Validity(&self) -> Temporary<ValidityState> {
|
fn Validity(self) -> Temporary<ValidityState> {
|
||||||
let window = window_from_node(*self).root();
|
let window = window_from_node(self).root();
|
||||||
ValidityState::new(*window)
|
ValidityState::new(*window)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: this function currently only exists for test_union.html.
|
// Note: this function currently only exists for test_union.html.
|
||||||
fn Add(&self, _element: HTMLOptionElementOrHTMLOptGroupElement, _before: Option<HTMLElementOrLong>) {
|
fn Add(self, _element: HTMLOptionElementOrHTMLOptGroupElement, _before: Option<HTMLElementOrLong>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://www.whatwg.org/html/#dom-fe-disabled
|
// http://www.whatwg.org/html/#dom-fe-disabled
|
||||||
make_bool_getter!(Disabled)
|
make_bool_getter!(Disabled)
|
||||||
|
|
||||||
// http://www.whatwg.org/html/#dom-fe-disabled
|
// http://www.whatwg.org/html/#dom-fe-disabled
|
||||||
fn SetDisabled(&self, disabled: bool) {
|
fn SetDisabled(self, disabled: bool) {
|
||||||
let elem: JSRef<Element> = ElementCast::from_ref(*self);
|
let elem: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
elem.set_bool_attribute("disabled", disabled)
|
elem.set_bool_attribute("disabled", disabled)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,10 +50,9 @@ impl Reflectable for HTMLTableElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLTableElementMethods for JSRef<'a, HTMLTableElement> {
|
impl<'a> HTMLTableElementMethods for JSRef<'a, HTMLTableElement> {
|
||||||
|
|
||||||
// http://www.whatwg.org/html/#dom-table-caption
|
// http://www.whatwg.org/html/#dom-table-caption
|
||||||
fn GetCaption(&self) -> Option<Temporary<HTMLTableCaptionElement>> {
|
fn GetCaption(self) -> Option<Temporary<HTMLTableCaptionElement>> {
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
node.children().find(|child| {
|
node.children().find(|child| {
|
||||||
child.type_id() == ElementNodeTypeId(HTMLTableCaptionElementTypeId)
|
child.type_id() == ElementNodeTypeId(HTMLTableCaptionElementTypeId)
|
||||||
}).map(|node| {
|
}).map(|node| {
|
||||||
|
@ -62,8 +61,8 @@ impl<'a> HTMLTableElementMethods for JSRef<'a, HTMLTableElement> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://www.whatwg.org/html/#dom-table-caption
|
// http://www.whatwg.org/html/#dom-table-caption
|
||||||
fn SetCaption(&self, new_caption: Option<JSRef<HTMLTableCaptionElement>>) {
|
fn SetCaption(self, new_caption: Option<JSRef<HTMLTableCaptionElement>>) {
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
let old_caption = self.GetCaption();
|
let old_caption = self.GetCaption();
|
||||||
|
|
||||||
match old_caption {
|
match old_caption {
|
||||||
|
|
|
@ -49,8 +49,8 @@ impl<'a> HTMLTextAreaElementMethods for JSRef<'a, HTMLTextAreaElement> {
|
||||||
make_bool_getter!(Disabled)
|
make_bool_getter!(Disabled)
|
||||||
|
|
||||||
// http://www.whatwg.org/html/#dom-fe-disabled
|
// http://www.whatwg.org/html/#dom-fe-disabled
|
||||||
fn SetDisabled(&self, disabled: bool) {
|
fn SetDisabled(self, disabled: bool) {
|
||||||
let elem: JSRef<Element> = ElementCast::from_ref(*self);
|
let elem: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
elem.set_bool_attribute("disabled", disabled)
|
elem.set_bool_attribute("disabled", disabled)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,8 @@ impl HTMLTitleElement {
|
||||||
|
|
||||||
impl<'a> HTMLTitleElementMethods for JSRef<'a, HTMLTitleElement> {
|
impl<'a> HTMLTitleElementMethods for JSRef<'a, HTMLTitleElement> {
|
||||||
// http://www.whatwg.org/html/#dom-title-text
|
// http://www.whatwg.org/html/#dom-title-text
|
||||||
fn Text(&self) -> DOMString {
|
fn Text(self) -> DOMString {
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
let mut content = String::new();
|
let mut content = String::new();
|
||||||
for child in node.children() {
|
for child in node.children() {
|
||||||
let text: Option<JSRef<Text>> = TextCast::to_ref(child);
|
let text: Option<JSRef<Text>> = TextCast::to_ref(child);
|
||||||
|
@ -58,8 +58,8 @@ impl<'a> HTMLTitleElementMethods for JSRef<'a, HTMLTitleElement> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://www.whatwg.org/html/#dom-title-text
|
// http://www.whatwg.org/html/#dom-title-text
|
||||||
fn SetText(&self, value: DOMString) {
|
fn SetText(self, value: DOMString) {
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
node.SetTextContent(Some(value))
|
node.SetTextContent(Some(value))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,15 +38,15 @@ impl Location {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> LocationMethods for JSRef<'a, Location> {
|
impl<'a> LocationMethods for JSRef<'a, Location> {
|
||||||
fn Href(&self) -> DOMString {
|
fn Href(self) -> DOMString {
|
||||||
UrlHelper::Href(&self.page.get_url())
|
UrlHelper::Href(&self.page.get_url())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Search(&self) -> DOMString {
|
fn Search(self) -> DOMString {
|
||||||
UrlHelper::Search(&self.page.get_url())
|
UrlHelper::Search(&self.page.get_url())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Hash(&self) -> DOMString {
|
fn Hash(self) -> DOMString {
|
||||||
UrlHelper::Hash(&self.page.get_url())
|
UrlHelper::Hash(&self.page.get_url())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,11 +7,11 @@
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! make_getter(
|
macro_rules! make_getter(
|
||||||
( $attr:ident ) => (
|
( $attr:ident ) => (
|
||||||
fn $attr(&self) -> DOMString {
|
fn $attr(self) -> DOMString {
|
||||||
use dom::element::{Element, AttributeHandlers};
|
use dom::element::{Element, AttributeHandlers};
|
||||||
use dom::bindings::codegen::InheritTypes::ElementCast;
|
use dom::bindings::codegen::InheritTypes::ElementCast;
|
||||||
use std::ascii::StrAsciiExt;
|
use std::ascii::StrAsciiExt;
|
||||||
let element: JSRef<Element> = ElementCast::from_ref(*self);
|
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
element.get_string_attribute(stringify!($attr).to_ascii_lower().as_slice())
|
element.get_string_attribute(stringify!($attr).to_ascii_lower().as_slice())
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -20,11 +20,11 @@ macro_rules! make_getter(
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! make_bool_getter(
|
macro_rules! make_bool_getter(
|
||||||
( $attr:ident ) => (
|
( $attr:ident ) => (
|
||||||
fn $attr(&self) -> bool {
|
fn $attr(self) -> bool {
|
||||||
use dom::element::{Element, AttributeHandlers};
|
use dom::element::{Element, AttributeHandlers};
|
||||||
use dom::bindings::codegen::InheritTypes::ElementCast;
|
use dom::bindings::codegen::InheritTypes::ElementCast;
|
||||||
use std::ascii::StrAsciiExt;
|
use std::ascii::StrAsciiExt;
|
||||||
let element: JSRef<Element> = ElementCast::from_ref(*self);
|
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
element.has_attribute(stringify!($attr).to_ascii_lower().as_slice())
|
element.has_attribute(stringify!($attr).to_ascii_lower().as_slice())
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -33,11 +33,11 @@ macro_rules! make_bool_getter(
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! make_uint_getter(
|
macro_rules! make_uint_getter(
|
||||||
( $attr:ident ) => (
|
( $attr:ident ) => (
|
||||||
fn $attr(&self) -> u32 {
|
fn $attr(self) -> u32 {
|
||||||
use dom::element::{Element, AttributeHandlers};
|
use dom::element::{Element, AttributeHandlers};
|
||||||
use dom::bindings::codegen::InheritTypes::ElementCast;
|
use dom::bindings::codegen::InheritTypes::ElementCast;
|
||||||
use std::ascii::StrAsciiExt;
|
use std::ascii::StrAsciiExt;
|
||||||
let element: JSRef<Element> = ElementCast::from_ref(*self);
|
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||||
element.get_uint_attribute(stringify!($attr).to_ascii_lower().as_slice())
|
element.get_uint_attribute(stringify!($attr).to_ascii_lower().as_slice())
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -80,15 +80,15 @@ impl MessageEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> MessageEventMethods for JSRef<'a, MessageEvent> {
|
impl<'a> MessageEventMethods for JSRef<'a, MessageEvent> {
|
||||||
fn Data(&self, _cx: *mut JSContext) -> JSVal {
|
fn Data(self, _cx: *mut JSContext) -> JSVal {
|
||||||
*self.data
|
*self.data
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Origin(&self) -> DOMString {
|
fn Origin(self) -> DOMString {
|
||||||
self.origin.clone()
|
self.origin.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn LastEventId(&self) -> DOMString {
|
fn LastEventId(self) -> DOMString {
|
||||||
self.lastEventId.clone()
|
self.lastEventId.clone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,47 +104,47 @@ impl MouseEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> MouseEventMethods for JSRef<'a, MouseEvent> {
|
impl<'a> MouseEventMethods for JSRef<'a, MouseEvent> {
|
||||||
fn ScreenX(&self) -> i32 {
|
fn ScreenX(self) -> i32 {
|
||||||
self.screen_x.deref().get()
|
self.screen_x.deref().get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ScreenY(&self) -> i32 {
|
fn ScreenY(self) -> i32 {
|
||||||
self.screen_y.deref().get()
|
self.screen_y.deref().get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ClientX(&self) -> i32 {
|
fn ClientX(self) -> i32 {
|
||||||
self.client_x.deref().get()
|
self.client_x.deref().get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ClientY(&self) -> i32 {
|
fn ClientY(self) -> i32 {
|
||||||
self.client_y.deref().get()
|
self.client_y.deref().get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn CtrlKey(&self) -> bool {
|
fn CtrlKey(self) -> bool {
|
||||||
self.ctrl_key.deref().get()
|
self.ctrl_key.deref().get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ShiftKey(&self) -> bool {
|
fn ShiftKey(self) -> bool {
|
||||||
self.shift_key.deref().get()
|
self.shift_key.deref().get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn AltKey(&self) -> bool {
|
fn AltKey(self) -> bool {
|
||||||
self.alt_key.deref().get()
|
self.alt_key.deref().get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn MetaKey(&self) -> bool {
|
fn MetaKey(self) -> bool {
|
||||||
self.meta_key.deref().get()
|
self.meta_key.deref().get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Button(&self) -> i16 {
|
fn Button(self) -> i16 {
|
||||||
self.button.deref().get()
|
self.button.deref().get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetRelatedTarget(&self) -> Option<Temporary<EventTarget>> {
|
fn GetRelatedTarget(self) -> Option<Temporary<EventTarget>> {
|
||||||
self.related_target.get().clone().map(|target| Temporary::new(target))
|
self.related_target.get().clone().map(|target| Temporary::new(target))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn InitMouseEvent(&self,
|
fn InitMouseEvent(self,
|
||||||
typeArg: DOMString,
|
typeArg: DOMString,
|
||||||
canBubbleArg: bool,
|
canBubbleArg: bool,
|
||||||
cancelableArg: bool,
|
cancelableArg: bool,
|
||||||
|
@ -160,7 +160,7 @@ impl<'a> MouseEventMethods for JSRef<'a, MouseEvent> {
|
||||||
metaKeyArg: bool,
|
metaKeyArg: bool,
|
||||||
buttonArg: i16,
|
buttonArg: i16,
|
||||||
relatedTargetArg: Option<JSRef<EventTarget>>) {
|
relatedTargetArg: Option<JSRef<EventTarget>>) {
|
||||||
let uievent: JSRef<UIEvent> = UIEventCast::from_ref(*self);
|
let uievent: JSRef<UIEvent> = UIEventCast::from_ref(self);
|
||||||
uievent.InitUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg);
|
uievent.InitUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg);
|
||||||
self.screen_x.deref().set(screenXArg);
|
self.screen_x.deref().set(screenXArg);
|
||||||
self.screen_y.deref().set(screenYArg);
|
self.screen_y.deref().set(screenYArg);
|
||||||
|
|
|
@ -33,15 +33,15 @@ impl NamedNodeMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> NamedNodeMapMethods for JSRef<'a, NamedNodeMap> {
|
impl<'a> NamedNodeMapMethods for JSRef<'a, NamedNodeMap> {
|
||||||
fn Length(&self) -> u32 {
|
fn Length(self) -> u32 {
|
||||||
self.owner.root().attrs.borrow().len() as u32
|
self.owner.root().attrs.borrow().len() as u32
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Item(&self, index: u32) -> Option<Temporary<Attr>> {
|
fn Item(self, index: u32) -> Option<Temporary<Attr>> {
|
||||||
self.owner.root().attrs.borrow().as_slice().get(index as uint).map(|x| Temporary::new(x.clone()))
|
self.owner.root().attrs.borrow().as_slice().get(index as uint).map(|x| Temporary::new(x.clone()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Temporary<Attr>> {
|
fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<Temporary<Attr>> {
|
||||||
let item = self.Item(index);
|
let item = self.Item(index);
|
||||||
*found = item.is_some();
|
*found = item.is_some();
|
||||||
item
|
item
|
||||||
|
|
|
@ -32,23 +32,23 @@ impl Navigator {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> NavigatorMethods for JSRef<'a, Navigator> {
|
impl<'a> NavigatorMethods for JSRef<'a, Navigator> {
|
||||||
fn Product(&self) -> DOMString {
|
fn Product(self) -> DOMString {
|
||||||
NavigatorInfo::Product()
|
NavigatorInfo::Product()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn TaintEnabled(&self) -> bool {
|
fn TaintEnabled(self) -> bool {
|
||||||
NavigatorInfo::TaintEnabled()
|
NavigatorInfo::TaintEnabled()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn AppName(&self) -> DOMString {
|
fn AppName(self) -> DOMString {
|
||||||
NavigatorInfo::AppName()
|
NavigatorInfo::AppName()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn AppCodeName(&self) -> DOMString {
|
fn AppCodeName(self) -> DOMString {
|
||||||
NavigatorInfo::AppCodeName()
|
NavigatorInfo::AppCodeName()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Platform(&self) -> DOMString {
|
fn Platform(self) -> DOMString {
|
||||||
NavigatorInfo::Platform()
|
NavigatorInfo::Platform()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1485,7 +1485,7 @@ impl Node {
|
||||||
|
|
||||||
impl<'a> NodeMethods for JSRef<'a, Node> {
|
impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
// http://dom.spec.whatwg.org/#dom-node-nodetype
|
// http://dom.spec.whatwg.org/#dom-node-nodetype
|
||||||
fn NodeType(&self) -> u16 {
|
fn NodeType(self) -> u16 {
|
||||||
match self.type_id {
|
match self.type_id {
|
||||||
ElementNodeTypeId(_) => NodeConstants::ELEMENT_NODE,
|
ElementNodeTypeId(_) => NodeConstants::ELEMENT_NODE,
|
||||||
TextNodeTypeId => NodeConstants::TEXT_NODE,
|
TextNodeTypeId => NodeConstants::TEXT_NODE,
|
||||||
|
@ -1498,21 +1498,21 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-nodename
|
// http://dom.spec.whatwg.org/#dom-node-nodename
|
||||||
fn NodeName(&self) -> DOMString {
|
fn NodeName(self) -> DOMString {
|
||||||
match self.type_id {
|
match self.type_id {
|
||||||
ElementNodeTypeId(..) => {
|
ElementNodeTypeId(..) => {
|
||||||
let elem: JSRef<Element> = ElementCast::to_ref(*self).unwrap();
|
let elem: JSRef<Element> = ElementCast::to_ref(self).unwrap();
|
||||||
elem.TagName()
|
elem.TagName()
|
||||||
}
|
}
|
||||||
TextNodeTypeId => "#text".to_string(),
|
TextNodeTypeId => "#text".to_string(),
|
||||||
ProcessingInstructionNodeTypeId => {
|
ProcessingInstructionNodeTypeId => {
|
||||||
let processing_instruction: JSRef<ProcessingInstruction> =
|
let processing_instruction: JSRef<ProcessingInstruction> =
|
||||||
ProcessingInstructionCast::to_ref(*self).unwrap();
|
ProcessingInstructionCast::to_ref(self).unwrap();
|
||||||
processing_instruction.Target()
|
processing_instruction.Target()
|
||||||
}
|
}
|
||||||
CommentNodeTypeId => "#comment".to_string(),
|
CommentNodeTypeId => "#comment".to_string(),
|
||||||
DoctypeNodeTypeId => {
|
DoctypeNodeTypeId => {
|
||||||
let doctype: JSRef<DocumentType> = DocumentTypeCast::to_ref(*self).unwrap();
|
let doctype: JSRef<DocumentType> = DocumentTypeCast::to_ref(self).unwrap();
|
||||||
doctype.deref().name.clone()
|
doctype.deref().name.clone()
|
||||||
},
|
},
|
||||||
DocumentFragmentNodeTypeId => "#document-fragment".to_string(),
|
DocumentFragmentNodeTypeId => "#document-fragment".to_string(),
|
||||||
|
@ -1521,13 +1521,13 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-baseuri
|
// http://dom.spec.whatwg.org/#dom-node-baseuri
|
||||||
fn GetBaseURI(&self) -> Option<DOMString> {
|
fn GetBaseURI(self) -> Option<DOMString> {
|
||||||
// FIXME (#1824) implement.
|
// FIXME (#1824) implement.
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-ownerdocument
|
// http://dom.spec.whatwg.org/#dom-node-ownerdocument
|
||||||
fn GetOwnerDocument(&self) -> Option<Temporary<Document>> {
|
fn GetOwnerDocument(self) -> Option<Temporary<Document>> {
|
||||||
match self.type_id {
|
match self.type_id {
|
||||||
ElementNodeTypeId(..) |
|
ElementNodeTypeId(..) |
|
||||||
CommentNodeTypeId |
|
CommentNodeTypeId |
|
||||||
|
@ -1540,12 +1540,12 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-parentnode
|
// http://dom.spec.whatwg.org/#dom-node-parentnode
|
||||||
fn GetParentNode(&self) -> Option<Temporary<Node>> {
|
fn GetParentNode(self) -> Option<Temporary<Node>> {
|
||||||
self.parent_node.get().map(|node| Temporary::new(node))
|
self.parent_node.get().map(|node| Temporary::new(node))
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-parentelement
|
// http://dom.spec.whatwg.org/#dom-node-parentelement
|
||||||
fn GetParentElement(&self) -> Option<Temporary<Element>> {
|
fn GetParentElement(self) -> Option<Temporary<Element>> {
|
||||||
self.parent_node.get()
|
self.parent_node.get()
|
||||||
.and_then(|parent| {
|
.and_then(|parent| {
|
||||||
let parent = parent.root();
|
let parent = parent.root();
|
||||||
|
@ -1556,12 +1556,12 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-haschildnodes
|
// http://dom.spec.whatwg.org/#dom-node-haschildnodes
|
||||||
fn HasChildNodes(&self) -> bool {
|
fn HasChildNodes(self) -> bool {
|
||||||
self.first_child.get().is_some()
|
self.first_child.get().is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-childnodes
|
// http://dom.spec.whatwg.org/#dom-node-childnodes
|
||||||
fn ChildNodes(&self) -> Temporary<NodeList> {
|
fn ChildNodes(self) -> Temporary<NodeList> {
|
||||||
match self.child_list.get() {
|
match self.child_list.get() {
|
||||||
None => (),
|
None => (),
|
||||||
Some(ref list) => return Temporary::new(list.clone()),
|
Some(ref list) => return Temporary::new(list.clone()),
|
||||||
|
@ -1569,38 +1569,38 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
|
|
||||||
let doc = self.owner_doc().root();
|
let doc = self.owner_doc().root();
|
||||||
let window = doc.deref().window.root();
|
let window = doc.deref().window.root();
|
||||||
let child_list = NodeList::new_child_list(*window, *self);
|
let child_list = NodeList::new_child_list(*window, self);
|
||||||
self.child_list.assign(Some(child_list));
|
self.child_list.assign(Some(child_list));
|
||||||
Temporary::new(self.child_list.get().get_ref().clone())
|
Temporary::new(self.child_list.get().get_ref().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-firstchild
|
// http://dom.spec.whatwg.org/#dom-node-firstchild
|
||||||
fn GetFirstChild(&self) -> Option<Temporary<Node>> {
|
fn GetFirstChild(self) -> Option<Temporary<Node>> {
|
||||||
self.first_child.get().map(|node| Temporary::new(node))
|
self.first_child.get().map(|node| Temporary::new(node))
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-lastchild
|
// http://dom.spec.whatwg.org/#dom-node-lastchild
|
||||||
fn GetLastChild(&self) -> Option<Temporary<Node>> {
|
fn GetLastChild(self) -> Option<Temporary<Node>> {
|
||||||
self.last_child.get().map(|node| Temporary::new(node))
|
self.last_child.get().map(|node| Temporary::new(node))
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-previoussibling
|
// http://dom.spec.whatwg.org/#dom-node-previoussibling
|
||||||
fn GetPreviousSibling(&self) -> Option<Temporary<Node>> {
|
fn GetPreviousSibling(self) -> Option<Temporary<Node>> {
|
||||||
self.prev_sibling.get().map(|node| Temporary::new(node))
|
self.prev_sibling.get().map(|node| Temporary::new(node))
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-nextsibling
|
// http://dom.spec.whatwg.org/#dom-node-nextsibling
|
||||||
fn GetNextSibling(&self) -> Option<Temporary<Node>> {
|
fn GetNextSibling(self) -> Option<Temporary<Node>> {
|
||||||
self.next_sibling.get().map(|node| Temporary::new(node))
|
self.next_sibling.get().map(|node| Temporary::new(node))
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-nodevalue
|
// http://dom.spec.whatwg.org/#dom-node-nodevalue
|
||||||
fn GetNodeValue(&self) -> Option<DOMString> {
|
fn GetNodeValue(self) -> Option<DOMString> {
|
||||||
match self.type_id {
|
match self.type_id {
|
||||||
CommentNodeTypeId |
|
CommentNodeTypeId |
|
||||||
TextNodeTypeId |
|
TextNodeTypeId |
|
||||||
ProcessingInstructionNodeTypeId => {
|
ProcessingInstructionNodeTypeId => {
|
||||||
let chardata: JSRef<CharacterData> = CharacterDataCast::to_ref(*self).unwrap();
|
let chardata: JSRef<CharacterData> = CharacterDataCast::to_ref(self).unwrap();
|
||||||
Some(chardata.Data())
|
Some(chardata.Data())
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -1610,7 +1610,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-nodevalue
|
// http://dom.spec.whatwg.org/#dom-node-nodevalue
|
||||||
fn SetNodeValue(&self, val: Option<DOMString>) {
|
fn SetNodeValue(self, val: Option<DOMString>) {
|
||||||
match self.type_id {
|
match self.type_id {
|
||||||
CommentNodeTypeId |
|
CommentNodeTypeId |
|
||||||
TextNodeTypeId |
|
TextNodeTypeId |
|
||||||
|
@ -1622,7 +1622,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-textcontent
|
// http://dom.spec.whatwg.org/#dom-node-textcontent
|
||||||
fn GetTextContent(&self) -> Option<DOMString> {
|
fn GetTextContent(self) -> Option<DOMString> {
|
||||||
match self.type_id {
|
match self.type_id {
|
||||||
DocumentFragmentNodeTypeId |
|
DocumentFragmentNodeTypeId |
|
||||||
ElementNodeTypeId(..) => {
|
ElementNodeTypeId(..) => {
|
||||||
|
@ -1632,7 +1632,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
CommentNodeTypeId |
|
CommentNodeTypeId |
|
||||||
TextNodeTypeId |
|
TextNodeTypeId |
|
||||||
ProcessingInstructionNodeTypeId => {
|
ProcessingInstructionNodeTypeId => {
|
||||||
let characterdata: JSRef<CharacterData> = CharacterDataCast::to_ref(*self).unwrap();
|
let characterdata: JSRef<CharacterData> = CharacterDataCast::to_ref(self).unwrap();
|
||||||
Some(characterdata.Data())
|
Some(characterdata.Data())
|
||||||
}
|
}
|
||||||
DoctypeNodeTypeId |
|
DoctypeNodeTypeId |
|
||||||
|
@ -1643,7 +1643,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-textcontent
|
// http://dom.spec.whatwg.org/#dom-node-textcontent
|
||||||
fn SetTextContent(&self, value: Option<DOMString>) {
|
fn SetTextContent(self, value: Option<DOMString>) {
|
||||||
let value = null_str_as_empty(&value);
|
let value = null_str_as_empty(&value);
|
||||||
match self.type_id {
|
match self.type_id {
|
||||||
DocumentFragmentNodeTypeId |
|
DocumentFragmentNodeTypeId |
|
||||||
|
@ -1657,14 +1657,14 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
}.root();
|
}.root();
|
||||||
|
|
||||||
// Step 3.
|
// Step 3.
|
||||||
Node::replace_all(node.root_ref(), *self);
|
Node::replace_all(node.root_ref(), self);
|
||||||
}
|
}
|
||||||
CommentNodeTypeId |
|
CommentNodeTypeId |
|
||||||
TextNodeTypeId |
|
TextNodeTypeId |
|
||||||
ProcessingInstructionNodeTypeId => {
|
ProcessingInstructionNodeTypeId => {
|
||||||
self.wait_until_safe_to_modify_dom();
|
self.wait_until_safe_to_modify_dom();
|
||||||
|
|
||||||
let characterdata: JSRef<CharacterData> = CharacterDataCast::to_ref(*self).unwrap();
|
let characterdata: JSRef<CharacterData> = CharacterDataCast::to_ref(self).unwrap();
|
||||||
*characterdata.data.deref().borrow_mut() = value;
|
*characterdata.data.deref().borrow_mut() = value;
|
||||||
|
|
||||||
// Notify the document that the content of this node is different
|
// Notify the document that the content of this node is different
|
||||||
|
@ -1677,17 +1677,17 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-insertbefore
|
// http://dom.spec.whatwg.org/#dom-node-insertbefore
|
||||||
fn InsertBefore(&self, node: JSRef<Node>, child: Option<JSRef<Node>>) -> Fallible<Temporary<Node>> {
|
fn InsertBefore(self, node: JSRef<Node>, child: Option<JSRef<Node>>) -> Fallible<Temporary<Node>> {
|
||||||
Node::pre_insert(node, *self, child)
|
Node::pre_insert(node, self, child)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-appendchild
|
// http://dom.spec.whatwg.org/#dom-node-appendchild
|
||||||
fn AppendChild(&self, node: JSRef<Node>) -> Fallible<Temporary<Node>> {
|
fn AppendChild(self, node: JSRef<Node>) -> Fallible<Temporary<Node>> {
|
||||||
Node::pre_insert(node, *self, None)
|
Node::pre_insert(node, self, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#concept-node-replace
|
// http://dom.spec.whatwg.org/#concept-node-replace
|
||||||
fn ReplaceChild(&self, node: JSRef<Node>, child: JSRef<Node>) -> Fallible<Temporary<Node>> {
|
fn ReplaceChild(self, node: JSRef<Node>, child: JSRef<Node>) -> Fallible<Temporary<Node>> {
|
||||||
|
|
||||||
// Step 1.
|
// Step 1.
|
||||||
match self.type_id {
|
match self.type_id {
|
||||||
|
@ -1698,7 +1698,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 2.
|
// Step 2.
|
||||||
if node.is_inclusive_ancestor_of(*self) {
|
if node.is_inclusive_ancestor_of(self) {
|
||||||
return Err(HierarchyRequest);
|
return Err(HierarchyRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1789,15 +1789,15 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Step 9.
|
// Step 9.
|
||||||
let document = document_from_node(*self).root();
|
let document = document_from_node(self).root();
|
||||||
Node::adopt(node, *document);
|
Node::adopt(node, *document);
|
||||||
|
|
||||||
{
|
{
|
||||||
// Step 10.
|
// Step 10.
|
||||||
Node::remove(child, *self, Suppressed);
|
Node::remove(child, self, Suppressed);
|
||||||
|
|
||||||
// Step 11.
|
// Step 11.
|
||||||
Node::insert(node, *self, reference_child, Suppressed);
|
Node::insert(node, self, reference_child, Suppressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 12-14.
|
// Step 12-14.
|
||||||
|
@ -1816,13 +1816,13 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-removechild
|
// http://dom.spec.whatwg.org/#dom-node-removechild
|
||||||
fn RemoveChild(&self, node: JSRef<Node>)
|
fn RemoveChild(self, node: JSRef<Node>)
|
||||||
-> Fallible<Temporary<Node>> {
|
-> Fallible<Temporary<Node>> {
|
||||||
Node::pre_remove(node, *self)
|
Node::pre_remove(node, self)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-normalize
|
// http://dom.spec.whatwg.org/#dom-node-normalize
|
||||||
fn Normalize(&self) {
|
fn Normalize(self) {
|
||||||
let mut prev_text = None;
|
let mut prev_text = None;
|
||||||
for child in self.children() {
|
for child in self.children() {
|
||||||
if child.is_text() {
|
if child.is_text() {
|
||||||
|
@ -1848,15 +1848,15 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-clonenode
|
// http://dom.spec.whatwg.org/#dom-node-clonenode
|
||||||
fn CloneNode(&self, deep: bool) -> Temporary<Node> {
|
fn CloneNode(self, deep: bool) -> Temporary<Node> {
|
||||||
match deep {
|
match deep {
|
||||||
true => Node::clone(*self, None, CloneChildren),
|
true => Node::clone(self, None, CloneChildren),
|
||||||
false => Node::clone(*self, None, DoNotCloneChildren)
|
false => Node::clone(self, None, DoNotCloneChildren)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-isequalnode
|
// http://dom.spec.whatwg.org/#dom-node-isequalnode
|
||||||
fn IsEqualNode(&self, maybe_node: Option<JSRef<Node>>) -> bool {
|
fn IsEqualNode(self, maybe_node: Option<JSRef<Node>>) -> bool {
|
||||||
fn is_equal_doctype(node: JSRef<Node>, other: JSRef<Node>) -> bool {
|
fn is_equal_doctype(node: JSRef<Node>, other: JSRef<Node>) -> bool {
|
||||||
let doctype: JSRef<DocumentType> = DocumentTypeCast::to_ref(node).unwrap();
|
let doctype: JSRef<DocumentType> = DocumentTypeCast::to_ref(node).unwrap();
|
||||||
let other_doctype: JSRef<DocumentType> = DocumentTypeCast::to_ref(other).unwrap();
|
let other_doctype: JSRef<DocumentType> = DocumentTypeCast::to_ref(other).unwrap();
|
||||||
|
@ -1931,13 +1931,13 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
// Step 1.
|
// Step 1.
|
||||||
None => false,
|
None => false,
|
||||||
// Step 2-6.
|
// Step 2-6.
|
||||||
Some(node) => is_equal_node(*self, node)
|
Some(node) => is_equal_node(self, node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-comparedocumentposition
|
// http://dom.spec.whatwg.org/#dom-node-comparedocumentposition
|
||||||
fn CompareDocumentPosition(&self, other: JSRef<Node>) -> u16 {
|
fn CompareDocumentPosition(self, other: JSRef<Node>) -> u16 {
|
||||||
if *self == other {
|
if self == other {
|
||||||
// step 2.
|
// step 2.
|
||||||
0
|
0
|
||||||
} else {
|
} else {
|
||||||
|
@ -1952,7 +1952,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
lastself = ancestor.clone();
|
lastself = ancestor.clone();
|
||||||
}
|
}
|
||||||
for ancestor in other.ancestors() {
|
for ancestor in other.ancestors() {
|
||||||
if ancestor == *self {
|
if ancestor == self {
|
||||||
// step 5.
|
// step 5.
|
||||||
return NodeConstants::DOCUMENT_POSITION_CONTAINED_BY +
|
return NodeConstants::DOCUMENT_POSITION_CONTAINED_BY +
|
||||||
NodeConstants::DOCUMENT_POSITION_FOLLOWING;
|
NodeConstants::DOCUMENT_POSITION_FOLLOWING;
|
||||||
|
@ -1961,7 +1961,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if lastself != lastother {
|
if lastself != lastother {
|
||||||
let abstract_uint: uintptr_t = as_uintptr(&*self);
|
let abstract_uint: uintptr_t = as_uintptr(&self);
|
||||||
let other_uint: uintptr_t = as_uintptr(&*other);
|
let other_uint: uintptr_t = as_uintptr(&*other);
|
||||||
|
|
||||||
let random = if abstract_uint < other_uint {
|
let random = if abstract_uint < other_uint {
|
||||||
|
@ -1980,7 +1980,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
// step 6.
|
// step 6.
|
||||||
return NodeConstants::DOCUMENT_POSITION_PRECEDING;
|
return NodeConstants::DOCUMENT_POSITION_PRECEDING;
|
||||||
}
|
}
|
||||||
if child == *self {
|
if child == self {
|
||||||
// step 7.
|
// step 7.
|
||||||
return NodeConstants::DOCUMENT_POSITION_FOLLOWING;
|
return NodeConstants::DOCUMENT_POSITION_FOLLOWING;
|
||||||
}
|
}
|
||||||
|
@ -1990,7 +1990,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-contains
|
// http://dom.spec.whatwg.org/#dom-node-contains
|
||||||
fn Contains(&self, maybe_other: Option<JSRef<Node>>) -> bool {
|
fn Contains(self, maybe_other: Option<JSRef<Node>>) -> bool {
|
||||||
match maybe_other {
|
match maybe_other {
|
||||||
None => false,
|
None => false,
|
||||||
Some(other) => self.is_inclusive_ancestor_of(other)
|
Some(other) => self.is_inclusive_ancestor_of(other)
|
||||||
|
@ -1998,19 +1998,19 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-lookupprefix
|
// http://dom.spec.whatwg.org/#dom-node-lookupprefix
|
||||||
fn LookupPrefix(&self, _prefix: Option<DOMString>) -> Option<DOMString> {
|
fn LookupPrefix(self, _prefix: Option<DOMString>) -> Option<DOMString> {
|
||||||
// FIXME (#1826) implement.
|
// FIXME (#1826) implement.
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-lookupnamespaceuri
|
// http://dom.spec.whatwg.org/#dom-node-lookupnamespaceuri
|
||||||
fn LookupNamespaceURI(&self, _namespace: Option<DOMString>) -> Option<DOMString> {
|
fn LookupNamespaceURI(self, _namespace: Option<DOMString>) -> Option<DOMString> {
|
||||||
// FIXME (#1826) implement.
|
// FIXME (#1826) implement.
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-isdefaultnamespace
|
// http://dom.spec.whatwg.org/#dom-node-isdefaultnamespace
|
||||||
fn IsDefaultNamespace(&self, _namespace: Option<DOMString>) -> bool {
|
fn IsDefaultNamespace(self, _namespace: Option<DOMString>) -> bool {
|
||||||
// FIXME (#1826) implement.
|
// FIXME (#1826) implement.
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ impl NodeList {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> NodeListMethods for JSRef<'a, NodeList> {
|
impl<'a> NodeListMethods for JSRef<'a, NodeList> {
|
||||||
fn Length(&self) -> u32 {
|
fn Length(self) -> u32 {
|
||||||
match self.list_type {
|
match self.list_type {
|
||||||
Simple(ref elems) => elems.len() as u32,
|
Simple(ref elems) => elems.len() as u32,
|
||||||
Children(ref node) => {
|
Children(ref node) => {
|
||||||
|
@ -58,7 +58,7 @@ impl<'a> NodeListMethods for JSRef<'a, NodeList> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Item(&self, index: u32) -> Option<Temporary<Node>> {
|
fn Item(self, index: u32) -> Option<Temporary<Node>> {
|
||||||
match self.list_type {
|
match self.list_type {
|
||||||
_ if index >= self.Length() => None,
|
_ if index >= self.Length() => None,
|
||||||
Simple(ref elems) => Some(Temporary::new(elems[index as uint].clone())),
|
Simple(ref elems) => Some(Temporary::new(elems[index as uint].clone())),
|
||||||
|
@ -70,7 +70,7 @@ impl<'a> NodeListMethods for JSRef<'a, NodeList> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Temporary<Node>> {
|
fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<Temporary<Node>> {
|
||||||
let item = self.Item(index);
|
let item = self.Item(index);
|
||||||
*found = item.is_some();
|
*found = item.is_some();
|
||||||
item
|
item
|
||||||
|
|
|
@ -36,11 +36,11 @@ impl Performance {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> PerformanceMethods for JSRef<'a, Performance> {
|
impl<'a> PerformanceMethods for JSRef<'a, Performance> {
|
||||||
fn Timing(&self) -> Temporary<PerformanceTiming> {
|
fn Timing(self) -> Temporary<PerformanceTiming> {
|
||||||
Temporary::new(self.timing.clone())
|
Temporary::new(self.timing.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Now(&self) -> DOMHighResTimeStamp {
|
fn Now(self) -> DOMHighResTimeStamp {
|
||||||
let navStart = self.timing.root().NavigationStartPrecise() as f64;
|
let navStart = self.timing.root().NavigationStartPrecise() as f64;
|
||||||
(time::precise_time_s() - navStart) as DOMHighResTimeStamp
|
(time::precise_time_s() - navStart) as DOMHighResTimeStamp
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ impl PerformanceTiming {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> PerformanceTimingMethods for JSRef<'a, PerformanceTiming> {
|
impl<'a> PerformanceTimingMethods for JSRef<'a, PerformanceTiming> {
|
||||||
fn NavigationStart(&self) -> u64 {
|
fn NavigationStart(self) -> u64 {
|
||||||
self.navigationStart
|
self.navigationStart
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ impl ProcessingInstruction {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ProcessingInstructionMethods for JSRef<'a, ProcessingInstruction> {
|
impl<'a> ProcessingInstructionMethods for JSRef<'a, ProcessingInstruction> {
|
||||||
fn Target(&self) -> DOMString {
|
fn Target(self) -> DOMString {
|
||||||
self.target.clone()
|
self.target.clone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,13 +58,13 @@ impl ProgressEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ProgressEventMethods for JSRef<'a, ProgressEvent> {
|
impl<'a> ProgressEventMethods for JSRef<'a, ProgressEvent> {
|
||||||
fn LengthComputable(&self) -> bool {
|
fn LengthComputable(self) -> bool {
|
||||||
self.length_computable
|
self.length_computable
|
||||||
}
|
}
|
||||||
fn Loaded(&self) -> u64{
|
fn Loaded(self) -> u64{
|
||||||
self.loaded
|
self.loaded
|
||||||
}
|
}
|
||||||
fn Total(&self) -> u64 {
|
fn Total(self) -> u64 {
|
||||||
self.total
|
self.total
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ impl Range {
|
||||||
|
|
||||||
impl<'a> RangeMethods for JSRef<'a, Range> {
|
impl<'a> RangeMethods for JSRef<'a, Range> {
|
||||||
/// http://dom.spec.whatwg.org/#dom-range-detach
|
/// http://dom.spec.whatwg.org/#dom-range-detach
|
||||||
fn Detach(&self) {
|
fn Detach(self) {
|
||||||
// This method intentionally left blank.
|
// This method intentionally left blank.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,11 +30,11 @@ impl Screen {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ScreenMethods for JSRef<'a, Screen> {
|
impl<'a> ScreenMethods for JSRef<'a, Screen> {
|
||||||
fn ColorDepth(&self) -> u32 {
|
fn ColorDepth(self) -> u32 {
|
||||||
24
|
24
|
||||||
}
|
}
|
||||||
|
|
||||||
fn PixelDepth(&self) -> u32 {
|
fn PixelDepth(self) -> u32 {
|
||||||
24
|
24
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,265 +26,265 @@ pub struct TestBinding {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> TestBindingMethods for JSRef<'a, TestBinding> {
|
impl<'a> TestBindingMethods for JSRef<'a, TestBinding> {
|
||||||
fn BooleanAttribute(&self) -> bool { false }
|
fn BooleanAttribute(self) -> bool { false }
|
||||||
fn SetBooleanAttribute(&self, _: bool) {}
|
fn SetBooleanAttribute(self, _: bool) {}
|
||||||
fn ByteAttribute(&self) -> i8 { 0 }
|
fn ByteAttribute(self) -> i8 { 0 }
|
||||||
fn SetByteAttribute(&self, _: i8) {}
|
fn SetByteAttribute(self, _: i8) {}
|
||||||
fn OctetAttribute(&self) -> u8 { 0 }
|
fn OctetAttribute(self) -> u8 { 0 }
|
||||||
fn SetOctetAttribute(&self, _: u8) {}
|
fn SetOctetAttribute(self, _: u8) {}
|
||||||
fn ShortAttribute(&self) -> i16 { 0 }
|
fn ShortAttribute(self) -> i16 { 0 }
|
||||||
fn SetShortAttribute(&self, _: i16) {}
|
fn SetShortAttribute(self, _: i16) {}
|
||||||
fn UnsignedShortAttribute(&self) -> u16 { 0 }
|
fn UnsignedShortAttribute(self) -> u16 { 0 }
|
||||||
fn SetUnsignedShortAttribute(&self, _: u16) {}
|
fn SetUnsignedShortAttribute(self, _: u16) {}
|
||||||
fn LongAttribute(&self) -> i32 { 0 }
|
fn LongAttribute(self) -> i32 { 0 }
|
||||||
fn SetLongAttribute(&self, _: i32) {}
|
fn SetLongAttribute(self, _: i32) {}
|
||||||
fn UnsignedLongAttribute(&self) -> u32 { 0 }
|
fn UnsignedLongAttribute(self) -> u32 { 0 }
|
||||||
fn SetUnsignedLongAttribute(&self, _: u32) {}
|
fn SetUnsignedLongAttribute(self, _: u32) {}
|
||||||
fn LongLongAttribute(&self) -> i64 { 0 }
|
fn LongLongAttribute(self) -> i64 { 0 }
|
||||||
fn SetLongLongAttribute(&self, _: i64) {}
|
fn SetLongLongAttribute(self, _: i64) {}
|
||||||
fn UnsignedLongLongAttribute(&self) -> u64 { 0 }
|
fn UnsignedLongLongAttribute(self) -> u64 { 0 }
|
||||||
fn SetUnsignedLongLongAttribute(&self, _: u64) {}
|
fn SetUnsignedLongLongAttribute(self, _: u64) {}
|
||||||
fn FloatAttribute(&self) -> f32 { 0. }
|
fn FloatAttribute(self) -> f32 { 0. }
|
||||||
fn SetFloatAttribute(&self, _: f32) {}
|
fn SetFloatAttribute(self, _: f32) {}
|
||||||
fn DoubleAttribute(&self) -> f64 { 0. }
|
fn DoubleAttribute(self) -> f64 { 0. }
|
||||||
fn SetDoubleAttribute(&self, _: f64) {}
|
fn SetDoubleAttribute(self, _: f64) {}
|
||||||
fn StringAttribute(&self) -> DOMString { "".to_string() }
|
fn StringAttribute(self) -> DOMString { "".to_string() }
|
||||||
fn SetStringAttribute(&self, _: DOMString) {}
|
fn SetStringAttribute(self, _: DOMString) {}
|
||||||
fn ByteStringAttribute(&self) -> ByteString { ByteString::new(vec!()) }
|
fn ByteStringAttribute(self) -> ByteString { ByteString::new(vec!()) }
|
||||||
fn SetByteStringAttribute(&self, _: ByteString) {}
|
fn SetByteStringAttribute(self, _: ByteString) {}
|
||||||
fn EnumAttribute(&self) -> TestEnum { _empty }
|
fn EnumAttribute(self) -> TestEnum { _empty }
|
||||||
fn SetEnumAttribute(&self, _: TestEnum) {}
|
fn SetEnumAttribute(self, _: TestEnum) {}
|
||||||
fn InterfaceAttribute(&self) -> Temporary<Blob> {
|
fn InterfaceAttribute(self) -> Temporary<Blob> {
|
||||||
let global = self.global.root();
|
let global = self.global.root();
|
||||||
Blob::new(&global.root_ref())
|
Blob::new(&global.root_ref())
|
||||||
}
|
}
|
||||||
fn SetInterfaceAttribute(&self, _: JSRef<Blob>) {}
|
fn SetInterfaceAttribute(self, _: JSRef<Blob>) {}
|
||||||
fn UnionAttribute(&self) -> HTMLElementOrLong { eLong(0) }
|
fn UnionAttribute(self) -> HTMLElementOrLong { eLong(0) }
|
||||||
fn SetUnionAttribute(&self, _: HTMLElementOrLong) {}
|
fn SetUnionAttribute(self, _: HTMLElementOrLong) {}
|
||||||
fn Union2Attribute(&self) -> EventOrString { eString("".to_string()) }
|
fn Union2Attribute(self) -> EventOrString { eString("".to_string()) }
|
||||||
fn SetUnion2Attribute(&self, _: EventOrString) {}
|
fn SetUnion2Attribute(self, _: EventOrString) {}
|
||||||
fn AnyAttribute(&self, _: *mut JSContext) -> JSVal { NullValue() }
|
fn AnyAttribute(self, _: *mut JSContext) -> JSVal { NullValue() }
|
||||||
fn SetAnyAttribute(&self, _: *mut JSContext, _: JSVal) {}
|
fn SetAnyAttribute(self, _: *mut JSContext, _: JSVal) {}
|
||||||
|
|
||||||
fn GetBooleanAttributeNullable(&self) -> Option<bool> { Some(false) }
|
fn GetBooleanAttributeNullable(self) -> Option<bool> { Some(false) }
|
||||||
fn SetBooleanAttributeNullable(&self, _: Option<bool>) {}
|
fn SetBooleanAttributeNullable(self, _: Option<bool>) {}
|
||||||
fn GetByteAttributeNullable(&self) -> Option<i8> { Some(0) }
|
fn GetByteAttributeNullable(self) -> Option<i8> { Some(0) }
|
||||||
fn SetByteAttributeNullable(&self, _: Option<i8>) {}
|
fn SetByteAttributeNullable(self, _: Option<i8>) {}
|
||||||
fn GetOctetAttributeNullable(&self) -> Option<u8> { Some(0) }
|
fn GetOctetAttributeNullable(self) -> Option<u8> { Some(0) }
|
||||||
fn SetOctetAttributeNullable(&self, _: Option<u8>) {}
|
fn SetOctetAttributeNullable(self, _: Option<u8>) {}
|
||||||
fn GetShortAttributeNullable(&self) -> Option<i16> { Some(0) }
|
fn GetShortAttributeNullable(self) -> Option<i16> { Some(0) }
|
||||||
fn SetShortAttributeNullable(&self, _: Option<i16>) {}
|
fn SetShortAttributeNullable(self, _: Option<i16>) {}
|
||||||
fn GetUnsignedShortAttributeNullable(&self) -> Option<u16> { Some(0) }
|
fn GetUnsignedShortAttributeNullable(self) -> Option<u16> { Some(0) }
|
||||||
fn SetUnsignedShortAttributeNullable(&self, _: Option<u16>) {}
|
fn SetUnsignedShortAttributeNullable(self, _: Option<u16>) {}
|
||||||
fn GetLongAttributeNullable(&self) -> Option<i32> { Some(0) }
|
fn GetLongAttributeNullable(self) -> Option<i32> { Some(0) }
|
||||||
fn SetLongAttributeNullable(&self, _: Option<i32>) {}
|
fn SetLongAttributeNullable(self, _: Option<i32>) {}
|
||||||
fn GetUnsignedLongAttributeNullable(&self) -> Option<u32> { Some(0) }
|
fn GetUnsignedLongAttributeNullable(self) -> Option<u32> { Some(0) }
|
||||||
fn SetUnsignedLongAttributeNullable(&self, _: Option<u32>) {}
|
fn SetUnsignedLongAttributeNullable(self, _: Option<u32>) {}
|
||||||
fn GetLongLongAttributeNullable(&self) -> Option<i64> { Some(0) }
|
fn GetLongLongAttributeNullable(self) -> Option<i64> { Some(0) }
|
||||||
fn SetLongLongAttributeNullable(&self, _: Option<i64>) {}
|
fn SetLongLongAttributeNullable(self, _: Option<i64>) {}
|
||||||
fn GetUnsignedLongLongAttributeNullable(&self) -> Option<u64> { Some(0) }
|
fn GetUnsignedLongLongAttributeNullable(self) -> Option<u64> { Some(0) }
|
||||||
fn SetUnsignedLongLongAttributeNullable(&self, _: Option<u64>) {}
|
fn SetUnsignedLongLongAttributeNullable(self, _: Option<u64>) {}
|
||||||
fn GetFloatAttributeNullable(&self) -> Option<f32> { Some(0.) }
|
fn GetFloatAttributeNullable(self) -> Option<f32> { Some(0.) }
|
||||||
fn SetFloatAttributeNullable(&self, _: Option<f32>) {}
|
fn SetFloatAttributeNullable(self, _: Option<f32>) {}
|
||||||
fn GetDoubleAttributeNullable(&self) -> Option<f64> { Some(0.) }
|
fn GetDoubleAttributeNullable(self) -> Option<f64> { Some(0.) }
|
||||||
fn SetDoubleAttributeNullable(&self, _: Option<f64>) {}
|
fn SetDoubleAttributeNullable(self, _: Option<f64>) {}
|
||||||
fn GetByteStringAttributeNullable(&self) -> Option<ByteString> { Some(ByteString::new(vec!())) }
|
fn GetByteStringAttributeNullable(self) -> Option<ByteString> { Some(ByteString::new(vec!())) }
|
||||||
fn SetByteStringAttributeNullable(&self, _: Option<ByteString>) {}
|
fn SetByteStringAttributeNullable(self, _: Option<ByteString>) {}
|
||||||
fn GetStringAttributeNullable(&self) -> Option<DOMString> { Some("".to_string()) }
|
fn GetStringAttributeNullable(self) -> Option<DOMString> { Some("".to_string()) }
|
||||||
fn SetStringAttributeNullable(&self, _: Option<DOMString>) {}
|
fn SetStringAttributeNullable(self, _: Option<DOMString>) {}
|
||||||
fn GetEnumAttributeNullable(&self) -> Option<TestEnum> { Some(_empty) }
|
fn GetEnumAttributeNullable(self) -> Option<TestEnum> { Some(_empty) }
|
||||||
fn GetInterfaceAttributeNullable(&self) -> Option<Temporary<Blob>> {
|
fn GetInterfaceAttributeNullable(self) -> Option<Temporary<Blob>> {
|
||||||
let global = self.global.root();
|
let global = self.global.root();
|
||||||
Some(Blob::new(&global.root_ref()))
|
Some(Blob::new(&global.root_ref()))
|
||||||
}
|
}
|
||||||
fn SetInterfaceAttributeNullable(&self, _: Option<JSRef<Blob>>) {}
|
fn SetInterfaceAttributeNullable(self, _: Option<JSRef<Blob>>) {}
|
||||||
fn GetUnionAttributeNullable(&self) -> Option<HTMLElementOrLong> { Some(eLong(0)) }
|
fn GetUnionAttributeNullable(self) -> Option<HTMLElementOrLong> { Some(eLong(0)) }
|
||||||
fn SetUnionAttributeNullable(&self, _: Option<HTMLElementOrLong>) {}
|
fn SetUnionAttributeNullable(self, _: Option<HTMLElementOrLong>) {}
|
||||||
fn GetUnion2AttributeNullable(&self) -> Option<EventOrString> { Some(eString("".to_string())) }
|
fn GetUnion2AttributeNullable(self) -> Option<EventOrString> { Some(eString("".to_string())) }
|
||||||
fn SetUnion2AttributeNullable(&self, _: Option<EventOrString>) {}
|
fn SetUnion2AttributeNullable(self, _: Option<EventOrString>) {}
|
||||||
fn ReceiveVoid(&self) -> () {}
|
fn ReceiveVoid(self) -> () {}
|
||||||
fn ReceiveBoolean(&self) -> bool { false }
|
fn ReceiveBoolean(self) -> bool { false }
|
||||||
fn ReceiveByte(&self) -> i8 { 0 }
|
fn ReceiveByte(self) -> i8 { 0 }
|
||||||
fn ReceiveOctet(&self) -> u8 { 0 }
|
fn ReceiveOctet(self) -> u8 { 0 }
|
||||||
fn ReceiveShort(&self) -> i16 { 0 }
|
fn ReceiveShort(self) -> i16 { 0 }
|
||||||
fn ReceiveUnsignedShort(&self) -> u16 { 0 }
|
fn ReceiveUnsignedShort(self) -> u16 { 0 }
|
||||||
fn ReceiveLong(&self) -> i32 { 0 }
|
fn ReceiveLong(self) -> i32 { 0 }
|
||||||
fn ReceiveUnsignedLong(&self) -> u32 { 0 }
|
fn ReceiveUnsignedLong(self) -> u32 { 0 }
|
||||||
fn ReceiveLongLong(&self) -> i64 { 0 }
|
fn ReceiveLongLong(self) -> i64 { 0 }
|
||||||
fn ReceiveUnsignedLongLong(&self) -> u64 { 0 }
|
fn ReceiveUnsignedLongLong(self) -> u64 { 0 }
|
||||||
fn ReceiveFloat(&self) -> f32 { 0. }
|
fn ReceiveFloat(self) -> f32 { 0. }
|
||||||
fn ReceiveDouble(&self) -> f64 { 0. }
|
fn ReceiveDouble(self) -> f64 { 0. }
|
||||||
fn ReceiveString(&self) -> DOMString { "".to_string() }
|
fn ReceiveString(self) -> DOMString { "".to_string() }
|
||||||
fn ReceiveByteString(&self) -> ByteString { ByteString::new(vec!()) }
|
fn ReceiveByteString(self) -> ByteString { ByteString::new(vec!()) }
|
||||||
fn ReceiveEnum(&self) -> TestEnum { _empty }
|
fn ReceiveEnum(self) -> TestEnum { _empty }
|
||||||
fn ReceiveInterface(&self) -> Temporary<Blob> {
|
fn ReceiveInterface(self) -> Temporary<Blob> {
|
||||||
let global = self.global.root();
|
let global = self.global.root();
|
||||||
Blob::new(&global.root_ref())
|
Blob::new(&global.root_ref())
|
||||||
}
|
}
|
||||||
fn ReceiveAny(&self, _: *mut JSContext) -> JSVal { NullValue() }
|
fn ReceiveAny(self, _: *mut JSContext) -> JSVal { NullValue() }
|
||||||
fn ReceiveUnion(&self) -> HTMLElementOrLong { eLong(0) }
|
fn ReceiveUnion(self) -> HTMLElementOrLong { eLong(0) }
|
||||||
fn ReceiveUnion2(&self) -> EventOrString { eString("".to_string()) }
|
fn ReceiveUnion2(self) -> EventOrString { eString("".to_string()) }
|
||||||
|
|
||||||
fn ReceiveNullableBoolean(&self) -> Option<bool> { Some(false) }
|
fn ReceiveNullableBoolean(self) -> Option<bool> { Some(false) }
|
||||||
fn ReceiveNullableByte(&self) -> Option<i8> { Some(0) }
|
fn ReceiveNullableByte(self) -> Option<i8> { Some(0) }
|
||||||
fn ReceiveNullableOctet(&self) -> Option<u8> { Some(0) }
|
fn ReceiveNullableOctet(self) -> Option<u8> { Some(0) }
|
||||||
fn ReceiveNullableShort(&self) -> Option<i16> { Some(0) }
|
fn ReceiveNullableShort(self) -> Option<i16> { Some(0) }
|
||||||
fn ReceiveNullableUnsignedShort(&self) -> Option<u16> { Some(0) }
|
fn ReceiveNullableUnsignedShort(self) -> Option<u16> { Some(0) }
|
||||||
fn ReceiveNullableLong(&self) -> Option<i32> { Some(0) }
|
fn ReceiveNullableLong(self) -> Option<i32> { Some(0) }
|
||||||
fn ReceiveNullableUnsignedLong(&self) -> Option<u32> { Some(0) }
|
fn ReceiveNullableUnsignedLong(self) -> Option<u32> { Some(0) }
|
||||||
fn ReceiveNullableLongLong(&self) -> Option<i64> { Some(0) }
|
fn ReceiveNullableLongLong(self) -> Option<i64> { Some(0) }
|
||||||
fn ReceiveNullableUnsignedLongLong(&self) -> Option<u64> { Some(0) }
|
fn ReceiveNullableUnsignedLongLong(self) -> Option<u64> { Some(0) }
|
||||||
fn ReceiveNullableFloat(&self) -> Option<f32> { Some(0.) }
|
fn ReceiveNullableFloat(self) -> Option<f32> { Some(0.) }
|
||||||
fn ReceiveNullableDouble(&self) -> Option<f64> { Some(0.) }
|
fn ReceiveNullableDouble(self) -> Option<f64> { Some(0.) }
|
||||||
fn ReceiveNullableString(&self) -> Option<DOMString> { Some("".to_string()) }
|
fn ReceiveNullableString(self) -> Option<DOMString> { Some("".to_string()) }
|
||||||
fn ReceiveNullableByteString(&self) -> Option<ByteString> { Some(ByteString::new(vec!())) }
|
fn ReceiveNullableByteString(self) -> Option<ByteString> { Some(ByteString::new(vec!())) }
|
||||||
fn ReceiveNullableEnum(&self) -> Option<TestEnum> { Some(_empty) }
|
fn ReceiveNullableEnum(self) -> Option<TestEnum> { Some(_empty) }
|
||||||
fn ReceiveNullableInterface(&self) -> Option<Temporary<Blob>> {
|
fn ReceiveNullableInterface(self) -> Option<Temporary<Blob>> {
|
||||||
let global = self.global.root();
|
let global = self.global.root();
|
||||||
Some(Blob::new(&global.root_ref()))
|
Some(Blob::new(&global.root_ref()))
|
||||||
}
|
}
|
||||||
fn ReceiveNullableUnion(&self) -> Option<HTMLElementOrLong> { Some(eLong(0)) }
|
fn ReceiveNullableUnion(self) -> Option<HTMLElementOrLong> { Some(eLong(0)) }
|
||||||
fn ReceiveNullableUnion2(&self) -> Option<EventOrString> { Some(eString("".to_string())) }
|
fn ReceiveNullableUnion2(self) -> Option<EventOrString> { Some(eString("".to_string())) }
|
||||||
|
|
||||||
fn PassBoolean(&self, _: bool) {}
|
fn PassBoolean(self, _: bool) {}
|
||||||
fn PassByte(&self, _: i8) {}
|
fn PassByte(self, _: i8) {}
|
||||||
fn PassOctet(&self, _: u8) {}
|
fn PassOctet(self, _: u8) {}
|
||||||
fn PassShort(&self, _: i16) {}
|
fn PassShort(self, _: i16) {}
|
||||||
fn PassUnsignedShort(&self, _: u16) {}
|
fn PassUnsignedShort(self, _: u16) {}
|
||||||
fn PassLong(&self, _: i32) {}
|
fn PassLong(self, _: i32) {}
|
||||||
fn PassUnsignedLong(&self, _: u32) {}
|
fn PassUnsignedLong(self, _: u32) {}
|
||||||
fn PassLongLong(&self, _: i64) {}
|
fn PassLongLong(self, _: i64) {}
|
||||||
fn PassUnsignedLongLong(&self, _: u64) {}
|
fn PassUnsignedLongLong(self, _: u64) {}
|
||||||
fn PassFloat(&self, _: f32) {}
|
fn PassFloat(self, _: f32) {}
|
||||||
fn PassDouble(&self, _: f64) {}
|
fn PassDouble(self, _: f64) {}
|
||||||
fn PassString(&self, _: DOMString) {}
|
fn PassString(self, _: DOMString) {}
|
||||||
fn PassByteString(&self, _: ByteString) {}
|
fn PassByteString(self, _: ByteString) {}
|
||||||
fn PassEnum(&self, _: TestEnum) {}
|
fn PassEnum(self, _: TestEnum) {}
|
||||||
fn PassInterface(&self, _: JSRef<Blob>) {}
|
fn PassInterface(self, _: JSRef<Blob>) {}
|
||||||
fn PassUnion(&self, _: HTMLElementOrLong) {}
|
fn PassUnion(self, _: HTMLElementOrLong) {}
|
||||||
fn PassUnion2(&self, _: EventOrString) {}
|
fn PassUnion2(self, _: EventOrString) {}
|
||||||
fn PassUnion3(&self, _: BlobOrString) {}
|
fn PassUnion3(self, _: BlobOrString) {}
|
||||||
fn PassAny(&self, _: *mut JSContext, _: JSVal) {}
|
fn PassAny(self, _: *mut JSContext, _: JSVal) {}
|
||||||
|
|
||||||
fn PassNullableBoolean(&self, _: Option<bool>) {}
|
fn PassNullableBoolean(self, _: Option<bool>) {}
|
||||||
fn PassNullableByte(&self, _: Option<i8>) {}
|
fn PassNullableByte(self, _: Option<i8>) {}
|
||||||
fn PassNullableOctet(&self, _: Option<u8>) {}
|
fn PassNullableOctet(self, _: Option<u8>) {}
|
||||||
fn PassNullableShort(&self, _: Option<i16>) {}
|
fn PassNullableShort(self, _: Option<i16>) {}
|
||||||
fn PassNullableUnsignedShort(&self, _: Option<u16>) {}
|
fn PassNullableUnsignedShort(self, _: Option<u16>) {}
|
||||||
fn PassNullableLong(&self, _: Option<i32>) {}
|
fn PassNullableLong(self, _: Option<i32>) {}
|
||||||
fn PassNullableUnsignedLong(&self, _: Option<u32>) {}
|
fn PassNullableUnsignedLong(self, _: Option<u32>) {}
|
||||||
fn PassNullableLongLong(&self, _: Option<i64>) {}
|
fn PassNullableLongLong(self, _: Option<i64>) {}
|
||||||
fn PassNullableUnsignedLongLong(&self, _: Option<u64>) {}
|
fn PassNullableUnsignedLongLong(self, _: Option<u64>) {}
|
||||||
fn PassNullableFloat(&self, _: Option<f32>) {}
|
fn PassNullableFloat(self, _: Option<f32>) {}
|
||||||
fn PassNullableDouble(&self, _: Option<f64>) {}
|
fn PassNullableDouble(self, _: Option<f64>) {}
|
||||||
fn PassNullableString(&self, _: Option<DOMString>) {}
|
fn PassNullableString(self, _: Option<DOMString>) {}
|
||||||
fn PassNullableByteString(&self, _: Option<ByteString>) {}
|
fn PassNullableByteString(self, _: Option<ByteString>) {}
|
||||||
// fn PassNullableEnum(&self, _: Option<TestEnum>) {}
|
// fn PassNullableEnum(self, _: Option<TestEnum>) {}
|
||||||
fn PassNullableInterface(&self, _: Option<JSRef<Blob>>) {}
|
fn PassNullableInterface(self, _: Option<JSRef<Blob>>) {}
|
||||||
fn PassNullableUnion(&self, _: Option<HTMLElementOrLong>) {}
|
fn PassNullableUnion(self, _: Option<HTMLElementOrLong>) {}
|
||||||
fn PassNullableUnion2(&self, _: Option<EventOrString>) {}
|
fn PassNullableUnion2(self, _: Option<EventOrString>) {}
|
||||||
|
|
||||||
fn PassOptionalBoolean(&self, _: Option<bool>) {}
|
fn PassOptionalBoolean(self, _: Option<bool>) {}
|
||||||
fn PassOptionalByte(&self, _: Option<i8>) {}
|
fn PassOptionalByte(self, _: Option<i8>) {}
|
||||||
fn PassOptionalOctet(&self, _: Option<u8>) {}
|
fn PassOptionalOctet(self, _: Option<u8>) {}
|
||||||
fn PassOptionalShort(&self, _: Option<i16>) {}
|
fn PassOptionalShort(self, _: Option<i16>) {}
|
||||||
fn PassOptionalUnsignedShort(&self, _: Option<u16>) {}
|
fn PassOptionalUnsignedShort(self, _: Option<u16>) {}
|
||||||
fn PassOptionalLong(&self, _: Option<i32>) {}
|
fn PassOptionalLong(self, _: Option<i32>) {}
|
||||||
fn PassOptionalUnsignedLong(&self, _: Option<u32>) {}
|
fn PassOptionalUnsignedLong(self, _: Option<u32>) {}
|
||||||
fn PassOptionalLongLong(&self, _: Option<i64>) {}
|
fn PassOptionalLongLong(self, _: Option<i64>) {}
|
||||||
fn PassOptionalUnsignedLongLong(&self, _: Option<u64>) {}
|
fn PassOptionalUnsignedLongLong(self, _: Option<u64>) {}
|
||||||
fn PassOptionalFloat(&self, _: Option<f32>) {}
|
fn PassOptionalFloat(self, _: Option<f32>) {}
|
||||||
fn PassOptionalDouble(&self, _: Option<f64>) {}
|
fn PassOptionalDouble(self, _: Option<f64>) {}
|
||||||
fn PassOptionalString(&self, _: Option<DOMString>) {}
|
fn PassOptionalString(self, _: Option<DOMString>) {}
|
||||||
fn PassOptionalByteString(&self, _: Option<ByteString>) {}
|
fn PassOptionalByteString(self, _: Option<ByteString>) {}
|
||||||
fn PassOptionalEnum(&self, _: Option<TestEnum>) {}
|
fn PassOptionalEnum(self, _: Option<TestEnum>) {}
|
||||||
fn PassOptionalInterface(&self, _: Option<JSRef<Blob>>) {}
|
fn PassOptionalInterface(self, _: Option<JSRef<Blob>>) {}
|
||||||
fn PassOptionalUnion(&self, _: Option<HTMLElementOrLong>) {}
|
fn PassOptionalUnion(self, _: Option<HTMLElementOrLong>) {}
|
||||||
fn PassOptionalUnion2(&self, _: Option<EventOrString>) {}
|
fn PassOptionalUnion2(self, _: Option<EventOrString>) {}
|
||||||
fn PassOptionalAny(&self, _: *mut JSContext, _: JSVal) {}
|
fn PassOptionalAny(self, _: *mut JSContext, _: JSVal) {}
|
||||||
|
|
||||||
fn PassOptionalNullableBoolean(&self, _: Option<Option<bool>>) {}
|
fn PassOptionalNullableBoolean(self, _: Option<Option<bool>>) {}
|
||||||
fn PassOptionalNullableByte(&self, _: Option<Option<i8>>) {}
|
fn PassOptionalNullableByte(self, _: Option<Option<i8>>) {}
|
||||||
fn PassOptionalNullableOctet(&self, _: Option<Option<u8>>) {}
|
fn PassOptionalNullableOctet(self, _: Option<Option<u8>>) {}
|
||||||
fn PassOptionalNullableShort(&self, _: Option<Option<i16>>) {}
|
fn PassOptionalNullableShort(self, _: Option<Option<i16>>) {}
|
||||||
fn PassOptionalNullableUnsignedShort(&self, _: Option<Option<u16>>) {}
|
fn PassOptionalNullableUnsignedShort(self, _: Option<Option<u16>>) {}
|
||||||
fn PassOptionalNullableLong(&self, _: Option<Option<i32>>) {}
|
fn PassOptionalNullableLong(self, _: Option<Option<i32>>) {}
|
||||||
fn PassOptionalNullableUnsignedLong(&self, _: Option<Option<u32>>) {}
|
fn PassOptionalNullableUnsignedLong(self, _: Option<Option<u32>>) {}
|
||||||
fn PassOptionalNullableLongLong(&self, _: Option<Option<i64>>) {}
|
fn PassOptionalNullableLongLong(self, _: Option<Option<i64>>) {}
|
||||||
fn PassOptionalNullableUnsignedLongLong(&self, _: Option<Option<u64>>) {}
|
fn PassOptionalNullableUnsignedLongLong(self, _: Option<Option<u64>>) {}
|
||||||
fn PassOptionalNullableFloat(&self, _: Option<Option<f32>>) {}
|
fn PassOptionalNullableFloat(self, _: Option<Option<f32>>) {}
|
||||||
fn PassOptionalNullableDouble(&self, _: Option<Option<f64>>) {}
|
fn PassOptionalNullableDouble(self, _: Option<Option<f64>>) {}
|
||||||
fn PassOptionalNullableString(&self, _: Option<Option<DOMString>>) {}
|
fn PassOptionalNullableString(self, _: Option<Option<DOMString>>) {}
|
||||||
fn PassOptionalNullableByteString(&self, _: Option<Option<ByteString>>) {}
|
fn PassOptionalNullableByteString(self, _: Option<Option<ByteString>>) {}
|
||||||
// fn PassOptionalNullableEnum(&self, _: Option<Option<TestEnum>>) {}
|
// fn PassOptionalNullableEnum(self, _: Option<Option<TestEnum>>) {}
|
||||||
fn PassOptionalNullableInterface(&self, _: Option<Option<JSRef<Blob>>>) {}
|
fn PassOptionalNullableInterface(self, _: Option<Option<JSRef<Blob>>>) {}
|
||||||
fn PassOptionalNullableUnion(&self, _: Option<Option<HTMLElementOrLong>>) {}
|
fn PassOptionalNullableUnion(self, _: Option<Option<HTMLElementOrLong>>) {}
|
||||||
fn PassOptionalNullableUnion2(&self, _: Option<Option<EventOrString>>) {}
|
fn PassOptionalNullableUnion2(self, _: Option<Option<EventOrString>>) {}
|
||||||
|
|
||||||
fn PassOptionalBooleanWithDefault(&self, _: bool) {}
|
fn PassOptionalBooleanWithDefault(self, _: bool) {}
|
||||||
fn PassOptionalByteWithDefault(&self, _: i8) {}
|
fn PassOptionalByteWithDefault(self, _: i8) {}
|
||||||
fn PassOptionalOctetWithDefault(&self, _: u8) {}
|
fn PassOptionalOctetWithDefault(self, _: u8) {}
|
||||||
fn PassOptionalShortWithDefault(&self, _: i16) {}
|
fn PassOptionalShortWithDefault(self, _: i16) {}
|
||||||
fn PassOptionalUnsignedShortWithDefault(&self, _: u16) {}
|
fn PassOptionalUnsignedShortWithDefault(self, _: u16) {}
|
||||||
fn PassOptionalLongWithDefault(&self, _: i32) {}
|
fn PassOptionalLongWithDefault(self, _: i32) {}
|
||||||
fn PassOptionalUnsignedLongWithDefault(&self, _: u32) {}
|
fn PassOptionalUnsignedLongWithDefault(self, _: u32) {}
|
||||||
fn PassOptionalLongLongWithDefault(&self, _: i64) {}
|
fn PassOptionalLongLongWithDefault(self, _: i64) {}
|
||||||
fn PassOptionalUnsignedLongLongWithDefault(&self, _: u64) {}
|
fn PassOptionalUnsignedLongLongWithDefault(self, _: u64) {}
|
||||||
fn PassOptionalStringWithDefault(&self, _: DOMString) {}
|
fn PassOptionalStringWithDefault(self, _: DOMString) {}
|
||||||
fn PassOptionalEnumWithDefault(&self, _: TestEnum) {}
|
fn PassOptionalEnumWithDefault(self, _: TestEnum) {}
|
||||||
|
|
||||||
fn PassOptionalNullableBooleanWithDefault(&self, _: Option<bool>) {}
|
fn PassOptionalNullableBooleanWithDefault(self, _: Option<bool>) {}
|
||||||
fn PassOptionalNullableByteWithDefault(&self, _: Option<i8>) {}
|
fn PassOptionalNullableByteWithDefault(self, _: Option<i8>) {}
|
||||||
fn PassOptionalNullableOctetWithDefault(&self, _: Option<u8>) {}
|
fn PassOptionalNullableOctetWithDefault(self, _: Option<u8>) {}
|
||||||
fn PassOptionalNullableShortWithDefault(&self, _: Option<i16>) {}
|
fn PassOptionalNullableShortWithDefault(self, _: Option<i16>) {}
|
||||||
fn PassOptionalNullableUnsignedShortWithDefault(&self, _: Option<u16>) {}
|
fn PassOptionalNullableUnsignedShortWithDefault(self, _: Option<u16>) {}
|
||||||
fn PassOptionalNullableLongWithDefault(&self, _: Option<i32>) {}
|
fn PassOptionalNullableLongWithDefault(self, _: Option<i32>) {}
|
||||||
fn PassOptionalNullableUnsignedLongWithDefault(&self, _: Option<u32>) {}
|
fn PassOptionalNullableUnsignedLongWithDefault(self, _: Option<u32>) {}
|
||||||
fn PassOptionalNullableLongLongWithDefault(&self, _: Option<i64>) {}
|
fn PassOptionalNullableLongLongWithDefault(self, _: Option<i64>) {}
|
||||||
fn PassOptionalNullableUnsignedLongLongWithDefault(&self, _: Option<u64>) {}
|
fn PassOptionalNullableUnsignedLongLongWithDefault(self, _: Option<u64>) {}
|
||||||
// fn PassOptionalNullableFloatWithDefault(&self, _: Option<f32>) {}
|
// fn PassOptionalNullableFloatWithDefault(self, _: Option<f32>) {}
|
||||||
// fn PassOptionalNullableDoubleWithDefault(&self, _: Option<f64>) {}
|
// fn PassOptionalNullableDoubleWithDefault(self, _: Option<f64>) {}
|
||||||
fn PassOptionalNullableStringWithDefault(&self, _: Option<DOMString>) {}
|
fn PassOptionalNullableStringWithDefault(self, _: Option<DOMString>) {}
|
||||||
fn PassOptionalNullableByteStringWithDefault(&self, _: Option<ByteString>) {}
|
fn PassOptionalNullableByteStringWithDefault(self, _: Option<ByteString>) {}
|
||||||
// fn PassOptionalNullableEnumWithDefault(&self, _: Option<TestEnum>) {}
|
// fn PassOptionalNullableEnumWithDefault(self, _: Option<TestEnum>) {}
|
||||||
fn PassOptionalNullableInterfaceWithDefault(&self, _: Option<JSRef<Blob>>) {}
|
fn PassOptionalNullableInterfaceWithDefault(self, _: Option<JSRef<Blob>>) {}
|
||||||
fn PassOptionalNullableUnionWithDefault(&self, _: Option<HTMLElementOrLong>) {}
|
fn PassOptionalNullableUnionWithDefault(self, _: Option<HTMLElementOrLong>) {}
|
||||||
fn PassOptionalNullableUnion2WithDefault(&self, _: Option<EventOrString>) {}
|
fn PassOptionalNullableUnion2WithDefault(self, _: Option<EventOrString>) {}
|
||||||
fn PassOptionalAnyWithDefault(&self, _: *mut JSContext, _: JSVal) {}
|
fn PassOptionalAnyWithDefault(self, _: *mut JSContext, _: JSVal) {}
|
||||||
|
|
||||||
fn PassOptionalNullableBooleanWithNonNullDefault(&self, _: Option<bool>) {}
|
fn PassOptionalNullableBooleanWithNonNullDefault(self, _: Option<bool>) {}
|
||||||
fn PassOptionalNullableByteWithNonNullDefault(&self, _: Option<i8>) {}
|
fn PassOptionalNullableByteWithNonNullDefault(self, _: Option<i8>) {}
|
||||||
fn PassOptionalNullableOctetWithNonNullDefault(&self, _: Option<u8>) {}
|
fn PassOptionalNullableOctetWithNonNullDefault(self, _: Option<u8>) {}
|
||||||
fn PassOptionalNullableShortWithNonNullDefault(&self, _: Option<i16>) {}
|
fn PassOptionalNullableShortWithNonNullDefault(self, _: Option<i16>) {}
|
||||||
fn PassOptionalNullableUnsignedShortWithNonNullDefault(&self, _: Option<u16>) {}
|
fn PassOptionalNullableUnsignedShortWithNonNullDefault(self, _: Option<u16>) {}
|
||||||
fn PassOptionalNullableLongWithNonNullDefault(&self, _: Option<i32>) {}
|
fn PassOptionalNullableLongWithNonNullDefault(self, _: Option<i32>) {}
|
||||||
fn PassOptionalNullableUnsignedLongWithNonNullDefault(&self, _: Option<u32>) {}
|
fn PassOptionalNullableUnsignedLongWithNonNullDefault(self, _: Option<u32>) {}
|
||||||
fn PassOptionalNullableLongLongWithNonNullDefault(&self, _: Option<i64>) {}
|
fn PassOptionalNullableLongLongWithNonNullDefault(self, _: Option<i64>) {}
|
||||||
fn PassOptionalNullableUnsignedLongLongWithNonNullDefault(&self, _: Option<u64>) {}
|
fn PassOptionalNullableUnsignedLongLongWithNonNullDefault(self, _: Option<u64>) {}
|
||||||
// fn PassOptionalNullableFloatWithNonNullDefault(&self, _: Option<f32>) {}
|
// fn PassOptionalNullableFloatWithNonNullDefault(self, _: Option<f32>) {}
|
||||||
// fn PassOptionalNullableDoubleWithNonNullDefault(&self, _: Option<f64>) {}
|
// fn PassOptionalNullableDoubleWithNonNullDefault(self, _: Option<f64>) {}
|
||||||
fn PassOptionalNullableStringWithNonNullDefault(&self, _: Option<DOMString>) {}
|
fn PassOptionalNullableStringWithNonNullDefault(self, _: Option<DOMString>) {}
|
||||||
// fn PassOptionalNullableEnumWithNonNullDefault(&self, _: Option<TestEnum>) {}
|
// fn PassOptionalNullableEnumWithNonNullDefault(self, _: Option<TestEnum>) {}
|
||||||
|
|
||||||
fn PassVariadicBoolean(&self, _: Vec<bool>) {}
|
fn PassVariadicBoolean(self, _: Vec<bool>) {}
|
||||||
fn PassVariadicByte(&self, _: Vec<i8>) {}
|
fn PassVariadicByte(self, _: Vec<i8>) {}
|
||||||
fn PassVariadicOctet(&self, _: Vec<u8>) {}
|
fn PassVariadicOctet(self, _: Vec<u8>) {}
|
||||||
fn PassVariadicShort(&self, _: Vec<i16>) {}
|
fn PassVariadicShort(self, _: Vec<i16>) {}
|
||||||
fn PassVariadicUnsignedShort(&self, _: Vec<u16>) {}
|
fn PassVariadicUnsignedShort(self, _: Vec<u16>) {}
|
||||||
fn PassVariadicLong(&self, _: Vec<i32>) {}
|
fn PassVariadicLong(self, _: Vec<i32>) {}
|
||||||
fn PassVariadicUnsignedLong(&self, _: Vec<u32>) {}
|
fn PassVariadicUnsignedLong(self, _: Vec<u32>) {}
|
||||||
fn PassVariadicLongLong(&self, _: Vec<i64>) {}
|
fn PassVariadicLongLong(self, _: Vec<i64>) {}
|
||||||
fn PassVariadicUnsignedLongLong(&self, _: Vec<u64>) {}
|
fn PassVariadicUnsignedLongLong(self, _: Vec<u64>) {}
|
||||||
fn PassVariadicFloat(&self, _: Vec<f32>) {}
|
fn PassVariadicFloat(self, _: Vec<f32>) {}
|
||||||
fn PassVariadicDouble(&self, _: Vec<f64>) {}
|
fn PassVariadicDouble(self, _: Vec<f64>) {}
|
||||||
fn PassVariadicString(&self, _: Vec<DOMString>) {}
|
fn PassVariadicString(self, _: Vec<DOMString>) {}
|
||||||
fn PassVariadicByteString(&self, _: Vec<ByteString>) {}
|
fn PassVariadicByteString(self, _: Vec<ByteString>) {}
|
||||||
fn PassVariadicEnum(&self, _: Vec<TestEnum>) {}
|
fn PassVariadicEnum(self, _: Vec<TestEnum>) {}
|
||||||
// fn PassVariadicInterface(&self, _: Vec<JSRef<Blob>>) {}
|
// fn PassVariadicInterface(self, _: Vec<JSRef<Blob>>) {}
|
||||||
fn PassVariadicUnion(&self, _: Vec<HTMLElementOrLong>) {}
|
fn PassVariadicUnion(self, _: Vec<HTMLElementOrLong>) {}
|
||||||
fn PassVariadicUnion2(&self, _: Vec<EventOrString>) {}
|
fn PassVariadicUnion2(self, _: Vec<EventOrString>) {}
|
||||||
fn PassVariadicUnion3(&self, _: Vec<BlobOrString>) {}
|
fn PassVariadicUnion3(self, _: Vec<BlobOrString>) {}
|
||||||
fn PassVariadicAny(&self, _: *mut JSContext, _: Vec<JSVal>) {}
|
fn PassVariadicAny(self, _: *mut JSContext, _: Vec<JSVal>) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TestBinding {
|
impl TestBinding {
|
||||||
|
|
|
@ -69,15 +69,15 @@ impl TreeWalker {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> TreeWalkerMethods for JSRef<'a, TreeWalker> {
|
impl<'a> TreeWalkerMethods for JSRef<'a, TreeWalker> {
|
||||||
fn Root(&self) -> Temporary<Node> {
|
fn Root(self) -> Temporary<Node> {
|
||||||
Temporary::new(self.root_node)
|
Temporary::new(self.root_node)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn WhatToShow(&self) -> u32 {
|
fn WhatToShow(self) -> u32 {
|
||||||
self.what_to_show
|
self.what_to_show
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetFilter(&self) -> Option<NodeFilter> {
|
fn GetFilter(self) -> Option<NodeFilter> {
|
||||||
match self.filter {
|
match self.filter {
|
||||||
FilterNone => None,
|
FilterNone => None,
|
||||||
FilterJS(nf) => Some(nf),
|
FilterJS(nf) => Some(nf),
|
||||||
|
@ -85,41 +85,41 @@ impl<'a> TreeWalkerMethods for JSRef<'a, TreeWalker> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn CurrentNode(&self) -> Temporary<Node> {
|
fn CurrentNode(self) -> Temporary<Node> {
|
||||||
Temporary::new(self.current_node.get())
|
Temporary::new(self.current_node.get())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetCurrentNode(&self, node: JSRef<Node>) -> ErrorResult {
|
fn SetCurrentNode(self, node: JSRef<Node>) -> ErrorResult {
|
||||||
// XXX Future: check_same_origin(root_node, node) (throws)
|
// XXX Future: check_same_origin(root_node, node) (throws)
|
||||||
self.current_node.set(JS::from_rooted(node));
|
self.current_node.set(JS::from_rooted(node));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ParentNode(&self) -> Fallible<Option<Temporary<Node>>> {
|
fn ParentNode(self) -> Fallible<Option<Temporary<Node>>> {
|
||||||
self.parent_node()
|
self.parent_node()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn FirstChild(&self) -> Fallible<Option<Temporary<Node>>> {
|
fn FirstChild(self) -> Fallible<Option<Temporary<Node>>> {
|
||||||
self.first_child()
|
self.first_child()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn LastChild(&self) -> Fallible<Option<Temporary<Node>>> {
|
fn LastChild(self) -> Fallible<Option<Temporary<Node>>> {
|
||||||
self.last_child()
|
self.last_child()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn PreviousSibling(&self) -> Fallible<Option<Temporary<Node>>> {
|
fn PreviousSibling(self) -> Fallible<Option<Temporary<Node>>> {
|
||||||
self.prev_sibling()
|
self.prev_sibling()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn NextSibling(&self) -> Fallible<Option<Temporary<Node>>> {
|
fn NextSibling(self) -> Fallible<Option<Temporary<Node>>> {
|
||||||
self.next_sibling()
|
self.next_sibling()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn PreviousNode(&self) -> Fallible<Option<Temporary<Node>>> {
|
fn PreviousNode(self) -> Fallible<Option<Temporary<Node>>> {
|
||||||
self.prev_node()
|
self.prev_node()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn NextNode(&self) -> Fallible<Option<Temporary<Node>>> {
|
fn NextNode(self) -> Fallible<Option<Temporary<Node>>> {
|
||||||
self.next_node()
|
self.next_node()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,21 +68,21 @@ impl UIEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> UIEventMethods for JSRef<'a, UIEvent> {
|
impl<'a> UIEventMethods for JSRef<'a, UIEvent> {
|
||||||
fn GetView(&self) -> Option<Temporary<Window>> {
|
fn GetView(self) -> Option<Temporary<Window>> {
|
||||||
self.view.get().map(|view| Temporary::new(view))
|
self.view.get().map(|view| Temporary::new(view))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Detail(&self) -> i32 {
|
fn Detail(self) -> i32 {
|
||||||
self.detail.deref().get()
|
self.detail.deref().get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn InitUIEvent(&self,
|
fn InitUIEvent(self,
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
can_bubble: bool,
|
can_bubble: bool,
|
||||||
cancelable: bool,
|
cancelable: bool,
|
||||||
view: Option<JSRef<Window>>,
|
view: Option<JSRef<Window>>,
|
||||||
detail: i32) {
|
detail: i32) {
|
||||||
let event: JSRef<Event> = EventCast::from_ref(*self);
|
let event: JSRef<Event> = EventCast::from_ref(self);
|
||||||
event.InitEvent(type_, can_bubble, cancelable);
|
event.InitEvent(type_, can_bubble, cancelable);
|
||||||
self.view.assign(view);
|
self.view.assign(view);
|
||||||
self.detail.deref().set(detail);
|
self.detail.deref().set(detail);
|
||||||
|
|
|
@ -61,26 +61,26 @@ impl URLSearchParams {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> URLSearchParamsMethods for JSRef<'a, URLSearchParams> {
|
impl<'a> URLSearchParamsMethods for JSRef<'a, URLSearchParams> {
|
||||||
fn Append(&self, name: DOMString, value: DOMString) {
|
fn Append(self, name: DOMString, value: DOMString) {
|
||||||
self.data.deref().borrow_mut().insert_or_update_with(name, vec!(value.clone()),
|
self.data.deref().borrow_mut().insert_or_update_with(name, vec!(value.clone()),
|
||||||
|_k, v| v.push(value.clone()));
|
|_k, v| v.push(value.clone()));
|
||||||
self.update_steps();
|
self.update_steps();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Delete(&self, name: DOMString) {
|
fn Delete(self, name: DOMString) {
|
||||||
self.data.deref().borrow_mut().remove(&name);
|
self.data.deref().borrow_mut().remove(&name);
|
||||||
self.update_steps();
|
self.update_steps();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Get(&self, name: DOMString) -> Option<DOMString> {
|
fn Get(self, name: DOMString) -> Option<DOMString> {
|
||||||
self.data.deref().borrow().find_equiv(&name).map(|v| v[0].clone())
|
self.data.deref().borrow().find_equiv(&name).map(|v| v[0].clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Has(&self, name: DOMString) -> bool {
|
fn Has(self, name: DOMString) -> bool {
|
||||||
self.data.deref().borrow().contains_key_equiv(&name)
|
self.data.deref().borrow().contains_key_equiv(&name)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Set(&self, name: DOMString, value: DOMString) {
|
fn Set(self, name: DOMString, value: DOMString) {
|
||||||
self.data.deref().borrow_mut().insert(name, vec!(value));
|
self.data.deref().borrow_mut().insert(name, vec!(value));
|
||||||
self.update_steps();
|
self.update_steps();
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,51 +202,51 @@ pub fn base64_atob(atob: DOMString) -> Fallible<DOMString> {
|
||||||
|
|
||||||
|
|
||||||
impl<'a> WindowMethods for JSRef<'a, Window> {
|
impl<'a> WindowMethods for JSRef<'a, Window> {
|
||||||
fn Alert(&self, s: DOMString) {
|
fn Alert(self, s: DOMString) {
|
||||||
// Right now, just print to the console
|
// Right now, just print to the console
|
||||||
println!("ALERT: {:s}", s);
|
println!("ALERT: {:s}", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Close(&self) {
|
fn Close(self) {
|
||||||
let ScriptChan(ref chan) = self.script_chan;
|
let ScriptChan(ref chan) = self.script_chan;
|
||||||
chan.send(ExitWindowMsg(self.page.id.clone()));
|
chan.send(ExitWindowMsg(self.page.id.clone()));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Document(&self) -> Temporary<Document> {
|
fn Document(self) -> Temporary<Document> {
|
||||||
let frame = self.page().frame();
|
let frame = self.page().frame();
|
||||||
Temporary::new(frame.get_ref().document.clone())
|
Temporary::new(frame.get_ref().document.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Location(&self) -> Temporary<Location> {
|
fn Location(self) -> Temporary<Location> {
|
||||||
if self.location.get().is_none() {
|
if self.location.get().is_none() {
|
||||||
let page = self.deref().page.clone();
|
let page = self.deref().page.clone();
|
||||||
let location = Location::new(*self, page);
|
let location = Location::new(self, page);
|
||||||
self.location.assign(Some(location));
|
self.location.assign(Some(location));
|
||||||
}
|
}
|
||||||
Temporary::new(self.location.get().get_ref().clone())
|
Temporary::new(self.location.get().get_ref().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Console(&self) -> Temporary<Console> {
|
fn Console(self) -> Temporary<Console> {
|
||||||
if self.console.get().is_none() {
|
if self.console.get().is_none() {
|
||||||
let console = Console::new(&global::Window(*self));
|
let console = Console::new(&global::Window(self));
|
||||||
self.console.assign(Some(console));
|
self.console.assign(Some(console));
|
||||||
}
|
}
|
||||||
Temporary::new(self.console.get().get_ref().clone())
|
Temporary::new(self.console.get().get_ref().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Navigator(&self) -> Temporary<Navigator> {
|
fn Navigator(self) -> Temporary<Navigator> {
|
||||||
if self.navigator.get().is_none() {
|
if self.navigator.get().is_none() {
|
||||||
let navigator = Navigator::new(*self);
|
let navigator = Navigator::new(self);
|
||||||
self.navigator.assign(Some(navigator));
|
self.navigator.assign(Some(navigator));
|
||||||
}
|
}
|
||||||
Temporary::new(self.navigator.get().get_ref().clone())
|
Temporary::new(self.navigator.get().get_ref().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetTimeout(&self, _cx: *mut JSContext, callback: JSVal, timeout: i32) -> i32 {
|
fn SetTimeout(self, _cx: *mut JSContext, callback: JSVal, timeout: i32) -> i32 {
|
||||||
self.set_timeout_or_interval(callback, timeout, false)
|
self.set_timeout_or_interval(callback, timeout, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ClearTimeout(&self, handle: i32) {
|
fn ClearTimeout(self, handle: i32) {
|
||||||
let mut timers = self.active_timers.deref().borrow_mut();
|
let mut timers = self.active_timers.deref().borrow_mut();
|
||||||
let mut timer_handle = timers.pop(&TimerId(handle));
|
let mut timer_handle = timers.pop(&TimerId(handle));
|
||||||
match timer_handle {
|
match timer_handle {
|
||||||
|
@ -256,103 +256,103 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
|
||||||
timers.remove(&TimerId(handle));
|
timers.remove(&TimerId(handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetInterval(&self, _cx: *mut JSContext, callback: JSVal, timeout: i32) -> i32 {
|
fn SetInterval(self, _cx: *mut JSContext, callback: JSVal, timeout: i32) -> i32 {
|
||||||
self.set_timeout_or_interval(callback, timeout, true)
|
self.set_timeout_or_interval(callback, timeout, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ClearInterval(&self, handle: i32) {
|
fn ClearInterval(self, handle: i32) {
|
||||||
self.ClearTimeout(handle);
|
self.ClearTimeout(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Window(&self) -> Temporary<Window> {
|
fn Window(self) -> Temporary<Window> {
|
||||||
Temporary::from_rooted(*self)
|
Temporary::from_rooted(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Self(&self) -> Temporary<Window> {
|
fn Self(self) -> Temporary<Window> {
|
||||||
self.Window()
|
self.Window()
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://www.whatwg.org/html/#dom-frames
|
// http://www.whatwg.org/html/#dom-frames
|
||||||
fn Frames(&self) -> Temporary<Window> {
|
fn Frames(self) -> Temporary<Window> {
|
||||||
self.Window()
|
self.Window()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Parent(&self) -> Temporary<Window> {
|
fn Parent(self) -> Temporary<Window> {
|
||||||
//TODO - Once we support iframes correctly this needs to return the parent frame
|
//TODO - Once we support iframes correctly this needs to return the parent frame
|
||||||
self.Window()
|
self.Window()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Performance(&self) -> Temporary<Performance> {
|
fn Performance(self) -> Temporary<Performance> {
|
||||||
if self.performance.get().is_none() {
|
if self.performance.get().is_none() {
|
||||||
let performance = Performance::new(*self);
|
let performance = Performance::new(self);
|
||||||
self.performance.assign(Some(performance));
|
self.performance.assign(Some(performance));
|
||||||
}
|
}
|
||||||
Temporary::new(self.performance.get().get_ref().clone())
|
Temporary::new(self.performance.get().get_ref().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetOnclick(&self) -> Option<EventHandlerNonNull> {
|
fn GetOnclick(self) -> Option<EventHandlerNonNull> {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.get_event_handler_common("click")
|
eventtarget.get_event_handler_common("click")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetOnclick(&self, listener: Option<EventHandlerNonNull>) {
|
fn SetOnclick(self, listener: Option<EventHandlerNonNull>) {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.set_event_handler_common("click", listener)
|
eventtarget.set_event_handler_common("click", listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetOnload(&self) -> Option<EventHandlerNonNull> {
|
fn GetOnload(self) -> Option<EventHandlerNonNull> {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.get_event_handler_common("load")
|
eventtarget.get_event_handler_common("load")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetOnload(&self, listener: Option<EventHandlerNonNull>) {
|
fn SetOnload(self, listener: Option<EventHandlerNonNull>) {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.set_event_handler_common("load", listener)
|
eventtarget.set_event_handler_common("load", listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetOnunload(&self) -> Option<EventHandlerNonNull> {
|
fn GetOnunload(self) -> Option<EventHandlerNonNull> {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.get_event_handler_common("unload")
|
eventtarget.get_event_handler_common("unload")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetOnunload(&self, listener: Option<EventHandlerNonNull>) {
|
fn SetOnunload(self, listener: Option<EventHandlerNonNull>) {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.set_event_handler_common("unload", listener)
|
eventtarget.set_event_handler_common("unload", listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetOnerror(&self) -> Option<OnErrorEventHandlerNonNull> {
|
fn GetOnerror(self) -> Option<OnErrorEventHandlerNonNull> {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.get_event_handler_common("error")
|
eventtarget.get_event_handler_common("error")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetOnerror(&self, listener: Option<OnErrorEventHandlerNonNull>) {
|
fn SetOnerror(self, listener: Option<OnErrorEventHandlerNonNull>) {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.set_event_handler_common("error", listener)
|
eventtarget.set_event_handler_common("error", listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Screen(&self) -> Temporary<Screen> {
|
fn Screen(self) -> Temporary<Screen> {
|
||||||
if self.screen.get().is_none() {
|
if self.screen.get().is_none() {
|
||||||
let screen = Screen::new(*self);
|
let screen = Screen::new(self);
|
||||||
self.screen.assign(Some(screen));
|
self.screen.assign(Some(screen));
|
||||||
}
|
}
|
||||||
Temporary::new(self.screen.get().get_ref().clone())
|
Temporary::new(self.screen.get().get_ref().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Debug(&self, message: DOMString) {
|
fn Debug(self, message: DOMString) {
|
||||||
debug!("{:s}", message);
|
debug!("{:s}", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Gc(&self) {
|
fn Gc(self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
JS_GC(JS_GetRuntime(self.get_cx()));
|
JS_GC(JS_GetRuntime(self.get_cx()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Btoa(&self, btoa: DOMString) -> Fallible<DOMString> {
|
fn Btoa(self, btoa: DOMString) -> Fallible<DOMString> {
|
||||||
base64_btoa(btoa)
|
base64_btoa(btoa)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Atob(&self, atob: DOMString) -> Fallible<DOMString> {
|
fn Atob(self, atob: DOMString) -> Fallible<DOMString> {
|
||||||
base64_atob(atob)
|
base64_atob(atob)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ impl Worker {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> WorkerMethods for JSRef<'a, Worker> {
|
impl<'a> WorkerMethods for JSRef<'a, Worker> {
|
||||||
fn PostMessage(&self, cx: *mut JSContext, message: JSVal) {
|
fn PostMessage(self, cx: *mut JSContext, message: JSVal) {
|
||||||
let mut data = ptr::mut_null();
|
let mut data = ptr::mut_null();
|
||||||
let mut nbytes = 0;
|
let mut nbytes = 0;
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -143,13 +143,13 @@ impl<'a> WorkerMethods for JSRef<'a, Worker> {
|
||||||
sender.send(DOMMessage(data, nbytes));
|
sender.send(DOMMessage(data, nbytes));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetOnmessage(&self) -> Option<EventHandlerNonNull> {
|
fn GetOnmessage(self) -> Option<EventHandlerNonNull> {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.get_event_handler_common("message")
|
eventtarget.get_event_handler_common("message")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetOnmessage(&self, listener: Option<EventHandlerNonNull>) {
|
fn SetOnmessage(self, listener: Option<EventHandlerNonNull>) {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.set_event_handler_common("message", listener)
|
eventtarget.set_event_handler_common("message", listener)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,19 +79,19 @@ impl WorkerGlobalScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> {
|
impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> {
|
||||||
fn Self(&self) -> Temporary<WorkerGlobalScope> {
|
fn Self(self) -> Temporary<WorkerGlobalScope> {
|
||||||
Temporary::from_rooted(*self)
|
Temporary::from_rooted(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Location(&self) -> Temporary<WorkerLocation> {
|
fn Location(self) -> Temporary<WorkerLocation> {
|
||||||
if self.location.get().is_none() {
|
if self.location.get().is_none() {
|
||||||
let location = WorkerLocation::new(*self, self.worker_url.deref().clone());
|
let location = WorkerLocation::new(self, self.worker_url.deref().clone());
|
||||||
self.location.assign(Some(location));
|
self.location.assign(Some(location));
|
||||||
}
|
}
|
||||||
Temporary::new(self.location.get().get_ref().clone())
|
Temporary::new(self.location.get().get_ref().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ImportScripts(&self, url_strings: Vec<DOMString>) -> ErrorResult {
|
fn ImportScripts(self, url_strings: Vec<DOMString>) -> ErrorResult {
|
||||||
let mut urls = Vec::with_capacity(url_strings.len());
|
let mut urls = Vec::with_capacity(url_strings.len());
|
||||||
for url in url_strings.move_iter() {
|
for url in url_strings.move_iter() {
|
||||||
let url = UrlParser::new().base_url(&*self.worker_url)
|
let url = UrlParser::new().base_url(&*self.worker_url)
|
||||||
|
@ -123,27 +123,27 @@ impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Navigator(&self) -> Temporary<WorkerNavigator> {
|
fn Navigator(self) -> Temporary<WorkerNavigator> {
|
||||||
if self.navigator.get().is_none() {
|
if self.navigator.get().is_none() {
|
||||||
let navigator = WorkerNavigator::new(*self);
|
let navigator = WorkerNavigator::new(self);
|
||||||
self.navigator.assign(Some(navigator));
|
self.navigator.assign(Some(navigator));
|
||||||
}
|
}
|
||||||
Temporary::new(self.navigator.get().get_ref().clone())
|
Temporary::new(self.navigator.get().get_ref().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Console(&self) -> Temporary<Console> {
|
fn Console(self) -> Temporary<Console> {
|
||||||
if self.console.get().is_none() {
|
if self.console.get().is_none() {
|
||||||
let console = Console::new(&global::Worker(*self));
|
let console = Console::new(&global::Worker(self));
|
||||||
self.console.assign(Some(console));
|
self.console.assign(Some(console));
|
||||||
}
|
}
|
||||||
Temporary::new(self.console.get().get_ref().clone())
|
Temporary::new(self.console.get().get_ref().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Btoa(&self, btoa: DOMString) -> Fallible<DOMString> {
|
fn Btoa(self, btoa: DOMString) -> Fallible<DOMString> {
|
||||||
base64_btoa(btoa)
|
base64_btoa(btoa)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Atob(&self, atob: DOMString) -> Fallible<DOMString> {
|
fn Atob(self, atob: DOMString) -> Fallible<DOMString> {
|
||||||
base64_atob(atob)
|
base64_atob(atob)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,15 +38,15 @@ impl WorkerLocation {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> WorkerLocationMethods for JSRef<'a, WorkerLocation> {
|
impl<'a> WorkerLocationMethods for JSRef<'a, WorkerLocation> {
|
||||||
fn Href(&self) -> DOMString {
|
fn Href(self) -> DOMString {
|
||||||
UrlHelper::Href(self.url.deref())
|
UrlHelper::Href(self.url.deref())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Search(&self) -> DOMString {
|
fn Search(self) -> DOMString {
|
||||||
UrlHelper::Search(self.url.deref())
|
UrlHelper::Search(self.url.deref())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Hash(&self) -> DOMString {
|
fn Hash(self) -> DOMString {
|
||||||
UrlHelper::Hash(self.url.deref())
|
UrlHelper::Hash(self.url.deref())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,23 +32,23 @@ impl WorkerNavigator {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> WorkerNavigatorMethods for JSRef<'a, WorkerNavigator> {
|
impl<'a> WorkerNavigatorMethods for JSRef<'a, WorkerNavigator> {
|
||||||
fn Product(&self) -> DOMString {
|
fn Product(self) -> DOMString {
|
||||||
NavigatorInfo::Product()
|
NavigatorInfo::Product()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn TaintEnabled(&self) -> bool {
|
fn TaintEnabled(self) -> bool {
|
||||||
NavigatorInfo::TaintEnabled()
|
NavigatorInfo::TaintEnabled()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn AppName(&self) -> DOMString {
|
fn AppName(self) -> DOMString {
|
||||||
NavigatorInfo::AppName()
|
NavigatorInfo::AppName()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn AppCodeName(&self) -> DOMString {
|
fn AppCodeName(self) -> DOMString {
|
||||||
NavigatorInfo::AppCodeName()
|
NavigatorInfo::AppCodeName()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Platform(&self) -> DOMString {
|
fn Platform(self) -> DOMString {
|
||||||
NavigatorInfo::Platform()
|
NavigatorInfo::Platform()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,8 +91,8 @@ pub enum XHRProgress {
|
||||||
TimeoutMsg
|
TimeoutMsg
|
||||||
}
|
}
|
||||||
|
|
||||||
enum SyncOrAsync<'a, 'b> {
|
enum SyncOrAsync<'a> {
|
||||||
Sync(&'b JSRef<'a, XMLHttpRequest>),
|
Sync(JSRef<'a, XMLHttpRequest>),
|
||||||
Async(TrustedXHRAddress, ScriptChan)
|
Async(TrustedXHRAddress, ScriptChan)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ impl XMLHttpRequest {
|
||||||
cors_request: Result<Option<CORSRequest>,()>) -> ErrorResult {
|
cors_request: Result<Option<CORSRequest>,()>) -> ErrorResult {
|
||||||
fn notify_partial_progress(fetch_type: &SyncOrAsync, msg: XHRProgress) {
|
fn notify_partial_progress(fetch_type: &SyncOrAsync, msg: XHRProgress) {
|
||||||
match *fetch_type {
|
match *fetch_type {
|
||||||
Sync(ref xhr) => {
|
Sync(xhr) => {
|
||||||
xhr.process_partial_response(msg);
|
xhr.process_partial_response(msg);
|
||||||
},
|
},
|
||||||
Async(addr, ref script_chan) => {
|
Async(addr, ref script_chan) => {
|
||||||
|
@ -259,21 +259,21 @@ impl XMLHttpRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
||||||
fn GetOnreadystatechange(&self) -> Option<EventHandlerNonNull> {
|
fn GetOnreadystatechange(self) -> Option<EventHandlerNonNull> {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.get_event_handler_common("readystatechange")
|
eventtarget.get_event_handler_common("readystatechange")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetOnreadystatechange(&self, listener: Option<EventHandlerNonNull>) {
|
fn SetOnreadystatechange(self, listener: Option<EventHandlerNonNull>) {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.set_event_handler_common("readystatechange", listener)
|
eventtarget.set_event_handler_common("readystatechange", listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ReadyState(&self) -> u16 {
|
fn ReadyState(self) -> u16 {
|
||||||
self.ready_state.deref().get() as u16
|
self.ready_state.deref().get() as u16
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Open(&self, method: ByteString, url: DOMString) -> ErrorResult {
|
fn Open(self, method: ByteString, url: DOMString) -> ErrorResult {
|
||||||
// Clean up from previous requests, if any:
|
// Clean up from previous requests, if any:
|
||||||
self.cancel_timeout();
|
self.cancel_timeout();
|
||||||
let uppercase_method = method.as_str().map(|s| {
|
let uppercase_method = method.as_str().map(|s| {
|
||||||
|
@ -334,12 +334,12 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
||||||
_ => Err(Syntax), // Step 3
|
_ => Err(Syntax), // Step 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn Open_(&self, method: ByteString, url: DOMString, async: bool,
|
fn Open_(self, method: ByteString, url: DOMString, async: bool,
|
||||||
_username: Option<DOMString>, _password: Option<DOMString>) -> ErrorResult {
|
_username: Option<DOMString>, _password: Option<DOMString>) -> ErrorResult {
|
||||||
self.sync.deref().set(!async);
|
self.sync.deref().set(!async);
|
||||||
self.Open(method, url)
|
self.Open(method, url)
|
||||||
}
|
}
|
||||||
fn SetRequestHeader(&self, name: ByteString, mut value: ByteString) -> ErrorResult {
|
fn SetRequestHeader(self, name: ByteString, mut value: ByteString) -> ErrorResult {
|
||||||
if self.ready_state.deref().get() != Opened || self.send_flag.deref().get() {
|
if self.ready_state.deref().get() != Opened || self.send_flag.deref().get() {
|
||||||
return Err(InvalidState); // Step 1, 2
|
return Err(InvalidState); // Step 1, 2
|
||||||
}
|
}
|
||||||
|
@ -403,10 +403,10 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
||||||
None => Err(Syntax)
|
None => Err(Syntax)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn Timeout(&self) -> u32 {
|
fn Timeout(self) -> u32 {
|
||||||
self.timeout.deref().get()
|
self.timeout.deref().get()
|
||||||
}
|
}
|
||||||
fn SetTimeout(&self, timeout: u32) -> ErrorResult {
|
fn SetTimeout(self, timeout: u32) -> ErrorResult {
|
||||||
if self.sync.deref().get() {
|
if self.sync.deref().get() {
|
||||||
// FIXME: Not valid for a worker environment
|
// FIXME: Not valid for a worker environment
|
||||||
Err(InvalidState)
|
Err(InvalidState)
|
||||||
|
@ -428,16 +428,16 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn WithCredentials(&self) -> bool {
|
fn WithCredentials(self) -> bool {
|
||||||
self.with_credentials.deref().get()
|
self.with_credentials.deref().get()
|
||||||
}
|
}
|
||||||
fn SetWithCredentials(&self, with_credentials: bool) {
|
fn SetWithCredentials(self, with_credentials: bool) {
|
||||||
self.with_credentials.deref().set(with_credentials);
|
self.with_credentials.deref().set(with_credentials);
|
||||||
}
|
}
|
||||||
fn Upload(&self) -> Temporary<XMLHttpRequestUpload> {
|
fn Upload(self) -> Temporary<XMLHttpRequestUpload> {
|
||||||
Temporary::new(self.upload)
|
Temporary::new(self.upload)
|
||||||
}
|
}
|
||||||
fn Send(&self, data: Option<SendParam>) -> ErrorResult {
|
fn Send(self, data: Option<SendParam>) -> ErrorResult {
|
||||||
if self.ready_state.deref().get() != Opened || self.send_flag.deref().get() {
|
if self.ready_state.deref().get() != Opened || self.send_flag.deref().get() {
|
||||||
return Err(InvalidState); // Step 1, 2
|
return Err(InvalidState); // Step 1, 2
|
||||||
}
|
}
|
||||||
|
@ -566,7 +566,7 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
fn Abort(&self) {
|
fn Abort(self) {
|
||||||
self.terminate_sender.deref().borrow().as_ref().map(|s| s.send_opt(Abort));
|
self.terminate_sender.deref().borrow().as_ref().map(|s| s.send_opt(Abort));
|
||||||
match self.ready_state.deref().get() {
|
match self.ready_state.deref().get() {
|
||||||
Opened if self.send_flag.deref().get() => self.process_partial_response(ErroredMsg(Some(Abort))),
|
Opened if self.send_flag.deref().get() => self.process_partial_response(ErroredMsg(Some(Abort))),
|
||||||
|
@ -575,16 +575,16 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
||||||
};
|
};
|
||||||
self.ready_state.deref().set(Unsent);
|
self.ready_state.deref().set(Unsent);
|
||||||
}
|
}
|
||||||
fn ResponseURL(&self) -> DOMString {
|
fn ResponseURL(self) -> DOMString {
|
||||||
self.response_url.clone()
|
self.response_url.clone()
|
||||||
}
|
}
|
||||||
fn Status(&self) -> u16 {
|
fn Status(self) -> u16 {
|
||||||
self.status.deref().get()
|
self.status.deref().get()
|
||||||
}
|
}
|
||||||
fn StatusText(&self) -> ByteString {
|
fn StatusText(self) -> ByteString {
|
||||||
self.status_text.deref().borrow().clone()
|
self.status_text.deref().borrow().clone()
|
||||||
}
|
}
|
||||||
fn GetResponseHeader(&self, name: ByteString) -> Option<ByteString> {
|
fn GetResponseHeader(self, name: ByteString) -> Option<ByteString> {
|
||||||
self.filter_response_headers().iter().find(|h| {
|
self.filter_response_headers().iter().find(|h| {
|
||||||
name.eq_ignore_case(&FromStr::from_str(h.header_name().as_slice()).unwrap())
|
name.eq_ignore_case(&FromStr::from_str(h.header_name().as_slice()).unwrap())
|
||||||
}).map(|h| {
|
}).map(|h| {
|
||||||
|
@ -592,7 +592,7 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
||||||
ByteString::new(h.header_value().as_slice().chars().map(|c| { assert!(c <= '\u00FF'); c as u8 }).collect())
|
ByteString::new(h.header_value().as_slice().chars().map(|c| { assert!(c <= '\u00FF'); c as u8 }).collect())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
fn GetAllResponseHeaders(&self) -> ByteString {
|
fn GetAllResponseHeaders(self) -> ByteString {
|
||||||
let mut writer = MemWriter::new();
|
let mut writer = MemWriter::new();
|
||||||
self.filter_response_headers().write_all(&mut writer).ok().expect("Writing response headers failed");
|
self.filter_response_headers().write_all(&mut writer).ok().expect("Writing response headers failed");
|
||||||
let mut vec = writer.unwrap();
|
let mut vec = writer.unwrap();
|
||||||
|
@ -603,10 +603,10 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
||||||
|
|
||||||
ByteString::new(vec)
|
ByteString::new(vec)
|
||||||
}
|
}
|
||||||
fn ResponseType(&self) -> XMLHttpRequestResponseType {
|
fn ResponseType(self) -> XMLHttpRequestResponseType {
|
||||||
self.response_type.deref().get()
|
self.response_type.deref().get()
|
||||||
}
|
}
|
||||||
fn SetResponseType(&self, response_type: XMLHttpRequestResponseType) -> ErrorResult {
|
fn SetResponseType(self, response_type: XMLHttpRequestResponseType) -> ErrorResult {
|
||||||
match self.global {
|
match self.global {
|
||||||
WorkerField(_) if response_type == Document => return Ok(()),
|
WorkerField(_) if response_type == Document => return Ok(()),
|
||||||
_ => {}
|
_ => {}
|
||||||
|
@ -620,7 +620,7 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn Response(&self, cx: *mut JSContext) -> JSVal {
|
fn Response(self, cx: *mut JSContext) -> JSVal {
|
||||||
match self.response_type.deref().get() {
|
match self.response_type.deref().get() {
|
||||||
_empty | Text => {
|
_empty | Text => {
|
||||||
let ready_state = self.ready_state.deref().get();
|
let ready_state = self.ready_state.deref().get();
|
||||||
|
@ -649,7 +649,7 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn GetResponseText(&self) -> Fallible<DOMString> {
|
fn GetResponseText(self) -> Fallible<DOMString> {
|
||||||
match self.response_type.deref().get() {
|
match self.response_type.deref().get() {
|
||||||
_empty | Text => {
|
_empty | Text => {
|
||||||
match self.ready_state.deref().get() {
|
match self.ready_state.deref().get() {
|
||||||
|
@ -660,7 +660,7 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
||||||
_ => Err(InvalidState)
|
_ => Err(InvalidState)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn GetResponseXML(&self) -> Option<Temporary<Document>> {
|
fn GetResponseXML(self) -> Option<Temporary<Document>> {
|
||||||
self.response_xml.get().map(|response| Temporary::new(response))
|
self.response_xml.get().map(|response| Temporary::new(response))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,73 +41,73 @@ impl Reflectable for XMLHttpRequestEventTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> XMLHttpRequestEventTargetMethods for JSRef<'a, XMLHttpRequestEventTarget> {
|
impl<'a> XMLHttpRequestEventTargetMethods for JSRef<'a, XMLHttpRequestEventTarget> {
|
||||||
fn GetOnloadstart(&self) -> Option<EventHandlerNonNull> {
|
fn GetOnloadstart(self) -> Option<EventHandlerNonNull> {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.get_event_handler_common("loadstart")
|
eventtarget.get_event_handler_common("loadstart")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetOnloadstart(&self, listener: Option<EventHandlerNonNull>) {
|
fn SetOnloadstart(self, listener: Option<EventHandlerNonNull>) {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.set_event_handler_common("loadstart", listener)
|
eventtarget.set_event_handler_common("loadstart", listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetOnprogress(&self) -> Option<EventHandlerNonNull> {
|
fn GetOnprogress(self) -> Option<EventHandlerNonNull> {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.get_event_handler_common("progress")
|
eventtarget.get_event_handler_common("progress")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetOnprogress(&self, listener: Option<EventHandlerNonNull>) {
|
fn SetOnprogress(self, listener: Option<EventHandlerNonNull>) {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.set_event_handler_common("progress", listener)
|
eventtarget.set_event_handler_common("progress", listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetOnabort(&self) -> Option<EventHandlerNonNull> {
|
fn GetOnabort(self) -> Option<EventHandlerNonNull> {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.get_event_handler_common("abort")
|
eventtarget.get_event_handler_common("abort")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetOnabort(&self, listener: Option<EventHandlerNonNull>) {
|
fn SetOnabort(self, listener: Option<EventHandlerNonNull>) {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.set_event_handler_common("abort", listener)
|
eventtarget.set_event_handler_common("abort", listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetOnerror(&self) -> Option<EventHandlerNonNull> {
|
fn GetOnerror(self) -> Option<EventHandlerNonNull> {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.get_event_handler_common("error")
|
eventtarget.get_event_handler_common("error")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetOnerror(&self, listener: Option<EventHandlerNonNull>) {
|
fn SetOnerror(self, listener: Option<EventHandlerNonNull>) {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.set_event_handler_common("error", listener)
|
eventtarget.set_event_handler_common("error", listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetOnload(&self) -> Option<EventHandlerNonNull> {
|
fn GetOnload(self) -> Option<EventHandlerNonNull> {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.get_event_handler_common("load")
|
eventtarget.get_event_handler_common("load")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetOnload(&self, listener: Option<EventHandlerNonNull>) {
|
fn SetOnload(self, listener: Option<EventHandlerNonNull>) {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.set_event_handler_common("load", listener)
|
eventtarget.set_event_handler_common("load", listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetOntimeout(&self) -> Option<EventHandlerNonNull> {
|
fn GetOntimeout(self) -> Option<EventHandlerNonNull> {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.get_event_handler_common("timeout")
|
eventtarget.get_event_handler_common("timeout")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetOntimeout(&self, listener: Option<EventHandlerNonNull>) {
|
fn SetOntimeout(self, listener: Option<EventHandlerNonNull>) {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.set_event_handler_common("timeout", listener)
|
eventtarget.set_event_handler_common("timeout", listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GetOnloadend(&self) -> Option<EventHandlerNonNull> {
|
fn GetOnloadend(self) -> Option<EventHandlerNonNull> {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.get_event_handler_common("loadend")
|
eventtarget.get_event_handler_common("loadend")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetOnloadend(&self, listener: Option<EventHandlerNonNull>) {
|
fn SetOnloadend(self, listener: Option<EventHandlerNonNull>) {
|
||||||
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.set_event_handler_common("loadend", listener)
|
eventtarget.set_event_handler_common("loadend", listener)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue