aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/activation.rs
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2014-11-16 03:17:54 +0530
committerManish Goregaokar <manishsmail@gmail.com>2014-12-05 18:32:11 -0800
commite2376a64bfc9e381871bfe569e259c0e22a81a0a (patch)
tree4da52ec84ab3b78457678f2e9aaaf9e9e0b3662a /components/script/dom/activation.rs
parent7d51a543d8d04f9603ceb00d21faa298dda8b6c4 (diff)
downloadservo-e2376a64bfc9e381871bfe569e259c0e22a81a0a.tar.gz
servo-e2376a64bfc9e381871bfe569e259c0e22a81a0a.zip
Add stub Activatable trait
Diffstat (limited to 'components/script/dom/activation.rs')
-rw-r--r--components/script/dom/activation.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/components/script/dom/activation.rs b/components/script/dom/activation.rs
new file mode 100644
index 00000000000..cb803d67ba1
--- /dev/null
+++ b/components/script/dom/activation.rs
@@ -0,0 +1,27 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * 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/. */
+
+use dom::bindings::codegen::InheritTypes::HTMLInputElementCast;
+use dom::bindings::js::JSRef;
+use dom::element::HTMLInputElementTypeId;
+use dom::htmlinputelement::HTMLInputElement;
+use dom::node::{ElementNodeTypeId, Node, NodeHelpers};
+
+pub trait Activatable {}
+
+
+/// Obtain an Activatable instance for a given Node-derived object,
+/// if it is activatable
+pub fn activation_vtable_for<'a>(node: &'a JSRef<'a, Node>) -> Option<&'a Activatable + 'a> {
+ match node.type_id() {
+ ElementNodeTypeId(HTMLInputElementTypeId) => {
+ let _element: &'a JSRef<'a, HTMLInputElement> = HTMLInputElementCast::to_borrowed_ref(node).unwrap();
+ // Some(element as &'a VirtualMethods + 'a)
+ None
+ },
+ _ => {
+ None
+ }
+ }
+}