Coverage Report

Created: 2026-10-28 07:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/serenity/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.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/HTMLFrameSetElementPrototype.h>
8
#include <LibWeb/DOM/Document.h>
9
#include <LibWeb/HTML/HTMLFrameSetElement.h>
10
#include <LibWeb/HTML/Window.h>
11
12
namespace Web::HTML {
13
14
JS_DEFINE_ALLOCATOR(HTMLFrameSetElement);
15
16
HTMLFrameSetElement::HTMLFrameSetElement(DOM::Document& document, DOM::QualifiedName qualified_name)
17
0
    : HTMLElement(document, move(qualified_name))
18
0
{
19
0
}
20
21
0
HTMLFrameSetElement::~HTMLFrameSetElement() = default;
22
23
void HTMLFrameSetElement::initialize(JS::Realm& realm)
24
0
{
25
0
    Base::initialize(realm);
26
0
    WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLFrameSetElement);
27
0
}
28
29
void HTMLFrameSetElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
30
0
{
31
0
    HTMLElement::attribute_changed(name, old_value, value);
32
33
0
#undef __ENUMERATE
34
0
#define __ENUMERATE(attribute_name, event_name)                     \
35
0
    if (name == HTML::AttributeNames::attribute_name) {             \
36
0
        element_event_handler_attribute_changed(event_name, value); \
37
0
    }
38
0
    ENUMERATE_WINDOW_EVENT_HANDLERS(__ENUMERATE)
39
0
#undef __ENUMERATE
40
0
}
41
42
JS::GCPtr<DOM::EventTarget> HTMLFrameSetElement::global_event_handlers_to_event_target(FlyString const& event_name)
43
0
{
44
    // NOTE: This is a little weird, but IIUC document.body.onload actually refers to window.onload
45
    // NOTE: document.body can return either a HTMLBodyElement or HTMLFrameSetElement, so both these elements must support this mapping.
46
0
    if (DOM::is_window_reflecting_body_element_event_handler(event_name))
47
0
        return document().window();
48
49
0
    return *this;
50
0
}
51
52
JS::GCPtr<DOM::EventTarget> HTMLFrameSetElement::window_event_handlers_to_event_target()
53
0
{
54
    // All WindowEventHandlers on HTMLFrameSetElement (e.g. document.body.onrejectionhandled) are mapped to window.on{event}.
55
    // NOTE: document.body can return either a HTMLBodyElement or HTMLFrameSetElement, so both these elements must support this mapping.
56
0
    return document().window();
57
0
}
58
59
}