| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google, Inc. | 2 * Copyright (C) 2013 Google, Inc. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
| 31 #include "core/xml/XPathExpression.h" | 31 #include "core/xml/XPathExpression.h" |
| 32 #include "core/xml/XPathResult.h" | 32 #include "core/xml/XPathResult.h" |
| 33 | 33 |
| 34 namespace WebCore { | 34 namespace WebCore { |
| 35 | 35 |
| 36 DocumentXPathEvaluator::DocumentXPathEvaluator() | 36 DocumentXPathEvaluator::DocumentXPathEvaluator() |
| 37 { | 37 { |
| 38 } | 38 } |
| 39 | 39 |
| 40 DocumentXPathEvaluator::~DocumentXPathEvaluator() | |
| 41 { | |
| 42 } | |
| 43 | |
| 44 DocumentXPathEvaluator& DocumentXPathEvaluator::from(DocumentSupplementable& doc
ument) | 40 DocumentXPathEvaluator& DocumentXPathEvaluator::from(DocumentSupplementable& doc
ument) |
| 45 { | 41 { |
| 46 DocumentXPathEvaluator* cache = static_cast<DocumentXPathEvaluator*>(Documen
tSupplement::from(document, supplementName())); | 42 DocumentXPathEvaluator* cache = static_cast<DocumentXPathEvaluator*>(Documen
tSupplement::from(document, supplementName())); |
| 47 if (!cache) { | 43 if (!cache) { |
| 48 cache = new DocumentXPathEvaluator(); | 44 cache = new DocumentXPathEvaluator(); |
| 49 DocumentSupplement::provideTo(document, supplementName(), adoptPtr(cache
)); | 45 DocumentSupplement::provideTo(document, supplementName(), adoptPtrWillBe
Noop(cache)); |
| 50 } | 46 } |
| 51 return *cache; | 47 return *cache; |
| 52 } | 48 } |
| 53 | 49 |
| 54 PassRefPtrWillBeRawPtr<XPathExpression> DocumentXPathEvaluator::createExpression
(DocumentSupplementable& document, | 50 PassRefPtrWillBeRawPtr<XPathExpression> DocumentXPathEvaluator::createExpression
(DocumentSupplementable& document, |
| 55 const String& expression, PassRefPtrWillBeRawPtr<XPathNSResolver> resolver,
ExceptionState& exceptionState) | 51 const String& expression, PassRefPtrWillBeRawPtr<XPathNSResolver> resolver,
ExceptionState& exceptionState) |
| 56 { | 52 { |
| 57 DocumentXPathEvaluator& suplement = from(document); | 53 DocumentXPathEvaluator& suplement = from(document); |
| 58 if (!suplement.m_xpathEvaluator) | 54 if (!suplement.m_xpathEvaluator) |
| 59 suplement.m_xpathEvaluator = XPathEvaluator::create(); | 55 suplement.m_xpathEvaluator = XPathEvaluator::create(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 71 PassRefPtrWillBeRawPtr<XPathResult> DocumentXPathEvaluator::evaluate(DocumentSup
plementable& document, const String& expression, | 67 PassRefPtrWillBeRawPtr<XPathResult> DocumentXPathEvaluator::evaluate(DocumentSup
plementable& document, const String& expression, |
| 72 Node* contextNode, PassRefPtrWillBeRawPtr<XPathNSResolver> resolver, unsigne
d short type, | 68 Node* contextNode, PassRefPtrWillBeRawPtr<XPathNSResolver> resolver, unsigne
d short type, |
| 73 XPathResult* result, ExceptionState& exceptionState) | 69 XPathResult* result, ExceptionState& exceptionState) |
| 74 { | 70 { |
| 75 DocumentXPathEvaluator& suplement = from(document); | 71 DocumentXPathEvaluator& suplement = from(document); |
| 76 if (!suplement.m_xpathEvaluator) | 72 if (!suplement.m_xpathEvaluator) |
| 77 suplement.m_xpathEvaluator = XPathEvaluator::create(); | 73 suplement.m_xpathEvaluator = XPathEvaluator::create(); |
| 78 return suplement.m_xpathEvaluator->evaluate(expression, contextNode, resolve
r, type, result, exceptionState); | 74 return suplement.m_xpathEvaluator->evaluate(expression, contextNode, resolve
r, type, result, exceptionState); |
| 79 } | 75 } |
| 80 | 76 |
| 77 void DocumentXPathEvaluator::trace(Visitor* visitor) |
| 78 { |
| 79 visitor->trace(m_xpathEvaluator); |
| 80 } |
| 81 |
| 81 } // namespace WebCore | 82 } // namespace WebCore |
| OLD | NEW |