| 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 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 #include "core/html/HTMLCollection.h" | 27 #include "core/html/HTMLCollection.h" |
| 28 #include "platform/wtf/text/AtomicString.h" | 28 #include "platform/wtf/text/AtomicString.h" |
| 29 | 29 |
| 30 namespace blink { | 30 namespace blink { |
| 31 | 31 |
| 32 // Collection that limits to a particular tag. | 32 // Collection that limits to a particular tag. |
| 33 class TagCollection : public HTMLCollection { | 33 class TagCollection : public HTMLCollection { |
| 34 public: | 34 public: |
| 35 static TagCollection* Create(ContainerNode& root_node, | 35 static TagCollection* Create(ContainerNode& root_node, |
| 36 const AtomicString& namespace_uri, | |
| 37 const AtomicString& local_name) { | |
| 38 DCHECK(namespace_uri != g_star_atom); | |
| 39 return new TagCollection(root_node, kTagCollectionType, namespace_uri, | |
| 40 local_name); | |
| 41 } | |
| 42 | |
| 43 static TagCollection* Create(ContainerNode& root_node, | |
| 44 CollectionType type, | 36 CollectionType type, |
| 45 const AtomicString& local_name) { | 37 const AtomicString& qualified_name) { |
| 46 DCHECK_EQ(type, kTagCollectionType); | 38 DCHECK_EQ(type, kTagCollectionType); |
| 47 return new TagCollection(root_node, kTagCollectionType, g_star_atom, | 39 return new TagCollection(root_node, kTagCollectionType, qualified_name); |
| 48 local_name); | |
| 49 } | 40 } |
| 50 | 41 |
| 51 ~TagCollection() override; | 42 ~TagCollection() override; |
| 52 | 43 |
| 53 bool ElementMatches(const Element&) const; | 44 bool ElementMatches(const Element&) const; |
| 54 | 45 |
| 55 protected: | 46 protected: |
| 56 TagCollection(ContainerNode& root_node, | 47 TagCollection(ContainerNode& root_node, |
| 57 CollectionType, | 48 CollectionType, |
| 58 const AtomicString& namespace_uri, | 49 const AtomicString& qualified_name); |
| 59 const AtomicString& local_name); | 50 |
| 51 AtomicString qualified_name_; |
| 52 }; |
| 53 |
| 54 class TagCollectionNS : public HTMLCollection { |
| 55 public: |
| 56 static TagCollectionNS* Create(ContainerNode& root_node, |
| 57 const AtomicString& namespace_uri, |
| 58 const AtomicString& local_name) { |
| 59 return new TagCollectionNS(root_node, kTagCollectionNSType, namespace_uri, |
| 60 local_name); |
| 61 } |
| 62 |
| 63 ~TagCollectionNS() override; |
| 64 |
| 65 bool ElementMatches(const Element&) const; |
| 66 |
| 67 private: |
| 68 TagCollectionNS(ContainerNode& root_node, |
| 69 CollectionType, |
| 70 const AtomicString& namespace_uri, |
| 71 const AtomicString& local_name); |
| 60 | 72 |
| 61 AtomicString namespace_uri_; | 73 AtomicString namespace_uri_; |
| 62 AtomicString local_name_; | 74 AtomicString local_name_; |
| 63 }; | 75 }; |
| 64 | 76 |
| 65 DEFINE_TYPE_CASTS(TagCollection, | 77 DEFINE_TYPE_CASTS(TagCollection, |
| 66 LiveNodeListBase, | 78 LiveNodeListBase, |
| 67 collection, | 79 collection, |
| 68 collection->GetType() == kTagCollectionType, | 80 collection->GetType() == kTagCollectionType, |
| 69 collection.GetType() == kTagCollectionType); | 81 collection.GetType() == kTagCollectionType); |
| 70 | 82 |
| 83 DEFINE_TYPE_CASTS(TagCollectionNS, |
| 84 LiveNodeListBase, |
| 85 collection, |
| 86 collection->GetType() == kTagCollectionNSType, |
| 87 collection.GetType() == kTagCollectionNSType); |
| 88 |
| 71 } // namespace blink | 89 } // namespace blink |
| 72 | 90 |
| 73 #endif // TagCollection_h | 91 #endif // TagCollection_h |
| OLD | NEW |