| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org> | 2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org> |
| 3 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. |
| 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 22 matching lines...) Expand all Loading... |
| 33 #include "core/xml/XPathNSResolver.h" | 33 #include "core/xml/XPathNSResolver.h" |
| 34 #include "core/xml/XPathParser.h" | 34 #include "core/xml/XPathParser.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 #include "wtf/text/WTFString.h" | 37 #include "wtf/text/WTFString.h" |
| 38 | 38 |
| 39 namespace WebCore { | 39 namespace WebCore { |
| 40 | 40 |
| 41 using namespace XPath; | 41 using namespace XPath; |
| 42 | 42 |
| 43 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(XPathExpression); |
| 44 |
| 43 XPathExpression::XPathExpression() | 45 XPathExpression::XPathExpression() |
| 44 { | 46 { |
| 45 ScriptWrappable::init(this); | 47 ScriptWrappable::init(this); |
| 46 } | 48 } |
| 47 | 49 |
| 48 PassRefPtrWillBeRawPtr<XPathExpression> XPathExpression::createExpression(const
String& expression, PassRefPtrWillBeRawPtr<XPathNSResolver> resolver, ExceptionS
tate& exceptionState) | 50 PassRefPtrWillBeRawPtr<XPathExpression> XPathExpression::createExpression(const
String& expression, PassRefPtrWillBeRawPtr<XPathNSResolver> resolver, ExceptionS
tate& exceptionState) |
| 49 { | 51 { |
| 50 RefPtrWillBeRawPtr<XPathExpression> expr = XPathExpression::create(); | 52 RefPtrWillBeRawPtr<XPathExpression> expr = XPathExpression::create(); |
| 51 Parser parser; | 53 Parser parser; |
| 52 | 54 |
| 53 expr->m_topExpression = parser.parseStatement(expression, resolver, exceptio
nState); | 55 expr->m_topExpression = parser.parseStatement(expression, resolver, exceptio
nState); |
| 54 if (!expr->m_topExpression) | 56 if (!expr->m_topExpression) |
| 55 return nullptr; | 57 return nullptr; |
| 56 | 58 |
| 57 return expr.release(); | 59 return expr.release(); |
| 58 } | 60 } |
| 59 | 61 |
| 60 XPathExpression::~XPathExpression() | |
| 61 { | |
| 62 } | |
| 63 | |
| 64 void XPathExpression::trace(Visitor* visitor) | 62 void XPathExpression::trace(Visitor* visitor) |
| 65 { | 63 { |
| 66 visitor->trace(m_topExpression); | 64 visitor->trace(m_topExpression); |
| 67 } | 65 } |
| 68 | 66 |
| 69 PassRefPtrWillBeRawPtr<XPathResult> XPathExpression::evaluate(Node* contextNode,
unsigned short type, XPathResult*, ExceptionState& exceptionState) | 67 PassRefPtrWillBeRawPtr<XPathResult> XPathExpression::evaluate(Node* contextNode,
unsigned short type, XPathResult*, ExceptionState& exceptionState) |
| 70 { | 68 { |
| 71 if (!contextNode) { | 69 if (!contextNode) { |
| 72 exceptionState.throwDOMException(NotSupportedError, "The context node pr
ovided is null."); | 70 exceptionState.throwDOMException(NotSupportedError, "The context node pr
ovided is null."); |
| 73 return nullptr; | 71 return nullptr; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 95 if (type != XPathResult::ANY_TYPE) { | 93 if (type != XPathResult::ANY_TYPE) { |
| 96 result->convertTo(type, exceptionState); | 94 result->convertTo(type, exceptionState); |
| 97 if (exceptionState.hadException()) | 95 if (exceptionState.hadException()) |
| 98 return nullptr; | 96 return nullptr; |
| 99 } | 97 } |
| 100 | 98 |
| 101 return result; | 99 return result; |
| 102 } | 100 } |
| 103 | 101 |
| 104 } | 102 } |
| OLD | NEW |