Skip to main content

script/dom/svg/
svggeometryelement.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::node::virtualmethods::VirtualMethods;
12use crate::dom::svg::svggraphicselement::SVGGraphicsElement;
13
14#[dom_struct]
15pub(crate) struct SVGGeometryElement {
16    svggraphicselement: SVGGraphicsElement,
17}
18
19impl SVGGeometryElement {
20    pub(crate) fn new_inherited(
21        tag_name: LocalName,
22        prefix: Option<Prefix>,
23        document: &Document,
24    ) -> SVGGeometryElement {
25        SVGGeometryElement::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    ) -> SVGGeometryElement {
39        SVGGeometryElement {
40            svggraphicselement: SVGGraphicsElement::new_inherited_with_state(
41                state, tag_name, prefix, document,
42            ),
43        }
44    }
45}
46
47impl VirtualMethods for SVGGeometryElement {
48    fn super_type(&self) -> Option<&dyn VirtualMethods> {
49        Some(self.upcast::<SVGGraphicsElement>() as &dyn VirtualMethods)
50    }
51}