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 23 matching lines...) Expand all Loading... |
34 namespace WebCore { | 34 namespace WebCore { |
35 | 35 |
36 DocumentXPathEvaluator::DocumentXPathEvaluator() | 36 DocumentXPathEvaluator::DocumentXPathEvaluator() |
37 { | 37 { |
38 } | 38 } |
39 | 39 |
40 DocumentXPathEvaluator::~DocumentXPathEvaluator() | 40 DocumentXPathEvaluator::~DocumentXPathEvaluator() |
41 { | 41 { |
42 } | 42 } |
43 | 43 |
44 DocumentXPathEvaluator* DocumentXPathEvaluator::from(DocumentSupplementable* doc
ument) | 44 DocumentXPathEvaluator& DocumentXPathEvaluator::from(DocumentSupplementable& doc
ument) |
45 { | 45 { |
46 DocumentXPathEvaluator* cache = static_cast<DocumentXPathEvaluator*>(Documen
tSupplement::from(document, supplementName())); | 46 DocumentXPathEvaluator* cache = static_cast<DocumentXPathEvaluator*>(Documen
tSupplement::from(document, supplementName())); |
47 if (!cache) { | 47 if (!cache) { |
48 cache = new DocumentXPathEvaluator(); | 48 cache = new DocumentXPathEvaluator(); |
49 DocumentSupplement::provideTo(document, supplementName(), adoptPtr(cache
)); | 49 DocumentSupplement::provideTo(document, supplementName(), adoptPtr(cache
)); |
50 } | 50 } |
51 return cache; | 51 return *cache; |
52 } | 52 } |
53 | 53 |
54 PassRefPtrWillBeRawPtr<XPathExpression> DocumentXPathEvaluator::createExpression
(DocumentSupplementable* document, | 54 PassRefPtrWillBeRawPtr<XPathExpression> DocumentXPathEvaluator::createExpression
(DocumentSupplementable& document, |
55 const String& expression, PassRefPtrWillBeRawPtr<XPathNSResolver> resolver,
ExceptionState& exceptionState) | 55 const String& expression, PassRefPtrWillBeRawPtr<XPathNSResolver> resolver,
ExceptionState& exceptionState) |
56 { | 56 { |
57 DocumentXPathEvaluator* suplement = from(document); | 57 DocumentXPathEvaluator& suplement = from(document); |
58 if (!suplement->m_xpathEvaluator) | 58 if (!suplement.m_xpathEvaluator) |
59 suplement->m_xpathEvaluator = XPathEvaluator::create(); | 59 suplement.m_xpathEvaluator = XPathEvaluator::create(); |
60 return suplement->m_xpathEvaluator->createExpression(expression, resolver, e
xceptionState); | 60 return suplement.m_xpathEvaluator->createExpression(expression, resolver, ex
ceptionState); |
61 } | 61 } |
62 | 62 |
63 PassRefPtrWillBeRawPtr<XPathNSResolver> DocumentXPathEvaluator::createNSResolver
(DocumentSupplementable* document, Node* nodeResolver) | 63 PassRefPtrWillBeRawPtr<XPathNSResolver> DocumentXPathEvaluator::createNSResolver
(DocumentSupplementable& document, Node* nodeResolver) |
64 { | 64 { |
65 DocumentXPathEvaluator* suplement = from(document); | 65 DocumentXPathEvaluator& suplement = from(document); |
66 if (!suplement->m_xpathEvaluator) | 66 if (!suplement.m_xpathEvaluator) |
67 suplement->m_xpathEvaluator = XPathEvaluator::create(); | 67 suplement.m_xpathEvaluator = XPathEvaluator::create(); |
68 return suplement->m_xpathEvaluator->createNSResolver(nodeResolver); | 68 return suplement.m_xpathEvaluator->createNSResolver(nodeResolver); |
69 } | 69 } |
70 | 70 |
71 PassRefPtrWillBeRawPtr<XPathResult> DocumentXPathEvaluator::evaluate(DocumentSup
plementable* document, const String& expression, | 71 PassRefPtrWillBeRawPtr<XPathResult> DocumentXPathEvaluator::evaluate(DocumentSup
plementable& document, const String& expression, |
72 Node* contextNode, PassRefPtrWillBeRawPtr<XPathNSResolver> resolver, unsigne
d short type, | 72 Node* contextNode, PassRefPtrWillBeRawPtr<XPathNSResolver> resolver, unsigne
d short type, |
73 XPathResult* result, ExceptionState& exceptionState) | 73 XPathResult* result, ExceptionState& exceptionState) |
74 { | 74 { |
75 DocumentXPathEvaluator* suplement = from(document); | 75 DocumentXPathEvaluator& suplement = from(document); |
76 if (!suplement->m_xpathEvaluator) | 76 if (!suplement.m_xpathEvaluator) |
77 suplement->m_xpathEvaluator = XPathEvaluator::create(); | 77 suplement.m_xpathEvaluator = XPathEvaluator::create(); |
78 return suplement->m_xpathEvaluator->evaluate(expression, contextNode, resolv
er, type, result, exceptionState); | 78 return suplement.m_xpathEvaluator->evaluate(expression, contextNode, resolve
r, type, result, exceptionState); |
79 } | 79 } |
80 | 80 |
81 } // namespace WebCore | 81 } // namespace WebCore |
OLD | NEW |