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

Side by Side Diff: Source/core/html/HTMLNameCollection.cpp

Issue 180143003: Have LiveNodeListBase::ownerNode() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 10 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
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, 2011, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2011, 2012 Apple Inc. All rights 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 24 matching lines...) Expand all
35 using namespace HTMLNames; 35 using namespace HTMLNames;
36 36
37 HTMLNameCollection::HTMLNameCollection(ContainerNode* document, CollectionType t ype, const AtomicString& name) 37 HTMLNameCollection::HTMLNameCollection(ContainerNode* document, CollectionType t ype, const AtomicString& name)
38 : HTMLCollection(document, type, OverridesItemAfter) 38 : HTMLCollection(document, type, OverridesItemAfter)
39 , m_name(name) 39 , m_name(name)
40 { 40 {
41 } 41 }
42 42
43 HTMLNameCollection::~HTMLNameCollection() 43 HTMLNameCollection::~HTMLNameCollection()
44 { 44 {
45 ASSERT(ownerNode()); 45 ASSERT(ownerNode().isDocumentNode());
46 ASSERT(ownerNode()->isDocumentNode());
47 ASSERT(type() == WindowNamedItems || type() == DocumentNamedItems); 46 ASSERT(type() == WindowNamedItems || type() == DocumentNamedItems);
48 47
49 ownerNode()->nodeLists()->removeCache(this, type(), m_name); 48 ownerNode().nodeLists()->removeCache(this, type(), m_name);
50 } 49 }
51 50
52 Element* HTMLNameCollection::virtualItemAfter(Element* previous) const 51 Element* HTMLNameCollection::virtualItemAfter(Element* previous) const
53 { 52 {
54 ASSERT(previous != ownerNode()); 53 ASSERT(previous != ownerNode());
55 54
56 Element* current; 55 Element* current;
57 if (!previous) 56 if (!previous)
58 current = ElementTraversal::firstWithin(*ownerNode()); 57 current = ElementTraversal::firstWithin(ownerNode());
59 else 58 else
60 current = ElementTraversal::next(*previous, ownerNode()); 59 current = ElementTraversal::next(*previous, &ownerNode());
61 60
62 for (; current; current = ElementTraversal::next(*current, ownerNode())) { 61 for (; current; current = ElementTraversal::next(*current, &ownerNode())) {
63 switch (type()) { 62 switch (type()) {
64 case WindowNamedItems: 63 case WindowNamedItems:
65 // find only images, forms, applets, embeds and objects by name, 64 // find only images, forms, applets, embeds and objects by name,
66 // but anything by id 65 // but anything by id
67 if (current->hasTagName(imgTag) 66 if (current->hasTagName(imgTag)
68 || current->hasTagName(formTag) 67 || current->hasTagName(formTag)
69 || current->hasTagName(appletTag) 68 || current->hasTagName(appletTag)
70 || current->hasTagName(embedTag) 69 || current->hasTagName(embedTag)
71 || current->hasTagName(objectTag)) { 70 || current->hasTagName(objectTag)) {
72 if (current->getNameAttribute() == m_name) 71 if (current->getNameAttribute() == m_name)
(...skipping 22 matching lines...) Expand all
95 break; 94 break;
96 default: 95 default:
97 ASSERT_NOT_REACHED(); 96 ASSERT_NOT_REACHED();
98 } 97 }
99 } 98 }
100 99
101 return 0; 100 return 0;
102 } 101 }
103 102
104 } 103 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLFormControlsCollection.idl ('k') | Source/core/html/HTMLOptionsCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698