mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
commit
462940fc2a
14 changed files with 162 additions and 87 deletions
|
@ -5220,7 +5220,7 @@ class GlobalGenRoots():
|
|||
descriptors = config.getDescriptors(register=True, isCallback=False)
|
||||
allprotos = [CGGeneric("#![allow(unused_imports)]\n"),
|
||||
CGGeneric("use dom::types::*;\n"),
|
||||
CGGeneric("use dom::bindings::js::{JS, JSRef, Temporary};\n"),
|
||||
CGGeneric("use dom::bindings::js::{JS, JSRef, LayoutJS, Temporary};\n"),
|
||||
CGGeneric("use dom::bindings::trace::JSTraceable;\n"),
|
||||
CGGeneric("use dom::bindings::utils::Reflectable;\n"),
|
||||
CGGeneric("use js::jsapi::JSTracer;\n\n"),
|
||||
|
@ -5279,6 +5279,17 @@ pub trait ${castTraitName} : Sized {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
#[allow(unrooted_must_root)]
|
||||
fn to_layout_js<T: ${toBound}+Reflectable>(base: &LayoutJS<T>) -> Option<LayoutJS<Self>> {
|
||||
unsafe {
|
||||
match (*base.unsafe_get()).${checkFn}() {
|
||||
true => Some(base.transmute_copy()),
|
||||
false => None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn from_ref<'a, T: ${fromBound}+Reflectable>(derived: JSRef<'a, T>) -> JSRef<'a, Self> {
|
||||
unsafe { derived.transmute() }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue