diff options
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/bindings/codegen/parser/module.patch | 9 | ||||
-rw-r--r-- | components/script/dom/htmlinputelement.rs | 2 | ||||
-rw-r--r-- | components/script/dom/keyboardevent.rs | 14 |
3 files changed, 18 insertions, 7 deletions
diff --git a/components/script/dom/bindings/codegen/parser/module.patch b/components/script/dom/bindings/codegen/parser/module.patch index 977947b4c63..f2ed1aff944 100644 --- a/components/script/dom/bindings/codegen/parser/module.patch +++ b/components/script/dom/bindings/codegen/parser/module.patch @@ -1,5 +1,14 @@ --- WebIDL.py +++ WebIDL.py +@@ -1422,6 +1422,9 @@ class IDLDictionary(IDLObjectWithScope): + self.identifier.name, + [member.location] + locations) + ++ def module(self): ++ return self.location.filename().split('/')[-1].split('.webidl')[0] + 'Binding' ++ + def addExtendedAttributes(self, attrs): + assert len(attrs) == 0 @@ -3398,6 +3398,9 @@ class IDLCallbackType(IDLType, IDLObjectWithScope): self._treatNonCallableAsNull = False self._treatNonObjectAsNull = False diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 680b77cd423..9c7050ec8a1 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -438,7 +438,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLInputElement> { let doc = document_from_node(*self).root(); doc.request_focus(ElementCast::from_ref(*self)); } else if "keydown" == event.Type().as_slice() && !event.DefaultPrevented() && - (self.input_type.get() == InputText|| self.input_type.get() == InputPassword) { + (self.input_type.get() == InputText || self.input_type.get() == InputPassword) { let keyevent: Option<JSRef<KeyboardEvent>> = KeyboardEventCast::to_ref(event); keyevent.map(|event| { match self.textinput.borrow_mut().handle_keydown(event) { diff --git a/components/script/dom/keyboardevent.rs b/components/script/dom/keyboardevent.rs index a6b488d947e..3a097fb54e2 100644 --- a/components/script/dom/keyboardevent.rs +++ b/components/script/dom/keyboardevent.rs @@ -117,8 +117,8 @@ impl KeyboardEvent { key: key_value(key, mods), code: code_value(key), location: key_location(key), - char_code: key_char_code(key, mods), - key_code: key_key_code(key), + char_code: key_charcode(key, mods), + key_code: key_keycode(key), } } } @@ -215,7 +215,7 @@ fn key_value(key: constellation_msg::Key, mods: constellation_msg::KeyModifiers) constellation_msg::KeyZ if shift => "Z", constellation_msg::KeyZ => "z", constellation_msg::KeyLeftBracket if shift => "{", - constellation_msg::KeyLeftBracket => "{", + constellation_msg::KeyLeftBracket => "[", constellation_msg::KeyBackslash if shift => "|", constellation_msg::KeyBackslash => "\\", constellation_msg::KeyRightBracket if shift => "}", @@ -444,7 +444,7 @@ fn key_location(key: constellation_msg::Key) -> u32 { } // https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#widl-KeyboardEvent-charCode -fn key_char_code(key: constellation_msg::Key, mods: constellation_msg::KeyModifiers) -> Option<u32> { +fn key_charcode(key: constellation_msg::Key, mods: constellation_msg::KeyModifiers) -> Option<u32> { let key = key_value(key, mods); if key.len() == 1 { Some(key.char_at(0) as u32) @@ -454,7 +454,7 @@ fn key_char_code(key: constellation_msg::Key, mods: constellation_msg::KeyModifi } // https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#legacy-key-models -fn key_key_code(key: constellation_msg::Key) -> u32 { +fn key_keycode(key: constellation_msg::Key) -> u32 { match key { // https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#legacy-key-models constellation_msg::KeyBackspace => 8, @@ -601,13 +601,15 @@ impl<'a> KeyboardEventMethods for JSRef<'a, KeyboardEvent> { self.is_composing.get() } + // https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#widl-KeyboardEvent-getModifierState fn GetModifierState(self, keyArg: DOMString) -> bool { match keyArg.as_slice() { "Ctrl" => self.CtrlKey(), "Alt" => self.AltKey(), "Shift" => self.ShiftKey(), "Meta" => self.MetaKey(), - "AltGraph" | "CapsLock" | "NumLock" | "ScrollLock" => false, //FIXME + "AltGraph" | "CapsLock" | "NumLock" | "ScrollLock" | "Accel" | + "Fn" | "FnLock" | "Hyper" | "OS" | "Symbol" | "SymbolLock" => false, //FIXME _ => false, } } |