Use keyboard-types crate

Have embedders send DOM keys to servo and use a strongly typed KeyboardEvent
from the W3C UI Events spec. All keyboard handling now uses the new types.

Introduce a ShortcutMatcher to recognize key bindings. Shortcuts are now
recognized in a uniform way.

Updated the winit port.
Updated webdriver integration.

part of #20331
This commit is contained in:
Pyfisch 2018-10-06 17:35:45 +02:00
parent 76ddbe4d7a
commit 0ccaa7e1a9
35 changed files with 762 additions and 1604 deletions

View file

@ -12,6 +12,7 @@ path = "lib.rs"
servo = [
"hyper",
"hyper_serde",
"keyboard-types",
"mozjs",
"serde",
"serde_bytes",
@ -30,6 +31,7 @@ euclid = "0.19"
hashglobe = { path = "../hashglobe" }
hyper = { version = "0.10", optional = true }
hyper_serde = { version = "0.8", optional = true }
keyboard-types = {version = "0.4.0-serde", features = ["serde"], optional = true}
mozjs = { version = "0.9.0", optional = true }
selectors = { path = "../selectors" }
serde = { version = "1.0.27", optional = true }

View file

@ -52,6 +52,8 @@ extern crate hyper;
#[cfg(feature = "servo")]
extern crate hyper_serde;
#[cfg(feature = "servo")]
extern crate keyboard_types;
#[cfg(feature = "servo")]
extern crate mozjs as js;
extern crate selectors;
#[cfg(feature = "servo")]
@ -957,6 +959,19 @@ malloc_size_of_is_0!(webrender_api::StickyOffsetBounds);
#[cfg(feature = "webrender_api")]
malloc_size_of_is_0!(webrender_api::TransformStyle);
#[cfg(feature = "servo")]
impl MallocSizeOf for keyboard_types::Key {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
match self {
keyboard_types::Key::Character(ref s) => s.size_of(ops),
_ => 0,
}
}
}
#[cfg(feature = "servo")]
malloc_size_of_is_0!(keyboard_types::Modifiers);
#[cfg(feature = "servo")]
impl MallocSizeOf for xml5ever::QualName {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {