mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Add stub Activatable trait
This commit is contained in:
parent
7d51a543d8
commit
e2376a64bf
2 changed files with 28 additions and 0 deletions
27
components/script/dom/activation.rs
Normal file
27
components/script/dom/activation.rs
Normal file
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -82,6 +82,7 @@ pub mod dom {
|
||||||
#[path="bindings/codegen/InterfaceTypes.rs"]
|
#[path="bindings/codegen/InterfaceTypes.rs"]
|
||||||
pub mod types;
|
pub mod types;
|
||||||
|
|
||||||
|
pub mod activation;
|
||||||
pub mod attr;
|
pub mod attr;
|
||||||
pub mod blob;
|
pub mod blob;
|
||||||
pub mod browsercontext;
|
pub mod browsercontext;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue