OLD | NEW |
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 Loading... |
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 Loading... |
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_ |
OLD | NEW |