| 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 23 matching lines...) Expand all  Loading... | 
| 34 #include "wtf/text/AtomicStringHash.h" | 34 #include "wtf/text/AtomicStringHash.h" | 
| 35 | 35 | 
| 36 namespace WebCore { | 36 namespace WebCore { | 
| 37 | 37 | 
| 38 class CSSSelector; | 38 class CSSSelector; | 
| 39 class ContainerNode; | 39 class ContainerNode; | 
| 40 class Document; | 40 class Document; | 
| 41 class Element; | 41 class Element; | 
| 42 class ExceptionState; | 42 class ExceptionState; | 
| 43 class Node; | 43 class Node; | 
| 44 class NodeList; |  | 
| 45 class SimpleNodeList; | 44 class SimpleNodeList; | 
|  | 45 class StaticNodeList; | 
| 46 class SpaceSplitString; | 46 class SpaceSplitString; | 
| 47 | 47 | 
| 48 class SelectorDataList { | 48 class SelectorDataList { | 
| 49 public: | 49 public: | 
| 50     void initialize(const CSSSelectorList&); | 50     void initialize(const CSSSelectorList&); | 
| 51     bool matches(Element&) const; | 51     bool matches(Element&) const; | 
| 52     PassRefPtrWillBeRawPtr<NodeList> queryAll(ContainerNode& rootNode) const; | 52     PassRefPtrWillBeRawPtr<StaticNodeList> queryAll(ContainerNode& rootNode) con
     st; | 
| 53     PassRefPtrWillBeRawPtr<Element> queryFirst(ContainerNode& rootNode) const; | 53     PassRefPtrWillBeRawPtr<Element> queryFirst(ContainerNode& rootNode) const; | 
| 54 | 54 | 
| 55 private: | 55 private: | 
| 56     bool canUseFastQuery(const ContainerNode& rootNode) const; | 56     bool canUseFastQuery(const ContainerNode& rootNode) const; | 
| 57     bool selectorMatches(const CSSSelector&, Element&, const ContainerNode&) con
     st; | 57     bool selectorMatches(const CSSSelector&, Element&, const ContainerNode&) con
     st; | 
| 58 | 58 | 
| 59     template <typename SelectorQueryTrait> | 59     template <typename SelectorQueryTrait> | 
| 60     void collectElementsByClassName(ContainerNode& rootNode, const AtomicString&
      className, typename SelectorQueryTrait::OutputType&) const; | 60     void collectElementsByClassName(ContainerNode& rootNode, const AtomicString&
      className, typename SelectorQueryTrait::OutputType&) const; | 
| 61     template <typename SelectorQueryTrait> | 61     template <typename SelectorQueryTrait> | 
| 62     void collectElementsByTagName(ContainerNode& rootNode, const QualifiedName& 
     tagName, typename SelectorQueryTrait::OutputType&) const; | 62     void collectElementsByTagName(ContainerNode& rootNode, const QualifiedName& 
     tagName, typename SelectorQueryTrait::OutputType&) const; | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
| 84     bool m_crossesTreeBoundary; | 84     bool m_crossesTreeBoundary; | 
| 85 }; | 85 }; | 
| 86 | 86 | 
| 87 class SelectorQuery { | 87 class SelectorQuery { | 
| 88     WTF_MAKE_NONCOPYABLE(SelectorQuery); | 88     WTF_MAKE_NONCOPYABLE(SelectorQuery); | 
| 89     WTF_MAKE_FAST_ALLOCATED; | 89     WTF_MAKE_FAST_ALLOCATED; | 
| 90 public: | 90 public: | 
| 91     static PassOwnPtr<SelectorQuery> adopt(CSSSelectorList&); | 91     static PassOwnPtr<SelectorQuery> adopt(CSSSelectorList&); | 
| 92 | 92 | 
| 93     bool matches(Element&) const; | 93     bool matches(Element&) const; | 
| 94     PassRefPtrWillBeRawPtr<NodeList> queryAll(ContainerNode& rootNode) const; | 94     PassRefPtrWillBeRawPtr<StaticNodeList> queryAll(ContainerNode& rootNode) con
     st; | 
| 95     PassRefPtrWillBeRawPtr<Element> queryFirst(ContainerNode& rootNode) const; | 95     PassRefPtrWillBeRawPtr<Element> queryFirst(ContainerNode& rootNode) const; | 
| 96 private: | 96 private: | 
| 97     explicit SelectorQuery(CSSSelectorList&); | 97     explicit SelectorQuery(CSSSelectorList&); | 
| 98 | 98 | 
| 99     SelectorDataList m_selectors; | 99     SelectorDataList m_selectors; | 
| 100     CSSSelectorList m_selectorList; | 100     CSSSelectorList m_selectorList; | 
| 101 }; | 101 }; | 
| 102 | 102 | 
| 103 class SelectorQueryCache { | 103 class SelectorQueryCache { | 
| 104     WTF_MAKE_FAST_ALLOCATED; | 104     WTF_MAKE_FAST_ALLOCATED; | 
| 105 public: | 105 public: | 
| 106     SelectorQuery* add(const AtomicString&, const Document&, ExceptionState&); | 106     SelectorQuery* add(const AtomicString&, const Document&, ExceptionState&); | 
| 107     void invalidate(); | 107     void invalidate(); | 
| 108 | 108 | 
| 109 private: | 109 private: | 
| 110     HashMap<AtomicString, OwnPtr<SelectorQuery> > m_entries; | 110     HashMap<AtomicString, OwnPtr<SelectorQuery> > m_entries; | 
| 111 }; | 111 }; | 
| 112 | 112 | 
| 113 } | 113 } | 
| 114 | 114 | 
| 115 #endif | 115 #endif | 
| OLD | NEW | 
|---|