OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2005 Frerich Raabe <raabe@kde.org> | 2 * Copyright 2005 Frerich Raabe <raabe@kde.org> |
3 * Copyright (C) 2006 Apple Computer, Inc. | 3 * Copyright (C) 2006 Apple Computer, Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "core/dom/Node.h" | 32 #include "core/dom/Node.h" |
33 #include "core/xml/NativeXPathNSResolver.h" | 33 #include "core/xml/NativeXPathNSResolver.h" |
34 #include "core/xml/XPathExpression.h" | 34 #include "core/xml/XPathExpression.h" |
35 #include "core/xml/XPathResult.h" | 35 #include "core/xml/XPathResult.h" |
36 #include "core/xml/XPathUtil.h" | 36 #include "core/xml/XPathUtil.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 using namespace XPath; | 40 using namespace XPath; |
41 | 41 |
42 PassRefPtrWillBeRawPtr<XPathExpression> XPathEvaluator::createExpression(const S
tring& expression, PassRefPtrWillBeRawPtr<XPathNSResolver> resolver, ExceptionSt
ate& exceptionState) | 42 XPathExpression* XPathEvaluator::createExpression(const String& expression, XPat
hNSResolver* resolver, ExceptionState& exceptionState) |
43 { | 43 { |
44 return XPathExpression::createExpression(expression, resolver, exceptionStat
e); | 44 return XPathExpression::createExpression(expression, resolver, exceptionStat
e); |
45 } | 45 } |
46 | 46 |
47 PassRefPtrWillBeRawPtr<XPathNSResolver> XPathEvaluator::createNSResolver(Node* n
odeResolver) | 47 XPathNSResolver* XPathEvaluator::createNSResolver(Node* nodeResolver) |
48 { | 48 { |
49 return NativeXPathNSResolver::create(nodeResolver); | 49 return NativeXPathNSResolver::create(nodeResolver); |
50 } | 50 } |
51 | 51 |
52 PassRefPtrWillBeRawPtr<XPathResult> XPathEvaluator::evaluate(const String& expre
ssion, Node* contextNode, | 52 XPathResult* XPathEvaluator::evaluate(const String& expression, Node* contextNod
e, XPathNSResolver* resolver, unsigned short type, const ScriptValue&, Exception
State& exceptionState) |
53 PassRefPtrWillBeRawPtr<XPathNSResolver> resolver, unsigned short type, const
ScriptValue&, ExceptionState& exceptionState) | |
54 { | 53 { |
55 if (!isValidContextNode(contextNode)) { | 54 if (!isValidContextNode(contextNode)) { |
56 exceptionState.throwDOMException(NotSupportedError, "The node provided i
s '" + contextNode->nodeName() + "', which is not a valid context node type."); | 55 exceptionState.throwDOMException(NotSupportedError, "The node provided i
s '" + contextNode->nodeName() + "', which is not a valid context node type."); |
57 return nullptr; | 56 return nullptr; |
58 } | 57 } |
59 | 58 |
60 RefPtrWillBeRawPtr<XPathExpression> expr = createExpression(expression, reso
lver, exceptionState); | 59 XPathExpression* expr = createExpression(expression, resolver, exceptionStat
e); |
61 if (exceptionState.hadException()) | 60 if (exceptionState.hadException()) |
62 return nullptr; | 61 return nullptr; |
63 | 62 |
64 return expr->evaluate(contextNode, type, ScriptValue(), exceptionState); | 63 return expr->evaluate(contextNode, type, ScriptValue(), exceptionState); |
65 } | 64 } |
66 | 65 |
67 } | 66 } // namespace blink |
OLD | NEW |