| 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 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007 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 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 #include "core/dom/TagCollection.h" | 24 #include "core/dom/TagCollection.h" |
| 25 | 25 |
| 26 #include "core/dom/NodeRareData.h" | 26 #include "core/dom/NodeRareData.h" |
| 27 #include "platform/wtf/Assertions.h" | 27 #include "platform/wtf/Assertions.h" |
| 28 | 28 |
| 29 namespace blink { | 29 namespace blink { |
| 30 | 30 |
| 31 TagCollection::TagCollection(ContainerNode& root_node, | 31 TagCollection::TagCollection(ContainerNode& root_node, |
| 32 CollectionType type, | 32 CollectionType type, |
| 33 const AtomicString& namespace_uri, | 33 const AtomicString& qualified_name) |
| 34 const AtomicString& local_name) | 34 : HTMLCollection(root_node, type, kDoesNotOverrideItemAfter), |
| 35 qualified_name_(qualified_name) {} |
| 36 |
| 37 TagCollection::~TagCollection() {} |
| 38 |
| 39 bool TagCollection::ElementMatches(const Element& test_node) const { |
| 40 if (qualified_name_ == g_star_atom) |
| 41 return true; |
| 42 |
| 43 return qualified_name_ == test_node.TagQName().ToString(); |
| 44 } |
| 45 |
| 46 TagCollectionNS::TagCollectionNS(ContainerNode& root_node, |
| 47 CollectionType type, |
| 48 const AtomicString& namespace_uri, |
| 49 const AtomicString& local_name) |
| 35 : HTMLCollection(root_node, type, kDoesNotOverrideItemAfter), | 50 : HTMLCollection(root_node, type, kDoesNotOverrideItemAfter), |
| 36 namespace_uri_(namespace_uri), | 51 namespace_uri_(namespace_uri), |
| 37 local_name_(local_name) { | 52 local_name_(local_name) { |
| 38 DCHECK(namespace_uri_.IsNull() || !namespace_uri_.IsEmpty()); | 53 DCHECK(namespace_uri_.IsNull() || !namespace_uri_.IsEmpty()); |
| 39 } | 54 } |
| 40 | 55 |
| 41 TagCollection::~TagCollection() {} | 56 TagCollectionNS::~TagCollectionNS() {} |
| 42 | 57 |
| 43 bool TagCollection::ElementMatches(const Element& test_node) const { | 58 bool TagCollectionNS::ElementMatches(const Element& test_node) const { |
| 44 // Implements | 59 // Implements |
| 45 // https://dom.spec.whatwg.org/#concept-getelementsbytagnamens | 60 // https://dom.spec.whatwg.org/#concept-getelementsbytagnamens |
| 46 if (local_name_ != g_star_atom && local_name_ != test_node.localName()) | 61 if (local_name_ != g_star_atom && local_name_ != test_node.localName()) |
| 47 return false; | 62 return false; |
| 48 | 63 |
| 49 return namespace_uri_ == g_star_atom || | 64 return namespace_uri_ == g_star_atom || |
| 50 namespace_uri_ == test_node.namespaceURI(); | 65 namespace_uri_ == test_node.namespaceURI(); |
| 51 } | 66 } |
| 52 | 67 |
| 53 } // namespace blink | 68 } // namespace blink |
| OLD | NEW |