script/dom/svg/
svgtextelement.rs1use dom_struct::dom_struct;
6use html5ever::{LocalName, Prefix};
7use js::rust::HandleObject;
8
9use crate::dom::bindings::inheritance::Castable;
10use crate::dom::bindings::root::DomRoot;
11use crate::dom::document::Document;
12use crate::dom::node::Node;
13use crate::dom::node::virtualmethods::VirtualMethods;
14use crate::dom::svg::svgtextpositioningelement::SVGTextPositioningElement;
15
16#[dom_struct]
17pub(crate) struct SVGTextElement {
18 svgtextpositioningelement: SVGTextPositioningElement,
19}
20
21impl SVGTextElement {
22 fn new_inherited(
23 local_name: LocalName,
24 prefix: Option<Prefix>,
25 document: &Document,
26 ) -> SVGTextElement {
27 SVGTextElement {
28 svgtextpositioningelement: SVGTextPositioningElement::new_inherited(
29 local_name, prefix, document,
30 ),
31 }
32 }
33
34 pub(crate) fn new(
35 cx: &mut js::context::JSContext,
36 local_name: LocalName,
37 prefix: Option<Prefix>,
38 document: &Document,
39 proto: Option<HandleObject>,
40 ) -> DomRoot<SVGTextElement> {
41 Node::reflect_node_with_proto(
42 cx,
43 Box::new(SVGTextElement::new_inherited(local_name, prefix, document)),
44 document,
45 proto,
46 )
47 }
48}
49
50impl VirtualMethods for SVGTextElement {
51 fn super_type(&self) -> Option<&dyn VirtualMethods> {
52 Some(self.upcast::<SVGTextPositioningElement>() as &dyn VirtualMethods)
53 }
54}