Files
tubestation/servo/components/script/dom/htmlpreelement.rs
Anthony Ramine c60f627416 servo: Merge #7873 - Generate the various TypeId enums in codegen (from nox:codegen-typeid); r=Ms2ger
This frees us forever from caring about maintaining these enums. The last commit removes their use from the initialisation of interface objects derived from Node.

Source-Repo: https://github.com/servo/servo
Source-Revision: 32daa17d5cbcad02db0713e21e52410cdc60480e
2015-10-14 12:47:48 -06:00

46 lines
1.6 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::HTMLPreElementBinding;
use dom::bindings::codegen::InheritTypes::{ElementTypeId, EventTargetTypeId, HTMLElementTypeId};
use dom::bindings::codegen::InheritTypes::{HTMLPreElementDerived, NodeTypeId};
use dom::bindings::js::Root;
use dom::document::Document;
use dom::eventtarget::EventTarget;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use util::str::DOMString;
#[dom_struct]
pub struct HTMLPreElement {
htmlelement: HTMLElement,
}
impl HTMLPreElementDerived for EventTarget {
fn is_htmlpreelement(&self) -> bool {
*self.type_id() ==
EventTargetTypeId::Node(
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLPreElement)))
}
}
impl HTMLPreElement {
fn new_inherited(localName: DOMString,
prefix: Option<DOMString>,
document: &Document) -> HTMLPreElement {
HTMLPreElement {
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLPreElement, localName, prefix, document)
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLPreElement> {
let element = HTMLPreElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLPreElementBinding::Wrap)
}
}