mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
feat: support pre-edit text display for IME (#35535)
* feat: support pre-edit text display for IME Signed-off-by: DK Liao <dklassic@gmail.com> * enable ime by show_ime Signed-off-by: DK Liao <dklassic@gmail.com> --------- Signed-off-by: DK Liao <dklassic@gmail.com>
This commit is contained in:
parent
42e873e9d9
commit
720bc725b0
6 changed files with 91 additions and 4 deletions
|
@ -2652,8 +2652,6 @@ impl VirtualMethods for HTMLInputElement {
|
|||
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
|
||||
|
@ -2661,6 +2659,12 @@ impl VirtualMethods for HTMLInputElement {
|
|||
.borrow_mut()
|
||||
.handle_compositionend(compositionevent);
|
||||
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
|
||||
} else if event.type_() == atom!("compositionupdate") {
|
||||
let _ = self
|
||||
.textinput
|
||||
.borrow_mut()
|
||||
.handle_compositionupdate(compositionevent);
|
||||
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
|
||||
}
|
||||
event.mark_as_handled();
|
||||
}
|
||||
|
|
|
@ -668,8 +668,6 @@ impl VirtualMethods for HTMLTextAreaElement {
|
|||
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
|
||||
|
@ -677,6 +675,12 @@ impl VirtualMethods for HTMLTextAreaElement {
|
|||
.borrow_mut()
|
||||
.handle_compositionend(compositionevent);
|
||||
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
|
||||
} else if event.type_() == atom!("compositionupdate") {
|
||||
let _ = self
|
||||
.textinput
|
||||
.borrow_mut()
|
||||
.handle_compositionupdate(compositionevent);
|
||||
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
|
||||
}
|
||||
event.mark_as_handled();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue