1 | /* |
2 | * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 | * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 | * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
5 | * |
6 | * This library is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU Library General Public |
8 | * License as published by the Free Software Foundation; either |
9 | * version 2 of the License, or (at your option) any later version. |
10 | * |
11 | * This library is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | * Library General Public License for more details. |
15 | * |
16 | * You should have received a copy of the GNU Library General Public License |
17 | * along with this library; see the file COPYING.LIB. If not, write to |
18 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | * Boston, MA 02110-1301, USA. |
20 | * |
21 | */ |
22 | |
23 | #pragma once |
24 | |
25 | namespace WebCore { |
26 | |
27 | enum CollectionType { |
28 | // Unnamed HTMLCollection types cached in the document. |
29 | DocImages, // all <img> elements in the document |
30 | DocApplets, // all <object> and <applet> elements |
31 | DocEmbeds, // all <embed> elements |
32 | DocForms, // all <form> elements |
33 | DocLinks, // all <a> _and_ <area> elements with a value for href |
34 | DocAnchors, // all <a> elements with a value for name |
35 | DocScripts, // all <script> elements |
36 | DocAll, // "all" elements (IE) |
37 | |
38 | // Named collection types cached in the document. |
39 | WindowNamedItems, |
40 | DocumentNamedItems, |
41 | |
42 | DocumentAllNamedItems, // Sub-collection returned by the "all" collection when there are multiple items with the same name |
43 | |
44 | // Unnamed HTMLCollection types cached in elements. |
45 | NodeChildren, // first-level children (IE) |
46 | TableTBodies, // all <tbody> elements in this table |
47 | TSectionRows, // all row elements in this table section |
48 | TableRows, |
49 | TRCells, // all cells in this row |
50 | SelectOptions, |
51 | SelectedOptions, |
52 | DataListOptions, |
53 | MapAreas, |
54 | FormControls, |
55 | FieldSetElements, |
56 | ByClass, |
57 | ByTag, |
58 | ByHTMLTag, |
59 | AllDescendants |
60 | }; |
61 | |
62 | enum class CollectionTraversalType { Descendants, ChildrenOnly, CustomForwardOnly }; |
63 | template<CollectionType collectionType> |
64 | struct CollectionTypeTraits { |
65 | static const CollectionTraversalType traversalType = CollectionTraversalType::Descendants; |
66 | }; |
67 | |
68 | template<> |
69 | struct CollectionTypeTraits<NodeChildren> { |
70 | static const CollectionTraversalType traversalType = CollectionTraversalType::ChildrenOnly; |
71 | }; |
72 | |
73 | template<> |
74 | struct CollectionTypeTraits<TRCells> { |
75 | static const CollectionTraversalType traversalType = CollectionTraversalType::ChildrenOnly; |
76 | }; |
77 | |
78 | template<> |
79 | struct CollectionTypeTraits<TSectionRows> { |
80 | static const CollectionTraversalType traversalType = CollectionTraversalType::ChildrenOnly; |
81 | }; |
82 | |
83 | template<> |
84 | struct CollectionTypeTraits<TableTBodies> { |
85 | static const CollectionTraversalType traversalType = CollectionTraversalType::ChildrenOnly; |
86 | }; |
87 | |
88 | template<> |
89 | struct CollectionTypeTraits<TableRows> { |
90 | static const CollectionTraversalType traversalType = CollectionTraversalType::CustomForwardOnly; |
91 | }; |
92 | |
93 | template<> |
94 | struct CollectionTypeTraits<FormControls> { |
95 | static const CollectionTraversalType traversalType = CollectionTraversalType::CustomForwardOnly; |
96 | }; |
97 | |
98 | } // namespace WebCore |
99 | |