mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
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.
This commit is contained in:
parent
1ac6f435c8
commit
b936fea79d
12 changed files with 118 additions and 26 deletions
|
@ -17,7 +17,7 @@ use euclid::TypedSize2D;
|
|||
use hyper::Method;
|
||||
use image::{DynamicImage, ImageFormat, RgbImage};
|
||||
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
||||
use keyboard_types::webdriver::{send_keys, Event as KeyEvent};
|
||||
use keyboard_types::webdriver::send_keys;
|
||||
use msg::constellation_msg::{BrowsingContextId, TopLevelBrowsingContextId, TraversalDirection};
|
||||
use net_traits::image::base::PixelFormat;
|
||||
use regex::Captures;
|
||||
|
@ -1036,19 +1036,12 @@ impl Handler {
|
|||
))
|
||||
})?;
|
||||
|
||||
// FIXME: Don't discard composition events.
|
||||
let keys = send_keys(&keys.text)
|
||||
.drain(..)
|
||||
.filter_map(|event| match event {
|
||||
KeyEvent::Keyboard(v) => Some(v),
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
let input_events = send_keys(&keys.text);
|
||||
|
||||
// TODO: there's a race condition caused by the focus command and the
|
||||
// send keys command being two separate messages,
|
||||
// so the constellation may have changed state between them.
|
||||
let cmd_msg = WebDriverCommandMsg::SendKeys(browsing_context_id, keys);
|
||||
let cmd_msg = WebDriverCommandMsg::SendKeys(browsing_context_id, input_events);
|
||||
self.constellation_chan
|
||||
.send(ConstellationMsg::WebDriverCommand(cmd_msg))
|
||||
.unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue