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

Side by Side Diff: Source/web/WebNodeList.cpp

Issue 152243003: Rename WebNodeCollection to WebElementCollection for clarity (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
« no previous file with comments | « Source/web/WebNodeCollection.cpp ('k') | Source/web/web.gypi » ('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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // FIXME(crbug.com/235008): Remove once chromium has been updated to stop using 46 // FIXME(crbug.com/235008): Remove once chromium has been updated to stop using
47 // WebCollection as a WebNodeList. 47 // WebCollection as a WebNodeList.
48 class NodeListWithInternalCollection FINAL : public NodeList { 48 class NodeListWithInternalCollection FINAL : public NodeList {
49 public: 49 public:
50 static PassRefPtr<NodeListWithInternalCollection> create(HTMLCollection* col lection) 50 static PassRefPtr<NodeListWithInternalCollection> create(HTMLCollection* col lection)
51 { 51 {
52 return adoptRef(new NodeListWithInternalCollection(collection)); 52 return adoptRef(new NodeListWithInternalCollection(collection));
53 } 53 }
54 54
55 // We have null checks in the following methods because WebNodeList does not have a isNull() method 55 // We have null checks in the following methods because WebNodeList does not have a isNull() method
56 // and callers need to be moved to WebNodeCollection and need to handle null using 56 // and callers need to be moved to WebElementCollection and need to handle n ull using
57 // WebNodeCollection::isNull(). 57 // WebElementCollection::isNull().
58 virtual unsigned length() const OVERRIDE { return m_collection ? m_collectio n->length() : 0; } 58 virtual unsigned length() const OVERRIDE { return m_collection ? m_collectio n->length() : 0; }
59 virtual Node* item(unsigned index) const OVERRIDE { return m_collection ? m_ collection->item(index) : 0; } 59 virtual Node* item(unsigned index) const OVERRIDE { return m_collection ? m_ collection->item(index) : 0; }
60 60
61 private: 61 private:
62 explicit NodeListWithInternalCollection(HTMLCollection* collection) 62 explicit NodeListWithInternalCollection(HTMLCollection* collection)
63 : m_collection(collection) 63 : m_collection(collection)
64 { 64 {
65 } 65 }
66 66
67 RefPtr<HTMLCollection> m_collection; 67 RefPtr<HTMLCollection> m_collection;
68 }; 68 };
69 69
70 WebNodeList::WebNodeList(const WebNodeCollection& n) 70 WebNodeList::WebNodeList(const WebElementCollection& n)
71 : m_private(0) 71 : m_private(0)
72 { 72 {
73 assign(NodeListWithInternalCollection::create(n.m_private).leakRef()); 73 assign(NodeListWithInternalCollection::create(n.m_private).leakRef());
74 } 74 }
75 75
76 void WebNodeList::reset() 76 void WebNodeList::reset()
77 { 77 {
78 assign(0); 78 assign(0);
79 } 79 }
80 80
(...skipping 22 matching lines...) Expand all
103 { 103 {
104 return m_private->length(); 104 return m_private->length();
105 } 105 }
106 106
107 WebNode WebNodeList::item(size_t index) const 107 WebNode WebNodeList::item(size_t index) const
108 { 108 {
109 return WebNode(m_private->item(index)); 109 return WebNode(m_private->item(index));
110 } 110 }
111 111
112 } // namespace blink 112 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebNodeCollection.cpp ('k') | Source/web/web.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698