mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
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.
This commit is contained in:
parent
996c0a60b8
commit
4accaf50b2
25 changed files with 156 additions and 135 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue