mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +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,
|
||||
cancelable: bool,
|
||||
detail: JSVal) {
|
||||
self.detail.set(detail);
|
||||
let event: JSRef<Event> = EventCast::from_ref(self);
|
||||
if event.dispatching() {
|
||||
return;
|
||||
}
|
||||
|
||||
self.detail.set(detail);
|
||||
event.InitEvent(type_, can_bubble, cancelable);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -219,10 +219,11 @@ impl<'a> EventMethods for JSRef<'a, Event> {
|
|||
type_: DOMString,
|
||||
bubbles: bool,
|
||||
cancelable: bool) {
|
||||
self.initialized.set(true);
|
||||
if self.dispatching.get() {
|
||||
return;
|
||||
}
|
||||
|
||||
self.initialized.set(true);
|
||||
self.stop_propagation.set(false);
|
||||
self.stop_immediate.set(false);
|
||||
self.canceled.set(false);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
use dom::bindings::codegen::Bindings::KeyboardEventBinding;
|
||||
use dom::bindings::codegen::Bindings::KeyboardEventBinding::{KeyboardEventMethods, KeyboardEventConstants};
|
||||
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::global::GlobalRef;
|
||||
use dom::bindings::global;
|
||||
|
@ -558,6 +558,11 @@ impl<'a> KeyboardEventMethods for JSRef<'a, KeyboardEvent> {
|
|||
_modifiersListArg: DOMString,
|
||||
repeat: bool,
|
||||
_locale: DOMString) {
|
||||
let event: JSRef<Event> = EventCast::from_ref(self);
|
||||
if event.dispatching() {
|
||||
return;
|
||||
}
|
||||
|
||||
let uievent: JSRef<UIEvent> = UIEventCast::from_ref(self);
|
||||
uievent.InitUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, 0);
|
||||
*self.key.borrow_mut() = keyArg;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
use dom::bindings::codegen::Bindings::MouseEventBinding;
|
||||
use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods;
|
||||
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::global::GlobalRef;
|
||||
use dom::bindings::global;
|
||||
|
@ -160,6 +160,11 @@ impl<'a> MouseEventMethods for JSRef<'a, MouseEvent> {
|
|||
metaKeyArg: bool,
|
||||
buttonArg: i16,
|
||||
relatedTargetArg: Option<JSRef<EventTarget>>) {
|
||||
let event: JSRef<Event> = EventCast::from_ref(self);
|
||||
if event.dispatching() {
|
||||
return;
|
||||
}
|
||||
|
||||
let uievent: JSRef<UIEvent> = UIEventCast::from_ref(self);
|
||||
uievent.InitUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg);
|
||||
self.screen_x.set(screenXArg);
|
||||
|
|
|
@ -89,6 +89,10 @@ impl<'a> UIEventMethods for JSRef<'a, UIEvent> {
|
|||
view: Option<JSRef<Window>>,
|
||||
detail: i32) {
|
||||
let event: JSRef<Event> = EventCast::from_ref(self);
|
||||
if event.dispatching() {
|
||||
return;
|
||||
}
|
||||
|
||||
event.InitEvent(type_, can_bubble, cancelable);
|
||||
self.view.assign(view);
|
||||
self.detail.set(detail);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue