script/dom/
svggraphicselement.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5use dom_struct::dom_struct;
6use html5ever::{LocalName, Prefix};
7use stylo_dom::ElementState;
8
9use crate::dom::bindings::inheritance::Castable;
10use crate::dom::document::Document;
11use crate::dom::svgelement::SVGElement;
12use crate::dom::virtualmethods::VirtualMethods;
13
14#[dom_struct]
15pub(crate) struct SVGGraphicsElement {
16    svgelement: SVGElement,
17}
18
19impl SVGGraphicsElement {
20    pub(crate) fn new_inherited(
21        tag_name: LocalName,
22        prefix: Option<Prefix>,
23        document: &Document,
24    ) -> SVGGraphicsElement {
25        SVGGraphicsElement::new_inherited_with_state(
26            ElementState::empty(),
27            tag_name,
28            prefix,
29            document,
30        )
31    }
32
33    pub(crate) fn new_inherited_with_state(
34        state: ElementState,
35        tag_name: LocalName,
36        prefix: Option<Prefix>,
37        document: &Document,
38    ) -> SVGGraphicsElement {
39        SVGGraphicsElement {
40            svgelement: SVGElement::new_inherited_with_state(state, tag_name, prefix, document),
41        }
42    }
43}
44
45impl VirtualMethods for SVGGraphicsElement {
46    fn super_type(&self) -> Option<&dyn VirtualMethods> {
47        Some(self.upcast::<SVGElement>() as &dyn VirtualMethods)
48    }
49}