/* * Copyright (c) 2025, Johannes Gustafsson * * SPDX-License-Identifier: BSD-2-Clause */ #include #include #include #include #include #include "XPath.h" #include "XPathEvaluator.h" #include "XPathExpression.h" #include "XPathResult.h" namespace Web::XPath { GC_DEFINE_ALLOCATOR(XPathEvaluator); XPathEvaluator::XPathEvaluator(JS::Realm& realm) : Web::Bindings::PlatformObject(realm) { } XPathEvaluator::~XPathEvaluator() = default; WebIDL::ExceptionOr> XPathEvaluator::construct_impl(JS::Realm& realm) { return realm.create(realm); } void XPathEvaluator::initialize(JS::Realm& realm) { WEB_SET_PROTOTYPE_FOR_INTERFACE(XPathEvaluator); Base::initialize(realm); } WebIDL::ExceptionOr> XPathEvaluator::create_expression(String const& expression, GC::Ptr resolver) { auto& realm = this->realm(); return XPath::create_expression(realm, expression, resolver); } WebIDL::ExceptionOr> XPathEvaluator::evaluate(String const& expression, DOM::Node const& context_node, GC::Ptr resolver, WebIDL::UnsignedShort type, GC::Ptr result) { auto& realm = this->realm(); return XPath::evaluate(realm, expression, context_node, resolver, type, result); } GC::Ref XPathEvaluator::create_ns_resolver(GC::Ref node_resolver) { return node_resolver; } }