Coverage Report

Created: 2026-07-25 07:46

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/serenity/Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp
Line
Count
Source
1
/*
2
 * Copyright (c) 2020, the SerenityOS developers.
3
 *
4
 * SPDX-License-Identifier: BSD-2-Clause
5
 */
6
7
#include <LibWeb/Bindings/HTMLMapElementPrototype.h>
8
#include <LibWeb/Bindings/Intrinsics.h>
9
#include <LibWeb/HTML/HTMLAreaElement.h>
10
#include <LibWeb/HTML/HTMLMapElement.h>
11
12
namespace Web::HTML {
13
14
JS_DEFINE_ALLOCATOR(HTMLMapElement);
15
16
HTMLMapElement::HTMLMapElement(DOM::Document& document, DOM::QualifiedName qualified_name)
17
0
    : HTMLElement(document, move(qualified_name))
18
0
{
19
0
}
20
21
0
HTMLMapElement::~HTMLMapElement() = default;
22
23
void HTMLMapElement::initialize(JS::Realm& realm)
24
0
{
25
0
    Base::initialize(realm);
26
0
    WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLMapElement);
27
0
}
28
29
void HTMLMapElement::visit_edges(Cell::Visitor& visitor)
30
0
{
31
0
    Base::visit_edges(visitor);
32
0
    visitor.visit(m_areas);
33
0
}
34
35
// https://html.spec.whatwg.org/multipage/image-maps.html#dom-map-areas
36
JS::NonnullGCPtr<DOM::HTMLCollection> HTMLMapElement::areas()
37
0
{
38
    // The areas attribute must return an HTMLCollection rooted at the map element, whose filter matches only area elements.
39
0
    if (!m_areas) {
40
0
        m_areas = DOM::HTMLCollection::create(*this, DOM::HTMLCollection::Scope::Descendants, [](Element const& element) {
41
0
            return is<HTML::HTMLAreaElement>(element);
42
0
        });
43
0
    }
44
0
    return *m_areas;
45
0
}
46
47
}