diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-11-20 03:32:25 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-20 03:32:25 -0500 |
commit | 98527ddb8cd03db965c8b78f1b01095623ed9702 (patch) | |
tree | af93eac897780b7d6fe6918b0abc6537f7472846 /components/script/dom/htmltextareaelement.rs | |
parent | f1dd31f70440fa9c7a40525bd1e03eede568f74d (diff) | |
parent | b936fea79de985213c053e67f77458b37f4b2995 (diff) | |
download | servo-98527ddb8cd03db965c8b78f1b01095623ed9702.tar.gz servo-98527ddb8cd03db965c8b78f1b01095623ed9702.zip |
Auto merge of #22224 - pyfisch:composition-webdriver, r=nox
Forward WebDriver CompositionEvent
Dispatch composition events in JS.
Insert characters from composition events to text input.
CompositionEvents currently can only be
created by WebDriver and not by embedders.
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).
<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22224)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/htmltextareaelement.rs')
-rwxr-xr-x | components/script/dom/htmltextareaelement.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs index 57d44baa290..9116b26b575 100755 --- a/components/script/dom/htmltextareaelement.rs +++ b/components/script/dom/htmltextareaelement.rs @@ -13,6 +13,7 @@ use crate::dom::bindings::error::ErrorResult; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::root::{DomRoot, LayoutDom, MutNullableDom}; use crate::dom::bindings::str::DOMString; +use crate::dom::compositionevent::CompositionEvent; use crate::dom::document::Document; use crate::dom::element::RawLayoutElementHelpers; use crate::dom::element::{AttributeMutation, Element}; @@ -576,6 +577,22 @@ impl VirtualMethods for HTMLTextAreaElement { &window, ); } + } else if event.type_() == atom!("compositionstart") || + event.type_() == atom!("compositionupdate") || + event.type_() == atom!("compositionend") + { + // 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(); + } } } |