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

Side by Side Diff: sky/engine/core/dom/StaticNodeList.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/SelectorQuery.cpp ('k') | sky/tests/framework/flights-app-pixels.sky » ('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) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 private: 57 private:
58 ptrdiff_t AllocationSize() 58 ptrdiff_t AllocationSize()
59 { 59 {
60 return m_nodes.capacity() * sizeof(RefPtr<NodeType>); 60 return m_nodes.capacity() * sizeof(RefPtr<NodeType>);
61 } 61 }
62 62
63 Vector<RefPtr<NodeType> > m_nodes; 63 Vector<RefPtr<NodeType> > m_nodes;
64 }; 64 };
65 65
66 typedef StaticNodeTypeList<Node> StaticNodeList; 66 typedef StaticNodeTypeList<Node> StaticNodeList;
67 typedef StaticNodeTypeList<Element> StaticElementList;
68 67
69 template <typename NodeType> 68 template <typename NodeType>
70 PassRefPtr<StaticNodeTypeList<NodeType> > StaticNodeTypeList<NodeType>::adopt(Ve ctor<RefPtr<NodeType> >& nodes) 69 PassRefPtr<StaticNodeTypeList<NodeType> > StaticNodeTypeList<NodeType>::adopt(Ve ctor<RefPtr<NodeType> >& nodes)
71 { 70 {
72 RefPtr<StaticNodeTypeList<NodeType> > nodeList = adoptRef(new StaticNodeType List<NodeType>); 71 RefPtr<StaticNodeTypeList<NodeType> > nodeList = adoptRef(new StaticNodeType List<NodeType>);
73 nodeList->m_nodes.swap(nodes); 72 nodeList->m_nodes.swap(nodes);
74 return nodeList.release(); 73 return nodeList.release();
75 } 74 }
76 75
77 template <typename NodeType> 76 template <typename NodeType>
(...skipping 11 matching lines...) Expand all
89 NodeType* StaticNodeTypeList<NodeType>::item(unsigned index) const 88 NodeType* StaticNodeTypeList<NodeType>::item(unsigned index) const
90 { 89 {
91 if (index < m_nodes.size()) 90 if (index < m_nodes.size())
92 return m_nodes[index].get(); 91 return m_nodes[index].get();
93 return 0; 92 return 0;
94 } 93 }
95 94
96 } // namespace blink 95 } // namespace blink
97 96
98 #endif // SKY_ENGINE_CORE_DOM_STATICNODELIST_H_ 97 #endif // SKY_ENGINE_CORE_DOM_STATICNODELIST_H_
OLDNEW
« no previous file with comments | « sky/engine/core/dom/SelectorQuery.cpp ('k') | sky/tests/framework/flights-app-pixels.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698