Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement single-line text input #3585

Merged
merged 10 commits into from Nov 13, 2014
Prev

Short-circuit initFooEvent while dispatching events.

  • Loading branch information
jdm committed Nov 13, 2014
commit c23edf6f5a020f24008c84957c1a290241632c6d
@@ -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);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.