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 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 bool elementMatches(const Element&) const; | 50 bool elementMatches(const Element&) const; |
51 | 51 |
52 protected: | 52 protected: |
53 TagCollection(ContainerNode& rootNode, CollectionType, const AtomicString& n
amespaceURI, const AtomicString& localName); | 53 TagCollection(ContainerNode& rootNode, CollectionType, const AtomicString& n
amespaceURI, const AtomicString& localName); |
54 | 54 |
55 AtomicString m_namespaceURI; | 55 AtomicString m_namespaceURI; |
56 AtomicString m_localName; | 56 AtomicString m_localName; |
57 }; | 57 }; |
58 | 58 |
| 59 DEFINE_TYPE_CASTS(TagCollection, LiveNodeListBase, collection, collection->type(
) == TagCollectionType, collection.type() == TagCollectionType); |
| 60 |
59 class HTMLTagCollection FINAL : public TagCollection { | 61 class HTMLTagCollection FINAL : public TagCollection { |
60 public: | 62 public: |
61 static PassRefPtrWillBeRawPtr<HTMLTagCollection> create(ContainerNode& rootN
ode, CollectionType type, const AtomicString& localName) | 63 static PassRefPtrWillBeRawPtr<HTMLTagCollection> create(ContainerNode& rootN
ode, CollectionType type, const AtomicString& localName) |
62 { | 64 { |
63 ASSERT_UNUSED(type, type == HTMLTagCollectionType); | 65 ASSERT_UNUSED(type, type == HTMLTagCollectionType); |
64 return adoptRefWillBeNoop(new HTMLTagCollection(rootNode, localName)); | 66 return adoptRefWillBeNoop(new HTMLTagCollection(rootNode, localName)); |
65 } | 67 } |
66 | 68 |
67 bool elementMatches(const Element&) const; | 69 bool elementMatches(const Element&) const; |
68 | 70 |
69 private: | 71 private: |
70 HTMLTagCollection(ContainerNode& rootNode, const AtomicString& localName); | 72 HTMLTagCollection(ContainerNode& rootNode, const AtomicString& localName); |
71 | 73 |
72 AtomicString m_loweredLocalName; | 74 AtomicString m_loweredLocalName; |
73 }; | 75 }; |
74 | 76 |
| 77 DEFINE_TYPE_CASTS(HTMLTagCollection, LiveNodeListBase, collection, collection->t
ype() == HTMLTagCollectionType, collection.type() == HTMLTagCollectionType); |
| 78 |
75 inline bool HTMLTagCollection::elementMatches(const Element& testElement) const | 79 inline bool HTMLTagCollection::elementMatches(const Element& testElement) const |
76 { | 80 { |
77 // Implements http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#conce
pt-getelementsbytagname | 81 // Implements http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#conce
pt-getelementsbytagname |
78 if (m_localName != starAtom) { | 82 if (m_localName != starAtom) { |
79 const AtomicString& localName = testElement.isHTMLElement() ? m_loweredL
ocalName : m_localName; | 83 const AtomicString& localName = testElement.isHTMLElement() ? m_loweredL
ocalName : m_localName; |
80 if (localName != testElement.localName()) | 84 if (localName != testElement.localName()) |
81 return false; | 85 return false; |
82 } | 86 } |
83 ASSERT(m_namespaceURI == starAtom); | 87 ASSERT(m_namespaceURI == starAtom); |
84 return true; | 88 return true; |
85 } | 89 } |
86 | 90 |
87 } // namespace WebCore | 91 } // namespace WebCore |
88 | 92 |
89 #endif // TagCollection_h | 93 #endif // TagCollection_h |
OLD | NEW |