diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-10-19 10:35:08 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-19 10:35:08 -0500 |
commit | fe16c1d5c3c9084da0ccb85af599d6ec0f8ab20b (patch) | |
tree | 84fe331eb4af20575050134b234b6c99a252726d /components/script/textinput.rs | |
parent | 07e9794306d597afe5d90d192fd32a99572c3cc3 (diff) | |
parent | e8e2d0a4b24475b018dbc7e59ea46fdceaf20815 (diff) | |
download | servo-fe16c1d5c3c9084da0ccb85af599d6ec0f8ab20b.tar.gz servo-fe16c1d5c3c9084da0ccb85af599d6ec0f8ab20b.zip |
Auto merge of #18809 - Eijebong:bitflags, r=nox
Update bitflags to 1.0 in every servo crate
It still needs dependencies update to remove all the other bitflags
versions.
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes do not require tests because it's a dependency update
<!-- 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/18809)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/textinput.rs')
-rw-r--r-- | components/script/textinput.rs | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/components/script/textinput.rs b/components/script/textinput.rs index 3c533964b7d..bfc34c9d5a6 100644 --- a/components/script/textinput.rs +++ b/components/script/textinput.rs @@ -7,7 +7,6 @@ use clipboard_provider::ClipboardProvider; use dom::bindings::str::DOMString; use dom::keyboardevent::KeyboardEvent; -use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER}; use msg::constellation_msg::{Key, KeyModifiers}; use std::borrow::ToOwned; use std::cmp::{max, min}; @@ -114,12 +113,12 @@ pub enum Direction { /// i.e. cmd on Mac OS or ctrl on other platforms. #[cfg(target_os = "macos")] fn is_control_key(mods: KeyModifiers) -> bool { - mods.contains(SUPER) && !mods.contains(CONTROL | ALT) + mods.contains(KeyModifiers::SUPER) && !mods.contains(KeyModifiers::CONTROL | KeyModifiers::ALT) } #[cfg(not(target_os = "macos"))] fn is_control_key(mods: KeyModifiers) -> bool { - mods.contains(CONTROL) && !mods.contains(SUPER | ALT) + mods.contains(KeyModifiers::CONTROL) && !mods.contains(KeyModifiers::SUPER | KeyModifiers::ALT) } /// The length in bytes of the first n characters in a UTF-8 string. @@ -585,31 +584,36 @@ impl<T: ClipboardProvider> TextInput<T> { printable: Option<char>, key: Key, mods: KeyModifiers) -> KeyReaction { - let maybe_select = if mods.contains(SHIFT) { Selection::Selected } else { Selection::NotSelected }; + let maybe_select = if mods.contains(KeyModifiers::SHIFT) { + Selection::Selected + } else { + Selection::NotSelected + }; + match (printable, key) { - (_, Key::B) if mods.contains(CONTROL | ALT) => { + (_, Key::B) if mods.contains(KeyModifiers::CONTROL | KeyModifiers::ALT) => { self.adjust_horizontal_by_word(Direction::Backward, maybe_select); KeyReaction::RedrawSelection }, - (_, Key::F) if mods.contains(CONTROL | ALT) => { + (_, Key::F) if mods.contains(KeyModifiers::CONTROL | KeyModifiers::ALT) => { self.adjust_horizontal_by_word(Direction::Forward, maybe_select); KeyReaction::RedrawSelection }, - (_, Key::A) if mods.contains(CONTROL | ALT) => { + (_, Key::A) if mods.contains(KeyModifiers::CONTROL | KeyModifiers::ALT) => { self.adjust_horizontal_to_line_end(Direction::Backward, maybe_select); KeyReaction::RedrawSelection }, - (_, Key::E) if mods.contains(CONTROL | ALT) => { + (_, Key::E) if mods.contains(KeyModifiers::CONTROL | KeyModifiers::ALT) => { self.adjust_horizontal_to_line_end(Direction::Forward, maybe_select); KeyReaction::RedrawSelection }, #[cfg(target_os = "macos")] - (None, Key::A) if mods == CONTROL => { + (None, Key::A) if mods == KeyModifiers::CONTROL => { self.adjust_horizontal_to_line_end(Direction::Backward, maybe_select); KeyReaction::RedrawSelection }, #[cfg(target_os = "macos")] - (None, Key::E) if mods == CONTROL => { + (None, Key::E) if mods == KeyModifiers::CONTROL => { self.adjust_horizontal_to_line_end(Direction::Forward, maybe_select); KeyReaction::RedrawSelection }, @@ -641,30 +645,30 @@ impl<T: ClipboardProvider> TextInput<T> { KeyReaction::DispatchInput }, #[cfg(target_os = "macos")] - (None, Key::Left) if mods.contains(SUPER) => { + (None, Key::Left) if mods.contains(KeyModifiers::SUPER) => { self.adjust_horizontal_to_line_end(Direction::Backward, maybe_select); KeyReaction::RedrawSelection }, #[cfg(target_os = "macos")] - (None, Key::Right) if mods.contains(SUPER) => { + (None, Key::Right) if mods.contains(KeyModifiers::SUPER) => { self.adjust_horizontal_to_line_end(Direction::Forward, maybe_select); KeyReaction::RedrawSelection }, #[cfg(target_os = "macos")] - (None, Key::Up) if mods.contains(SUPER) => { + (None, Key::Up) if mods.contains(KeyModifiers::SUPER) => { self.adjust_horizontal_to_limit(Direction::Backward, maybe_select); KeyReaction::RedrawSelection }, #[cfg(target_os = "macos")] - (None, Key::Down) if mods.contains(SUPER) => { + (None, Key::Down) if mods.contains(KeyModifiers::SUPER) => { self.adjust_horizontal_to_limit(Direction::Forward, maybe_select); KeyReaction::RedrawSelection }, - (None, Key::Left) if mods.contains(ALT) => { + (None, Key::Left) if mods.contains(KeyModifiers::ALT) => { self.adjust_horizontal_by_word(Direction::Backward, maybe_select); KeyReaction::RedrawSelection }, - (None, Key::Right) if mods.contains(ALT) => { + (None, Key::Right) if mods.contains(KeyModifiers::ALT) => { self.adjust_horizontal_by_word(Direction::Forward, maybe_select); KeyReaction::RedrawSelection }, |