From 6f577c7c84f8cedf83a6f4c71625190ba8cbd19e Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 28 Oct 2014 11:14:06 -0700 Subject: [PATCH] script: Avoid a temporary when constructing `` and `` elements. Was a huge improvement to RoboHornet. --- components/script/dom/htmltabledatacellelement.rs | 10 +++++++--- components/script/dom/htmltablerowelement.rs | 8 +++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/components/script/dom/htmltabledatacellelement.rs b/components/script/dom/htmltabledatacellelement.rs index 535f2e4ffd5..a2a73bd86f8 100644 --- a/components/script/dom/htmltabledatacellelement.rs +++ b/components/script/dom/htmltabledatacellelement.rs @@ -32,9 +32,13 @@ impl HTMLTableDataCellElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option, document: JSRef) -> Temporary { - let element = HTMLTableDataCellElement::new_inherited(localName, prefix, document); - Node::reflect_node(box element, document, HTMLTableDataCellElementBinding::Wrap) + pub fn new(localName: DOMString, prefix: Option, document: JSRef) + -> Temporary { + Node::reflect_node(box HTMLTableDataCellElement::new_inherited(localName, + prefix, + document), + document, + HTMLTableDataCellElementBinding::Wrap) } } diff --git a/components/script/dom/htmltablerowelement.rs b/components/script/dom/htmltablerowelement.rs index 64bd1e66c11..3edf4a0e64f 100644 --- a/components/script/dom/htmltablerowelement.rs +++ b/components/script/dom/htmltablerowelement.rs @@ -32,9 +32,11 @@ impl HTMLTableRowElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option, document: JSRef) -> Temporary { - let element = HTMLTableRowElement::new_inherited(localName, prefix, document); - Node::reflect_node(box element, document, HTMLTableRowElementBinding::Wrap) + pub fn new(localName: DOMString, prefix: Option, document: JSRef) + -> Temporary { + Node::reflect_node(box HTMLTableRowElement::new_inherited(localName, prefix, document), + document, + HTMLTableRowElementBinding::Wrap) } }