Rename CacheableWrapper to Reflectable.

This commit is contained in:
Bobby Holley 2013-10-08 20:04:29 +02:00
parent 77f8dba48b
commit 0a0599ad9b
30 changed files with 96 additions and 96 deletions

View file

@ -1533,7 +1533,7 @@ for (uint32_t i = 0; i < length; ++i) {
if descriptor.pointerType == '': if descriptor.pointerType == '':
wrap = "%s.wrap(cx, ${obj}, ${jsvalPtr} as *mut JSVal)" % result wrap = "%s.wrap(cx, ${obj}, ${jsvalPtr} as *mut JSVal)" % result
else: else:
wrap = "%s(cx, ${obj}, %s as @mut CacheableWrapper, ${jsvalPtr} as *mut JSVal)" % (wrapMethod, result) wrap = "%s(cx, ${obj}, %s as @mut Reflectable, ${jsvalPtr} as *mut JSVal)" % (wrapMethod, result)
# We don't support prefable stuff in workers. # We don't support prefable stuff in workers.
assert(not descriptor.prefable or not descriptor.workers) assert(not descriptor.prefable or not descriptor.workers)
if not descriptor.prefable: if not descriptor.prefable:
@ -1555,7 +1555,7 @@ for (uint32_t i = 0; i < length; ++i) {
if descriptor.pointerType == '': if descriptor.pointerType == '':
wrap = "(%s.wrap(cx, ${obj}, ${jsvalPtr}) != 0)" % result wrap = "(%s.wrap(cx, ${obj}, ${jsvalPtr}) != 0)" % result
else: else:
wrap = "if WrapNewBindingObject(cx, ${obj}, %s as @mut CacheableWrapper, ${jsvalPtr}) { 1 } else { 0 };" % result wrap = "if WrapNewBindingObject(cx, ${obj}, %s as @mut Reflectable, ${jsvalPtr}) { 1 } else { 0 };" % result
wrappingCode += wrapAndSetPtr(wrap) wrappingCode += wrapAndSetPtr(wrap)
return (wrappingCode, False) return (wrappingCode, False)

View file

@ -3,7 +3,7 @@
* 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::{CacheableWrapper, WrapperCache}; use dom::bindings::utils::{Reflectable, WrapperCache};
use dom::bindings::utils::{BindingObject, DerivedWrapper}; use dom::bindings::utils::{BindingObject, DerivedWrapper};
use dom::domparser::DOMParser; use dom::domparser::DOMParser;
@ -12,7 +12,7 @@ use js::glue::{RUST_OBJECT_TO_JSVAL};
use std::cast; use std::cast;
impl CacheableWrapper for DOMParser { impl Reflectable for DOMParser {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
unsafe { cast::transmute(&self.wrapper) } unsafe { cast::transmute(&self.wrapper) }
} }
@ -24,8 +24,8 @@ impl CacheableWrapper for DOMParser {
} }
impl BindingObject for DOMParser { impl BindingObject for DOMParser {
fn GetParentObject(&self, _cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, _cx: *JSContext) -> Option<@mut Reflectable> {
Some(self.owner as @mut CacheableWrapper) Some(self.owner as @mut Reflectable)
} }
} }

View file

