mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
#4508 Only dispatching input event when the textarea receives keyboard input and not for javascript
This commit is contained in:
parent
bfa4fe762b
commit
a481c8f28a
1 changed files with 12 additions and 2 deletions
|
@ -27,7 +27,7 @@ use dom::node::{DisabledStateHelpers, Node, NodeHelpers, NodeDamage, NodeTypeId}
|
||||||
use dom::node::{document_from_node, window_from_node};
|
use dom::node::{document_from_node, window_from_node};
|
||||||
use textinput::{TextInput, Lines, KeyReaction};
|
use textinput::{TextInput, Lines, KeyReaction};
|
||||||
use dom::virtualmethods::VirtualMethods;
|
use dom::virtualmethods::VirtualMethods;
|
||||||
use script_task::{Runnable};
|
use script_task::{ScriptMsg, Runnable};
|
||||||
|
|
||||||
use util::str::DOMString;
|
use util::str::DOMString;
|
||||||
use string_cache::Atom;
|
use string_cache::Atom;
|
||||||
|
@ -345,8 +345,18 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLTextAreaElement> {
|
||||||
match self.textinput.borrow_mut().handle_keydown(event) {
|
match self.textinput.borrow_mut().handle_keydown(event) {
|
||||||
KeyReaction::TriggerDefaultAction => (),
|
KeyReaction::TriggerDefaultAction => (),
|
||||||
KeyReaction::DispatchInput => {
|
KeyReaction::DispatchInput => {
|
||||||
self.force_relayout();
|
|
||||||
self.value_changed.set(true);
|
self.value_changed.set(true);
|
||||||
|
|
||||||
|
let window = window_from_node(*self).root();
|
||||||
|
let window = window.r();
|
||||||
|
let chan = window.script_chan();
|
||||||
|
let handler = Trusted::new(window.get_cx(), *self , chan.clone());
|
||||||
|
let dispatcher = TrustedHTMLTextAreaElement {
|
||||||
|
element: handler,
|
||||||
|
};
|
||||||
|
chan.send(ScriptMsg::RunnableMsg(box dispatcher));
|
||||||
|
|
||||||
|
self.force_relayout();
|
||||||
}
|
}
|
||||||
KeyReaction::Nothing => (),
|
KeyReaction::Nothing => (),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue