mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
parent
72ecbbe221
commit
fb0304cfdb
5 changed files with 33 additions and 30 deletions
|
@ -332,12 +332,12 @@ impl EventTarget {
|
||||||
|
|
||||||
/// Implements https://html.spec.whatwg.org/multipage/#fire-a-simple-event
|
/// Implements https://html.spec.whatwg.org/multipage/#fire-a-simple-event
|
||||||
pub fn fire_simple_event(&self, name: &str, win: GlobalRef) -> Root<Event> {
|
pub fn fire_simple_event(&self, name: &str, win: GlobalRef) -> Root<Event> {
|
||||||
self.fire_simple_event_params(name, EventBubbles::DoesNotBubble,
|
self.fire_event(name, EventBubbles::DoesNotBubble,
|
||||||
EventCancelable::NotCancelable, win)
|
EventCancelable::NotCancelable, win)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Implements more customizable variant of EventTarget::fire_simple_event.
|
/// Implements more customizable variant of EventTarget::fire_simple_event.
|
||||||
pub fn fire_simple_event_params(&self, name: &str,
|
pub fn fire_event(&self, name: &str,
|
||||||
bubbles: EventBubbles,
|
bubbles: EventBubbles,
|
||||||
cancelable: EventCancelable,
|
cancelable: EventCancelable,
|
||||||
win: GlobalRef) -> Root<Event> {
|
win: GlobalRef) -> Root<Event> {
|
||||||
|
|
|
@ -172,7 +172,7 @@ impl HTMLFormElement {
|
||||||
// Step 5
|
// Step 5
|
||||||
if submit_method_flag == SubmittedFrom::NotFromFormSubmitMethod {
|
if submit_method_flag == SubmittedFrom::NotFromFormSubmitMethod {
|
||||||
let event = self.upcast::<EventTarget>()
|
let event = self.upcast::<EventTarget>()
|
||||||
.fire_simple_event_params("submit",
|
.fire_event("submit",
|
||||||
EventBubbles::Bubbles,
|
EventBubbles::Bubbles,
|
||||||
EventCancelable::Cancelable,
|
EventCancelable::Cancelable,
|
||||||
GlobalRef::Window(win.r()));
|
GlobalRef::Window(win.r()));
|
||||||
|
@ -271,7 +271,7 @@ impl HTMLFormElement {
|
||||||
let win = window_from_node(self);
|
let win = window_from_node(self);
|
||||||
let unhandled_invalid_controls = invalid_controls.into_iter().filter_map(|field| {
|
let unhandled_invalid_controls = invalid_controls.into_iter().filter_map(|field| {
|
||||||
let event = field.as_event_target()
|
let event = field.as_event_target()
|
||||||
.fire_simple_event_params("invalid",
|
.fire_event("invalid",
|
||||||
EventBubbles::DoesNotBubble,
|
EventBubbles::DoesNotBubble,
|
||||||
EventCancelable::Cancelable,
|
EventCancelable::Cancelable,
|
||||||
GlobalRef::Window(win.r()));
|
GlobalRef::Window(win.r()));
|
||||||
|
@ -398,7 +398,7 @@ impl HTMLFormElement {
|
||||||
|
|
||||||
let win = window_from_node(self);
|
let win = window_from_node(self);
|
||||||
let event = self.upcast::<EventTarget>()
|
let event = self.upcast::<EventTarget>()
|
||||||
.fire_simple_event_params("reset",
|
.fire_event("reset",
|
||||||
EventBubbles::Bubbles,
|
EventBubbles::Bubbles,
|
||||||
EventCancelable::Cancelable,
|
EventCancelable::Cancelable,
|
||||||
GlobalRef::Window(win.r()));
|
GlobalRef::Window(win.r()));
|
||||||
|
|
|
@ -866,11 +866,11 @@ impl Activatable for HTMLInputElement {
|
||||||
let win = window_from_node(self);
|
let win = window_from_node(self);
|
||||||
let target = self.upcast::<EventTarget>();
|
let target = self.upcast::<EventTarget>();
|
||||||
|
|
||||||
target.fire_simple_event_params("input",
|
target.fire_event("input",
|
||||||
EventBubbles::Bubbles,
|
EventBubbles::Bubbles,
|
||||||
EventCancelable::NotCancelable,
|
EventCancelable::NotCancelable,
|
||||||
GlobalRef::Window(win.r()));
|
GlobalRef::Window(win.r()));
|
||||||
target.fire_simple_event_params("change",
|
target.fire_event("change",
|
||||||
EventBubbles::Bubbles,
|
EventBubbles::Bubbles,
|
||||||
EventCancelable::NotCancelable,
|
EventCancelable::NotCancelable,
|
||||||
GlobalRef::Window(win.r()));
|
GlobalRef::Window(win.r()));
|
||||||
|
|
|
@ -8,6 +8,9 @@
|
||||||
*
|
*
|
||||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||||
* liability, trademark and document use rules apply.
|
* liability, trademark and document use rules apply.
|
||||||
|
*
|
||||||
|
* WebIDL specification for this interface:
|
||||||
|
* https://dom.spec.whatwg.org/#event
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[Constructor(DOMString type, optional EventInit eventInitDict)]
|
[Constructor(DOMString type, optional EventInit eventInitDict)]
|
||||||
|
|
|
@ -530,7 +530,7 @@ impl Runnable for CloseTask {
|
||||||
ws.full.set(false);
|
ws.full.set(false);
|
||||||
//A Bad close
|
//A Bad close
|
||||||
ws.clean_close.set(false);
|
ws.clean_close.set(false);
|
||||||
ws.upcast().fire_simple_event_params("error",
|
ws.upcast().fire_event("error",
|
||||||
EventBubbles::DoesNotBubble,
|
EventBubbles::DoesNotBubble,
|
||||||
EventCancelable::Cancelable,
|
EventCancelable::Cancelable,
|
||||||
global.r());
|
global.r());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue