This source file includes following definitions.
- from
- createExpression
- createNSResolver
- evaluate
#include "config.h"
#include "core/xml/DocumentXPathEvaluator.h"
#include "bindings/v8/ExceptionState.h"
#include "core/dom/Document.h"
#include "core/xml/XPathExpression.h"
#include "core/xml/XPathResult.h"
namespace WebCore {
DocumentXPathEvaluator::DocumentXPathEvaluator()
{
}
DocumentXPathEvaluator::~DocumentXPathEvaluator()
{
}
DocumentXPathEvaluator& DocumentXPathEvaluator::from(DocumentSupplementable& document)
{
DocumentXPathEvaluator* cache = static_cast<DocumentXPathEvaluator*>(DocumentSupplement::from(document, supplementName()));
if (!cache) {
cache = new DocumentXPathEvaluator();
DocumentSupplement::provideTo(document, supplementName(), adoptPtr(cache));
}
return *cache;
}
PassRefPtrWillBeRawPtr<XPathExpression> DocumentXPathEvaluator::createExpression(DocumentSupplementable& document,
const String& expression, PassRefPtrWillBeRawPtr<XPathNSResolver> resolver, ExceptionState& exceptionState)
{
DocumentXPathEvaluator& suplement = from(document);
if (!suplement.m_xpathEvaluator)
suplement.m_xpathEvaluator = XPathEvaluator::create();
return suplement.m_xpathEvaluator->createExpression(expression, resolver, exceptionState);
}
PassRefPtrWillBeRawPtr<XPathNSResolver> DocumentXPathEvaluator::createNSResolver(DocumentSupplementable& document, Node* nodeResolver)
{
DocumentXPathEvaluator& suplement = from(document);
if (!suplement.m_xpathEvaluator)
suplement.m_xpathEvaluator = XPathEvaluator::create();
return suplement.m_xpathEvaluator->createNSResolver(nodeResolver);
}
PassRefPtrWillBeRawPtr<XPathResult> DocumentXPathEvaluator::evaluate(DocumentSupplementable& document, const String& expression,
Node* contextNode, PassRefPtrWillBeRawPtr<XPathNSResolver> resolver, unsigned short type,
XPathResult* result, ExceptionState& exceptionState)
{
DocumentXPathEvaluator& suplement = from(document);
if (!suplement.m_xpathEvaluator)
suplement.m_xpathEvaluator = XPathEvaluator::create();
return suplement.m_xpathEvaluator->evaluate(expression, contextNode, resolver, type, result, exceptionState);
}
}