aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen/CodegenRust.py
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-01-31 16:24:48 -0700
committerbors-servo <metajack+bors@gmail.com>2015-01-31 16:24:48 -0700
commit462940fc2a2ba76794f37d9a6ac5af8da454aa66 (patch)
treee8b1a97ef339c81d00bd859caabdd2005c7506cd /components/script/dom/bindings/codegen/CodegenRust.py
parent6d06a0075777d70c5d5dd99105210a356fabd2fb (diff)
parent2cca095481efb0a62de6d4584b589d89ffab35c0 (diff)
downloadservo-462940fc2a2ba76794f37d9a6ac5af8da454aa66.tar.gz
servo-462940fc2a2ba76794f37d9a6ac5af8da454aa66.zip
auto merge of #4613 : saneyuki/servo/layoutjs, r=jdm
#4571
Diffstat (limited to 'components/script/dom/bindings/codegen/CodegenRust.py')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 6fa1b75fcd4..a7f73e67494 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -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"),
@@ -5280,6 +5280,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() }
}