OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2011, 2012 Apple Inc. All rights
reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2011, 2012 Apple Inc. All rights
reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 24 matching lines...) Expand all Loading... |
35 using namespace HTMLNames; | 35 using namespace HTMLNames; |
36 | 36 |
37 HTMLNameCollection::HTMLNameCollection(ContainerNode* document, CollectionType t
ype, const AtomicString& name) | 37 HTMLNameCollection::HTMLNameCollection(ContainerNode* document, CollectionType t
ype, const AtomicString& name) |
38 : HTMLCollection(document, type, OverridesItemAfter) | 38 : HTMLCollection(document, type, OverridesItemAfter) |
39 , m_name(name) | 39 , m_name(name) |
40 { | 40 { |
41 } | 41 } |
42 | 42 |
43 HTMLNameCollection::~HTMLNameCollection() | 43 HTMLNameCollection::~HTMLNameCollection() |
44 { | 44 { |
45 ASSERT(ownerNode()); | 45 ASSERT(ownerNode().isDocumentNode()); |
46 ASSERT(ownerNode()->isDocumentNode()); | |
47 ASSERT(type() == WindowNamedItems || type() == DocumentNamedItems); | 46 ASSERT(type() == WindowNamedItems || type() == DocumentNamedItems); |
48 | 47 |
49 ownerNode()->nodeLists()->removeCache(this, type(), m_name); | 48 ownerNode().nodeLists()->removeCache(this, type(), m_name); |
50 } | 49 } |
51 | 50 |
52 Element* HTMLNameCollection::virtualItemAfter(Element* previous) const | 51 Element* HTMLNameCollection::virtualItemAfter(Element* previous) const |
53 { | 52 { |
54 ASSERT(previous != ownerNode()); | 53 ASSERT(previous != ownerNode()); |
55 | 54 |
56 Element* current; | 55 Element* current; |
57 if (!previous) | 56 if (!previous) |
58 current = ElementTraversal::firstWithin(*ownerNode()); | 57 current = ElementTraversal::firstWithin(ownerNode()); |
59 else | 58 else |
60 current = ElementTraversal::next(*previous, ownerNode()); | 59 current = ElementTraversal::next(*previous, &ownerNode()); |
61 | 60 |
62 for (; current; current = ElementTraversal::next(*current, ownerNode())) { | 61 for (; current; current = ElementTraversal::next(*current, &ownerNode())) { |
63 switch (type()) { | 62 switch (type()) { |
64 case WindowNamedItems: | 63 case WindowNamedItems: |
65 // find only images, forms, applets, embeds and objects by name, | 64 // find only images, forms, applets, embeds and objects by name, |
66 // but anything by id | 65 // but anything by id |
67 if (current->hasTagName(imgTag) | 66 if (current->hasTagName(imgTag) |
68 || current->hasTagName(formTag) | 67 || current->hasTagName(formTag) |
69 || current->hasTagName(appletTag) | 68 || current->hasTagName(appletTag) |
70 || current->hasTagName(embedTag) | 69 || current->hasTagName(embedTag) |
71 || current->hasTagName(objectTag)) { | 70 || current->hasTagName(objectTag)) { |
72 if (current->getNameAttribute() == m_name) | 71 if (current->getNameAttribute() == m_name) |
(...skipping 22 matching lines...) Expand all Loading... |
95 break; | 94 break; |
96 default: | 95 default: |
97 ASSERT_NOT_REACHED(); | 96 ASSERT_NOT_REACHED(); |
98 } | 97 } |
99 } | 98 } |
100 | 99 |
101 return 0; | 100 return 0; |
102 } | 101 } |
103 | 102 |
104 } | 103 } |
OLD | NEW |