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

Side by Side Diff: Source/core/dom/LiveNodeList.cpp

Issue 23890025: WIP (Introduce WTF::NonNullPtr<T>.) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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/dom/EventRetargeter.cpp ('k') | Source/core/dom/Node.h » ('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, 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 const HTMLCollection* cacheBase = static_cast<const HTMLCollection*>(this); 66 const HTMLCollection* cacheBase = static_cast<const HTMLCollection*>(this);
67 cacheBase->m_idCache.clear(); 67 cacheBase->m_idCache.clear();
68 cacheBase->m_nameCache.clear(); 68 cacheBase->m_nameCache.clear();
69 } 69 }
70 70
71 Node* LiveNodeList::namedItem(const AtomicString& elementId) const 71 Node* LiveNodeList::namedItem(const AtomicString& elementId) const
72 { 72 {
73 Node* rootNode = this->rootNode(); 73 Node* rootNode = this->rootNode();
74 74
75 if (rootNode->inDocument()) { 75 if (rootNode->inDocument()) {
76 Element* element = rootNode->treeScope().getElementById(elementId); 76 Element* element = rootNode->treeScope()->getElementById(elementId);
77 if (element && nodeMatches(element) && element->isDescendantOf(rootNode) ) 77 if (element && nodeMatches(element) && element->isDescendantOf(rootNode) )
78 return element; 78 return element;
79 if (!element) 79 if (!element)
80 return 0; 80 return 0;
81 // In the case of multiple nodes with the same name, just fall through. 81 // In the case of multiple nodes with the same name, just fall through.
82 } 82 }
83 83
84 unsigned length = this->length(); 84 unsigned length = this->length();
85 for (unsigned i = 0; i < length; i++) { 85 for (unsigned i = 0; i < length; i++) {
86 Node* node = item(i); 86 Node* node = item(i);
87 // FIXME: This should probably be using getIdAttribute instead of idForS tyleResolution. 87 // FIXME: This should probably be using getIdAttribute instead of idForS tyleResolution.
88 if (node->hasID() && toElement(node)->idForStyleResolution() == elementI d) 88 if (node->hasID() && toElement(node)->idForStyleResolution() == elementI d)
89 return node; 89 return node;
90 } 90 }
91 91
92 return 0; 92 return 0;
93 } 93 }
94 94
95 } // namespace WebCore 95 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/EventRetargeter.cpp ('k') | Source/core/dom/Node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698