fune/servo/components/script/dom/htmldivelement.rs
Josh Matthews d5309d3b13 servo: Merge #12374 - Improve performance of HTMLDivElement constructor (from jdm:jsup); r=Manishearth
These changes address two sources of performance loss seen while profiling in #12354. #12358 and https://github.com/rust-lang/rust/issues/34727 are still the biggest offenders, however.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes do not require tests because we don't have performance tests and these are only optimizations

Source-Repo: https://github.com/servo/servo
Source-Revision: 01ec8491d3200d6710336da1bb0f4e01b49dc4bc
2016-07-10 08:18:27 -07:00

43 lines
1.4 KiB
Rust

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLDivElementBinding::{self, HTMLDivElementMethods};
use dom::bindings::js::Root;
use dom::bindings::str::DOMString;
use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use string_cache::Atom;
#[dom_struct]
pub struct HTMLDivElement {
htmlelement: HTMLElement
}
impl HTMLDivElement {
fn new_inherited(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> HTMLDivElement {
HTMLDivElement {
htmlelement: HTMLElement::new_inherited(localName, prefix, document)
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLDivElement> {
Node::reflect_node(box HTMLDivElement::new_inherited(localName, prefix, document),
document,
HTMLDivElementBinding::Wrap)
}
}
impl HTMLDivElementMethods for HTMLDivElement {
// https://html.spec.whatwg.org/multipage/#dom-div-align
make_getter!(Align, "align");
// https://html.spec.whatwg.org/multipage/#dom-div-align
make_setter!(SetAlign, "align");
}