@ -4,14 +4,14 @@
use dom::types::*; use dom::types::*;
use dom::bindings::codegen::*; use dom::bindings::codegen::*;
use dom::bindings::utils::{BindingObject, WrapperCache, CacheableWrapper, Traceable}; use dom::bindings::utils::{BindingObject, WrapperCache, Reflectable, Traceable};
use dom::node::ScriptView; use dom::node::ScriptView;
use js::jsapi::{JSContext, JSObject, JSTracer}; use js::jsapi::{JSContext, JSObject, JSTracer};
macro_rules! generate_cacheable_wrapper( macro_rules! generate_cacheable_wrapper(
($name: path, $wrap: path) => ( ($name: path, $wrap: path) => (
impl CacheableWrapper for $name { impl Reflectable for $name {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
self.element.get_wrappercache() self.element.get_wrappercache()
} }
@ -26,7 +26,7 @@ macro_rules! generate_cacheable_wrapper(
macro_rules! generate_cacheable_wrapper_htmlelement( macro_rules! generate_cacheable_wrapper_htmlelement(
($name: path, $wrap: path) => ( ($name: path, $wrap: path) => (
impl CacheableWrapper for $name { impl Reflectable for $name {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
self.htmlelement.get_wrappercache() self.htmlelement.get_wrappercache()
} }
@ -41,7 +41,7 @@ macro_rules! generate_cacheable_wrapper_htmlelement(
macro_rules! generate_cacheable_wrapper_node( macro_rules! generate_cacheable_wrapper_node(
($name: path, $wrap: path) => ( ($name: path, $wrap: path) => (
impl CacheableWrapper for $name { impl Reflectable for $name {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
self.node.get_wrappercache() self.node.get_wrappercache()
} }
@ -57,7 +57,7 @@ macro_rules! generate_cacheable_wrapper_node(
macro_rules! generate_binding_object( macro_rules! generate_binding_object(
($name: path) => ( ($name: path) => (
impl BindingObject for $name { impl BindingObject for $name {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> {
self.element.GetParentObject(cx) self.element.GetParentObject(cx)
} }
} }
@ -67,7 +67,7 @@ macro_rules! generate_binding_object(
macro_rules! generate_binding_object_htmlelement( macro_rules! generate_binding_object_htmlelement(
($name: path) => ( ($name: path) => (
impl BindingObject for $name { impl BindingObject for $name {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> {
self.htmlelement.GetParentObject(cx) self.htmlelement.GetParentObject(cx)
} }
} }
@ -77,7 +77,7 @@ macro_rules! generate_binding_object_htmlelement(
macro_rules! generate_binding_object_node( macro_rules! generate_binding_object_node(
($name: path) => ( ($name: path) => (
impl BindingObject for $name { impl BindingObject for $name {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> {
self.node.GetParentObject(cx) self.node.GetParentObject(cx)
} }
} }

View file

@ -2,7 +2,7 @@
* 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::{CacheableWrapper, WrapperCache, Traceable}; use dom::bindings::utils::{Reflectable, WrapperCache, Traceable};
use dom::element::*; use dom::element::*;
use dom::types::*; use dom::types::*;
use dom::node::{AbstractNode, ElementNodeTypeId, TextNodeTypeId, CommentNodeTypeId}; use dom::node::{AbstractNode, ElementNodeTypeId, TextNodeTypeId, CommentNodeTypeId};
@ -95,7 +95,7 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject
} }
} }
impl CacheableWrapper for AbstractNode<ScriptView> { impl Reflectable for AbstractNode<ScriptView> {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
do self.with_mut_base |base| { do self.with_mut_base |base| {
unsafe { unsafe {

View file

@ -527,7 +527,7 @@ pub fn initialize_global(global: *JSObject) {
} }
} }
pub trait CacheableWrapper { pub trait Reflectable {
fn get_wrappercache(&mut self) -> &mut WrapperCache; fn get_wrappercache(&mut self) -> &mut WrapperCache;
fn wrap_object_shared(@mut self, cx: *JSContext, scope: *JSObject) -> *JSObject; fn wrap_object_shared(@mut self, cx: *JSContext, scope: *JSObject) -> *JSObject;
} }
@ -558,7 +558,7 @@ impl WrapperCache {
#[fixed_stack_segment] #[fixed_stack_segment]
pub fn WrapNewBindingObject(cx: *JSContext, scope: *JSObject, pub fn WrapNewBindingObject(cx: *JSContext, scope: *JSObject,
value: @mut CacheableWrapper, value: @mut Reflectable,
vp: *mut JSVal) -> JSBool { vp: *mut JSVal) -> JSBool {
unsafe { unsafe {
let cache = value.get_wrappercache(); let cache = value.get_wrappercache();
@ -581,7 +581,7 @@ pub fn WrapNewBindingObject(cx: *JSContext, scope: *JSObject,
} }
#[fixed_stack_segment] #[fixed_stack_segment]
pub fn WrapNativeParent(cx: *JSContext, scope: *JSObject, mut p: Option<@mut CacheableWrapper>) -> *JSObject { pub fn WrapNativeParent(cx: *JSContext, scope: *JSObject, mut p: Option<@mut Reflectable>) -> *JSObject {
match p { match p {
Some(ref mut p) => { Some(ref mut p) => {
let cache = p.get_wrappercache(); let cache = p.get_wrappercache();
@ -598,7 +598,7 @@ pub fn WrapNativeParent(cx: *JSContext, scope: *JSObject, mut p: Option<@mut Cac
} }
pub trait BindingObject { pub trait BindingObject {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper>; fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable>;
} }
#[fixed_stack_segment] #[fixed_stack_segment]

View file

@ -2,7 +2,7 @@
* 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::{WrapperCache, BindingObject, CacheableWrapper}; use dom::bindings::utils::{WrapperCache, BindingObject, Reflectable};
use dom::bindings::codegen::BlobBinding; use dom::bindings::codegen::BlobBinding;
use script_task::{page_from_context}; use script_task::{page_from_context};
@ -22,7 +22,7 @@ impl Blob {
} }
} }
impl CacheableWrapper for Blob { impl Reflectable for Blob {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
unsafe { cast::transmute(&self.wrapper) } unsafe { cast::transmute(&self.wrapper) }
} }
@ -34,10 +34,10 @@ impl CacheableWrapper for Blob {
} }
impl BindingObject for Blob { impl BindingObject for Blob {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> {
let page = page_from_context(cx); let page = page_from_context(cx);
unsafe { unsafe {
Some((*page).frame.get_ref().window as @mut CacheableWrapper) Some((*page).frame.get_ref().window as @mut Reflectable)
} }
} }
} }

View file

@ -5,7 +5,7 @@
//! DOM bindings for `CharacterData`. //! DOM bindings for `CharacterData`.
use dom::bindings::utils::{DOMString, ErrorResult, Fallible}; use dom::bindings::utils::{DOMString, ErrorResult, Fallible};
use dom::bindings::utils::{BindingObject, CacheableWrapper, WrapperCache}; use dom::bindings::utils::{BindingObject, Reflectable, WrapperCache};
use dom::node::{Node, NodeTypeId, ScriptView}; use dom::node::{Node, NodeTypeId, ScriptView};
use js::jsapi::{JSObject, JSContext}; use js::jsapi::{JSObject, JSContext};
@ -57,7 +57,7 @@ impl CharacterData {
} }
} }
impl CacheableWrapper for CharacterData { impl Reflectable for CharacterData {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
self.node.get_wrappercache() self.node.get_wrappercache()
} }
@ -68,7 +68,7 @@ impl CacheableWrapper for CharacterData {
} }
impl BindingObject for CharacterData { impl BindingObject for CharacterData {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> {
self.node.GetParentObject(cx) self.node.GetParentObject(cx)
} }
} }

View file

@ -2,7 +2,7 @@
* 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::{CacheableWrapper, WrapperCache, BindingObject, DerivedWrapper}; use dom::bindings::utils::{Reflectable, WrapperCache, BindingObject, DerivedWrapper};
use dom::bindings::codegen::ClientRectBinding; use dom::bindings::codegen::ClientRectBinding;
use script_task::page_from_context; use script_task::page_from_context;
@ -61,7 +61,7 @@ impl ClientRect {
} }
} }
impl CacheableWrapper for ClientRect { impl Reflectable for ClientRect {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
unsafe { unsafe {
cast::transmute(&self.wrapper) cast::transmute(&self.wrapper)
@ -75,10 +75,10 @@ impl CacheableWrapper for ClientRect {
} }
impl BindingObject for ClientRect { impl BindingObject for ClientRect {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> {
let page = page_from_context(cx); let page = page_from_context(cx);
unsafe { unsafe {
Some((*page).frame.get_ref().window as @mut CacheableWrapper) Some((*page).frame.get_ref().window as @mut Reflectable)
} }
} }
} }

View file

@ -3,7 +3,7 @@
* 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::ClientRectListBinding; use dom::bindings::codegen::ClientRectListBinding;
use dom::bindings::utils::{WrapperCache, CacheableWrapper, BindingObject}; use dom::bindings::utils::{WrapperCache, Reflectable, BindingObject};
use dom::clientrect::ClientRect; use dom::clientrect::ClientRect;
use script_task::page_from_context; use script_task::page_from_context;
@ -48,7 +48,7 @@ impl ClientRectList {
} }
} }
impl CacheableWrapper for ClientRectList { impl Reflectable for ClientRectList {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
unsafe { unsafe {
cast::transmute(&self.wrapper) cast::transmute(&self.wrapper)
@ -62,10 +62,10 @@ impl CacheableWrapper for ClientRectList {
} }
impl BindingObject for ClientRectList { impl BindingObject for ClientRectList {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> {
let page = page_from_context(cx); let page = page_from_context(cx);
unsafe { unsafe {
Some((*page).frame.get_ref().window as @mut CacheableWrapper) Some((*page).frame.get_ref().window as @mut Reflectable)
} }
} }
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::DocumentBinding; use dom::bindings::codegen::DocumentBinding;
use dom::bindings::utils::{DOMString, WrapperCache, ErrorResult, Fallible}; use dom::bindings::utils::{DOMString, WrapperCache, ErrorResult, Fallible};
use dom::bindings::utils::{BindingObject, CacheableWrapper, DerivedWrapper}; use dom::bindings::utils::{BindingObject, Reflectable, DerivedWrapper};
use dom::bindings::utils::{is_valid_element_name, InvalidCharacter, Traceable, null_str_as_empty}; use dom::bindings::utils::{is_valid_element_name, InvalidCharacter, Traceable, null_str_as_empty};
use dom::element::{Element}; use dom::element::{Element};
use dom::element::{HTMLHtmlElementTypeId, HTMLHeadElementTypeId, HTMLTitleElementTypeId}; use dom::element::{HTMLHtmlElementTypeId, HTMLHeadElementTypeId, HTMLTitleElementTypeId};
@ -131,7 +131,7 @@ impl WrappableDocument for Document {
} }
} }
impl CacheableWrapper for AbstractDocument { impl Reflectable for AbstractDocument {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
do self.with_mut_base |doc| { do self.with_mut_base |doc| {
doc.get_wrappercache() doc.get_wrappercache()
@ -152,7 +152,7 @@ impl CacheableWrapper for AbstractDocument {
} }
impl BindingObject for AbstractDocument { impl BindingObject for AbstractDocument {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> {
do self.with_mut_base |doc| { do self.with_mut_base |doc| {
doc.GetParentObject(cx) doc.GetParentObject(cx)
} }
@ -174,7 +174,7 @@ impl DerivedWrapper for AbstractDocument {
} }
impl CacheableWrapper for Document { impl Reflectable for Document {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
unsafe { unsafe {
cast::transmute(&self.wrapper) cast::transmute(&self.wrapper)
@ -188,9 +188,9 @@ impl CacheableWrapper for Document {
} }
impl BindingObject for Document { impl BindingObject for Document {
fn GetParentObject(&self, _cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, _cx: *JSContext) -> Option<@mut Reflectable> {
match self.window { match self.window {
Some(win) => Some(win as @mut CacheableWrapper), Some(win) => Some(win as @mut Reflectable),
None => None None => None
} }
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::DOMParserBinding; use dom::bindings::codegen::DOMParserBinding;
use dom::bindings::codegen::DOMParserBinding::SupportedTypeValues::{Text_html, Text_xml}; use dom::bindings::codegen::DOMParserBinding::SupportedTypeValues::{Text_html, Text_xml};
use dom::bindings::utils::{DOMString, Fallible, WrapperCache, CacheableWrapper}; use dom::bindings::utils::{DOMString, Fallible, WrapperCache, Reflectable};
use dom::document::{AbstractDocument, Document, XML}; use dom::document::{AbstractDocument, Document, XML};
use dom::element::HTMLHtmlElementTypeId; use dom::element::HTMLHtmlElementTypeId;
use dom::htmldocument::HTMLDocument; use dom::htmldocument::HTMLDocument;

View file

@ -4,7 +4,7 @@
//! Element nodes. //! Element nodes.
use dom::bindings::utils::{BindingObject, CacheableWrapper, DOMString, ErrorResult, Fallible, WrapperCache}; use dom::bindings::utils::{BindingObject, Reflectable, DOMString, ErrorResult, Fallible, WrapperCache};
use dom::bindings::utils::{null_str_as_empty, null_str_as_empty_ref}; use dom::bindings::utils::{null_str_as_empty, null_str_as_empty_ref};
use dom::htmlcollection::HTMLCollection; use dom::htmlcollection::HTMLCollection;
use dom::clientrect::ClientRect; use dom::clientrect::ClientRect;
@ -28,7 +28,7 @@ pub struct Element {
style_attribute: Option<Stylesheet>, style_attribute: Option<Stylesheet>,
} }
impl CacheableWrapper for Element { impl Reflectable for Element {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
self.node.get_wrappercache() self.node.get_wrappercache()
} }
@ -39,7 +39,7 @@ impl CacheableWrapper for Element {
} }
impl BindingObject for Element { impl BindingObject for Element {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> {
self.node.GetParentObject(cx) self.node.GetParentObject(cx)
} }
} }

View file

@ -5,7 +5,7 @@
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::{CacheableWrapper, BindingObject, DerivedWrapper}; use dom::bindings::utils::{Reflectable, BindingObject, DerivedWrapper};
use dom::bindings::utils::{DOMString, ErrorResult, Fallible, WrapperCache}; use dom::bindings::utils::{DOMString, ErrorResult, Fallible, WrapperCache};
use geom::point::Point2D; use geom::point::Point2D;
@ -113,7 +113,7 @@ impl Event {
} }
} }
impl CacheableWrapper for Event { impl Reflectable for Event {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
unsafe { cast::transmute(&self.wrapper) } unsafe { cast::transmute(&self.wrapper) }
} }
@ -125,10 +125,10 @@ impl CacheableWrapper for Event {
} }
impl BindingObject for Event { impl BindingObject for Event {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> {
let page = page_from_context(cx); let page = page_from_context(cx);
unsafe { unsafe {
Some((*page).frame.get_ref().window as @mut CacheableWrapper) Some((*page).frame.get_ref().window as @mut Reflectable)
} }
} }
} }

View file

@ -3,7 +3,7 @@
* 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::{CacheableWrapper, WrapperCache, BindingObject, DerivedWrapper}; use dom::bindings::utils::{Reflectable, WrapperCache, BindingObject, DerivedWrapper};
use script_task::page_from_context; use script_task::page_from_context;
use js::glue::RUST_OBJECT_TO_JSVAL; use js::glue::RUST_OBJECT_TO_JSVAL;
@ -27,7 +27,7 @@ impl EventTarget {
} }
} }
impl CacheableWrapper for EventTarget { impl Reflectable for EventTarget {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
unsafe { cast::transmute(&self.wrapper) } unsafe { cast::transmute(&self.wrapper) }
} }
@ -39,11 +39,11 @@ impl CacheableWrapper for EventTarget {
} }
impl BindingObject for EventTarget { impl BindingObject for EventTarget {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> {
let page = page_from_context(cx); let page = page_from_context(cx);
// TODO(tkuehn): This only handles top-level pages. Needs to handle subframes. // TODO(tkuehn): This only handles top-level pages. Needs to handle subframes.
unsafe { unsafe {
Some((*page).frame.get_ref().window as @mut CacheableWrapper) Some((*page).frame.get_ref().window as @mut Reflectable)
} }
} }
} }

View file

@ -2,7 +2,7 @@
* 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::{CacheableWrapper, BindingObject, DerivedWrapper}; use dom::bindings::utils::{Reflectable, BindingObject, DerivedWrapper};
use dom::bindings::utils::{WrapperCache, DOMString, null_str_as_empty}; use dom::bindings::utils::{WrapperCache, DOMString, null_str_as_empty};
use dom::bindings::codegen::FormDataBinding; use dom::bindings::codegen::FormDataBinding;
use dom::blob::Blob; use dom::blob::Blob;
@ -49,7 +49,7 @@ impl FormData {
} }
} }
impl CacheableWrapper for FormData { impl Reflectable for FormData {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
unsafe { unsafe {
cast::transmute(&self.wrapper) cast::transmute(&self.wrapper)
@ -63,10 +63,10 @@ impl CacheableWrapper for FormData {
} }
impl BindingObject for FormData { impl BindingObject for FormData {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> {
let page = page_from_context(cx); let page = page_from_context(cx);
unsafe { unsafe {
Some((*page).frame.get_ref().window as @mut CacheableWrapper) Some((*page).frame.get_ref().window as @mut Reflectable)
} }
} }
} }

View file

@ -3,7 +3,7 @@
* 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::HTMLCollectionBinding; use dom::bindings::codegen::HTMLCollectionBinding;
use dom::bindings::utils::{CacheableWrapper, BindingObject, WrapperCache}; use dom::bindings::utils::{Reflectable, BindingObject, WrapperCache};
use dom::bindings::utils::{DOMString, Fallible}; use dom::bindings::utils::{DOMString, Fallible};
use dom::node::{AbstractNode, ScriptView}; use dom::node::{AbstractNode, ScriptView};
use script_task::page_from_context; use script_task::page_from_context;
@ -59,16 +59,16 @@ impl HTMLCollection {
} }
impl BindingObject for HTMLCollection { impl BindingObject for HTMLCollection {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> {
let page = page_from_context(cx); let page = page_from_context(cx);
// TODO(tkuehn): This only handles the top-level frame. Need to grab subframes. // TODO(tkuehn): This only handles the top-level frame. Need to grab subframes.
unsafe { unsafe {
Some((*page).frame.get_ref().window as @mut CacheableWrapper) Some((*page).frame.get_ref().window as @mut Reflectable)
} }
} }
} }
impl CacheableWrapper for HTMLCollection { impl Reflectable for HTMLCollection {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
unsafe { unsafe {
cast::transmute(&self.wrapper) cast::transmute(&self.wrapper)

View file

@ -2,7 +2,7 @@
* 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::CacheableWrapper; use dom::bindings::utils::Reflectable;
use dom::htmlcollection::HTMLCollection; use dom::htmlcollection::HTMLCollection;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::HTMLDocumentBinding; use dom::bindings::codegen::HTMLDocumentBinding;
use dom::bindings::utils::{DOMString, ErrorResult, Fallible, Traceable}; use dom::bindings::utils::{DOMString, ErrorResult, Fallible, Traceable};
use dom::bindings::utils::{CacheableWrapper, BindingObject, WrapperCache}; use dom::bindings::utils::{Reflectable, BindingObject, WrapperCache};
use dom::document::{AbstractDocument, Document, WrappableDocument, HTML}; use dom::document::{AbstractDocument, Document, WrappableDocument, HTML};
use dom::element::HTMLHeadElementTypeId; use dom::element::HTMLHeadElementTypeId;
use dom::htmlcollection::HTMLCollection; use dom::htmlcollection::HTMLCollection;
@ -200,7 +200,7 @@ impl HTMLDocument {
} }
} }
impl CacheableWrapper for HTMLDocument { impl Reflectable for HTMLDocument {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
self.parent.get_wrappercache() self.parent.get_wrappercache()
} }
@ -212,7 +212,7 @@ impl CacheableWrapper for HTMLDocument {
} }
impl BindingObject for HTMLDocument { impl BindingObject for HTMLDocument {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> {
self.parent.GetParentObject(cx) self.parent.GetParentObject(cx)
} }
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::HTMLElementBinding; use dom::bindings::codegen::HTMLElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult, Fallible}; use dom::bindings::utils::{DOMString, ErrorResult, Fallible};
use dom::bindings::utils::{CacheableWrapper, BindingObject, WrapperCache}; use dom::bindings::utils::{Reflectable, BindingObject, WrapperCache};
use dom::element::{Element, ElementTypeId}; use dom::element::{Element, ElementTypeId};
use dom::node::{AbstractNode, ScriptView}; use dom::node::{AbstractNode, ScriptView};
use js::jsapi::{JSObject, JSContext, JSVal}; use js::jsapi::{JSObject, JSContext, JSVal};
@ -148,7 +148,7 @@ impl HTMLElement {
} }
} }
impl CacheableWrapper for HTMLElement { impl Reflectable for HTMLElement {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
self.element.get_wrappercache() self.element.get_wrappercache()
} }
@ -160,7 +160,7 @@ impl CacheableWrapper for HTMLElement {
} }
impl BindingObject for HTMLElement { impl BindingObject for HTMLElement {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> {
self.element.GetParentObject(cx) self.element.GetParentObject(cx)
} }
} }

View file

@ -2,7 +2,7 @@
* 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::{DOMString, ErrorResult, CacheableWrapper}; use dom::bindings::utils::{DOMString, ErrorResult, Reflectable};
use dom::htmlcollection::HTMLCollection; use dom::htmlcollection::HTMLCollection;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, ScriptView}; use dom::node::{AbstractNode, ScriptView};

View file

@ -2,7 +2,7 @@
* 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::{CacheableWrapper, DOMString, ErrorResult}; use dom::bindings::utils::{Reflectable, DOMString, ErrorResult};
use dom::element::HTMLFormElementTypeId; use dom::element::HTMLFormElementTypeId;
use dom::htmlcollection::HTMLCollection; use dom::htmlcollection::HTMLCollection;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;

View file

@ -2,7 +2,7 @@
* 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::{DOMString, ErrorResult, CacheableWrapper}; use dom::bindings::utils::{DOMString, ErrorResult, Reflectable};
use dom::htmlcollection::HTMLCollection; use dom::htmlcollection::HTMLCollection;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
use js::jsapi::{JSObject, JSContext}; use js::jsapi::{JSObject, JSContext};

View file

@ -4,7 +4,7 @@
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::{CacheableWrapper, WrapperCache, BindingObject, DerivedWrapper}; use dom::bindings::utils::{Reflectable, WrapperCache, BindingObject, DerivedWrapper};
use dom::eventtarget::EventTarget; use dom::eventtarget::EventTarget;
use dom::uievent::UIEvent; use dom::uievent::UIEvent;
use dom::window::Window; use dom::window::Window;
@ -142,7 +142,7 @@ impl MouseEvent {
} }
} }
impl CacheableWrapper for MouseEvent { impl Reflectable for MouseEvent {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
return self.parent.get_wrappercache() return self.parent.get_wrappercache()
} }
@ -154,7 +154,7 @@ impl CacheableWrapper for MouseEvent {
} }
impl BindingObject for MouseEvent { impl BindingObject for MouseEvent {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> {
self.parent.GetParentObject(cx) self.parent.GetParentObject(cx)
} }
} }

View file

@ -2,7 +2,7 @@
* 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::{WrapperCache, BindingObject, CacheableWrapper}; use dom::bindings::utils::{WrapperCache, BindingObject, Reflectable};
use dom::bindings::utils::{DOMString, Fallible}; use dom::bindings::utils::{DOMString, Fallible};
use dom::bindings::codegen::NavigatorBinding; use dom::bindings::codegen::NavigatorBinding;
use script_task::{page_from_context}; use script_task::{page_from_context};
@ -87,7 +87,7 @@ impl Navigator {
} }
} }
impl CacheableWrapper for Navigator { impl Reflectable for Navigator {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
unsafe { cast::transmute(&self.wrapper) } unsafe { cast::transmute(&self.wrapper) }
} }
@ -99,10 +99,10 @@ impl CacheableWrapper for Navigator {
} }
impl BindingObject for Navigator { impl BindingObject for Navigator {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> {
let page = page_from_context(cx); let page = page_from_context(cx);
unsafe { unsafe {
Some((*page).frame.get_ref().window as @mut CacheableWrapper) Some((*page).frame.get_ref().window as @mut Reflectable)
} }
} }
} }

