mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Move various reflector types and traits to script_bindings (#35279)
* script: Move Reflector to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Extract global() helper from DomObject into new trait. Move DomObject and related traits to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
0d51578cc3
commit
c94ac5bccb
212 changed files with 357 additions and 319 deletions
|
@ -15,12 +15,11 @@ use js::jsapi::{
|
|||
};
|
||||
use js::jsval::{JSVal, ObjectValue, UndefinedValue};
|
||||
use js::rust::wrappers::{JS_GetProperty, JS_WrapObject};
|
||||
use js::rust::{HandleObject, MutableHandleObject, Runtime};
|
||||
use js::rust::{MutableHandleObject, Runtime};
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::WindowBinding::Window_Binding::WindowMethods;
|
||||
use crate::dom::bindings::error::{report_pending_exception, Error, Fallible};
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::bindings::reflector::DomObject;
|
||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||
use crate::dom::bindings::settings_stack::{AutoEntryScript, AutoIncumbentScript};
|
||||
use crate::dom::bindings::utils::AsCCharPtrPtr;
|
||||
|
@ -206,21 +205,7 @@ impl CallbackInterface {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) trait ThisReflector {
|
||||
fn jsobject(&self) -> *mut JSObject;
|
||||
}
|
||||
|
||||
impl<T: DomObject> ThisReflector for T {
|
||||
fn jsobject(&self) -> *mut JSObject {
|
||||
self.reflector().get_jsobject().get()
|
||||
}
|
||||
}
|
||||
|
||||
impl ThisReflector for HandleObject<'_> {
|
||||
fn jsobject(&self) -> *mut JSObject {
|
||||
self.get()
|
||||
}
|
||||
}
|
||||
pub(crate) use script_bindings::callback::ThisReflector;
|
||||
|
||||
/// Wraps the reflector for `p` into the realm of `cx`.
|
||||
pub(crate) fn wrap_call_this_object<T: ThisReflector>(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue