| 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 WebCore { | 38 namespace WebCore { |
| 39 | 39 |
| 40 using namespace XPath; | 40 using namespace XPath; |
| 41 | 41 |
| 42 PassRefPtr<XPathExpression> XPathEvaluator::createExpression(const String& expre
ssion, PassRefPtr<XPathNSResolver> resolver, ExceptionState& exceptionState) | 42 DEFINE_GC_INFO(XPathEvaluator); |
| 43 |
| 44 PassRefPtrWillBeRawPtr<XPathExpression> XPathEvaluator::createExpression(const S
tring& expression, PassRefPtrWillBeRawPtr<XPathNSResolver> resolver, ExceptionSt
ate& exceptionState) |
| 43 { | 45 { |
| 44 return XPathExpression::createExpression(expression, resolver, exceptionStat
e); | 46 return XPathExpression::createExpression(expression, resolver, exceptionStat
e); |
| 45 } | 47 } |
| 46 | 48 |
| 47 PassRefPtr<XPathNSResolver> XPathEvaluator::createNSResolver(Node* nodeResolver) | 49 PassRefPtrWillBeRawPtr<XPathNSResolver> XPathEvaluator::createNSResolver(Node* n
odeResolver) |
| 48 { | 50 { |
| 49 return NativeXPathNSResolver::create(nodeResolver); | 51 return NativeXPathNSResolver::create(nodeResolver); |
| 50 } | 52 } |
| 51 | 53 |
| 52 PassRefPtr<XPathResult> XPathEvaluator::evaluate(const String& expression, Node*
contextNode, | 54 PassRefPtrWillBeRawPtr<XPathResult> XPathEvaluator::evaluate(const String& expre
ssion, Node* contextNode, |
| 53 PassRefPtr<XPathNSResolver> resolver, unsigned short type, XPathResult* resu
lt, ExceptionState& exceptionState) | 55 PassRefPtrWillBeRawPtr<XPathNSResolver> resolver, unsigned short type, XPath
Result* result, ExceptionState& exceptionState) |
| 54 { | 56 { |
| 55 if (!contextNode) { | 57 if (!contextNode) { |
| 56 exceptionState.throwDOMException(NotSupportedError, "The context node pr
ovided is null."); | 58 exceptionState.throwDOMException(NotSupportedError, "The context node pr
ovided is null."); |
| 57 return 0; | 59 return 0; |
| 58 } | 60 } |
| 59 | 61 |
| 60 if (!isValidContextNode(contextNode)) { | 62 if (!isValidContextNode(contextNode)) { |
| 61 exceptionState.throwDOMException(NotSupportedError, "The node provided i
s '" + contextNode->nodeName() + "', which is not a valid context node type."); | 63 exceptionState.throwDOMException(NotSupportedError, "The node provided i
s '" + contextNode->nodeName() + "', which is not a valid context node type."); |
| 62 return 0; | 64 return 0; |
| 63 } | 65 } |
| 64 | 66 |
| 65 RefPtr<XPathExpression> expr = createExpression(expression, resolver, except
ionState); | 67 RefPtrWillBeRawPtr<XPathExpression> expr = createExpression(expression, reso
lver, exceptionState); |
| 66 if (exceptionState.hadException()) | 68 if (exceptionState.hadException()) |
| 67 return 0; | 69 return 0; |
| 68 | 70 |
| 69 return expr->evaluate(contextNode, type, result, exceptionState); | 71 return expr->evaluate(contextNode, type, result, exceptionState); |
| 70 } | 72 } |
| 71 | 73 |
| 72 } | 74 } |
| OLD | NEW |