| 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 29 matching lines...) Expand all Loading... |
| 40 class Document; | 40 class Document; |
| 41 class Element; | 41 class Element; |
| 42 class ExceptionState; | 42 class ExceptionState; |
| 43 template <typename NodeType> class StaticNodeTypeList; | 43 template <typename NodeType> class StaticNodeTypeList; |
| 44 typedef StaticNodeTypeList<Element> StaticElementList; | 44 typedef StaticNodeTypeList<Element> StaticElementList; |
| 45 | 45 |
| 46 class SelectorDataList { | 46 class SelectorDataList { |
| 47 public: | 47 public: |
| 48 void initialize(const CSSSelectorList&); | 48 void initialize(const CSSSelectorList&); |
| 49 bool matches(Element&) const; | 49 bool matches(Element&) const; |
| 50 Element* closest(Element&) const; |
| 50 PassRefPtrWillBeRawPtr<StaticElementList> queryAll(ContainerNode& rootNode)
const; | 51 PassRefPtrWillBeRawPtr<StaticElementList> queryAll(ContainerNode& rootNode)
const; |
| 51 PassRefPtrWillBeRawPtr<Element> queryFirst(ContainerNode& rootNode) const; | 52 PassRefPtrWillBeRawPtr<Element> queryFirst(ContainerNode& rootNode) const; |
| 52 | 53 |
| 53 private: | 54 private: |
| 54 bool canUseFastQuery(const ContainerNode& rootNode) const; | 55 bool canUseFastQuery(const ContainerNode& rootNode) const; |
| 55 bool selectorMatches(const CSSSelector&, Element&, const ContainerNode&) con
st; | 56 bool selectorMatches(const CSSSelector&, Element&, const ContainerNode&) con
st; |
| 56 | 57 |
| 57 template <typename SelectorQueryTrait> | 58 template <typename SelectorQueryTrait> |
| 58 void collectElementsByClassName(ContainerNode& rootNode, const AtomicString&
className, typename SelectorQueryTrait::OutputType&) const; | 59 void collectElementsByClassName(ContainerNode& rootNode, const AtomicString&
className, typename SelectorQueryTrait::OutputType&) const; |
| 59 template <typename SelectorQueryTrait> | 60 template <typename SelectorQueryTrait> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 82 bool m_crossesTreeBoundary; | 83 bool m_crossesTreeBoundary; |
| 83 }; | 84 }; |
| 84 | 85 |
| 85 class SelectorQuery { | 86 class SelectorQuery { |
| 86 WTF_MAKE_NONCOPYABLE(SelectorQuery); | 87 WTF_MAKE_NONCOPYABLE(SelectorQuery); |
| 87 WTF_MAKE_FAST_ALLOCATED; | 88 WTF_MAKE_FAST_ALLOCATED; |
| 88 public: | 89 public: |
| 89 static PassOwnPtr<SelectorQuery> adopt(CSSSelectorList&); | 90 static PassOwnPtr<SelectorQuery> adopt(CSSSelectorList&); |
| 90 | 91 |
| 91 bool matches(Element&) const; | 92 bool matches(Element&) const; |
| 93 Element* closest(Element&) const; |
| 92 PassRefPtrWillBeRawPtr<StaticElementList> queryAll(ContainerNode& rootNode)
const; | 94 PassRefPtrWillBeRawPtr<StaticElementList> queryAll(ContainerNode& rootNode)
const; |
| 93 PassRefPtrWillBeRawPtr<Element> queryFirst(ContainerNode& rootNode) const; | 95 PassRefPtrWillBeRawPtr<Element> queryFirst(ContainerNode& rootNode) const; |
| 94 private: | 96 private: |
| 95 explicit SelectorQuery(CSSSelectorList&); | 97 explicit SelectorQuery(CSSSelectorList&); |
| 96 | 98 |
| 97 SelectorDataList m_selectors; | 99 SelectorDataList m_selectors; |
| 98 CSSSelectorList m_selectorList; | 100 CSSSelectorList m_selectorList; |
| 99 }; | 101 }; |
| 100 | 102 |
| 101 class SelectorQueryCache { | 103 class SelectorQueryCache { |
| 102 WTF_MAKE_FAST_ALLOCATED; | 104 WTF_MAKE_FAST_ALLOCATED; |
| 103 public: | 105 public: |
| 104 SelectorQuery* add(const AtomicString&, const Document&, ExceptionState&); | 106 SelectorQuery* add(const AtomicString&, const Document&, ExceptionState&); |
| 105 void invalidate(); | 107 void invalidate(); |
| 106 | 108 |
| 107 private: | 109 private: |
| 108 HashMap<AtomicString, OwnPtr<SelectorQuery> > m_entries; | 110 HashMap<AtomicString, OwnPtr<SelectorQuery> > m_entries; |
| 109 }; | 111 }; |
| 110 | 112 |
| 111 } | 113 } |
| 112 | 114 |
| 113 #endif | 115 #endif |
| OLD | NEW |