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

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

Issue 280123002: Oilpan: move LiveNodeList collections to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Have NodeRareData clear out NodeListsNodeData instead. Created 6 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 | « Source/core/html/HTMLOptionsCollection.h ('k') | Source/core/html/HTMLSelectElement.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) 2006, 2011, 2012 Apple Computer, Inc. 2 * Copyright (C) 2006, 2011, 2012 Apple Computer, Inc.
3 * Copyright (C) 2014 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2014 Samsung Electronics. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 const AtomicString& nameAttribute = element->getNameAttribute(); 58 const AtomicString& nameAttribute = element->getNameAttribute();
59 if (!nameAttribute.isEmpty()) { 59 if (!nameAttribute.isEmpty()) {
60 HashSet<AtomicString>::AddResult addResult = existingNames.add(nameA ttribute); 60 HashSet<AtomicString>::AddResult addResult = existingNames.add(nameA ttribute);
61 if (addResult.isNewEntry) 61 if (addResult.isNewEntry)
62 names.append(nameAttribute); 62 names.append(nameAttribute);
63 } 63 }
64 } 64 }
65 } 65 }
66 66
67 PassRefPtr<HTMLOptionsCollection> HTMLOptionsCollection::create(ContainerNode& s elect, CollectionType) 67 PassRefPtrWillBeRawPtr<HTMLOptionsCollection> HTMLOptionsCollection::create(Cont ainerNode& select, CollectionType)
68 { 68 {
69 return adoptRef(new HTMLOptionsCollection(select)); 69 return adoptRefWillBeNoop(new HTMLOptionsCollection(select));
70 } 70 }
71 71
72 void HTMLOptionsCollection::add(PassRefPtrWillBeRawPtr<HTMLOptionElement> elemen t, ExceptionState& exceptionState) 72 void HTMLOptionsCollection::add(PassRefPtrWillBeRawPtr<HTMLOptionElement> elemen t, ExceptionState& exceptionState)
73 { 73 {
74 add(element, length(), exceptionState); 74 add(element, length(), exceptionState);
75 } 75 }
76 76
77 void HTMLOptionsCollection::add(PassRefPtrWillBeRawPtr<HTMLOptionElement> elemen t, int index, ExceptionState& exceptionState) 77 void HTMLOptionsCollection::add(PassRefPtrWillBeRawPtr<HTMLOptionElement> elemen t, int index, ExceptionState& exceptionState)
78 { 78 {
79 HTMLOptionElement* newOption = element.get(); 79 HTMLOptionElement* newOption = element.get();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 void HTMLOptionsCollection::setSelectedIndex(int index) 116 void HTMLOptionsCollection::setSelectedIndex(int index)
117 { 117 {
118 toHTMLSelectElement(ownerNode()).setSelectedIndex(index); 118 toHTMLSelectElement(ownerNode()).setSelectedIndex(index);
119 } 119 }
120 120
121 void HTMLOptionsCollection::setLength(unsigned length, ExceptionState& exception State) 121 void HTMLOptionsCollection::setLength(unsigned length, ExceptionState& exception State)
122 { 122 {
123 toHTMLSelectElement(ownerNode()).setLength(length, exceptionState); 123 toHTMLSelectElement(ownerNode()).setLength(length, exceptionState);
124 } 124 }
125 125
126 void HTMLOptionsCollection::namedGetter(const AtomicString& name, bool& returnVa lue0Enabled, RefPtr<NodeList>& returnValue0, bool& returnValue1Enabled, RefPtr<E lement>& returnValue1) 126 void HTMLOptionsCollection::namedGetter(const AtomicString& name, bool& returnVa lue0Enabled, RefPtrWillBeRawPtr<NodeList>& returnValue0, bool& returnValue1Enabl ed, RefPtr<Element>& returnValue1)
127 { 127 {
128 Vector<RefPtr<Element> > namedItems; 128 WillBeHeapVector<RefPtrWillBeMember<Element> > namedItems;
129 this->namedItems(name, namedItems); 129 this->namedItems(name, namedItems);
130 130
131 if (!namedItems.size()) 131 if (!namedItems.size())
132 return; 132 return;
133 133
134 if (namedItems.size() == 1) { 134 if (namedItems.size() == 1) {
135 returnValue1Enabled = true; 135 returnValue1Enabled = true;
136 returnValue1 = namedItems.at(0); 136 // FIXME: Oilpan: remove the call to |get| when Element becomes [Garbage Collected].
137 returnValue1 = namedItems.at(0).get();
137 return; 138 return;
138 } 139 }
139 140
140 // FIXME: The spec and Firefox do not return a NodeList. They always return the first matching Element. 141 // FIXME: The spec and Firefox do not return a NodeList. They always return the first matching Element.
141 returnValue0Enabled = true; 142 returnValue0Enabled = true;
142 returnValue0 = NamedNodesCollection::create(namedItems); 143 returnValue0 = NamedNodesCollection::create(namedItems);
143 } 144 }
144 145
145 bool HTMLOptionsCollection::anonymousIndexedSetter(unsigned index, PassRefPtrWil lBeRawPtr<HTMLOptionElement> value, ExceptionState& exceptionState) 146 bool HTMLOptionsCollection::anonymousIndexedSetter(unsigned index, PassRefPtrWil lBeRawPtr<HTMLOptionElement> value, ExceptionState& exceptionState)
146 { 147 {
147 HTMLSelectElement& base = toHTMLSelectElement(ownerNode()); 148 HTMLSelectElement& base = toHTMLSelectElement(ownerNode());
148 if (!value) { // undefined or null 149 if (!value) { // undefined or null
149 base.remove(index); 150 base.remove(index);
150 return true; 151 return true;
151 } 152 }
152 base.setOption(index, value.get(), exceptionState); 153 base.setOption(index, value.get(), exceptionState);
153 return true; 154 return true;
154 } 155 }
155 156
156 } //namespace 157 } //namespace
157 158
OLDNEW
« no previous file with comments | « Source/core/html/HTMLOptionsCollection.h ('k') | Source/core/html/HTMLSelectElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698