mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Bump bitflags to 1.0 in every servo crate
This commit is contained in:
parent
b6475cf433
commit
29b4eec141
131 changed files with 1591 additions and 1580 deletions
|
@ -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
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue