Make the traits for the IDL interfaces take &self

This commit is contained in:
Anthony Ramine 2015-08-27 22:15:54 +02:00
parent 856fda7f2e
commit 709d347872
99 changed files with 1192 additions and 1192 deletions

View file

@ -172,67 +172,67 @@ impl Event {
}
}
impl<'a> EventMethods for &'a Event {
impl EventMethods for Event {
// https://dom.spec.whatwg.org/#dom-event-eventphase
fn EventPhase(self) -> u16 {
fn EventPhase(&self) -> u16 {
self.phase.get() as u16
}
// https://dom.spec.whatwg.org/#dom-event-type
fn Type(self) -> DOMString {
fn Type(&self) -> DOMString {
self.type_.borrow().clone()
}
// https://dom.spec.whatwg.org/#dom-event-target
fn GetTarget(self) -> Option<Root<EventTarget>> {
fn GetTarget(&self) -> Option<Root<EventTarget>> {
self.target.get().map(Root::from_rooted)
}
// https://dom.spec.whatwg.org/#dom-event-currenttarget
fn GetCurrentTarget(self) -> Option<Root<EventTarget>> {
fn GetCurrentTarget(&self) -> Option<Root<EventTarget>> {
self.current_target.get().map(Root::from_rooted)
}
// https://dom.spec.whatwg.org/#dom-event-defaultprevented
fn DefaultPrevented(self) -> bool {
fn DefaultPrevented(&self) -> bool {
self.canceled.get()
}
// https://dom.spec.whatwg.org/#dom-event-preventdefault
fn PreventDefault(self) {
fn PreventDefault(&self) {
if self.cancelable.get() {
self.canceled.set(true)
}
}
// https://dom.spec.whatwg.org/#dom-event-stoppropagation
fn StopPropagation(self) {
fn StopPropagation(&self) {
self.stop_propagation.set(true);
}
// https://dom.spec.whatwg.org/#dom-event-stopimmediatepropagation
fn StopImmediatePropagation(self) {
fn StopImmediatePropagation(&self) {
self.stop_immediate.set(true);
self.stop_propagation.set(true);
}
// https://dom.spec.whatwg.org/#dom-event-bubbles
fn Bubbles(self) -> bool {
fn Bubbles(&self) -> bool {
self.bubbles.get()
}
// https://dom.spec.whatwg.org/#dom-event-cancelable
fn Cancelable(self) -> bool {
fn Cancelable(&self) -> bool {
self.cancelable.get()
}
// https://dom.spec.whatwg.org/#dom-event-timestamp
fn TimeStamp(self) -> u64 {
fn TimeStamp(&self) -> u64 {
self.timestamp
}
// https://dom.spec.whatwg.org/#dom-event-initevent
fn InitEvent(self,
fn InitEvent(&self,
type_: DOMString,
bubbles: bool,
cancelable: bool) {
@ -252,7 +252,7 @@ impl<'a> EventMethods for &'a Event {
}
// https://dom.spec.whatwg.org/#dom-event-istrusted
fn IsTrusted(self) -> bool {
fn IsTrusted(&self) -> bool {
self.trusted.get()
}
}