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 "sky/engine/wtf/text/AtomicStringHash.h" | 34 #include "sky/engine/wtf/text/AtomicStringHash.h" |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
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 template <typename NodeType> class StaticNodeTypeList; | 43 template <typename NodeType> class StaticNodeTypeList; |
44 typedef StaticNodeTypeList<Element> StaticElementList; | |
45 | 44 |
46 class SelectorQuery { | 45 class SelectorQuery { |
47 WTF_MAKE_NONCOPYABLE(SelectorQuery); | 46 WTF_MAKE_NONCOPYABLE(SelectorQuery); |
48 WTF_MAKE_FAST_ALLOCATED; | 47 WTF_MAKE_FAST_ALLOCATED; |
49 public: | 48 public: |
50 static PassOwnPtr<SelectorQuery> adopt(CSSSelectorList&); | 49 static PassOwnPtr<SelectorQuery> adopt(CSSSelectorList&); |
51 | 50 |
52 bool matches(Element&) const; | 51 bool matches(Element&) const; |
53 PassRefPtr<StaticElementList> queryAll(ContainerNode& rootNode) const; | 52 Vector<RefPtr<Element>> queryAll(ContainerNode& rootNode) const; |
54 PassRefPtr<Element> queryFirst(ContainerNode& rootNode) const; | 53 PassRefPtr<Element> queryFirst(ContainerNode& rootNode) const; |
55 private: | 54 private: |
56 explicit SelectorQuery(CSSSelectorList&); | 55 explicit SelectorQuery(CSSSelectorList&); |
57 bool selectorMatches(ContainerNode& rootNode, Element& subject) const; | 56 bool selectorMatches(ContainerNode& rootNode, Element& subject) const; |
58 | 57 |
59 CSSSelectorList m_selectors; | 58 CSSSelectorList m_selectors; |
60 }; | 59 }; |
61 | 60 |
62 class SelectorQueryCache { | 61 class SelectorQueryCache { |
63 WTF_MAKE_FAST_ALLOCATED; | 62 WTF_MAKE_FAST_ALLOCATED; |
64 public: | 63 public: |
65 SelectorQuery* add(const AtomicString&, const Document&, ExceptionState&); | 64 SelectorQuery* add(const AtomicString&, const Document&, ExceptionState&); |
66 | 65 |
67 private: | 66 private: |
68 HashMap<AtomicString, OwnPtr<SelectorQuery> > m_entries; | 67 HashMap<AtomicString, OwnPtr<SelectorQuery> > m_entries; |
69 }; | 68 }; |
70 | 69 |
71 } | 70 } |
72 | 71 |
73 #endif // SKY_ENGINE_CORE_DOM_SELECTORQUERY_H_ | 72 #endif // SKY_ENGINE_CORE_DOM_SELECTORQUERY_H_ |
OLD | NEW |