Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: Source/core/html/HTMLTagCollection.h

Issue 355163004: Move HTMLTagCollection to its own file (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLCollection.cpp ('k') | Source/core/html/HTMLTagCollection.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 * Copyright (C) 2014 Samsung Electronics. All rights reserved.
7 * 8 *
8 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 11 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version. 12 * version 2 of the License, or (at your option) any later version.
12 * 13 *
13 * This library is distributed in the hope that it will be useful, 14 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details. 17 * Library General Public License for more details.
17 * 18 *
18 * You should have received a copy of the GNU Library General Public License 19 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to 20 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA. 22 * Boston, MA 02110-1301, USA.
22 */ 23 */
23 24
24 #ifndef TagCollection_h 25 #ifndef HTMLTagCollection_h
25 #define TagCollection_h 26 #define HTMLTagCollection_h
26 27
27 #include "core/dom/Element.h" 28 #include "core/dom/Element.h"
28 #include "core/html/HTMLCollection.h" 29 #include "core/dom/TagCollection.h"
29 #include "wtf/text/AtomicString.h"
30 30
31 namespace WebCore { 31 namespace WebCore {
32 32
33 // Collection that limits to a particular tag. 33 // Collection that limits to a particular tag and whose rootNode is in an HTMLDo cument.
34 class TagCollection : public HTMLCollection {
35 public:
36 static PassRefPtrWillBeRawPtr<TagCollection> create(ContainerNode& rootNode, const AtomicString& namespaceURI, const AtomicString& localName)
37 {
38 ASSERT(namespaceURI != starAtom);
39 return adoptRefWillBeNoop(new TagCollection(rootNode, TagCollectionType, namespaceURI, localName));
40 }
41
42 static PassRefPtrWillBeRawPtr<TagCollection> create(ContainerNode& rootNode, CollectionType type, const AtomicString& localName)
43 {
44 ASSERT_UNUSED(type, type == TagCollectionType);
45 return adoptRefWillBeNoop(new TagCollection(rootNode, TagCollectionType, starAtom, localName));
46 }
47
48 virtual ~TagCollection();
49
50 bool elementMatches(const Element&) const;
51
52 protected:
53 TagCollection(ContainerNode& rootNode, CollectionType, const AtomicString& n amespaceURI, const AtomicString& localName);
54
55 AtomicString m_namespaceURI;
56 AtomicString m_localName;
57 };
58
59 DEFINE_TYPE_CASTS(TagCollection, LiveNodeListBase, collection, collection->type( ) == TagCollectionType, collection.type() == TagCollectionType);
60
61 class HTMLTagCollection FINAL : public TagCollection { 34 class HTMLTagCollection FINAL : public TagCollection {
62 public: 35 public:
63 static PassRefPtrWillBeRawPtr<HTMLTagCollection> create(ContainerNode& rootN ode, CollectionType type, const AtomicString& localName) 36 static PassRefPtrWillBeRawPtr<HTMLTagCollection> create(ContainerNode& rootN ode, CollectionType type, const AtomicString& localName)
64 { 37 {
65 ASSERT_UNUSED(type, type == HTMLTagCollectionType); 38 ASSERT_UNUSED(type, type == HTMLTagCollectionType);
66 return adoptRefWillBeNoop(new HTMLTagCollection(rootNode, localName)); 39 return adoptRefWillBeNoop(new HTMLTagCollection(rootNode, localName));
67 } 40 }
68 41
69 bool elementMatches(const Element&) const; 42 bool elementMatches(const Element&) const;
70 43
(...skipping 12 matching lines...) Expand all
83 const AtomicString& localName = testElement.isHTMLElement() ? m_loweredL ocalName : m_localName; 56 const AtomicString& localName = testElement.isHTMLElement() ? m_loweredL ocalName : m_localName;
84 if (localName != testElement.localName()) 57 if (localName != testElement.localName())
85 return false; 58 return false;
86 } 59 }
87 ASSERT(m_namespaceURI == starAtom); 60 ASSERT(m_namespaceURI == starAtom);
88 return true; 61 return true;
89 } 62 }
90 63
91 } // namespace WebCore 64 } // namespace WebCore
92 65
93 #endif // TagCollection_h 66 #endif // HTMLTagCollection_h
OLDNEW
« no previous file with comments | « Source/core/html/HTMLCollection.cpp ('k') | Source/core/html/HTMLTagCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698