mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
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
This commit is contained in:
parent
fe16c1d5c3
commit
11c64178d8
142 changed files with 1635 additions and 1685 deletions
|
@ -417,13 +417,13 @@ full_cef_class_impl! {
|
|||
};
|
||||
let mut key_modifiers = KeyModifiers::empty();
|
||||
if (*event).modifiers & EVENTFLAG_SHIFT_DOWN as u32 != 0 {
|
||||
key_modifiers = key_modifiers | constellation_msg::KeyModifiers::SHIFT;
|
||||
key_modifiers = key_modifiers | constellation_msg::SHIFT;
|
||||
}
|
||||
if (*event).modifiers & EVENTFLAG_CONTROL_DOWN as u32 != 0 {
|
||||
key_modifiers = key_modifiers | constellation_msg::KeyModifiers::CONTROL;
|
||||
key_modifiers = key_modifiers | constellation_msg::CONTROL;
|
||||
}
|
||||
if (*event).modifiers & EVENTFLAG_ALT_DOWN as u32 != 0 {
|
||||
key_modifiers = key_modifiers | constellation_msg::KeyModifiers::ALT;
|
||||
key_modifiers = key_modifiers | constellation_msg::ALT;
|
||||
}
|
||||
let ch = char::from_u32((*event).character as u32);
|
||||
this.downcast().send_window_event(WindowEvent::KeyEvent(ch, key, key_state, key_modifiers))
|
||||
|
|
|
@ -114,9 +114,11 @@ use style::invalidation::element::restyle_hints;
|
|||
use style::media_queries::{Device, MediaList, parse_media_query_list};
|
||||
use style::parser::{Parse, ParserContext, self};
|
||||
use style::properties::{CascadeFlags, ComputedValues, DeclarationSource, Importance};
|
||||
use style::properties::{LonghandId, LonghandIdSet, PropertyDeclaration, PropertyDeclarationBlock, PropertyId};
|
||||
use style::properties::{IS_FIELDSET_CONTENT, IS_LINK, IS_VISITED_LINK, LonghandIdSet};
|
||||
use style::properties::{LonghandId, PropertyDeclaration, PropertyDeclarationBlock, PropertyId};
|
||||
use style::properties::{PropertyDeclarationId, ShorthandId};
|
||||
use style::properties::{SourcePropertyDeclaration, StyleBuilder};
|
||||
use style::properties::{SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP, SourcePropertyDeclaration, StyleBuilder};
|
||||
use style::properties::PROHIBIT_DISPLAY_CONTENTS;
|
||||
use style::properties::animated_properties::AnimationValue;
|
||||
use style::properties::animated_properties::compare_property_priority;
|
||||
use style::properties::parse_one_declaration_into;
|
||||
|
@ -138,14 +140,14 @@ use style::thread_state;
|
|||
use style::timer::Timer;
|
||||
use style::traversal::DomTraversal;
|
||||
use style::traversal::resolve_style;
|
||||
use style::traversal_flags::{self, TraversalFlags};
|
||||
use style::traversal_flags::{TraversalFlags, self};
|
||||
use style::values::{CustomIdent, KeyframesName};
|
||||
use style::values::animated::{Animate, Procedure, ToAnimatedZero};
|
||||
use style::values::computed::{Context, ToComputedValue};
|
||||
use style::values::distance::ComputeSquaredDistance;
|
||||
use style::values::specified;
|
||||
use style::values::specified::gecko::IntersectionObserverRootMargin;
|
||||
use style_traits::{ParsingMode, ToCss};
|
||||
use style_traits::{PARSING_MODE_DEFAULT, ToCss};
|
||||
use super::error_reporter::ErrorReporter;
|
||||
use super::stylesheet_loader::StylesheetLoader;
|
||||
|
||||
|
@ -174,7 +176,7 @@ pub extern "C" fn Servo_Initialize(dummy_url_data: *mut URLExtraData) {
|
|||
};
|
||||
|
||||
// Pretend that we're a Servo Layout thread, to make some assertions happy.
|
||||
thread_state::initialize(thread_state::ThreadState::LAYOUT);
|
||||
thread_state::initialize(thread_state::LAYOUT);
|
||||
|
||||
// Perform some debug-only runtime assertions.
|
||||
restyle_hints::assert_restyle_hints_match();
|
||||
|
@ -189,7 +191,7 @@ pub extern "C" fn Servo_Initialize(dummy_url_data: *mut URLExtraData) {
|
|||
#[no_mangle]
|
||||
pub extern "C" fn Servo_InitializeCooperativeThread() {
|
||||
// Pretend that we're a Servo Layout thread to make some assertions happy.
|
||||
thread_state::initialize(thread_state::ThreadState::LAYOUT);
|
||||
thread_state::initialize(thread_state::LAYOUT);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
@ -259,7 +261,7 @@ fn traverse_subtree(element: GeckoElement,
|
|||
debug!("Traversing subtree from {:?}", element);
|
||||
|
||||
let thread_pool_holder = &*STYLE_THREAD_POOL;
|
||||
let thread_pool = if traversal_flags.contains(TraversalFlags::ParallelTraversal) {
|
||||
let thread_pool = if traversal_flags.contains(traversal_flags::ParallelTraversal) {
|
||||
thread_pool_holder.style_thread_pool.as_ref()
|
||||
} else {
|
||||
None
|
||||
|
@ -289,7 +291,7 @@ pub extern "C" fn Servo_TraverseSubtree(
|
|||
debug!("{:?}", ShowSubtreeData(element.as_node()));
|
||||
// It makes no sense to do an animation restyle when we're styling
|
||||
// newly-inserted content.
|
||||
if !traversal_flags.contains(TraversalFlags::UnstyledOnly) {
|
||||
if !traversal_flags.contains(traversal_flags::UnstyledOnly) {
|
||||
let needs_animation_only_restyle =
|
||||
element.has_animation_only_dirty_descendants() ||
|
||||
element.has_animation_restyle_hints();
|
||||
|
@ -299,7 +301,7 @@ pub extern "C" fn Servo_TraverseSubtree(
|
|||
element.has_animation_only_dirty_descendants());
|
||||
traverse_subtree(element,
|
||||
raw_data,
|
||||
traversal_flags | TraversalFlags::AnimationOnly,
|
||||
traversal_flags | traversal_flags::AnimationOnly,
|
||||
unsafe { &*snapshots });
|
||||
}
|
||||
}
|
||||
|
@ -924,7 +926,7 @@ pub extern "C" fn Servo_Element_IsPrimaryStyleReusedViaRuleNode(element: RawGeck
|
|||
let element = GeckoElement(element);
|
||||
let data = element.borrow_data()
|
||||
.expect("Invoking Servo_Element_IsPrimaryStyleReusedViaRuleNode on unstyled element");
|
||||
data.flags.contains(data::ElementDataFlags::PRIMARY_STYLE_REUSED_VIA_RULE_NODE)
|
||||
data.flags.contains(data::PRIMARY_STYLE_REUSED_VIA_RULE_NODE)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
@ -1814,9 +1816,9 @@ pub extern "C" fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null:
|
|||
let pseudo = PseudoElement::from_anon_box_atom(&atom)
|
||||
.expect("Not an anon box pseudo?");
|
||||
|
||||
let mut cascade_flags = CascadeFlags::SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP;
|
||||
let mut cascade_flags = SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP;
|
||||
if pseudo.is_fieldset_content() {
|
||||
cascade_flags.insert(CascadeFlags::IS_FIELDSET_CONTENT);
|
||||
cascade_flags.insert(IS_FIELDSET_CONTENT);
|
||||
}
|
||||
let metrics = get_metrics_provider_for_product();
|
||||
|
||||
|
@ -2094,26 +2096,26 @@ pub extern "C" fn Servo_ComputedValues_Inherit(
|
|||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_ComputedValues_GetStyleBits(values: ServoStyleContextBorrowed) -> u64 {
|
||||
use style::properties::computed_value_flags::ComputedValueFlags;
|
||||
use style::properties::computed_value_flags::*;
|
||||
// FIXME(emilio): We could do this more efficiently I'm quite sure.
|
||||
let flags = values.flags;
|
||||
let mut result = 0;
|
||||
if flags.contains(ComputedValueFlags::IS_RELEVANT_LINK_VISITED) {
|
||||
if flags.contains(IS_RELEVANT_LINK_VISITED) {
|
||||
result |= structs::NS_STYLE_RELEVANT_LINK_VISITED as u64;
|
||||
}
|
||||
if flags.contains(ComputedValueFlags::HAS_TEXT_DECORATION_LINES) {
|
||||
if flags.contains(HAS_TEXT_DECORATION_LINES) {
|
||||
result |= structs::NS_STYLE_HAS_TEXT_DECORATION_LINES as u64;
|
||||
}
|
||||
if flags.contains(ComputedValueFlags::SHOULD_SUPPRESS_LINEBREAK) {
|
||||
if flags.contains(SHOULD_SUPPRESS_LINEBREAK) {
|
||||
result |= structs::NS_STYLE_SUPPRESS_LINEBREAK as u64;
|
||||
}
|
||||
if flags.contains(ComputedValueFlags::IS_TEXT_COMBINED) {
|
||||
if flags.contains(IS_TEXT_COMBINED) {
|
||||
result |= structs::NS_STYLE_IS_TEXT_COMBINED as u64;
|
||||
}
|
||||
if flags.contains(ComputedValueFlags::IS_IN_PSEUDO_ELEMENT_SUBTREE) {
|
||||
if flags.contains(IS_IN_PSEUDO_ELEMENT_SUBTREE) {
|
||||
result |= structs::NS_STYLE_HAS_PSEUDO_ELEMENT_DATA as u64;
|
||||
}
|
||||
if flags.contains(ComputedValueFlags::IS_IN_DISPLAY_NONE_SUBTREE) {
|
||||
if flags.contains(IS_IN_DISPLAY_NONE_SUBTREE) {
|
||||
result |= structs::NS_STYLE_IN_DISPLAY_NONE_SUBTREE as u64;
|
||||
}
|
||||
result
|
||||
|
@ -2274,7 +2276,7 @@ pub extern "C" fn Servo_ParseEasing(
|
|||
let context = ParserContext::new(Origin::Author,
|
||||
url_data,
|
||||
Some(CssRuleType::Style),
|
||||
ParsingMode::DEFAULT,
|
||||
PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks);
|
||||
let easing = unsafe { (*easing).to_string() };
|
||||
let mut input = ParserInput::new(&easing);
|
||||
|
@ -2675,7 +2677,7 @@ pub extern "C" fn Servo_MediaList_SetText(list: RawServoMediaListBorrowed, text:
|
|||
let mut parser = Parser::new(&mut input);
|
||||
let url_data = unsafe { dummy_url_data() };
|
||||
let context = ParserContext::new_for_cssom(url_data, Some(CssRuleType::Media),
|
||||
ParsingMode::DEFAULT,
|
||||
PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks);
|
||||
write_locked_arc(list, |list: &mut MediaList| {
|
||||
*list = parse_media_query_list(&context, &mut parser, &NullReporter);
|
||||
|
@ -2711,7 +2713,7 @@ pub extern "C" fn Servo_MediaList_AppendMedium(
|
|||
let new_medium = unsafe { new_medium.as_ref().unwrap().as_str_unchecked() };
|
||||
let url_data = unsafe { dummy_url_data() };
|
||||
let context = ParserContext::new_for_cssom(url_data, Some(CssRuleType::Media),
|
||||
ParsingMode::DEFAULT,
|
||||
PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks);
|
||||
write_locked_arc(list, |list: &mut MediaList| {
|
||||
list.append_medium(&context, new_medium);
|
||||
|
@ -2726,7 +2728,7 @@ pub extern "C" fn Servo_MediaList_DeleteMedium(
|
|||
let old_medium = unsafe { old_medium.as_ref().unwrap().as_str_unchecked() };
|
||||
let url_data = unsafe { dummy_url_data() };
|
||||
let context = ParserContext::new_for_cssom(url_data, Some(CssRuleType::Media),
|
||||
ParsingMode::DEFAULT,
|
||||
PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks);
|
||||
write_locked_arc(list, |list: &mut MediaList| list.delete_medium(&context, old_medium))
|
||||
}
|
||||
|
@ -3112,7 +3114,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetBackgroundImage(
|
|||
let url_data = unsafe { RefPtr::from_ptr_ref(&raw_extra_data) };
|
||||
let string = unsafe { (*value).to_string() };
|
||||
let context = ParserContext::new(Origin::Author, url_data,
|
||||
Some(CssRuleType::Style), ParsingMode::DEFAULT,
|
||||
Some(CssRuleType::Style), PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks);
|
||||
if let Ok(mut url) = SpecifiedUrl::parse_from_string(string.into(), &context) {
|
||||
url.build_image_value();
|
||||
|
@ -3133,7 +3135,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetTextDecorationColorOverride(
|
|||
use style::properties::longhands::text_decoration_line;
|
||||
|
||||
let mut decoration = text_decoration_line::computed_value::none;
|
||||
decoration |= text_decoration_line::SpecifiedValue::COLOR_OVERRIDE;
|
||||
decoration |= text_decoration_line::COLOR_OVERRIDE;
|
||||
let decl = PropertyDeclaration::TextDecorationLine(decoration);
|
||||
write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
|
||||
decls.push(decl, Importance::Normal, DeclarationSource::CssOm);
|
||||
|
@ -3173,7 +3175,7 @@ pub extern "C" fn Servo_CSSSupports(cond: *const nsACString) -> bool {
|
|||
ParserContext::new_for_cssom(
|
||||
url_data,
|
||||
Some(CssRuleType::Style),
|
||||
ParsingMode::DEFAULT,
|
||||
PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks,
|
||||
);
|
||||
cond.eval(&context)
|
||||
|
@ -3340,25 +3342,25 @@ pub extern "C" fn Servo_ReparentStyle(
|
|||
|
||||
let mut cascade_flags = CascadeFlags::empty();
|
||||
if style_to_reparent.is_anon_box() {
|
||||
cascade_flags.insert(CascadeFlags::SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP);
|
||||
cascade_flags.insert(SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP);
|
||||
}
|
||||
if let Some(element) = element {
|
||||
if element.is_link() {
|
||||
cascade_flags.insert(CascadeFlags::IS_LINK);
|
||||
cascade_flags.insert(IS_LINK);
|
||||
if element.is_visited_link() &&
|
||||
doc_data.visited_styles_enabled() {
|
||||
cascade_flags.insert(CascadeFlags::IS_VISITED_LINK);
|
||||
cascade_flags.insert(IS_VISITED_LINK);
|
||||
}
|
||||
};
|
||||
|
||||
if element.is_native_anonymous() {
|
||||
cascade_flags.insert(CascadeFlags::PROHIBIT_DISPLAY_CONTENTS);
|
||||
cascade_flags.insert(PROHIBIT_DISPLAY_CONTENTS);
|
||||
}
|
||||
}
|
||||
if let Some(pseudo) = pseudo.as_ref() {
|
||||
cascade_flags.insert(CascadeFlags::PROHIBIT_DISPLAY_CONTENTS);
|
||||
cascade_flags.insert(PROHIBIT_DISPLAY_CONTENTS);
|
||||
if pseudo.is_fieldset_content() {
|
||||
cascade_flags.insert(CascadeFlags::IS_FIELDSET_CONTENT);
|
||||
cascade_flags.insert(IS_FIELDSET_CONTENT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4345,7 +4347,7 @@ pub extern "C" fn Servo_ParseIntersectionObserverRootMargin(
|
|||
Origin::Author,
|
||||
url_data,
|
||||
Some(CssRuleType::Style),
|
||||
ParsingMode::DEFAULT,
|
||||
PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks,
|
||||
);
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ name = "glutin_app"
|
|||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
bitflags = "1.0"
|
||||
bitflags = "0.7"
|
||||
compositing = {path = "../../components/compositing"}
|
||||
euclid = "0.15"
|
||||
gleam = "0.4"
|
||||
|
|
|
@ -20,7 +20,7 @@ use glutin::TouchPhase;
|
|||
#[cfg(target_os = "macos")]
|
||||
use glutin::os::macos::{ActivationPolicy, WindowBuilderExt};
|
||||
use msg::constellation_msg::{self, Key, TopLevelBrowsingContextId as BrowserId};
|
||||
use msg::constellation_msg::{KeyModifiers, KeyState, TraversalDirection};
|
||||
use msg::constellation_msg::{ALT, CONTROL, KeyState, NONE, SHIFT, SUPER, TraversalDirection};
|
||||
use net_traits::net_error_list::NetError;
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||
use osmesa_sys;
|
||||
|
@ -52,29 +52,29 @@ use winapi;
|
|||
static mut G_NESTED_EVENT_LOOP_LISTENER: Option<*mut (NestedEventLoopListener + 'static)> = None;
|
||||
|
||||
bitflags! {
|
||||
struct GlutinKeyModifiers: u8 {
|
||||
const LEFT_CONTROL = 1;
|
||||
const RIGHT_CONTROL = 2;
|
||||
const LEFT_SHIFT = 4;
|
||||
const RIGHT_SHIFT = 8;
|
||||
const LEFT_ALT = 16;
|
||||
const RIGHT_ALT = 32;
|
||||
const LEFT_SUPER = 64;
|
||||
const RIGHT_SUPER = 128;
|
||||
flags KeyModifiers: u8 {
|
||||
const LEFT_CONTROL = 1,
|
||||
const RIGHT_CONTROL = 2,
|
||||
const LEFT_SHIFT = 4,
|
||||
const RIGHT_SHIFT = 8,
|
||||
const LEFT_ALT = 16,
|
||||
const RIGHT_ALT = 32,
|
||||
const LEFT_SUPER = 64,
|
||||
const RIGHT_SUPER = 128,
|
||||
}
|
||||
}
|
||||
|
||||
// Some shortcuts use Cmd on Mac and Control on other systems.
|
||||
#[cfg(target_os = "macos")]
|
||||
const CMD_OR_CONTROL: KeyModifiers = KeyModifiers::SUPER;
|
||||
const CMD_OR_CONTROL: constellation_msg::KeyModifiers = SUPER;
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
const CMD_OR_CONTROL: KeyModifiers = KeyModifiers::CONTROL;
|
||||
const CMD_OR_CONTROL: constellation_msg::KeyModifiers = CONTROL;
|
||||
|
||||
// Some shortcuts use Cmd on Mac and Alt on other systems.
|
||||
#[cfg(target_os = "macos")]
|
||||
const CMD_OR_ALT: KeyModifiers = KeyModifiers::SUPER;
|
||||
const CMD_OR_ALT: constellation_msg::KeyModifiers = SUPER;
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
const CMD_OR_ALT: KeyModifiers = KeyModifiers::ALT;
|
||||
const CMD_OR_ALT: constellation_msg::KeyModifiers = ALT;
|
||||
|
||||
// This should vary by zoom level and maybe actual text size (focused or under cursor)
|
||||
const LINE_HEIGHT: f32 = 38.0;
|
||||
|
@ -189,7 +189,7 @@ pub struct Window {
|
|||
browser_id: Cell<Option<BrowserId>>,
|
||||
|
||||
mouse_pos: Cell<Point2D<i32>>,
|
||||
key_modifiers: Cell<GlutinKeyModifiers>,
|
||||
key_modifiers: Cell<KeyModifiers>,
|
||||
current_url: RefCell<Option<ServoUrl>>,
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
|
@ -322,7 +322,7 @@ impl Window {
|
|||
browser_id: Cell::new(None),
|
||||
|
||||
mouse_pos: Cell::new(Point2D::new(0, 0)),
|
||||
key_modifiers: Cell::new(GlutinKeyModifiers::empty()),
|
||||
key_modifiers: Cell::new(KeyModifiers::empty()),
|
||||
current_url: RefCell::new(None),
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
|
@ -403,14 +403,14 @@ impl Window {
|
|||
|
||||
fn toggle_keyboard_modifiers(&self, virtual_key_code: VirtualKeyCode) {
|
||||
match virtual_key_code {
|
||||
VirtualKeyCode::LControl => self.toggle_modifier(GlutinKeyModifiers::LEFT_CONTROL),
|
||||
VirtualKeyCode::RControl => self.toggle_modifier(GlutinKeyModifiers::RIGHT_CONTROL),
|
||||
VirtualKeyCode::LShift => self.toggle_modifier(GlutinKeyModifiers::LEFT_SHIFT),
|
||||
VirtualKeyCode::RShift => self.toggle_modifier(GlutinKeyModifiers::RIGHT_SHIFT),
|
||||
VirtualKeyCode::LAlt => self.toggle_modifier(GlutinKeyModifiers::LEFT_ALT),
|
||||
VirtualKeyCode::RAlt => self.toggle_modifier(GlutinKeyModifiers::RIGHT_ALT),
|
||||
VirtualKeyCode::LWin => self.toggle_modifier(GlutinKeyModifiers::LEFT_SUPER),
|
||||
VirtualKeyCode::RWin => self.toggle_modifier(GlutinKeyModifiers::RIGHT_SUPER),
|
||||
VirtualKeyCode::LControl => self.toggle_modifier(LEFT_CONTROL),
|
||||
VirtualKeyCode::RControl => self.toggle_modifier(RIGHT_CONTROL),
|
||||
VirtualKeyCode::LShift => self.toggle_modifier(LEFT_SHIFT),
|
||||
VirtualKeyCode::RShift => self.toggle_modifier(RIGHT_SHIFT),
|
||||
VirtualKeyCode::LAlt => self.toggle_modifier(LEFT_ALT),
|
||||
VirtualKeyCode::RAlt => self.toggle_modifier(RIGHT_ALT),
|
||||
VirtualKeyCode::LWin => self.toggle_modifier(LEFT_SUPER),
|
||||
VirtualKeyCode::RWin => self.toggle_modifier(RIGHT_SUPER),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
@ -550,7 +550,7 @@ impl Window {
|
|||
false
|
||||
}
|
||||
|
||||
fn toggle_modifier(&self, modifier: GlutinKeyModifiers) {
|
||||
fn toggle_modifier(&self, modifier: KeyModifiers) {
|
||||
let mut modifiers = self.key_modifiers.get();
|
||||
modifiers.toggle(modifier);
|
||||
self.key_modifiers.set(modifiers);
|
||||
|
@ -929,19 +929,19 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
fn glutin_mods_to_script_mods(modifiers: GlutinKeyModifiers) -> constellation_msg::KeyModifiers {
|
||||
fn glutin_mods_to_script_mods(modifiers: KeyModifiers) -> constellation_msg::KeyModifiers {
|
||||
let mut result = constellation_msg::KeyModifiers::empty();
|
||||
if modifiers.intersects(GlutinKeyModifiers::LEFT_SHIFT | GlutinKeyModifiers::RIGHT_SHIFT) {
|
||||
result.insert(KeyModifiers::SHIFT);
|
||||
if modifiers.intersects(LEFT_SHIFT | RIGHT_SHIFT) {
|
||||
result.insert(SHIFT);
|
||||
}
|
||||
if modifiers.intersects(GlutinKeyModifiers::LEFT_CONTROL | GlutinKeyModifiers::RIGHT_CONTROL) {
|
||||
result.insert(KeyModifiers::CONTROL);
|
||||
if modifiers.intersects(LEFT_CONTROL | RIGHT_CONTROL) {
|
||||
result.insert(CONTROL);
|
||||
}
|
||||
if modifiers.intersects(GlutinKeyModifiers::LEFT_ALT | GlutinKeyModifiers::RIGHT_ALT) {
|
||||
result.insert(KeyModifiers::ALT);
|
||||
if modifiers.intersects(LEFT_ALT | RIGHT_ALT) {
|
||||
result.insert(ALT);
|
||||
}
|
||||
if modifiers.intersects(GlutinKeyModifiers::LEFT_SUPER | GlutinKeyModifiers::RIGHT_SUPER) {
|
||||
result.insert(KeyModifiers::SUPER);
|
||||
if modifiers.intersects(LEFT_SUPER | RIGHT_SUPER) {
|
||||
result.insert(SUPER);
|
||||
}
|
||||
result
|
||||
}
|
||||
|
@ -1229,32 +1229,32 @@ impl WindowMethods for Window {
|
|||
};
|
||||
match (mods, ch, key) {
|
||||
(_, Some('+'), _) => {
|
||||
if mods & !KeyModifiers::SHIFT == CMD_OR_CONTROL {
|
||||
if mods & !SHIFT == CMD_OR_CONTROL {
|
||||
self.event_queue.borrow_mut().push(WindowEvent::Zoom(1.1));
|
||||
} else if mods & !KeyModifiers::SHIFT == CMD_OR_CONTROL | KeyModifiers::ALT {
|
||||
} else if mods & !SHIFT == CMD_OR_CONTROL | ALT {
|
||||
self.event_queue.borrow_mut().push(WindowEvent::PinchZoom(1.1));
|
||||
}
|
||||
}
|
||||
(CMD_OR_CONTROL, Some('-'), _) => {
|
||||
self.event_queue.borrow_mut().push(WindowEvent::Zoom(1.0 / 1.1));
|
||||
}
|
||||
(_, Some('-'), _) if mods == CMD_OR_CONTROL | KeyModifiers::ALT => {
|
||||
(_, Some('-'), _) if mods == CMD_OR_CONTROL | ALT => {
|
||||
self.event_queue.borrow_mut().push(WindowEvent::PinchZoom(1.0 / 1.1));
|
||||
}
|
||||
(CMD_OR_CONTROL, Some('0'), _) => {
|
||||
self.event_queue.borrow_mut().push(WindowEvent::ResetZoom);
|
||||
}
|
||||
|
||||
(KeyModifiers::NONE, None, Key::NavigateForward) => {
|
||||
(NONE, None, Key::NavigateForward) => {
|
||||
let event = WindowEvent::Navigation(browser_id, TraversalDirection::Forward(1));
|
||||
self.event_queue.borrow_mut().push(event);
|
||||
}
|
||||
(KeyModifiers::NONE, None, Key::NavigateBackward) => {
|
||||
(NONE, None, Key::NavigateBackward) => {
|
||||
let event = WindowEvent::Navigation(browser_id, TraversalDirection::Back(1));
|
||||
self.event_queue.borrow_mut().push(event);
|
||||
}
|
||||
|
||||
(KeyModifiers::NONE, None, Key::Escape) => {
|
||||
(NONE, None, Key::Escape) => {
|
||||
if let Some(true) = PREFS.get("shell.builtin-key-shortcuts.enabled").as_boolean() {
|
||||
self.event_queue.borrow_mut().push(WindowEvent::Quit);
|
||||
}
|
||||
|
@ -1269,7 +1269,7 @@ impl WindowMethods for Window {
|
|||
self.event_queue.borrow_mut().push(event);
|
||||
}
|
||||
|
||||
(KeyModifiers::NONE, None, Key::PageDown) => {
|
||||
(NONE, None, Key::PageDown) => {
|
||||
let scroll_location = ScrollLocation::Delta(TypedVector2D::new(0.0,
|
||||
-self.framebuffer_size()
|
||||
.to_f32()
|
||||
|
@ -1278,7 +1278,7 @@ impl WindowMethods for Window {
|
|||
self.scroll_window(scroll_location,
|
||||
TouchEventType::Move);
|
||||
}
|
||||
(KeyModifiers::NONE, None, Key::PageUp) => {
|
||||
(NONE, None, Key::PageUp) => {
|
||||
let scroll_location = ScrollLocation::Delta(TypedVector2D::new(0.0,
|
||||
self.framebuffer_size()
|
||||
.to_f32()
|
||||
|
@ -1288,26 +1288,26 @@ impl WindowMethods for Window {
|
|||
TouchEventType::Move);
|
||||
}
|
||||
|
||||
(KeyModifiers::NONE, None, Key::Home) => {
|
||||
(NONE, None, Key::Home) => {
|
||||
self.scroll_window(ScrollLocation::Start, TouchEventType::Move);
|
||||
}
|
||||
|
||||
(KeyModifiers::NONE, None, Key::End) => {
|
||||
(NONE, None, Key::End) => {
|
||||
self.scroll_window(ScrollLocation::End, TouchEventType::Move);
|
||||
}
|
||||
|
||||
(KeyModifiers::NONE, None, Key::Up) => {
|
||||
(NONE, None, Key::Up) => {
|
||||
self.scroll_window(ScrollLocation::Delta(TypedVector2D::new(0.0, 3.0 * LINE_HEIGHT)),
|
||||
TouchEventType::Move);
|
||||
}
|
||||
(KeyModifiers::NONE, None, Key::Down) => {
|
||||
(NONE, None, Key::Down) => {
|
||||
self.scroll_window(ScrollLocation::Delta(TypedVector2D::new(0.0, -3.0 * LINE_HEIGHT)),
|
||||
TouchEventType::Move);
|
||||
}
|
||||
(KeyModifiers::NONE, None, Key::Left) => {
|
||||
(NONE, None, Key::Left) => {
|
||||
self.scroll_window(ScrollLocation::Delta(TypedVector2D::new(LINE_HEIGHT, 0.0)), TouchEventType::Move);
|
||||
}
|
||||
(KeyModifiers::NONE, None, Key::Right) => {
|
||||
(NONE, None, Key::Right) => {
|
||||
self.scroll_window(ScrollLocation::Delta(TypedVector2D::new(-LINE_HEIGHT, 0.0)), TouchEventType::Move);
|
||||
}
|
||||
(CMD_OR_CONTROL, Some('r'), _) => {
|
||||
|
@ -1320,15 +1320,15 @@ impl WindowMethods for Window {
|
|||
self.event_queue.borrow_mut().push(WindowEvent::Quit);
|
||||
}
|
||||
}
|
||||
(KeyModifiers::CONTROL, None, Key::F10) => {
|
||||
(CONTROL, None, Key::F10) => {
|
||||
let event = WindowEvent::ToggleWebRenderDebug(WebRenderDebugOption::RenderTargetDebug);
|
||||
self.event_queue.borrow_mut().push(event);
|
||||
}
|
||||
(KeyModifiers::CONTROL, None, Key::F11) => {
|
||||
(CONTROL, None, Key::F11) => {
|
||||
let event = WindowEvent::ToggleWebRenderDebug(WebRenderDebugOption::TextureCacheDebug);
|
||||
self.event_queue.borrow_mut().push(event);
|
||||
}
|
||||
(KeyModifiers::CONTROL, None, Key::F12) => {
|
||||
(CONTROL, None, Key::F12) => {
|
||||
let event = WindowEvent::ToggleWebRenderDebug(WebRenderDebugOption::Profiler);
|
||||
self.event_queue.borrow_mut().push(event);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue