diff options
author | Gecko Backout <gecko-backout@mozilla.org> | 2017-10-19 21:26:51 +0000 |
---|---|---|
committer | moz-servo-sync <developer-services+moz-servo-sync@mozilla.org> | 2017-10-19 21:26:51 +0000 |
commit | 11c64178d86979e8d50f11cff66c2b0e8fe666c1 (patch) | |
tree | 083c71bdf8216ca56d38d509e5b2988eb18da5ca /components/script/textinput.rs | |
parent | fe16c1d5c3c9084da0ccb85af599d6ec0f8ab20b (diff) | |
download | servo-11c64178d86979e8d50f11cff66c2b0e8fe666c1.tar.gz servo-11c64178d86979e8d50f11cff66c2b0e8fe666c1.zip |
Backed out changeset e64e659c077d: servo PR #18809 and revendor for reftest failures, e.g. in layout/reftests/bugs/392435-1.html. r=backout on a CLOSED TREE
Backs out https://github.com/servo/servo/pull/18809
Diffstat (limited to 'components/script/textinput.rs')
-rw-r--r-- | components/script/textinput.rs | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/components/script/textinput.rs b/components/script/textinput.rs index bfc34c9d5a6..3c533964b7d 100644 --- a/components/script/textinput.rs +++ b/components/script/textinput.rs @@ -7,6 +7,7 @@ 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}; @@ -113,12 +114,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(KeyModifiers::SUPER) && !mods.contains(KeyModifiers::CONTROL | KeyModifiers::ALT) + mods.contains(SUPER) && !mods.contains(CONTROL | ALT) } #[cfg(not(target_os = "macos"))] fn is_control_key(mods: KeyModifiers) -> bool { - mods.contains(KeyModifiers::CONTROL) && !mods.contains(KeyModifiers::SUPER | KeyModifiers::ALT) + mods.contains(CONTROL) && !mods.contains(SUPER | ALT) } /// The length in bytes of the first n characters in a UTF-8 string. @@ -584,36 +585,31 @@ impl<T: ClipboardProvider> TextInput<T> { printable: Option<char>, key: Key, mods: KeyModifiers) -> KeyReaction { - let maybe_select = if mods.contains(KeyModifiers::SHIFT) { - Selection::Selected - } else { - Selection::NotSelected - }; - + let maybe_select = if mods.contains(SHIFT) { Selection::Selected } else { Selection::NotSelected }; match (printable, key) { - (_, Key::B) if mods.contains(KeyModifiers::CONTROL | KeyModifiers::ALT) => { + (_, Key::B) if mods.contains(CONTROL | ALT) => { self.adjust_horizontal_by_word(Direction::Backward, maybe_select); KeyReaction::RedrawSelection }, - (_, Key::F) if mods.contains(KeyModifiers::CONTROL | KeyModifiers::ALT) => { + (_, Key::F) if mods.contains(CONTROL | ALT) => { self.adjust_horizontal_by_word(Direction::Forward, maybe_select); KeyReaction::RedrawSelection }, - (_, Key::A) if mods.contains(KeyModifiers::CONTROL | KeyModifiers::ALT) => { + (_, Key::A) if mods.contains(CONTROL | ALT) => { self.adjust_horizontal_to_line_end(Direction::Backward, maybe_select); KeyReaction::RedrawSelection }, - (_, Key::E) if mods.contains(KeyModifiers::CONTROL | KeyModifiers::ALT) => { + (_, Key::E) if mods.contains(CONTROL | ALT) => { self.adjust_horizontal_to_line_end(Direction::Forward, maybe_select); KeyReaction::RedrawSelection }, #[cfg(target_os = "macos")] - (None, Key::A) if mods == KeyModifiers::CONTROL => { + (None, Key::A) if mods == CONTROL => { self.adjust_horizontal_to_line_end(Direction::Backward, maybe_select); KeyReaction::RedrawSelection }, #[cfg(target_os = "macos")] - (None, Key::E) if mods == KeyModifiers::CONTROL => { + (None, Key::E) if mods == CONTROL => { self.adjust_horizontal_to_line_end(Direction::Forward, maybe_select); KeyReaction::RedrawSelection }, @@ -645,30 +641,30 @@ impl<T: ClipboardProvider> TextInput<T> { KeyReaction::DispatchInput }, #[cfg(target_os = "macos")] - (None, Key::Left) if mods.contains(KeyModifiers::SUPER) => { + (None, Key::Left) if mods.contains(SUPER) => { self.adjust_horizontal_to_line_end(Direction::Backward, maybe_select); KeyReaction::RedrawSelection }, #[cfg(target_os = "macos")] - (None, Key::Right) if mods.contains(KeyModifiers::SUPER) => { + (None, Key::Right) if mods.contains(SUPER) => { self.adjust_horizontal_to_line_end(Direction::Forward, maybe_select); KeyReaction::RedrawSelection }, #[cfg(target_os = "macos")] - (None, Key::Up) if mods.contains(KeyModifiers::SUPER) => { + (None, Key::Up) if mods.contains(SUPER) => { self.adjust_horizontal_to_limit(Direction::Backward, maybe_select); KeyReaction::RedrawSelection }, #[cfg(target_os = "macos")] - (None, Key::Down) if mods.contains(KeyModifiers::SUPER) => { + (None, Key::Down) if mods.contains(SUPER) => { self.adjust_horizontal_to_limit(Direction::Forward, maybe_select); KeyReaction::RedrawSelection }, - (None, Key::Left) if mods.contains(KeyModifiers::ALT) => { + (None, Key::Left) if mods.contains(ALT) => { self.adjust_horizontal_by_word(Direction::Backward, maybe_select); KeyReaction::RedrawSelection }, - (None, Key::Right) if mods.contains(KeyModifiers::ALT) => { + (None, Key::Right) if mods.contains(ALT) => { self.adjust_horizontal_by_word(Direction::Forward, maybe_select); KeyReaction::RedrawSelection }, |