mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
auto merge of #1085 : Ms2ger/servo/wrap_shared, r=jdm
This commit is contained in:
commit
19c1b023e0
9 changed files with 14 additions and 153 deletions
|
@ -3,12 +3,10 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use dom::bindings::codegen::DOMParserBinding;
|
use dom::bindings::codegen::DOMParserBinding;
|
||||||
use dom::bindings::utils::{Reflectable, Reflector};
|
use dom::bindings::utils::{BindingObject, Reflectable, Reflector};
|
||||||
use dom::bindings::utils::{BindingObject, DerivedWrapper};
|
|
||||||
use dom::domparser::DOMParser;
|
use dom::domparser::DOMParser;
|
||||||
|
|
||||||
use js::jsapi::{JSContext, JSObject, JSVal};
|
use js::jsapi::{JSContext, JSObject};
|
||||||
use js::glue::{RUST_OBJECT_TO_JSVAL};
|
|
||||||
|
|
||||||
impl Reflectable for DOMParser {
|
impl Reflectable for DOMParser {
|
||||||
fn reflector<'a>(&'a self) -> &'a Reflector {
|
fn reflector<'a>(&'a self) -> &'a Reflector {
|
||||||
|
@ -29,20 +27,3 @@ impl BindingObject for DOMParser {
|
||||||
Some(self.owner as @mut Reflectable)
|
Some(self.owner as @mut Reflectable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DerivedWrapper for DOMParser {
|
|
||||||
fn wrap(&mut self, _cx: *JSContext, _scope: *JSObject, _vp: *mut JSVal) -> i32 {
|
|
||||||
fail!(~"nyi")
|
|
||||||
}
|
|
||||||
|
|
||||||
#[fixed_stack_segment]
|
|
||||||
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32 {
|
|
||||||
let obj = self.wrap_object_shared(cx, scope);
|
|
||||||
if obj.is_null() {
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
unsafe { *vp = RUST_OBJECT_TO_JSVAL(obj) };
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -738,7 +738,6 @@ pub fn InitIds(cx: *JSContext, specs: &[JSPropertySpec], ids: &mut [jsid]) -> bo
|
||||||
|
|
||||||
pub trait DerivedWrapper {
|
pub trait DerivedWrapper {
|
||||||
fn wrap(&mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32;
|
fn wrap(&mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32;
|
||||||
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DerivedWrapper for AbstractNode<ScriptView> {
|
impl DerivedWrapper for AbstractNode<ScriptView> {
|
||||||
|
@ -752,10 +751,6 @@ impl DerivedWrapper for AbstractNode<ScriptView> {
|
||||||
unsafe { *vp = RUST_OBJECT_TO_JSVAL(node::create(cx, self)) };
|
unsafe { *vp = RUST_OBJECT_TO_JSVAL(node::create(cx, self)) };
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wrap_shared(@mut self, _cx: *JSContext, _scope: *JSObject, _vp: *mut JSVal) -> i32 {
|
|
||||||
fail!(~"nyi")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(ToStr)]
|
#[deriving(ToStr)]
|
||||||
|
|
|
@ -2,12 +2,11 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use dom::bindings::utils::{Reflectable, Reflector, BindingObject, DerivedWrapper};
|
use dom::bindings::utils::{Reflectable, Reflector, BindingObject};
|
||||||
use dom::bindings::codegen::ClientRectBinding;
|
use dom::bindings::codegen::ClientRectBinding;
|
||||||
use script_task::page_from_context;
|
use script_task::page_from_context;
|
||||||
|
|
||||||
use js::jsapi::{JSObject, JSContext, JSVal};
|
use js::jsapi::{JSObject, JSContext};
|
||||||
use js::glue::RUST_OBJECT_TO_JSVAL;
|
|
||||||
|
|
||||||
pub struct ClientRect {
|
pub struct ClientRect {
|
||||||
reflector_: Reflector,
|
reflector_: Reflector,
|
||||||
|
@ -81,20 +80,3 @@ impl BindingObject for ClientRect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DerivedWrapper for ClientRect {
|
|
||||||
fn wrap(&mut self, _cx: *JSContext, _scope: *JSObject, _vp: *mut JSVal) -> i32 {
|
|
||||||
fail!(~"nyi")
|
|
||||||
}
|
|
||||||
|
|
||||||
#[fixed_stack_segment]
|
|
||||||
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32 {
|
|
||||||
let obj = self.wrap_object_shared(cx, scope);
|
|
||||||
if obj.is_null() {
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
unsafe { *vp = RUST_OBJECT_TO_JSVAL(obj) };
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -192,10 +192,6 @@ impl DerivedWrapper for AbstractDocument {
|
||||||
unsafe { *vp = RUST_OBJECT_TO_JSVAL(self.reflector().get_jsobject()) };
|
unsafe { *vp = RUST_OBJECT_TO_JSVAL(self.reflector().get_jsobject()) };
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wrap_shared(@mut self, _cx: *JSContext, _scope: *JSObject, _vp: *mut JSVal) -> i32 {
|
|
||||||
fail!(~"nyi")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,11 @@
|
||||||
use dom::eventtarget::EventTarget;
|
use dom::eventtarget::EventTarget;
|
||||||
use dom::window::Window;
|
use dom::window::Window;
|
||||||
use dom::bindings::codegen::EventBinding;
|
use dom::bindings::codegen::EventBinding;
|
||||||
use dom::bindings::utils::{Reflectable, BindingObject, DerivedWrapper};
|
use dom::bindings::utils::{Reflectable, BindingObject};
|
||||||
use dom::bindings::utils::{DOMString, ErrorResult, Fallible, Reflector};
|
use dom::bindings::utils::{DOMString, ErrorResult, Fallible, Reflector};
|
||||||
|
|
||||||
use geom::point::Point2D;
|
use geom::point::Point2D;
|
||||||
use js::glue::RUST_OBJECT_TO_JSVAL;
|
use js::jsapi::{JSObject, JSContext};
|
||||||
use js::jsapi::{JSObject, JSContext, JSVal};
|
|
||||||
|
|
||||||
use script_task::page_from_context;
|
use script_task::page_from_context;
|
||||||
|
|
||||||
|
@ -132,20 +131,3 @@ impl BindingObject for Event {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DerivedWrapper for Event {
|
|
||||||
fn wrap(&mut self, _cx: *JSContext, _scope: *JSObject, _vp: *mut JSVal) -> i32 {
|
|
||||||
fail!(~"nyi")
|
|
||||||
}
|
|
||||||
|
|
||||||
#[fixed_stack_segment]
|
|
||||||
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32 {
|
|
||||||
let obj = self.wrap_object_shared(cx, scope);
|
|
||||||
if obj.is_null() {
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
unsafe { *vp = RUST_OBJECT_TO_JSVAL(obj) };
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -3,11 +3,10 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use dom::bindings::codegen::EventTargetBinding;
|
use dom::bindings::codegen::EventTargetBinding;
|
||||||
use dom::bindings::utils::{Reflectable, Reflector, BindingObject, DerivedWrapper};
|
use dom::bindings::utils::{Reflectable, Reflector, BindingObject};
|
||||||
use script_task::page_from_context;
|
use script_task::page_from_context;
|
||||||
|
|
||||||
use js::glue::RUST_OBJECT_TO_JSVAL;
|
use js::jsapi::{JSObject, JSContext};
|
||||||
use js::jsapi::{JSObject, JSContext, JSVal};
|
|
||||||
|
|
||||||
pub struct EventTarget {
|
pub struct EventTarget {
|
||||||
reflector_: Reflector
|
reflector_: Reflector
|
||||||
|
@ -48,22 +47,3 @@ impl BindingObject for EventTarget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DerivedWrapper for EventTarget {
|
|
||||||
fn wrap(&mut self, _cx: *JSContext, _scope: *JSObject, _vp: *mut JSVal) -> i32 {
|
|
||||||
fail!(~"nyi")
|
|
||||||
}
|
|
||||||
|
|
||||||
#[fixed_stack_segment]
|
|
||||||
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32 {
|
|
||||||
let obj = self.wrap_object_shared(cx, scope);
|
|
||||||
if obj.is_null() {
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
unsafe {
|
|
||||||
*vp = RUST_OBJECT_TO_JSVAL(obj)
|
|
||||||
};
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,14 +2,13 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use dom::bindings::utils::{Reflectable, BindingObject, DerivedWrapper};
|
use dom::bindings::utils::{Reflectable, BindingObject};
|
||||||
use dom::bindings::utils::{Reflector, DOMString, null_str_as_empty};
|
use dom::bindings::utils::{Reflector, DOMString, null_str_as_empty};
|
||||||
use dom::bindings::codegen::FormDataBinding;
|
use dom::bindings::codegen::FormDataBinding;
|
||||||
use dom::blob::Blob;
|
use dom::blob::Blob;
|
||||||
use script_task::{page_from_context};
|
use script_task::{page_from_context};
|
||||||
|
|
||||||
use js::jsapi::{JSObject, JSContext, JSVal};
|
use js::jsapi::{JSObject, JSContext};
|
||||||
use js::glue::RUST_OBJECT_TO_JSVAL;
|
|
||||||
|
|
||||||
use std::hashmap::HashMap;
|
use std::hashmap::HashMap;
|
||||||
|
|
||||||
|
@ -70,20 +69,3 @@ impl BindingObject for FormData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DerivedWrapper for FormData {
|
|
||||||
fn wrap(&mut self, _cx: *JSContext, _scope: *JSObject, _vp: *mut JSVal) -> i32 {
|
|
||||||
fail!(~"nyi")
|
|
||||||
}
|
|
||||||
|
|
||||||
#[fixed_stack_segment]
|
|
||||||
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32 {
|
|
||||||
let obj = self.wrap_object_shared(cx, scope);
|
|
||||||
if obj.is_null() {
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
unsafe { *vp = RUST_OBJECT_TO_JSVAL(obj) };
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -4,14 +4,13 @@
|
||||||
|
|
||||||
use dom::bindings::codegen::MouseEventBinding;
|
use dom::bindings::codegen::MouseEventBinding;
|
||||||
use dom::bindings::utils::{ErrorResult, Fallible, DOMString};
|
use dom::bindings::utils::{ErrorResult, Fallible, DOMString};
|
||||||
use dom::bindings::utils::{Reflectable, Reflector, BindingObject, DerivedWrapper};
|
use dom::bindings::utils::{Reflectable, Reflector, BindingObject};
|
||||||
use dom::eventtarget::EventTarget;
|
use dom::eventtarget::EventTarget;
|
||||||
use dom::uievent::UIEvent;
|
use dom::uievent::UIEvent;
|
||||||
use dom::window::Window;
|
use dom::window::Window;
|
||||||
use dom::windowproxy::WindowProxy;
|
use dom::windowproxy::WindowProxy;
|
||||||
|
|
||||||
use js::glue::RUST_OBJECT_TO_JSVAL;
|
use js::jsapi::{JSObject, JSContext};
|
||||||
use js::jsapi::{JSObject, JSContext, JSVal};
|
|
||||||
|
|
||||||
pub struct MouseEvent {
|
pub struct MouseEvent {
|
||||||
parent: UIEvent,
|
parent: UIEvent,
|
||||||
|
@ -161,21 +160,3 @@ impl BindingObject for MouseEvent {
|
||||||
self.parent.GetParentObject(cx)
|
self.parent.GetParentObject(cx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DerivedWrapper for MouseEvent {
|
|
||||||
fn wrap(&mut self, _cx: *JSContext, _scope: *JSObject, _vp: *mut JSVal) -> i32 {
|
|
||||||
fail!(~"nyi")
|
|
||||||
}
|
|
||||||
|
|
||||||
#[fixed_stack_segment]
|
|
||||||
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32 {
|
|
||||||
let obj = self.wrap_object_shared(cx, scope);
|
|
||||||
if obj.is_null() {
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
unsafe { *vp = RUST_OBJECT_TO_JSVAL(obj) };
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -4,14 +4,13 @@
|
||||||
|
|
||||||
use dom::bindings::codegen::UIEventBinding;
|
use dom::bindings::codegen::UIEventBinding;
|
||||||
use dom::bindings::utils::{DOMString, Fallible};
|
use dom::bindings::utils::{DOMString, Fallible};
|
||||||
use dom::bindings::utils::{Reflectable, Reflector, BindingObject, DerivedWrapper};
|
use dom::bindings::utils::{Reflectable, Reflector, BindingObject};
|
||||||
use dom::node::{AbstractNode, ScriptView};
|
use dom::node::{AbstractNode, ScriptView};
|
||||||
use dom::event::Event;
|
use dom::event::Event;
|
||||||
use dom::window::Window;
|
use dom::window::Window;
|
||||||
use dom::windowproxy::WindowProxy;
|
use dom::windowproxy::WindowProxy;
|
||||||
|
|
||||||
use js::glue::RUST_OBJECT_TO_JSVAL;
|
use js::jsapi::{JSObject, JSContext};
|
||||||
use js::jsapi::{JSObject, JSContext, JSVal};
|
|
||||||
|
|
||||||
pub struct UIEvent {
|
pub struct UIEvent {
|
||||||
parent: Event,
|
parent: Event,
|
||||||
|
@ -134,20 +133,3 @@ impl BindingObject for UIEvent {
|
||||||
self.parent.GetParentObject(cx)
|
self.parent.GetParentObject(cx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DerivedWrapper for UIEvent {
|
|
||||||
fn wrap(&mut self, _cx: *JSContext, _scope: *JSObject, _vp: *mut JSVal) -> i32 {
|
|
||||||
fail!(~"nyi")
|
|
||||||
}
|
|
||||||
|
|
||||||
#[fixed_stack_segment]
|
|
||||||
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32 {
|
|
||||||
let obj = self.wrap_object_shared(cx, scope);
|
|
||||||
if obj.is_null() {
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
unsafe { *vp = RUST_OBJECT_TO_JSVAL(obj) };
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue