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

@ -124,9 +124,9 @@ impl HTMLElement {
}
}
impl<'a> HTMLElementMethods for &'a HTMLElement {
impl HTMLElementMethods for HTMLElement {
// https://html.spec.whatwg.org/multipage/#the-style-attribute
fn Style(self) -> Root<CSSStyleDeclaration> {
fn Style(&self) -> Root<CSSStyleDeclaration> {
self.style_decl.or_init(|| {
let global = window_from_node(self);
CSSStyleDeclaration::new(global.r(), ElementCast::from_ref(self), None, CSSModificationAccess::ReadWrite)
@ -146,12 +146,12 @@ impl<'a> HTMLElementMethods for &'a HTMLElement {
global_event_handlers!(NoOnload);
// https://html.spec.whatwg.org/multipage/#dom-dataset
fn Dataset(self) -> Root<DOMStringMap> {
fn Dataset(&self) -> Root<DOMStringMap> {
self.dataset.or_init(|| DOMStringMap::new(self))
}
// https://html.spec.whatwg.org/multipage/#handler-onload
fn GetOnload(self) -> Option<Rc<EventHandlerNonNull>> {
fn GetOnload(&self) -> Option<Rc<EventHandlerNonNull>> {
if self.is_body_or_frameset() {
let win = window_from_node(self);
win.r().GetOnload()
@ -162,7 +162,7 @@ impl<'a> HTMLElementMethods for &'a HTMLElement {
}
// https://html.spec.whatwg.org/multipage/#handler-onload
fn SetOnload(self, listener: Option<Rc<EventHandlerNonNull>>) {
fn SetOnload(&self, listener: Option<Rc<EventHandlerNonNull>>) {
if self.is_body_or_frameset() {
let win = window_from_node(self);
win.r().SetOnload(listener)
@ -173,7 +173,7 @@ impl<'a> HTMLElementMethods for &'a HTMLElement {
}
// https://html.spec.whatwg.org/multipage/#dom-click
fn Click(self) {
fn Click(&self) {
let maybe_input: Option<&HTMLInputElement> = HTMLInputElementCast::to_ref(self);
if let Some(i) = maybe_input {
if i.Disabled() {
@ -186,7 +186,7 @@ impl<'a> HTMLElementMethods for &'a HTMLElement {
}
// https://html.spec.whatwg.org/multipage/#dom-focus
fn Focus(self) {
fn Focus(&self) {
// TODO: Mark the element as locked for focus and run the focusing steps.
// https://html.spec.whatwg.org/multipage/#focusing-steps
let element = ElementCast::from_ref(self);
@ -198,7 +198,7 @@ impl<'a> HTMLElementMethods for &'a HTMLElement {
}
// https://html.spec.whatwg.org/multipage/#dom-blur
fn Blur(self) {
fn Blur(&self) {
// TODO: Run the unfocusing steps.
let node = NodeCast::from_ref(self);
if !node.get_focus_state() {
@ -212,7 +212,7 @@ impl<'a> HTMLElementMethods for &'a HTMLElement {
}
// https://drafts.csswg.org/cssom-view/#extensions-to-the-htmlelement-interface
fn GetOffsetParent(self) -> Option<Root<Element>> {
fn GetOffsetParent(&self) -> Option<Root<Element>> {
if self.is_htmlbodyelement() || self.is_htmlhtmlelement() {
return None;
}
@ -225,7 +225,7 @@ impl<'a> HTMLElementMethods for &'a HTMLElement {
}
// https://drafts.csswg.org/cssom-view/#extensions-to-the-htmlelement-interface
fn OffsetTop(self) -> i32 {
fn OffsetTop(&self) -> i32 {
if self.is_htmlbodyelement() {
return 0;
}
@ -238,7 +238,7 @@ impl<'a> HTMLElementMethods for &'a HTMLElement {
}
// https://drafts.csswg.org/cssom-view/#extensions-to-the-htmlelement-interface
fn OffsetLeft(self) -> i32 {
fn OffsetLeft(&self) -> i32 {
if self.is_htmlbodyelement() {
return 0;
}
@ -251,7 +251,7 @@ impl<'a> HTMLElementMethods for &'a HTMLElement {
}
// https://drafts.csswg.org/cssom-view/#extensions-to-the-htmlelement-interface
fn OffsetWidth(self) -> i32 {
fn OffsetWidth(&self) -> i32 {
let node = NodeCast::from_ref(self);
let window = window_from_node(self);
let (_, rect) = window.offset_parent_query(node.to_trusted_node_address());
@ -260,7 +260,7 @@ impl<'a> HTMLElementMethods for &'a HTMLElement {
}
// https://drafts.csswg.org/cssom-view/#extensions-to-the-htmlelement-interface
fn OffsetHeight(self) -> i32 {
fn OffsetHeight(&self) -> i32 {
let node = NodeCast::from_ref(self);
let window = window_from_node(self);
let (_, rect) = window.offset_parent_query(node.to_trusted_node_address());