servo: Merge #11952 - Creates KeyModifiers value using empty() instead of from_bits() (from cynicaldevil:master); r=Ms2ger
authorNikhil Shagrithaya <nikhilshagri@gmail.com>
Thu, 30 Jun 2016 06:19:29 -0500
changeset 339165 c2338bfa32991059bd59230a59a4538b6a5ccc8e
parent 339164 76708c9e8c36603bf709d7b29edf6d5853118f28
child 339166 0c6e5c9471438632a98d11ca1c21882d305074da
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMs2ger
servo: Merge #11952 - Creates KeyModifiers value using empty() instead of from_bits() (from cynicaldevil:master); r=Ms2ger <!-- Please describe your changes on the following line: --> --- <!-- 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 - [X] These changes fix #11935 . <!-- Either: --> - [X] These changes do not require tests because: @jdm said so :P Source-Repo: https://github.com/servo/servo Source-Revision: 87d08eb4e8282f591261250d6b1d061fbb0584b6
servo/ports/glutin/window.rs
--- a/servo/ports/glutin/window.rs
+++ b/servo/ports/glutin/window.rs
@@ -571,17 +571,17 @@ impl Window {
 
             VirtualKeyCode::NavigateBackward => Ok(Key::NavigateBackward),
             VirtualKeyCode::NavigateForward => Ok(Key::NavigateForward),
             _ => Err(()),
         }
     }
 
     fn glutin_mods_to_script_mods(modifiers: KeyModifiers) -> constellation_msg::KeyModifiers {
-        let mut result = constellation_msg::KeyModifiers::from_bits(0).expect("infallible");
+        let mut result = constellation_msg::KeyModifiers::empty();
         if modifiers.intersects(LEFT_SHIFT | RIGHT_SHIFT) {
             result.insert(SHIFT);
         }
         if modifiers.intersects(LEFT_CONTROL | RIGHT_CONTROL) {
             result.insert(CONTROL);
         }
         if modifiers.intersects(LEFT_ALT | RIGHT_ALT) {
             result.insert(ALT);