Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: sky/engine/core/dom/SelectorQuery.h

Issue 943433002: querySelectorAll should return List<Element> (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Named return value optimization Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/dom/ParentNode.idl ('k') | sky/engine/core/dom/SelectorQuery.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_
OLDNEW
« no previous file with comments | « sky/engine/core/dom/ParentNode.idl ('k') | sky/engine/core/dom/SelectorQuery.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698