script/dom/html/
htmlframesetelement.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 js::rust::HandleObject;
8
9use crate::dom::bindings::codegen::Bindings::HTMLFrameSetElementBinding::HTMLFrameSetElementMethods;
10use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
11use crate::dom::bindings::inheritance::Castable;
12use crate::dom::bindings::root::DomRoot;
13use crate::dom::document::Document;
14use crate::dom::html::htmlelement::HTMLElement;
15use crate::dom::node::{Node, NodeTraits};
16use crate::script_runtime::CanGc;
17
18#[dom_struct]
19pub(crate) struct HTMLFrameSetElement {
20    htmlelement: HTMLElement,
21}
22
23impl HTMLFrameSetElement {
24    fn new_inherited(
25        local_name: LocalName,
26        prefix: Option<Prefix>,
27        document: &Document,
28    ) -> HTMLFrameSetElement {
29        HTMLFrameSetElement {
30            htmlelement: HTMLElement::new_inherited(local_name, prefix, document),
31        }
32    }
33
34    #[cfg_attr(crown, allow(crown::unrooted_must_root))]
35    pub(crate) fn new(
36        local_name: LocalName,
37        prefix: Option<Prefix>,
38        document: &Document,
39        proto: Option<HandleObject>,
40        can_gc: CanGc,
41    ) -> DomRoot<HTMLFrameSetElement> {
42        let n = Node::reflect_node_with_proto(
43            Box::new(HTMLFrameSetElement::new_inherited(
44                local_name, prefix, document,
45            )),
46            document,
47            proto,
48            can_gc,
49        );
50        n.upcast::<Node>().set_weird_parser_insertion_mode();
51        n
52    }
53}
54
55impl HTMLFrameSetElementMethods<crate::DomTypeHolder> for HTMLFrameSetElement {
56    // https://html.spec.whatwg.org/multipage/#windoweventhandlers
57    window_event_handlers!(ForwardToWindow);
58}