View file

@ -6,7 +6,7 @@
use dom::bindings::node; use dom::bindings::node;
use dom::bindings::utils::{WrapperCache, DOMString, ErrorResult, Fallible, NotFound, HierarchyRequest}; use dom::bindings::utils::{WrapperCache, DOMString, ErrorResult, Fallible, NotFound, HierarchyRequest};
use dom::bindings::utils::{BindingObject, CacheableWrapper, null_str_as_empty}; use dom::bindings::utils::{BindingObject, Reflectable, null_str_as_empty};
use dom::characterdata::CharacterData; use dom::characterdata::CharacterData;
use dom::document::AbstractDocument; use dom::document::AbstractDocument;
use dom::element::{Element, ElementTypeId, HTMLImageElementTypeId, HTMLIframeElementTypeId}; use dom::element::{Element, ElementTypeId, HTMLImageElementTypeId, HTMLIframeElementTypeId};
@ -155,11 +155,11 @@ impl<View> TreeNode<AbstractNode<View>> for Node<View> { }
impl<'self, View> AbstractNode<View> { impl<'self, View> AbstractNode<View> {
// Unsafe accessors // Unsafe accessors
pub unsafe fn as_cacheable_wrapper(&self) -> @mut CacheableWrapper { pub unsafe fn as_cacheable_wrapper(&self) -> @mut Reflectable {
match self.type_id() { match self.type_id() {
TextNodeTypeId => { TextNodeTypeId => {
let node: @mut Text = cast::transmute(self.obj); let node: @mut Text = cast::transmute(self.obj);
node as @mut CacheableWrapper node as @mut Reflectable
} }
_ => { _ => {
fail!("unsupported node type") fail!("unsupported node type")
@ -789,7 +789,7 @@ impl VoidPtrLike for AbstractNode<LayoutView> {
} }
} }
impl CacheableWrapper for Node<ScriptView> { impl Reflectable for Node<ScriptView> {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
unsafe { cast::transmute(&mut self.wrapper) } unsafe { cast::transmute(&mut self.wrapper) }
} }
@ -800,7 +800,7 @@ impl CacheableWrapper for Node<ScriptView> {
} }
impl BindingObject for Node<ScriptView> { impl BindingObject for Node<ScriptView> {
fn GetParentObject(&self, _cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, _cx: *JSContext) -> Option<@mut Reflectable> {
match self.parent_node { match self.parent_node {
Some(node) => Some(unsafe {node.as_cacheable_wrapper()}), Some(node) => Some(unsafe {node.as_cacheable_wrapper()}),
None => None None => None

View file

@ -4,7 +4,7 @@
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::{CacheableWrapper, WrapperCache, BindingObject, DerivedWrapper}; use dom::bindings::utils::{Reflectable, WrapperCache, BindingObject, DerivedWrapper};
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;
@ -115,7 +115,7 @@ impl UIEvent {
} }
} }
impl CacheableWrapper for UIEvent { impl Reflectable for UIEvent {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
return self.parent.get_wrappercache() return self.parent.get_wrappercache()
} }
@ -127,7 +127,7 @@ impl CacheableWrapper for UIEvent {
} }
impl BindingObject for UIEvent { impl BindingObject for UIEvent {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> {
self.parent.GetParentObject(cx) self.parent.GetParentObject(cx)
} }
} }

View file

@ -2,7 +2,7 @@
* 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::{WrapperCache, BindingObject, CacheableWrapper}; use dom::bindings::utils::{WrapperCache, BindingObject, Reflectable};
use dom::bindings::codegen::ValidityStateBinding; use dom::bindings::codegen::ValidityStateBinding;
use js::jsapi::{JSContext, JSObject}; use js::jsapi::{JSContext, JSObject};
use std::cast; use std::cast;
@ -59,7 +59,7 @@ impl ValidityState {
} }
} }
impl CacheableWrapper for ValidityState { impl Reflectable for ValidityState {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
unsafe { cast::transmute(&self.wrapper) } unsafe { cast::transmute(&self.wrapper) }
} }
@ -71,7 +71,7 @@ impl CacheableWrapper for ValidityState {
} }
impl BindingObject for ValidityState { impl BindingObject for ValidityState {
fn GetParentObject(&self, _cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, _cx: *JSContext) -> Option<@mut Reflectable> {
None None
} }
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::WindowBinding; use dom::bindings::codegen::WindowBinding;
use dom::bindings::utils::{WrapperCache, DOMString, Traceable}; use dom::bindings::utils::{WrapperCache, DOMString, Traceable};
use dom::bindings::utils::{CacheableWrapper, BindingObject, null_str_as_empty}; use dom::bindings::utils::{Reflectable, BindingObject, null_str_as_empty};
use dom::document::AbstractDocument; use dom::document::AbstractDocument;
use dom::node::{AbstractNode, ScriptView}; use dom::node::{AbstractNode, ScriptView};
use dom::navigator::Navigator; use dom::navigator::Navigator;
@ -135,7 +135,7 @@ impl Window {
} }
} }
impl CacheableWrapper for Window { impl Reflectable for Window {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
unsafe { cast::transmute(&self.wrapper) } unsafe { cast::transmute(&self.wrapper) }
} }
@ -147,7 +147,7 @@ impl CacheableWrapper for Window {
} }
impl BindingObject for Window { impl BindingObject for Window {
fn GetParentObject(&self, _cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, _cx: *JSContext) -> Option<@mut Reflectable> {
None None
} }
} }

