ladybird/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp
Brian Gianforcaro 1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00

35 lines
793 B
C++

/*
* Copyright (c) 2020, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/DOM/Event.h>
#include <LibWeb/DOM/ShadowRoot.h>
#include <LibWeb/Layout/BlockBox.h>
namespace Web::DOM {
ShadowRoot::ShadowRoot(Document& document, Element& host)
: DocumentFragment(document)
{
set_host(host);
}
EventTarget* ShadowRoot::get_parent(const Event& event)
{
if (!event.composed()) {
auto& events_first_invocation_target = downcast<Node>(*event.path().first().invocation_target);
if (events_first_invocation_target.root() == this)
return nullptr;
}
return host();
}
RefPtr<Layout::Node> ShadowRoot::create_layout_node()
{
return adopt(*new Layout::BlockBox(document(), this, CSS::ComputedValues {}));
}
}