merge from master

This commit is contained in:
rohan.prinja 2015-11-03 19:01:23 +09:00
commit 6e774ea6eb
1044 changed files with 46059 additions and 1506 deletions

View file

@ -13,6 +13,7 @@ use dom::eventtarget::EventTarget;
use std::borrow::ToOwned;
use std::cell::Cell;
use std::default::Default;
use string_cache::Atom;
use time;
use util::str::DOMString;
@ -43,7 +44,7 @@ pub struct Event {
reflector_: Reflector,
current_target: MutNullableHeap<JS<EventTarget>>,
target: MutNullableHeap<JS<EventTarget>>,
type_: DOMRefCell<DOMString>,
type_: DOMRefCell<Atom>,
phase: Cell<EventPhase>,
canceled: Cell<bool>,
stop_propagation: Cell<bool>,
@ -62,15 +63,15 @@ impl Event {
reflector_: Reflector::new(),
current_target: Default::default(),
target: Default::default(),
type_: DOMRefCell::new(atom!("")),
phase: Cell::new(EventPhase::None),
type_: DOMRefCell::new("".to_owned()),
canceled: Cell::new(false),
stop_propagation: Cell::new(false),
stop_immediate: Cell::new(false),
cancelable: Cell::new(false),
bubbles: Cell::new(false),
trusted: Cell::new(false),
dispatching: Cell::new(false),
stop_propagation: Cell::new(false),
stop_immediate: Cell::new(false),
initialized: Cell::new(false),
timestamp: time::get_time().sec as u64,
}
@ -153,6 +154,11 @@ impl Event {
pub fn initialized(&self) -> bool {
self.initialized.get()
}
#[inline]
pub fn type_(&self) -> Atom {
self.type_.borrow().clone()
}
}
impl EventMethods for Event {
@ -163,7 +169,7 @@ impl EventMethods for Event {
// https://dom.spec.whatwg.org/#dom-event-type
fn Type(&self) -> DOMString {
self.type_.borrow().clone()
(*self.type_()).to_owned()
}
// https://dom.spec.whatwg.org/#dom-event-target
@ -229,7 +235,7 @@ impl EventMethods for Event {
self.canceled.set(false);
self.trusted.set(false);
self.target.set(None);
*self.type_.borrow_mut() = type_;
*self.type_.borrow_mut() = Atom::from_slice(&type_);
self.bubbles.set(bubbles);
self.cancelable.set(cancelable);
}