aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings
diff options
context:
space:
mode:
authorAnthony Ramine <nox@nox.paris>2020-03-31 22:06:26 +0200
committerAnthony Ramine <nox@nox.paris>2020-03-31 22:06:40 +0200
commitf014da9565a491455c8cf0570a4bde9ec6328c35 (patch)
tree988013ec46d959aa220ecdf3850a56c44cccc5d4 /components/script/dom/bindings
parent9c8540af5c37c7df2d4c0dff27ca76e36a6e6c02 (diff)
downloadservo-f014da9565a491455c8cf0570a4bde9ec6328c35.tar.gz
servo-f014da9565a491455c8cf0570a4bde9ec6328c35.zip
Introduce LayoutDom::is
Just like Castable::is.
Diffstat (limited to 'components/script/dom/bindings')
-rw-r--r--components/script/dom/bindings/root.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs
index 9f571f1379c..4f4d376e951 100644
--- a/components/script/dom/bindings/root.rs
+++ b/components/script/dom/bindings/root.rs
@@ -441,6 +441,15 @@ where
debug_assert!(thread_state::get().is_layout());
self.value.downcast::<U>().map(|value| LayoutDom { value })
}
+
+ /// Returns whether this inner object is a U.
+ pub fn is<U>(&self) -> bool
+ where
+ U: DerivedFrom<T>,
+ {
+ debug_assert!(thread_state::get().is_layout());
+ self.value.is::<U>()
+ }
}
impl<T> LayoutDom<'_, T>