diff options
Diffstat (limited to 'components/script/dom/htmlinputelement.rs')
-rwxr-xr-x | components/script/dom/htmlinputelement.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 5618b366702..ab7d55d5b9a 100755 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -40,6 +40,7 @@ use dom::virtualmethods::VirtualMethods; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; use mime_guess; +use msg::constellation_msg::InputMethodType; use net_traits::{CoreResourceMsg, IpcSend}; use net_traits::blob_url_store::get_blob_origin; use net_traits::filemanager_thread::{FileManagerThreadMsg, FilterPattern}; @@ -137,6 +138,25 @@ impl InputType { InputType::Week => "week", } } + + pub fn as_ime_type(&self) -> Option<InputMethodType> { + match *self { + InputType::Color => Some(InputMethodType::Color), + InputType::Date => Some(InputMethodType::Date), + InputType::DatetimeLocal => Some(InputMethodType::DatetimeLocal), + InputType::Email => Some(InputMethodType::Email), + InputType::Month => Some(InputMethodType::Month), + InputType::Number => Some(InputMethodType::Number), + InputType::Password => Some(InputMethodType::Password), + InputType::Search => Some(InputMethodType::Search), + InputType::Tel => Some(InputMethodType::Tel), + InputType::Text => Some(InputMethodType::Text), + InputType::Time => Some(InputMethodType::Time), + InputType::Url => Some(InputMethodType::Url), + InputType::Week => Some(InputMethodType::Week), + _ => None, + } + } } impl<'a> From<&'a Atom> for InputType { |