OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2013 Apple Inc. All rights reserved. |
3 * Copyright (C) 2014 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2014 Samsung Electronics. 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 return false; | 134 return false; |
135 } | 135 } |
136 | 136 |
137 PassRefPtrWillBeRawPtr<NodeList> SelectorDataList::queryAll(ContainerNode& rootN
ode) const | 137 PassRefPtrWillBeRawPtr<NodeList> SelectorDataList::queryAll(ContainerNode& rootN
ode) const |
138 { | 138 { |
139 Vector<RefPtr<Node> > result; | 139 Vector<RefPtr<Node> > result; |
140 execute<AllElementsSelectorQueryTrait>(rootNode, result); | 140 execute<AllElementsSelectorQueryTrait>(rootNode, result); |
141 return StaticNodeList::adopt(result); | 141 return StaticNodeList::adopt(result); |
142 } | 142 } |
143 | 143 |
144 PassRefPtr<Element> SelectorDataList::queryFirst(ContainerNode& rootNode) const | 144 PassRefPtrWillBeRawPtr<Element> SelectorDataList::queryFirst(ContainerNode& root
Node) const |
145 { | 145 { |
146 Element* matchedElement = 0; | 146 Element* matchedElement = 0; |
147 execute<SingleElementSelectorQueryTrait>(rootNode, matchedElement); | 147 execute<SingleElementSelectorQueryTrait>(rootNode, matchedElement); |
148 return matchedElement; | 148 return matchedElement; |
149 } | 149 } |
150 | 150 |
151 template <typename SelectorQueryTrait> | 151 template <typename SelectorQueryTrait> |
152 void SelectorDataList::collectElementsByClassName(ContainerNode& rootNode, const
AtomicString& className, typename SelectorQueryTrait::OutputType& output) cons
t | 152 void SelectorDataList::collectElementsByClassName(ContainerNode& rootNode, const
AtomicString& className, typename SelectorQueryTrait::OutputType& output) cons
t |
153 { | 153 { |
154 for (Element* element = ElementTraversal::firstWithin(rootNode); element; el
ement = ElementTraversal::next(*element, &rootNode)) { | 154 for (Element* element = ElementTraversal::firstWithin(rootNode); element; el
ement = ElementTraversal::next(*element, &rootNode)) { |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 bool SelectorQuery::matches(Element& element) const | 473 bool SelectorQuery::matches(Element& element) const |
474 { | 474 { |
475 return m_selectors.matches(element); | 475 return m_selectors.matches(element); |
476 } | 476 } |
477 | 477 |
478 PassRefPtrWillBeRawPtr<NodeList> SelectorQuery::queryAll(ContainerNode& rootNode
) const | 478 PassRefPtrWillBeRawPtr<NodeList> SelectorQuery::queryAll(ContainerNode& rootNode
) const |
479 { | 479 { |
480 return m_selectors.queryAll(rootNode); | 480 return m_selectors.queryAll(rootNode); |
481 } | 481 } |
482 | 482 |
483 PassRefPtr<Element> SelectorQuery::queryFirst(ContainerNode& rootNode) const | 483 PassRefPtrWillBeRawPtr<Element> SelectorQuery::queryFirst(ContainerNode& rootNod
e) const |
484 { | 484 { |
485 return m_selectors.queryFirst(rootNode); | 485 return m_selectors.queryFirst(rootNode); |
486 } | 486 } |
487 | 487 |
488 SelectorQuery* SelectorQueryCache::add(const AtomicString& selectors, const Docu
ment& document, ExceptionState& exceptionState) | 488 SelectorQuery* SelectorQueryCache::add(const AtomicString& selectors, const Docu
ment& document, ExceptionState& exceptionState) |
489 { | 489 { |
490 HashMap<AtomicString, OwnPtr<SelectorQuery> >::iterator it = m_entries.find(
selectors); | 490 HashMap<AtomicString, OwnPtr<SelectorQuery> >::iterator it = m_entries.find(
selectors); |
491 if (it != m_entries.end()) | 491 if (it != m_entries.end()) |
492 return it->value.get(); | 492 return it->value.get(); |
493 | 493 |
(...skipping 21 matching lines...) Expand all Loading... |
515 m_entries.add(selectors, selectorQuery.release()); | 515 m_entries.add(selectors, selectorQuery.release()); |
516 return rawSelectorQuery; | 516 return rawSelectorQuery; |
517 } | 517 } |
518 | 518 |
519 void SelectorQueryCache::invalidate() | 519 void SelectorQueryCache::invalidate() |
520 { | 520 { |
521 m_entries.clear(); | 521 m_entries.clear(); |
522 } | 522 } |
523 | 523 |
524 } | 524 } |
OLD | NEW |