mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Short-circuit initFooEvent while dispatching events.
This commit is contained in:
parent
642a3592c7
commit
c23edf6f5a
5 changed files with 23 additions and 4 deletions
|
@ -65,8 +65,12 @@ impl<'a> CustomEventMethods for JSRef<'a, CustomEvent> {
|
||||||
can_bubble: bool,
|
can_bubble: bool,
|
||||||
cancelable: bool,
|
cancelable: bool,
|
||||||
detail: JSVal) {
|
detail: JSVal) {
|
||||||
self.detail.set(detail);
|
|
||||||
let event: JSRef<Event> = EventCast::from_ref(self);
|
let event: JSRef<Event> = EventCast::from_ref(self);
|
||||||
|
if event.dispatching() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.detail.set(detail);
|
||||||
event.InitEvent(type_, can_bubble, cancelable);
|
event.InitEvent(type_, can_bubble, cancelable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,10 +219,11 @@ impl<'a> EventMethods for JSRef<'a, Event> {
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
bubbles: bool,
|
bubbles: bool,
|
||||||
cancelable: bool) {
|
cancelable: bool) {
|
||||||
self.initialized.set(true);
|
|
||||||
if self.dispatching.get() {
|
if self.dispatching.get() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.initialized.set(true);
|
||||||
self.stop_propagation.set(false);
|
self.stop_propagation.set(false);
|
||||||
self.stop_immediate.set(false);
|
self.stop_immediate.set(false);
|
||||||
self.canceled.set(false);
|
self.canceled.set(false);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
use dom::bindings::codegen::Bindings::KeyboardEventBinding;
|
use dom::bindings::codegen::Bindings::KeyboardEventBinding;
|
||||||
use dom::bindings::codegen::Bindings::KeyboardEventBinding::{KeyboardEventMethods, KeyboardEventConstants};
|
use dom::bindings::codegen::Bindings::KeyboardEventBinding::{KeyboardEventMethods, KeyboardEventConstants};
|
||||||
use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
|
use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
|
||||||
use dom::bindings::codegen::InheritTypes::{UIEventCast, KeyboardEventDerived};
|
use dom::bindings::codegen::InheritTypes::{EventCast, UIEventCast, KeyboardEventDerived};
|
||||||
use dom::bindings::error::Fallible;
|
use dom::bindings::error::Fallible;
|
||||||
use dom::bindings::global::GlobalRef;
|
use dom::bindings::global::GlobalRef;
|
||||||
use dom::bindings::global;
|
use dom::bindings::global;
|
||||||
|
@ -558,6 +558,11 @@ impl<'a> KeyboardEventMethods for JSRef<'a, KeyboardEvent> {
|
||||||
_modifiersListArg: DOMString,
|
_modifiersListArg: DOMString,
|
||||||
repeat: bool,
|
repeat: bool,
|
||||||
_locale: DOMString) {
|
_locale: DOMString) {
|
||||||
|
let event: JSRef<Event> = EventCast::from_ref(self);
|
||||||
|
if event.dispatching() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let uievent: JSRef<UIEvent> = UIEventCast::from_ref(self);
|
let uievent: JSRef<UIEvent> = UIEventCast::from_ref(self);
|
||||||
uievent.InitUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, 0);
|
uievent.InitUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, 0);
|
||||||
*self.key.borrow_mut() = keyArg;
|
*self.key.borrow_mut() = keyArg;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
use dom::bindings::codegen::Bindings::MouseEventBinding;
|
use dom::bindings::codegen::Bindings::MouseEventBinding;
|
||||||
use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods;
|
use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods;
|
||||||
use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
|
use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
|
||||||
use dom::bindings::codegen::InheritTypes::{UIEventCast, MouseEventDerived};
|
use dom::bindings::codegen::InheritTypes::{EventCast, UIEventCast, MouseEventDerived};
|
||||||
use dom::bindings::error::Fallible;
|
use dom::bindings::error::Fallible;
|
||||||
use dom::bindings::global::GlobalRef;
|
use dom::bindings::global::GlobalRef;
|
||||||
use dom::bindings::global;
|
use dom::bindings::global;
|
||||||
|
@ -160,6 +160,11 @@ impl<'a> MouseEventMethods for JSRef<'a, MouseEvent> {
|
||||||
metaKeyArg: bool,
|
metaKeyArg: bool,
|
||||||
buttonArg: i16,
|
buttonArg: i16,
|
||||||
relatedTargetArg: Option<JSRef<EventTarget>>) {
|
relatedTargetArg: Option<JSRef<EventTarget>>) {
|
||||||
|
let event: JSRef<Event> = EventCast::from_ref(self);
|
||||||
|
if event.dispatching() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let uievent: JSRef<UIEvent> = UIEventCast::from_ref(self);
|
let uievent: JSRef<UIEvent> = UIEventCast::from_ref(self);
|
||||||
uievent.InitUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg);
|
uievent.InitUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg);
|
||||||
self.screen_x.set(screenXArg);
|
self.screen_x.set(screenXArg);
|
||||||
|
|
|
@ -89,6 +89,10 @@ impl<'a> UIEventMethods for JSRef<'a, UIEvent> {
|
||||||
view: Option<JSRef<Window>>,
|
view: Option<JSRef<Window>>,
|
||||||
detail: i32) {
|
detail: i32) {
|
||||||
let event: JSRef<Event> = EventCast::from_ref(self);
|
let event: JSRef<Event> = EventCast::from_ref(self);
|
||||||
|
if event.dispatching() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
event.InitEvent(type_, can_bubble, cancelable);
|
event.InitEvent(type_, can_bubble, cancelable);
|
||||||
self.view.assign(view);
|
self.view.assign(view);
|
||||||
self.detail.set(detail);
|
self.detail.set(detail);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue