Skip to content

Commit

Permalink
Inline DOM element creation into box expressions in components/script…
Browse files Browse the repository at this point in the history
…/dom/
  • Loading branch information
ice9js committed Jul 14, 2016
1 parent 3011d4b commit 85f4da1
Show file tree
Hide file tree
Showing 66 changed files with 198 additions and 132 deletions.
5 changes: 3 additions & 2 deletions components/script/dom/documenttype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ impl DocumentType {
system_id: Option<DOMString>,
document: &Document)
-> Root<DocumentType> {
let documenttype = DocumentType::new_inherited(name, public_id, system_id, document);
Node::reflect_node(box documenttype, document, DocumentTypeBinding::Wrap)
Node::reflect_node(box DocumentType::new_inherited(name, public_id, system_id, document),
document,
DocumentTypeBinding::Wrap)
}

#[inline]
Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmlanchorelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ impl HTMLAnchorElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLAnchorElement> {
let element = HTMLAnchorElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLAnchorElementBinding::Wrap)
Node::reflect_node(box HTMLAnchorElement::new_inherited(localName, prefix, document),
document,
HTMLAnchorElementBinding::Wrap)
}

// https://html.spec.whatwg.org/multipage/#concept-hyperlink-url-set
Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmlappletelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ impl HTMLAppletElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLAppletElement> {
let element = HTMLAppletElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLAppletElementBinding::Wrap)
Node::reflect_node(box HTMLAppletElement::new_inherited(localName, prefix, document),
document,
HTMLAppletElementBinding::Wrap)
}
}

Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmlareaelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ impl HTMLAreaElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLAreaElement> {
let element = HTMLAreaElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLAreaElementBinding::Wrap)
Node::reflect_node(box HTMLAreaElement::new_inherited(localName, prefix, document),
document,
HTMLAreaElementBinding::Wrap)
}
}

Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmlaudioelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ impl HTMLAudioElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLAudioElement> {
let element = HTMLAudioElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLAudioElementBinding::Wrap)
Node::reflect_node(box HTMLAudioElement::new_inherited(localName, prefix, document),
document,
HTMLAudioElementBinding::Wrap)
}
}
5 changes: 3 additions & 2 deletions components/script/dom/htmlbaseelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ impl HTMLBaseElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLBaseElement> {
let element = HTMLBaseElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLBaseElementBinding::Wrap)
Node::reflect_node(box HTMLBaseElement::new_inherited(localName, prefix, document),
document,
HTMLBaseElementBinding::Wrap)
}

/// https://html.spec.whatwg.org/multipage/#frozen-base-url
Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmlbodyelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ impl HTMLBodyElement {
#[allow(unrooted_must_root)]
pub fn new(localName: Atom, prefix: Option<DOMString>, document: &Document)
-> Root<HTMLBodyElement> {
let element = HTMLBodyElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLBodyElementBinding::Wrap)
Node::reflect_node(box HTMLBodyElement::new_inherited(localName, prefix, document),
document,
HTMLBodyElementBinding::Wrap)
}

/// https://drafts.csswg.org/cssom-view/#the-html-body-element
Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmlbrelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ impl HTMLBRElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLBRElement> {
let element = HTMLBRElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLBRElementBinding::Wrap)
Node::reflect_node(box HTMLBRElement::new_inherited(localName, prefix, document),
document,
HTMLBRElementBinding::Wrap)
}
}
5 changes: 3 additions & 2 deletions components/script/dom/htmlbuttonelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ impl HTMLButtonElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLButtonElement> {
let element = HTMLButtonElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLButtonElementBinding::Wrap)
Node::reflect_node(box HTMLButtonElement::new_inherited(localName, prefix, document),
document,
HTMLButtonElementBinding::Wrap)
}
}

Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmlcanvaselement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ impl HTMLCanvasElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLCanvasElement> {
let element = HTMLCanvasElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLCanvasElementBinding::Wrap)
Node::reflect_node(box HTMLCanvasElement::new_inherited(localName, prefix, document),
document,
HTMLCanvasElementBinding::Wrap)
}

fn recreate_contexts(&self) {
Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmldataelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ impl HTMLDataElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLDataElement> {
let element = HTMLDataElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLDataElementBinding::Wrap)
Node::reflect_node(box HTMLDataElement::new_inherited(localName, prefix, document),
document,
HTMLDataElementBinding::Wrap)
}
}
5 changes: 3 additions & 2 deletions components/script/dom/htmldatalistelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ impl HTMLDataListElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLDataListElement> {
let element = HTMLDataListElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLDataListElementBinding::Wrap)
Node::reflect_node(box HTMLDataListElement::new_inherited(localName, prefix, document),
document,
HTMLDataListElementBinding::Wrap)
}
}

Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmldetailselement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ impl HTMLDetailsElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLDetailsElement> {
let element = HTMLDetailsElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLDetailsElementBinding::Wrap)
Node::reflect_node(box HTMLDetailsElement::new_inherited(localName, prefix, document),
document,
HTMLDetailsElementBinding::Wrap)
}

pub fn check_toggle_count(&self, number: u32) -> bool {
Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmldialogelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ impl HTMLDialogElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLDialogElement> {
let element = HTMLDialogElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLDialogElementBinding::Wrap)
Node::reflect_node(box HTMLDialogElement::new_inherited(localName, prefix, document),
document,
HTMLDialogElementBinding::Wrap)
}
}

Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmldirectoryelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ impl HTMLDirectoryElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLDirectoryElement> {
let element = HTMLDirectoryElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLDirectoryElementBinding::Wrap)
Node::reflect_node(box HTMLDirectoryElement::new_inherited(localName, prefix, document),
document,
HTMLDirectoryElementBinding::Wrap)
}
}
5 changes: 3 additions & 2 deletions components/script/dom/htmldlistelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ impl HTMLDListElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLDListElement> {
let element = HTMLDListElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLDListElementBinding::Wrap)
Node::reflect_node(box HTMLDListElement::new_inherited(localName, prefix, document),
document,
HTMLDListElementBinding::Wrap)
}
}
5 changes: 3 additions & 2 deletions components/script/dom/htmlelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ impl HTMLElement {

#[allow(unrooted_must_root)]
pub fn new(localName: Atom, prefix: Option<DOMString>, document: &Document) -> Root<HTMLElement> {
let element = HTMLElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLElementBinding::Wrap)
Node::reflect_node(box HTMLElement::new_inherited(localName, prefix, document),
document,
HTMLElementBinding::Wrap)
}

fn is_body_or_frameset(&self) -> bool {
Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmlembedelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ impl HTMLEmbedElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLEmbedElement> {
let element = HTMLEmbedElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLEmbedElementBinding::Wrap)
Node::reflect_node(box HTMLEmbedElement::new_inherited(localName, prefix, document),
document,
HTMLEmbedElementBinding::Wrap)
}
}
5 changes: 3 additions & 2 deletions components/script/dom/htmlfieldsetelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ impl HTMLFieldSetElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLFieldSetElement> {
let element = HTMLFieldSetElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLFieldSetElementBinding::Wrap)
Node::reflect_node(box HTMLFieldSetElement::new_inherited(localName, prefix, document),
document,
HTMLFieldSetElementBinding::Wrap)
}
}

Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmlfontelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ impl HTMLFontElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLFontElement> {
let element = HTMLFontElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLFontElementBinding::Wrap)
Node::reflect_node(box HTMLFontElement::new_inherited(localName, prefix, document),
document,
HTMLFontElementBinding::Wrap)
}
}

Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmlformelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ impl HTMLFormElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLFormElement> {
let element = HTMLFormElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLFormElementBinding::Wrap)
Node::reflect_node(box HTMLFormElement::new_inherited(localName, prefix, document),
document,
HTMLFormElementBinding::Wrap)
}

pub fn generation_id(&self) -> GenerationId {
Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmlframeelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ impl HTMLFrameElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLFrameElement> {
let element = HTMLFrameElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLFrameElementBinding::Wrap)
Node::reflect_node(box HTMLFrameElement::new_inherited(localName, prefix, document),
document,
HTMLFrameElementBinding::Wrap)
}
}
5 changes: 3 additions & 2 deletions components/script/dom/htmlframesetelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ impl HTMLFrameSetElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLFrameSetElement> {
let element = HTMLFrameSetElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLFrameSetElementBinding::Wrap)
Node::reflect_node(box HTMLFrameSetElement::new_inherited(localName, prefix, document),
document,
HTMLFrameSetElementBinding::Wrap)
}
}

Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmlheadelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ impl HTMLHeadElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLHeadElement> {
let element = HTMLHeadElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLHeadElementBinding::Wrap)
Node::reflect_node(box HTMLHeadElement::new_inherited(localName, prefix, document),
document,
HTMLHeadElementBinding::Wrap)
}

/// https://html.spec.whatwg.org/multipage/#meta-referrer
Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmlheadingelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ impl HTMLHeadingElement {
prefix: Option<DOMString>,
document: &Document,
level: HeadingLevel) -> Root<HTMLHeadingElement> {
let element = HTMLHeadingElement::new_inherited(localName, prefix, document, level);
Node::reflect_node(box element, document, HTMLHeadingElementBinding::Wrap)
Node::reflect_node(box HTMLHeadingElement::new_inherited(localName, prefix, document, level),
document,
HTMLHeadingElementBinding::Wrap)
}
}
5 changes: 3 additions & 2 deletions components/script/dom/htmlhrelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ impl HTMLHRElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLHRElement> {
let element = HTMLHRElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLHRElementBinding::Wrap)
Node::reflect_node(box HTMLHRElement::new_inherited(localName, prefix, document),
document,
HTMLHRElementBinding::Wrap)
}
}

Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmlhtmlelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ impl HTMLHtmlElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLHtmlElement> {
let element = HTMLHtmlElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLHtmlElementBinding::Wrap)
Node::reflect_node(box HTMLHtmlElement::new_inherited(localName, prefix, document),
document,
HTMLHtmlElementBinding::Wrap)
}
}
5 changes: 3 additions & 2 deletions components/script/dom/htmliframeelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,9 @@ impl HTMLIFrameElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLIFrameElement> {
let element = HTMLIFrameElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLIFrameElementBinding::Wrap)
Node::reflect_node(box HTMLIFrameElement::new_inherited(localName, prefix, document),
document,
HTMLIFrameElementBinding::Wrap)
}

#[inline]
Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmlimageelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,9 @@ impl HTMLImageElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLImageElement> {
let element = HTMLImageElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLImageElementBinding::Wrap)
Node::reflect_node(box HTMLImageElement::new_inherited(localName, prefix, document),
document,
HTMLImageElementBinding::Wrap)
}

pub fn Image(global: GlobalRef,
Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmlinputelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,9 @@ impl HTMLInputElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLInputElement> {
let element = HTMLInputElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLInputElementBinding::Wrap)
Node::reflect_node(box HTMLInputElement::new_inherited(localName, prefix, document),
document,
HTMLInputElementBinding::Wrap)
}

pub fn type_(&self) -> Atom {
Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmllabelelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ impl HTMLLabelElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLLabelElement> {
let element = HTMLLabelElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLLabelElementBinding::Wrap)
Node::reflect_node(box HTMLLabelElement::new_inherited(localName, prefix, document),
document,
HTMLLabelElementBinding::Wrap)
}
}

Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmllegendelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ impl HTMLLegendElement {
prefix: Option<DOMString>,
document: &Document)
-> Root<HTMLLegendElement> {
let element = HTMLLegendElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLLegendElementBinding::Wrap)
Node::reflect_node(box HTMLLegendElement::new_inherited(localName, prefix, document),
document,
HTMLLegendElementBinding::Wrap)
}
}

Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/htmllielement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ impl HTMLLIElement {
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLLIElement> {
let element = HTMLLIElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLLIElementBinding::Wrap)
Node::reflect_node(box HTMLLIElement::new_inherited(localName, prefix, document),
document,
HTMLLIElementBinding::Wrap)
}
}
5 changes: 3 additions & 2 deletions components/script/dom/htmllinkelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ impl HTMLLinkElement {
prefix: Option<DOMString>,
document: &Document,
creator: ElementCreator) -> Root<HTMLLinkElement> {
let element = HTMLLinkElement::new_inherited(localName, prefix, document, creator);
Node::reflect_node(box element, document, HTMLLinkElementBinding::Wrap)
Node::reflect_node(box HTMLLinkElement::new_inherited(localName, prefix, document, creator),
document,
HTMLLinkElementBinding::Wrap)
}

pub fn get_stylesheet(&self) -> Option<Arc<Stylesheet>> {
Expand Down
Loading

0 comments on commit 85f4da1

Please sign in to comment.