mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-25 20:22:18 +03:00
LibWeb: Make Node::parent_element() an inline function
Also remove a redundant verify_cast<Element> while we're here.
This commit is contained in:
parent
d7e2894e57
commit
b40f0415ef
Notes:
sideshowbarker
2024-07-17 03:18:29 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/b40f0415ef Pull-request: https://github.com/SerenityOS/serenity/pull/23637
@ -454,6 +454,22 @@ private:
|
||||
template<>
|
||||
inline bool Node::fast_is<Element>() const { return is_element(); }
|
||||
|
||||
inline Element* Node::parent_element()
|
||||
{
|
||||
auto* parent = this->parent();
|
||||
if (!parent || !is<Element>(parent))
|
||||
return nullptr;
|
||||
return static_cast<Element*>(parent);
|
||||
}
|
||||
|
||||
inline Element const* Node::parent_element() const
|
||||
{
|
||||
auto const* parent = this->parent();
|
||||
if (!parent || !is<Element>(parent))
|
||||
return nullptr;
|
||||
return static_cast<Element const*>(parent);
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<QualifiedName> validate_and_extract(JS::Realm&, Optional<FlyString> namespace_, FlyString const& qualified_name);
|
||||
|
||||
}
|
||||
|
@ -330,20 +330,6 @@ bool Node::is_connected() const
|
||||
return shadow_including_root().is_document();
|
||||
}
|
||||
|
||||
Element* Node::parent_element()
|
||||
{
|
||||
if (!parent() || !is<Element>(parent()))
|
||||
return nullptr;
|
||||
return verify_cast<Element>(parent());
|
||||
}
|
||||
|
||||
Element const* Node::parent_element() const
|
||||
{
|
||||
if (!parent() || !is<Element>(parent()))
|
||||
return nullptr;
|
||||
return verify_cast<Element>(parent());
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
|
||||
WebIDL::ExceptionOr<void> Node::ensure_pre_insertion_validity(JS::NonnullGCPtr<Node> node, JS::GCPtr<Node> child) const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user