Skip to content

Commit

Permalink
#4508 Only dispatching input event when the textarea receives keyboar…
Browse files Browse the repository at this point in the history
…d input and not for javascript
  • Loading branch information
mattnenterprise committed Mar 17, 2015
1 parent bfa4fe7 commit a481c8f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions components/script/dom/htmltextareaelement.rs
Expand Up @@ -27,7 +27,7 @@ use dom::node::{DisabledStateHelpers, Node, NodeHelpers, NodeDamage, NodeTypeId}
use dom::node::{document_from_node, window_from_node};
use textinput::{TextInput, Lines, KeyReaction};
use dom::virtualmethods::VirtualMethods;
use script_task::{Runnable};
use script_task::{ScriptMsg, Runnable};

use util::str::DOMString;
use string_cache::Atom;
Expand Down Expand Up @@ -345,8 +345,18 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLTextAreaElement> {
match self.textinput.borrow_mut().handle_keydown(event) {
KeyReaction::TriggerDefaultAction => (),
KeyReaction::DispatchInput => {
self.force_relayout();
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 => (),
}
Expand Down

0 comments on commit a481c8f

Please sign in to comment.