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

Side by Side Diff: Source/WebCore/dom/TagNodeList.cpp

Issue 10695128: Merge 120979 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 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
« no previous file with comments | « Source/WebCore/dom/TagNodeList.h ('k') | Source/WebCore/html/LabelableElement.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 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
11 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
12 * 12 *
13 * This library is distributed in the hope that it will be useful, 13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details. 16 * Library General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU Library General Public License 18 * 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 19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA. 21 * Boston, MA 02110-1301, USA.
22 */ 22 */
23 23
24 #include "config.h" 24 #include "config.h"
25 #include "TagNodeList.h" 25 #include "TagNodeList.h"
26 26
27 #include "Element.h" 27 #include "Element.h"
28 #include "NodeRareData.h"
28 #include <wtf/Assertions.h> 29 #include <wtf/Assertions.h>
29 30
30 namespace WebCore { 31 namespace WebCore {
31 32
32 TagNodeList::TagNodeList(PassRefPtr<Node> rootNode, const AtomicString& namespac eURI, const AtomicString& localName) 33 TagNodeList::TagNodeList(PassRefPtr<Node> rootNode, const AtomicString& namespac eURI, const AtomicString& localName)
33 : DynamicSubtreeNodeList(rootNode) 34 : DynamicSubtreeNodeList(rootNode, RootedAtNode, DoNotInvalidateOnAttributeC hange)
34 , m_namespaceURI(namespaceURI) 35 , m_namespaceURI(namespaceURI)
35 , m_localName(localName) 36 , m_localName(localName)
36 { 37 {
37 ASSERT(m_namespaceURI.isNull() || !m_namespaceURI.isEmpty()); 38 ASSERT(m_namespaceURI.isNull() || !m_namespaceURI.isEmpty());
38 } 39 }
39 40
40 TagNodeList::~TagNodeList() 41 TagNodeList::~TagNodeList()
41 { 42 {
42 if (m_namespaceURI == starAtom) 43 if (m_namespaceURI == starAtom)
43 node()->removeCachedTagNodeList(this, m_localName); 44 m_node->nodeLists()->removeCacheWithAtomicName(this, DynamicNodeList::Ta gNodeListType, m_localName);
44 else 45 else
45 node()->removeCachedTagNodeList(this, QualifiedName(nullAtom, m_localNam e, m_namespaceURI)); 46 m_node->nodeLists()->removeCacheWithQualifiedName(this, m_namespaceURI, m_localName);
46 } 47 }
47 48
48 bool TagNodeList::nodeMatches(Element* testNode) const 49 bool TagNodeList::nodeMatches(Element* testNode) const
49 { 50 {
50 // Implements http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#conce pt-getelementsbytagnamens 51 // Implements http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#conce pt-getelementsbytagnamens
51 if (m_localName != starAtom && m_localName != testNode->localName()) 52 if (m_localName != starAtom && m_localName != testNode->localName())
52 return false; 53 return false;
53 54
54 return m_namespaceURI == starAtom || m_namespaceURI == testNode->namespaceUR I(); 55 return m_namespaceURI == starAtom || m_namespaceURI == testNode->namespaceUR I();
55 } 56 }
56 57
57 HTMLTagNodeList::HTMLTagNodeList(PassRefPtr<Node> rootNode, const AtomicString& namespaceURI, const AtomicString& localName) 58 HTMLTagNodeList::HTMLTagNodeList(PassRefPtr<Node> rootNode, const AtomicString& localName)
58 : TagNodeList(rootNode, namespaceURI, localName) 59 : TagNodeList(rootNode, starAtom, localName)
59 , m_loweredLocalName(localName.lower()) 60 , m_loweredLocalName(localName.lower())
60 { 61 {
61 } 62 }
62 63
63 bool HTMLTagNodeList::nodeMatches(Element* testNode) const 64 bool HTMLTagNodeList::nodeMatches(Element* testNode) const
64 { 65 {
65 // Implements http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#conce pt-getelementsbytagname 66 // Implements http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#conce pt-getelementsbytagname
66 if (m_localName != starAtom) { 67 if (m_localName != starAtom) {
67 const AtomicString& localName = testNode->isHTMLElement() ? m_loweredLoc alName : m_localName; 68 const AtomicString& localName = testNode->isHTMLElement() ? m_loweredLoc alName : m_localName;
68 if (localName != testNode->localName()) 69 if (localName != testNode->localName())
69 return false; 70 return false;
70 } 71 }
71 72
72 return m_namespaceURI == starAtom || m_namespaceURI == testNode->namespaceUR I(); 73 ASSERT(m_namespaceURI == starAtom);
74 return true;
73 } 75 }
74 76
75 } // namespace WebCore 77 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/dom/TagNodeList.h ('k') | Source/WebCore/html/LabelableElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698