View file

@ -2,7 +2,7 @@
* 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::{CacheableWrapper, WrapperCache, BindingObject}; use dom::bindings::utils::{Reflectable, WrapperCache, BindingObject};
use script_task::page_from_context; use script_task::page_from_context;
use js::jsapi::{JSContext, JSObject}; use js::jsapi::{JSContext, JSObject};
@ -24,15 +24,15 @@ impl WindowProxy {
} }
impl BindingObject for WindowProxy { impl BindingObject for WindowProxy {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> { fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> {
let page = page_from_context(cx); let page = page_from_context(cx);
unsafe { unsafe {
Some((*page).frame.get_ref().window as @mut CacheableWrapper) Some((*page).frame.get_ref().window as @mut Reflectable)
} }
} }
} }
impl CacheableWrapper for WindowProxy { impl Reflectable for WindowProxy {
fn get_wrappercache(&mut self) -> &mut WrapperCache { fn get_wrappercache(&mut self) -> &mut WrapperCache {
return self.get_wrappercache() return self.get_wrappercache()
} }

View file

@ -8,7 +8,7 @@
use servo_msg::compositor_msg::{ScriptListener, Loading, PerformingLayout}; use servo_msg::compositor_msg::{ScriptListener, Loading, PerformingLayout};
use servo_msg::compositor_msg::FinishedLoading; use servo_msg::compositor_msg::FinishedLoading;
use dom::bindings::codegen::RegisterBindings; use dom::bindings::codegen::RegisterBindings;
use dom::bindings::utils::{CacheableWrapper, GlobalStaticData}; use dom::bindings::utils::{Reflectable, GlobalStaticData};
use dom::document::AbstractDocument; use dom::document::AbstractDocument;
use dom::element::Element; use dom::element::Element;
use dom::event::{Event_, ResizeEvent, ReflowEvent, ClickEvent, MouseDownEvent, MouseUpEvent}; use dom::event::{Event_, ResizeEvent, ReflowEvent, ClickEvent, MouseDownEvent, MouseUpEvent};