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

Side by Side Diff: Source/WebCore/html/HTMLCollection.cpp

Issue 10368018: Merge 115398 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1084/
Patch Set: Created 8 years, 7 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 | « LayoutTests/fast/dom/htmlcollection-non-html-expected.txt ('k') | no next file » | 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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All r ights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All r ights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 if (m_cache.version == docversion) 94 if (m_cache.version == docversion)
95 return; 95 return;
96 96
97 m_cache.clear(); 97 m_cache.clear();
98 m_cache.version = docversion; 98 m_cache.version = docversion;
99 } 99 }
100 100
101 inline bool HTMLCollection::isAcceptableElement(Element* element) const 101 inline bool HTMLCollection::isAcceptableElement(Element* element) const
102 { 102 {
103 if (!element->isHTMLElement() && !(m_type == DocAll || m_type == NodeChildre n))
104 return false;
105
103 switch (m_type) { 106 switch (m_type) {
104 case DocImages: 107 case DocImages:
105 return element->hasLocalName(imgTag); 108 return element->hasLocalName(imgTag);
106 case DocScripts: 109 case DocScripts:
107 return element->hasLocalName(scriptTag); 110 return element->hasLocalName(scriptTag);
108 case DocForms: 111 case DocForms:
109 return element->hasLocalName(formTag); 112 return element->hasLocalName(formTag);
110 case TableTBodies: 113 case TableTBodies:
111 return element->hasLocalName(tbodyTag); 114 return element->hasLocalName(tbodyTag);
112 case TRCells: 115 case TRCells:
(...skipping 26 matching lines...) Expand all
139 return element->hasLocalName(objectTag); 142 return element->hasLocalName(objectTag);
140 case DocLinks: 143 case DocLinks:
141 return (element->hasLocalName(aTag) || element->hasLocalName(areaTag)) & & element->fastHasAttribute(hrefAttr); 144 return (element->hasLocalName(aTag) || element->hasLocalName(areaTag)) & & element->fastHasAttribute(hrefAttr);
142 case DocAnchors: 145 case DocAnchors:
143 return element->hasLocalName(aTag) && element->fastHasAttribute(nameAttr ); 146 return element->hasLocalName(aTag) && element->fastHasAttribute(nameAttr );
144 case DocAll: 147 case DocAll:
145 case NodeChildren: 148 case NodeChildren:
146 return true; 149 return true;
147 #if ENABLE(MICRODATA) 150 #if ENABLE(MICRODATA)
148 case ItemProperties: 151 case ItemProperties:
149 return element->isHTMLElement() && element->fastHasAttribute(itempropAtt r); 152 return element->fastHasAttribute(itempropAttr);
150 #endif 153 #endif
151 case DocumentNamedItems: 154 case DocumentNamedItems:
152 case OtherCollection: 155 case OtherCollection:
153 case WindowNamedItems: 156 case WindowNamedItems:
154 ASSERT_NOT_REACHED(); 157 ASSERT_NOT_REACHED();
155 } 158 }
156 return false; 159 return false;
157 } 160 }
158 161
159 static Node* nextNodeOrSibling(Node* base, Node* node, bool includeChildren) 162 static Node* nextNodeOrSibling(Node* base, Node* node, bool includeChildren)
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 362
360 void HTMLCollection::append(NodeCacheMap& map, const AtomicString& key, Element* element) 363 void HTMLCollection::append(NodeCacheMap& map, const AtomicString& key, Element* element)
361 { 364 {
362 OwnPtr<Vector<Element*> >& vector = map.add(key.impl(), nullptr).first->seco nd; 365 OwnPtr<Vector<Element*> >& vector = map.add(key.impl(), nullptr).first->seco nd;
363 if (!vector) 366 if (!vector)
364 vector = adoptPtr(new Vector<Element*>); 367 vector = adoptPtr(new Vector<Element*>);
365 vector->append(element); 368 vector->append(element);
366 } 369 }
367 370
368 } // namespace WebCore 371 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/htmlcollection-non-html-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698