aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/uievent.rs
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2015-12-10 22:06:05 -0500
committerCorey Farwell <coreyf@rwell.org>2015-12-10 23:47:25 -0500
commit4accaf50b21a6344e9ee7518f7ab07c1dde7c36c (patch)
tree36d486ba0e57440a7a69e14829814e7ad5006712 /components/script/dom/uievent.rs
parent996c0a60b81e7d7e0fbfea81a546771ea9327df6 (diff)
downloadservo-4accaf50b21a6344e9ee7518f7ab07c1dde7c36c.tar.gz
servo-4accaf50b21a6344e9ee7518f7ab07c1dde7c36c.zip
Pass around event types as Atoms instead of Strings
`Event` internally stores the `type` as an `Atom`, and we're `String`s everywhere, which can cause unnecessary allocations to occur since they'll end up as `Atom`s anyways.
Diffstat (limited to 'components/script/dom/uievent.rs')
-rw-r--r--components/script/dom/uievent.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/components/script/dom/uievent.rs b/components/script/dom/uievent.rs
index c75d263bfe7..6687864eb4c 100644
--- a/components/script/dom/uievent.rs
+++ b/components/script/dom/uievent.rs
@@ -15,6 +15,7 @@ use dom::event::{Event, EventBubbles, EventCancelable};
use dom::window::Window;
use std::cell::Cell;
use std::default::Default;
+use string_cache::Atom;
use util::str::DOMString;
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#interface-UIEvent
@@ -91,7 +92,7 @@ impl UIEventMethods for UIEvent {
return;
}
- event.InitEvent(type_, can_bubble, cancelable);
+ event.init_event(Atom::from(&*type_), can_bubble, cancelable);
self.view.set(view);
self.detail.set(detail);
}