diff options
author | Manish Goregaokar <manishsmail@gmail.com> | 2014-11-16 03:17:54 +0530 |
---|---|---|
committer | Manish Goregaokar <manishsmail@gmail.com> | 2014-12-05 18:32:11 -0800 |
commit | e2376a64bfc9e381871bfe569e259c0e22a81a0a (patch) | |
tree | 4da52ec84ab3b78457678f2e9aaaf9e9e0b3662a /components | |
parent | 7d51a543d8d04f9603ceb00d21faa298dda8b6c4 (diff) | |
download | servo-e2376a64bfc9e381871bfe569e259c0e22a81a0a.tar.gz servo-e2376a64bfc9e381871bfe569e259c0e22a81a0a.zip |
Add stub Activatable trait
Diffstat (limited to 'components')
-rw-r--r-- | components/script/dom/activation.rs | 27 | ||||
-rw-r--r-- | components/script/lib.rs | 1 |
2 files changed, 28 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 + } + } +} diff --git a/components/script/lib.rs b/components/script/lib.rs index 6edcb72ae45..de1ddbe5987 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -82,6 +82,7 @@ pub mod dom { #[path="bindings/codegen/InterfaceTypes.rs"] pub mod types; + pub mod activation; pub mod attr; pub mod blob; pub mod browsercontext; |