mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Unfocus input when virtual keyboard is dismissed
This commit is contained in:
parent
967a70bd60
commit
6252d36a14
11 changed files with 91 additions and 2 deletions
|
@ -1722,6 +1722,13 @@ impl Document {
|
|||
self.window.reflow(ReflowGoal::Full, ReflowReason::KeyEvent);
|
||||
}
|
||||
|
||||
pub fn ime_dismissed(&self) {
|
||||
self.request_focus(
|
||||
self.GetBody().as_ref().map(|e| &*e.upcast()),
|
||||
FocusType::Element,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn dispatch_composition_event(
|
||||
&self,
|
||||
composition_event: ::keyboard_types::CompositionEvent,
|
||||
|
|
|
@ -129,8 +129,8 @@ use profile_traits::time::{self as profile_time, profile, ProfilerCategory};
|
|||
use script_layout_interface::message::{self, LayoutThreadInit, Msg, ReflowGoal};
|
||||
use script_traits::webdriver_msg::WebDriverScriptCommand;
|
||||
use script_traits::CompositorEvent::{
|
||||
CompositionEvent, KeyboardEvent, MouseButtonEvent, MouseMoveEvent, ResizeEvent, TouchEvent,
|
||||
WheelEvent,
|
||||
CompositionEvent, IMEDismissedEvent, KeyboardEvent, MouseButtonEvent, MouseMoveEvent,
|
||||
ResizeEvent, TouchEvent, WheelEvent,
|
||||
};
|
||||
use script_traits::{
|
||||
AnimationTickType, CompositorEvent, ConstellationControlMsg, DiscardBrowsingContext,
|
||||
|
@ -3583,6 +3583,14 @@ impl ScriptThread {
|
|||
document.dispatch_key_event(key_event);
|
||||
},
|
||||
|
||||
IMEDismissedEvent => {
|
||||
let document = match self.documents.borrow().find_document(pipeline_id) {
|
||||
Some(document) => document,
|
||||
None => return warn!("Message sent to closed pipeline {}.", pipeline_id),
|
||||
};
|
||||
document.ime_dismissed();
|
||||
},
|
||||
|
||||
CompositionEvent(composition_event) => {
|
||||
let document = match self.documents.borrow().find_document(pipeline_id) {
|
||||
Some(document) => document,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue