mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Migrate EventTarget
event firing functions to use Atom
s.
This allows us to utilize more `atom` macros.
This commit is contained in:
parent
80575c3d2e
commit
f447040ea9
16 changed files with 42 additions and 33 deletions
|
@ -491,28 +491,28 @@ impl EventTarget {
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-event-fire
|
||||
pub fn fire_event(&self, name: &str) -> Root<Event> {
|
||||
pub fn fire_event(&self, name: Atom) -> Root<Event> {
|
||||
self.fire_event_with_params(name,
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable)
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-event-fire
|
||||
pub fn fire_bubbling_event(&self, name: &str) -> Root<Event> {
|
||||
pub fn fire_bubbling_event(&self, name: Atom) -> Root<Event> {
|
||||
self.fire_event_with_params(name,
|
||||
EventBubbles::Bubbles,
|
||||
EventCancelable::NotCancelable)
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-event-fire
|
||||
pub fn fire_cancelable_event(&self, name: &str) -> Root<Event> {
|
||||
pub fn fire_cancelable_event(&self, name: Atom) -> Root<Event> {
|
||||
self.fire_event_with_params(name,
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::Cancelable)
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-event-fire
|
||||
pub fn fire_bubbling_cancelable_event(&self, name: &str) -> Root<Event> {
|
||||
pub fn fire_bubbling_cancelable_event(&self, name: Atom) -> Root<Event> {
|
||||
self.fire_event_with_params(name,
|
||||
EventBubbles::Bubbles,
|
||||
EventCancelable::Cancelable)
|
||||
|
@ -520,11 +520,11 @@ impl EventTarget {
|
|||
|
||||
// https://dom.spec.whatwg.org/#concept-event-fire
|
||||
pub fn fire_event_with_params(&self,
|
||||
name: &str,
|
||||
name: Atom,
|
||||
bubbles: EventBubbles,
|
||||
cancelable: EventCancelable)
|
||||
-> Root<Event> {
|
||||
let event = Event::new(&self.global(), Atom::from(name), bubbles, cancelable);
|
||||
let event = Event::new(&self.global(), name, bubbles, cancelable);
|
||||
event.fire(self);
|
||||
event
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue