mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-13 06:38:48 +02:00
<!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #15884 Source-Repo: https://github.com/servo/servo Source-Revision: c12b17d276df5e6960358b33b9c9ff2fc414e083 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : a1c28c393bec450b59318df4ced2f1a5be37a51d
45 lines
1.5 KiB
Rust
45 lines
1.5 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::HTMLMapElementBinding;
|
|
use dom::bindings::inheritance::Castable;
|
|
use dom::bindings::js::Root;
|
|
use dom::bindings::str::DOMString;
|
|
use dom::document::Document;
|
|
use dom::htmlareaelement::HTMLAreaElement;
|
|
use dom::htmlelement::HTMLElement;
|
|
use dom::node::Node;
|
|
use dom_struct::dom_struct;
|
|
use html5ever_atoms::LocalName;
|
|
|
|
#[dom_struct]
|
|
pub struct HTMLMapElement {
|
|
htmlelement: HTMLElement
|
|
}
|
|
|
|
impl HTMLMapElement {
|
|
fn new_inherited(local_name: LocalName,
|
|
prefix: Option<DOMString>,
|
|
document: &Document) -> HTMLMapElement {
|
|
HTMLMapElement {
|
|
htmlelement: HTMLElement::new_inherited(local_name, prefix, document)
|
|
}
|
|
}
|
|
|
|
#[allow(unrooted_must_root)]
|
|
pub fn new(local_name: LocalName,
|
|
prefix: Option<DOMString>,
|
|
document: &Document) -> Root<HTMLMapElement> {
|
|
Node::reflect_node(box HTMLMapElement::new_inherited(local_name, prefix, document),
|
|
document,
|
|
HTMLMapElementBinding::Wrap)
|
|
}
|
|
|
|
pub fn get_area_elements(&self) -> Vec<Root<HTMLAreaElement>> {
|
|
self.upcast::<Node>()
|
|
.traverse_preorder()
|
|
.filter_map(Root::downcast::<HTMLAreaElement>).collect()
|
|
}
|
|
}
|
|
|