mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #21603 - chansuke:format_webdriver_server, r=jdm
Format component of webdriver_sever <!-- Please describe your changes on the following line: --> Format `webdriver_server` with `rustfmt components/webdriver_server/*.rs`. --- <!-- 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 #21373. - [x] These changes do not require tests because they format the code only. <!-- 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/21603) <!-- Reviewable:end -->
This commit is contained in:
commit
04929fe527
2 changed files with 465 additions and 224 deletions
|
@ -4,7 +4,6 @@
|
|||
|
||||
use msg::constellation_msg::{Key, KeyState, KeyModifiers};
|
||||
|
||||
|
||||
/// Takes a character and returns an Option containing a tuple of the
|
||||
/// corresponding keycode and whether shift is required. This is
|
||||
/// currently pretty much ascii-only and the webdriver spec isn't
|
||||
|
@ -164,7 +163,7 @@ fn key_from_char(key_string: &char) -> Option<(Key, bool)> {
|
|||
'\u{E03C}' => Some((Key::F12, false)),
|
||||
'\u{E03D}' => None,
|
||||
'\u{E040}' => None,
|
||||
_ => None
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,7 +171,8 @@ pub fn keycodes_to_keys(key_codes: &str) -> Result<Vec<(Key, KeyModifiers, KeySt
|
|||
let mut rv = vec![];
|
||||
|
||||
for char_code in key_codes.chars() {
|
||||
let (key, with_shift) = key_from_char(&char_code).ok_or(format!("Unsupported character code {}", char_code))?;
|
||||
let (key, with_shift) =
|
||||
key_from_char(&char_code).ok_or(format!("Unsupported character code {}", char_code))?;
|
||||
let modifiers = if with_shift {
|
||||
KeyModifiers::SHIFT
|
||||
} else {
|
||||
|
@ -180,6 +180,6 @@ pub fn keycodes_to_keys(key_codes: &str) -> Result<Vec<(Key, KeyModifiers, KeySt
|
|||
};
|
||||
rv.push((key, modifiers, KeyState::Pressed));
|
||||
rv.push((key, modifiers, KeyState::Released));
|
||||
};
|
||||
}
|
||||
Ok(rv)
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue