diff options
Diffstat (limited to 'components/script/dom/htmlinputelement.rs')
-rwxr-xr-x | components/script/dom/htmlinputelement.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index d7110183c4a..67473fce92d 100755 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -17,6 +17,7 @@ use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom, RootedReference}; use crate::dom::bindings::str::DOMString; +use crate::dom::compositionevent::CompositionEvent; use crate::dom::document::Document; use crate::dom::element::{ AttributeMutation, Element, LayoutElementHelpers, RawLayoutElementHelpers, @@ -1526,6 +1527,23 @@ impl VirtualMethods for HTMLInputElement { &window, ); } + } else if (event.type_() == atom!("compositionstart") || + event.type_() == atom!("compositionupdate") || + event.type_() == atom!("compositionend")) && + self.input_type().is_textual_or_password() + { + // TODO: Update DOM on start and continue + // and generally do proper CompositionEvent handling. + if let Some(compositionevent) = event.downcast::<CompositionEvent>() { + if event.type_() == atom!("compositionend") { + let _ = self + .textinput + .borrow_mut() + .handle_compositionend(compositionevent); + self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage); + } + event.mark_as_handled(); + } } } } |